-
Notifications
You must be signed in to change notification settings - Fork 233
Support subgraph datasources #1754
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 5 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
477bf10
Add new datasource type for subgraph composition
incrypto32 8a9fdba
Support ABI's in subgraph datasource manifest
incrypto32 ad068a9
Generate types for source subgraph schema
incrypto32 b7a8358
Add changeset
incrypto32 b45cf73
Dont generate store methods for source subgraph schema
incrypto32 a3da5e6
Add graph init command for subgraph composition
incrypto32 76bee17
Address review comments
incrypto32 b75cda9
Merge branch 'main' into feat-subgraph-composition
0237h File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| --- | ||
| '@graphprotocol/graph-cli': minor | ||
| '@graphprotocol/graph-ts': minor | ||
| --- | ||
|
|
||
| Add support for subgraph datasource and associated types. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| # Each referenced type's in any of the types below must be listed | ||
| # here either as `scalar` or `type` for the validation code to work | ||
| # properly. | ||
| # | ||
| # That's why `String` is listed as a scalar even though it's built-in | ||
| # GraphQL basic types. | ||
| scalar String | ||
| scalar File | ||
| scalar BigInt | ||
| scalar Boolean | ||
| scalar JSON | ||
|
|
||
| type SubgraphManifest { | ||
| specVersion: String! | ||
| features: [String!] | ||
| schema: Schema! | ||
| description: String | ||
| repository: String | ||
| graft: Graft | ||
| dataSources: [DataSource!]! | ||
| indexerHints: IndexerHints | ||
| } | ||
|
|
||
| type Schema { | ||
| file: File! | ||
| } | ||
|
|
||
| type DataSource { | ||
| kind: String! | ||
| name: String! | ||
| network: String | ||
| context: JSON | ||
| source: ContractSource! | ||
| mapping: ContractMapping! | ||
| } | ||
|
|
||
| type ContractSource { | ||
| address: String! | ||
| startBlock: BigInt | ||
| } | ||
|
|
||
| type ContractMapping { | ||
| kind: String | ||
| apiVersion: String! | ||
| language: String! | ||
| file: File! | ||
| abis: [ContractABI!]! | ||
| entities: [String!]! | ||
| handlers: [EntityHandler!] | ||
| } | ||
|
|
||
| type ContractABI { | ||
| name: String! | ||
| file: File! | ||
| } | ||
|
|
||
| type EntityHandler { | ||
| handler: String! | ||
| entity: String! | ||
| } | ||
|
|
||
| type Graft { | ||
| base: String! | ||
| block: BigInt! | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| export const source = ({ spkgPath }: { spkgPath?: string }) => ` | ||
| package: | ||
| moduleName: graph_out | ||
| file: ${spkgPath || 'substreams-eth-block-meta-v0.1.0.spkg'}`; | ||
|
|
||
| export const mapping = () => ` | ||
| apiVersion: 0.0.5 | ||
| kind: substreams/graph-entities`; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| import immutable from 'immutable'; | ||
| import { Subgraph, SubgraphOptions } from '../subgraph'; | ||
|
|
||
| export default class SubgraphDS implements Subgraph { | ||
0237h marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| public manifest: SubgraphOptions['manifest']; | ||
| public resolveFile: SubgraphOptions['resolveFile']; | ||
| public protocol: SubgraphOptions['protocol']; | ||
|
|
||
| constructor(options: SubgraphOptions) { | ||
| this.manifest = options.manifest; | ||
| this.resolveFile = options.resolveFile; | ||
| this.protocol = options.protocol; | ||
| } | ||
|
|
||
| validateManifest() { | ||
| return immutable.List(); | ||
| } | ||
|
|
||
| handlerTypes() { | ||
| return immutable.List([]); | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.