File tree Expand file tree Collapse file tree 2 files changed +17
-7
lines changed Expand file tree Collapse file tree 2 files changed +17
-7
lines changed Original file line number Diff line number Diff line change 4
4
"fields" : [
5
5
{ "name" : " id" , "type" : " Bytes!" },
6
6
{ "name" : " asCounter" , "type" : " CounterContract" },
7
- { "name" : " CounterIncrementedEvent" , "type" : " CounterIncremented!" }
7
+ {
8
+ "name" : " CounterIncrementedEvents" ,
9
+ "type" : " CounterIncremented!" ,
10
+ "derived" : " emitter"
11
+ }
8
12
]
9
13
},
10
14
{
11
15
"name" : " CounterContract" ,
12
16
"fields" : [
13
17
{ "name" : " asAccount" , "type" : " Account!" },
14
- { "name" : " currentValue" , "type" : " BigInt!" }
18
+ { "name" : " currentValue" , "type" : " BigInt!" },
19
+ {
20
+ "name" : " CounterIncrementedEvent" ,
21
+ "type" : " CounterIncremented!" ,
22
+ "derived" : " contract"
23
+ }
15
24
]
16
25
},
17
26
{
26
35
{ "name" : " currentValue" , "type" : " BigInt!" }
27
36
]
28
37
}
29
- ]
38
+ ]
Original file line number Diff line number Diff line change 1
- import { Address } from " @graphprotocol/graph-ts" ;
2
- import { CounterContract } from " ../../generated/schema" ;
3
- import { fetchAccount } from " ./account" ;
1
+ import { Address , BigInt } from ' @graphprotocol/graph-ts' ;
2
+ import { CounterContract } from ' ../../generated/schema' ;
3
+ import { fetchAccount } from ' ./account' ;
4
4
5
5
export function fetchCounter ( address : Address ) : CounterContract {
6
6
const account = fetchAccount ( address ) ;
@@ -10,10 +10,11 @@ export function fetchCounter(address: Address): CounterContract {
10
10
contract = new CounterContract ( account . id . toHex ( ) ) ;
11
11
contract . asAccount = account . id ;
12
12
account . asCounter = contract . id ;
13
+ contract . currentValue = BigInt . fromString ( '0' ) ;
13
14
14
15
contract . save ( ) ;
15
16
account . save ( ) ;
16
17
}
17
18
18
19
return contract as CounterContract ;
19
- }
20
+ }
You can’t perform that action at this time.
0 commit comments