You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Fix subgraphs without abi field failing to build
* Fix graph init for composed subgraphs
* Add changeset
* Fix validation not working
* Support declared calls in manifest
* Lint fix
* Address review comments
* Dont allow adding new contracts when subgraph is a composed subgraph
* Allow init of subgraph datasource subgraphs without the interactive mode
* Reduce code duplication between subgraph datasource and normal data source
* prevent using --from-contract and --from-source-subgraph flags together
* cli: validate protocol and source subgraph relationship
* chore(dependencies): updated changesets for modified dependencies
* change flag name for source subgraph
* Refactor manifest validation util functions
* get start block from source manifest
* set fromSubgraph to be default value for graph init in interactive mode
* fix protocol flag validation
* Add init test for subgraphs
* Fix error message
* chore(dependencies): updated changesets for modified dependencies
---------
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: YaroShkvorets <shkvorets@gmail.com>
* Validates that the network of a source subgraph matches the target network
58
+
* @param manifestYaml Parsed manifest YAML
59
+
* @param targetNetwork Network of the target subgraph being created
60
+
* @returns Object containing validation result and error message if any
61
+
*/
62
+
exportfunctionvalidateSubgraphNetworkMatch(
63
+
manifestYaml: any,
64
+
targetNetwork: string,
65
+
): {valid: boolean;error?: string}{
66
+
// Extract network from data sources
67
+
constdataSources=manifestYaml.dataSources||[];
68
+
consttemplates=manifestYaml.templates||[];
69
+
constallSources=[...dataSources, ...templates];
70
+
71
+
if(allSources.length===0){
72
+
return{valid: true};// No data sources to validate
73
+
}
74
+
75
+
// Get network from first data source
76
+
constsourceNetwork=allSources[0].network;
77
+
78
+
if(sourceNetwork!==targetNetwork){
79
+
return{
80
+
valid: false,
81
+
error: `Network mismatch: The source subgraph is indexing the '${sourceNetwork}' network, but you're creating a subgraph for '${targetNetwork}' network. When composing subgraphs, they must index the same network.`,
82
+
};
83
+
}
84
+
85
+
return{valid: true};
86
+
}
87
+
88
+
/**
89
+
* Gets the minimum startBlock from all dataSources in the manifest
90
+
* @param manifestYaml Parsed manifest YAML
91
+
* @returns The minimum startBlock or undefined if no startBlock is found
0 commit comments