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 44 "fields" : [
55 { "name" : " id" , "type" : " Bytes!" },
66 { "name" : " asCounter" , "type" : " CounterContract" },
7- { "name" : " CounterIncrementedEvent" , "type" : " CounterIncremented!" }
7+ {
8+ "name" : " CounterIncrementedEvents" ,
9+ "type" : " CounterIncremented!" ,
10+ "derived" : " emitter"
11+ }
812 ]
913 },
1014 {
1115 "name" : " CounterContract" ,
1216 "fields" : [
1317 { "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+ }
1524 ]
1625 },
1726 {
2635 { "name" : " currentValue" , "type" : " BigInt!" }
2736 ]
2837 }
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' ;
44
55export function fetchCounter ( address : Address ) : CounterContract {
66 const account = fetchAccount ( address ) ;
@@ -10,10 +10,11 @@ export function fetchCounter(address: Address): CounterContract {
1010 contract = new CounterContract ( account . id . toHex ( ) ) ;
1111 contract . asAccount = account . id ;
1212 account . asCounter = contract . id ;
13+ contract . currentValue = BigInt . fromString ( '0' ) ;
1314
1415 contract . save ( ) ;
1516 account . save ( ) ;
1617 }
1718
1819 return contract as CounterContract ;
19- }
20+ }
You can’t perform that action at this time.
0 commit comments