File tree Expand file tree Collapse file tree 6 files changed +33
-13
lines changed
validation/subgraph-data-source Expand file tree Collapse file tree 6 files changed +33
-13
lines changed Original file line number Diff line number Diff line change @@ -301,10 +301,12 @@ const ethereumProtocol: ProtocolConfig = {
301301
302302const subgraphProtocol : ProtocolConfig = {
303303 displayName : 'Subgraph' ,
304- abi : undefined ,
304+ abi : EthereumABI ,
305305 contract : undefined ,
306306 getTemplateCodeGen : undefined ,
307- getTypeGenerator : undefined ,
307+ getTypeGenerator ( options ) {
308+ return new EthereumTypeGenerator ( options ) ;
309+ } ,
308310 getSubgraph ( options ) {
309311 return new SubgraphDS ( options ) ;
310312 } ,
Original file line number Diff line number Diff line change @@ -44,10 +44,16 @@ type ContractMapping {
4444 apiVersion : String !
4545 language : String !
4646 file : File !
47+ abis : [ContractAbi ! ]!
4748 entities : [String ! ]!
4849 handlers : [EntityHandler ! ]
4950}
5051
52+ type ContractAbi {
53+ name : String !
54+ file : File !
55+ }
56+
5157type EntityHandler {
5258 handler : String !
5359 entity : String !
Original file line number Diff line number Diff line change @@ -80,7 +80,6 @@ export default class TypeGenerator {
8080 const abis = await this . protocolTypeGenerator . loadABIs ( subgraph ) ;
8181 await this . protocolTypeGenerator . generateTypesForABIs ( abis ) ;
8282 }
83-
8483 typeGenDebug . extend ( 'generateTypes' ) ( 'Generating types for templates' ) ;
8584 await this . generateTypesForDataSourceTemplates ( subgraph ) ;
8685
Original file line number Diff line number Diff line change @@ -969,6 +969,16 @@ Types generated successfully
969969"
970970`;
971971
972+ exports[`Validation > Subgraph data source with handlers 1`] = `
973+ " Error: Could not locate \`@graphprotocol/graph-ts\` package in parent
974+ directories of subgraph manifest.
975+ "
976+ `;
977+
978+ exports[`Validation > Subgraph data source with handlers 2`] = `1`;
979+
980+ exports[`Validation > Subgraph data source with handlers 3`] = `""`;
981+
972982exports[`Validation > topic0 is valid in an event handler 1`] = `
973983"- Load subgraph from subgraph.yaml
974984✔ Load subgraph from subgraph.yaml
Original file line number Diff line number Diff line change @@ -4,20 +4,20 @@ import { cliTest } from './util';
44describe . concurrent (
55 'Validation' ,
66 ( ) => {
7- cliTest (
8- 'Block handler filters' ,
9- [ 'codegen' , '--skip-migrations' ] ,
10- 'validation/subgraph-data-source' ,
11- {
12- exitCode : 0 ,
13- } ,
14- ) ;
7+ // cliTest(
8+ // 'Block handler filters',
9+ // ['codegen', '--skip-migrations'],
10+ // 'validation/subgraph-data-source',
11+ // {
12+ // exitCode: 0,
13+ // },
14+ // );
1515 cliTest (
1616 'Subgraph data source with handlers' ,
1717 [ 'build' , '--skip-migrations' ] ,
1818 'validation/subgraph-data-source' ,
1919 {
20- exitCode : 1 ,
20+ exitCode : 0 ,
2121 } ,
2222 ) ;
2323 // cliTest(
Original file line number Diff line number Diff line change 1- specVersion : 0.0.1
1+ specVersion : 0.0.4
22repository : https://github.com/graphprotocol/test-subgraph
33description : Test subgraph
44schema :
@@ -16,6 +16,9 @@ dataSources:
1616 file : ./mapping.ts
1717 entities :
1818 - ExampleEntity
19+ abis :
20+ - name : ExampleContract
21+ file : ./Abi.json
1922 handlers :
2023 - handler : handleExampleEvent
2124 entity : ExampleEntity
You can’t perform that action at this time.
0 commit comments