From bb8a5acd676fa5e0b4d1a7ddd9a200306fe3c830 Mon Sep 17 00:00:00 2001 From: Idalith Bustos Date: Wed, 26 Feb 2025 17:20:13 -0800 Subject: [PATCH 01/14] Three Source Example --- .../src/pages/ar/subgraphs/cookbook/_meta.js | 1 + .../subgraph-composition-three-source.mdx | 121 ++++++++++++++++++ .../src/pages/cs/subgraphs/cookbook/_meta.js | 1 + .../subgraph-composition-three-source.mdx | 121 ++++++++++++++++++ .../src/pages/de/subgraphs/cookbook/_meta.js | 1 + .../subgraph-composition-three-source.mdx | 121 ++++++++++++++++++ .../src/pages/en/subgraphs/cookbook/_meta.js | 1 + .../subgraph-composition-three-sources.mdx | 121 ++++++++++++++++++ .../src/pages/es/subgraphs/cookbook/_meta.js | 1 + .../subgraph-composition-three-source.mdx | 121 ++++++++++++++++++ .../src/pages/fr/subgraphs/cookbook/_meta.js | 1 + .../subgraph-composition-three-source.mdx | 121 ++++++++++++++++++ .../src/pages/hi/subgraphs/cookbook/_meta.js | 1 + .../subgraph-composition-three-source.mdx | 121 ++++++++++++++++++ .../src/pages/it/subgraphs/cookbook/_meta.js | 1 + .../subgraph-composition-three-source.mdx | 121 ++++++++++++++++++ .../src/pages/ja/subgraphs/cookbook/_meta.js | 1 + .../subgraph-composition-three-source.mdx | 121 ++++++++++++++++++ .../src/pages/ko/subgraphs/cookbook/_meta.js | 1 + .../subgraph-composition-three-source.mdx | 121 ++++++++++++++++++ .../src/pages/mr/subgraphs/cookbook/_meta.js | 1 + .../subgraph-composition-three-source.mdx | 121 ++++++++++++++++++ .../src/pages/nl/subgraphs/cookbook/_meta.js | 1 + .../subgraph-composition-three-source.mdx | 121 ++++++++++++++++++ .../src/pages/pl/subgraphs/cookbook/_meta.js | 1 + .../subgraph-composition-three-source.mdx | 121 ++++++++++++++++++ .../src/pages/pt/subgraphs/cookbook/_meta.js | 1 + .../subgraph-composition-three-source.mdx | 121 ++++++++++++++++++ .../src/pages/ro/subgraphs/cookbook/_meta.js | 1 + .../subgraph-composition-three-source.mdx | 121 ++++++++++++++++++ .../src/pages/ru/subgraphs/cookbook/_meta.js | 1 + .../subgraph-composition-three-source.mdx | 121 ++++++++++++++++++ .../src/pages/sv/subgraphs/cookbook/_meta.js | 1 + .../subgraph-composition-three-source.mdx | 121 ++++++++++++++++++ .../src/pages/tr/subgraphs/cookbook/_meta.js | 1 + .../subgraph-composition-three-source.mdx | 121 ++++++++++++++++++ .../src/pages/uk/subgraphs/cookbook/_meta.js | 1 + .../subgraph-composition-three-source.mdx | 121 ++++++++++++++++++ .../src/pages/ur/subgraphs/cookbook/_meta.js | 1 + .../subgraph-composition-three-source.mdx | 121 ++++++++++++++++++ .../src/pages/vi/subgraphs/cookbook/_meta.js | 1 + .../subgraph-composition-three-source.mdx | 121 ++++++++++++++++++ .../src/pages/zh/subgraphs/cookbook/_meta.js | 1 + .../subgraph-composition-three-source.mdx | 121 ++++++++++++++++++ 44 files changed, 2684 insertions(+) create mode 100644 website/src/pages/ar/subgraphs/cookbook/subgraph-composition-three-source.mdx create mode 100644 website/src/pages/cs/subgraphs/cookbook/subgraph-composition-three-source.mdx create mode 100644 website/src/pages/de/subgraphs/cookbook/subgraph-composition-three-source.mdx create mode 100644 website/src/pages/en/subgraphs/cookbook/subgraph-composition-three-sources.mdx create mode 100644 website/src/pages/es/subgraphs/cookbook/subgraph-composition-three-source.mdx create mode 100644 website/src/pages/fr/subgraphs/cookbook/subgraph-composition-three-source.mdx create mode 100644 website/src/pages/hi/subgraphs/cookbook/subgraph-composition-three-source.mdx create mode 100644 website/src/pages/it/subgraphs/cookbook/subgraph-composition-three-source.mdx create mode 100644 website/src/pages/ja/subgraphs/cookbook/subgraph-composition-three-source.mdx create mode 100644 website/src/pages/ko/subgraphs/cookbook/subgraph-composition-three-source.mdx create mode 100644 website/src/pages/mr/subgraphs/cookbook/subgraph-composition-three-source.mdx create mode 100644 website/src/pages/nl/subgraphs/cookbook/subgraph-composition-three-source.mdx create mode 100644 website/src/pages/pl/subgraphs/cookbook/subgraph-composition-three-source.mdx create mode 100644 website/src/pages/pt/subgraphs/cookbook/subgraph-composition-three-source.mdx create mode 100644 website/src/pages/ro/subgraphs/cookbook/subgraph-composition-three-source.mdx create mode 100644 website/src/pages/ru/subgraphs/cookbook/subgraph-composition-three-source.mdx create mode 100644 website/src/pages/sv/subgraphs/cookbook/subgraph-composition-three-source.mdx create mode 100644 website/src/pages/tr/subgraphs/cookbook/subgraph-composition-three-source.mdx create mode 100644 website/src/pages/uk/subgraphs/cookbook/subgraph-composition-three-source.mdx create mode 100644 website/src/pages/ur/subgraphs/cookbook/subgraph-composition-three-source.mdx create mode 100644 website/src/pages/vi/subgraphs/cookbook/subgraph-composition-three-source.mdx create mode 100644 website/src/pages/zh/subgraphs/cookbook/subgraph-composition-three-source.mdx diff --git a/website/src/pages/ar/subgraphs/cookbook/_meta.js b/website/src/pages/ar/subgraphs/cookbook/_meta.js index e642f12ef11d..ae67ab7baed1 100644 --- a/website/src/pages/ar/subgraphs/cookbook/_meta.js +++ b/website/src/pages/ar/subgraphs/cookbook/_meta.js @@ -8,4 +8,5 @@ export default { enums: '', 'secure-api-keys-nextjs': '', polymarket: '', + 'subgraph-composition-three-sources': '', } diff --git a/website/src/pages/ar/subgraphs/cookbook/subgraph-composition-three-source.mdx b/website/src/pages/ar/subgraphs/cookbook/subgraph-composition-three-source.mdx new file mode 100644 index 000000000000..80b86a24d036 --- /dev/null +++ b/website/src/pages/ar/subgraphs/cookbook/subgraph-composition-three-source.mdx @@ -0,0 +1,121 @@ +--- +title: Integrating Three Subgraphs Using Subgraph Composition +sidebarTitle: 'Subgraph Composition with Three Source Subgraphs' +--- + +Optimize your Subgraph by merging data from three independent, `source` Subgraphs into a single composable Subgraph to enhance data aggregation. + +> Important Reminders + +> - Subgraph composition is built into the CLI, and you can deploy with [Subgraph Studio](https://thegraph.com/studio/). +> - This feature requires spec version 1.3.0. + +## Overview + +Subgraph composition empowers developer to leverage a Subgraph with other Subgraphs as data sources, seamlessly integrating and reacting to data updates and entity changes. This capability enhances efficiency and responsiveness in data handling. + +## Prerequisites + +To deploy **all** Subgraphs locally, you must have the following: + +- A [graph-node](https://github.com/graphprotocol/graph-node) instance running locally +- An [IPFS](https://docs.ipfs.tech/) instance running locally +- [Node.js.](https://nodejs.org/en) and npm + +## Get Started + +The following guide provides examples for defining three `source` Subgraphs to create one powerful composed Subgraph. + +### Specifics + +- To keep this example simple, all `source` subgraphs use only block handlers, but in a real environment, each source Subgraph will use data from different smart contracts. +- The examples below show how to import and extend the schema of another Subgraph to enhance its functionality. +- Each source Subgraph is optimized with a specific entity. +- All the commands listed install the necessary dependencies, generate code based on the GraphQL schema, build the Subgraph, and deploy it to your local Graph Node instance. + +### Step 1. Deploy Block Time Source Subgraph + +This first source Subgraph calculates the block time for each block. + +- It imports schemas from other Subgraphs and adds a `block` entity with a `timestamp` field, representing the time each block was mined. +- It listens to time-related blockchain events (e.g., block timestamps) and processes this data to update the Subgraph's entities accordingly. + +To deploy this Subgraph locally, run the following commands: + +```bash +npm install +npm run codegen +npm run build +npm run create-local +npm run deploy-local +``` + +### Step 1. Deploy Block Cost Source Subgraph + +This second `source` Subgraph indexes the cost of each block. + +#### Key Functions + +- It imports schemas from other Subgraphs and adds a `block` entity with cost-related fields. +- It listens to blockchain events related to costs (e.g. gas fees, transaction costs) and processes this data to update the Subgraph's entities accordingly. + +To deploy this Subgraph locally, run the following commands: + +```bash +npm install +npm run codegen +npm run build +npm run create-local +npm run deploy-local +``` + +### Step 2. Define Block Size in Source Subgraph + +This third `source` Subgraph indexes the size of each block. + +#### Key Functions + +- It imports existing schemas from other Subgraphs and adds a `Block` entity with a `size` field representing each block's size. +- It listens to blockchain events related to block sizes (e.g., storage or volume) and processes this data to update the Subgraph's entities accordingly. + +To deploy this Subgraph locally, run the following commands: + +```bash +npm install +npm run codegen +npm run build +npm run create-local +npm run deploy-local +``` + +### Step 3. Combine Into Block Stats Subgraph + +This composed Subgraph combines and aggregates the information from the three source Subgraphs above. + +> [!NOTE] Any change to a source Subgraph will likely generate a new deployment ID. Be sure to update the deployment ID in the data source address of the Subgraph manifest to take advantage of the latest changes. [!IMPORTANT] All source Subgraphs should be deployed before the composed Subgraph is deployed. + +This composed Subgraph demonstrates how to create a subgraph that aggregates data from three source subgraphs, providing a unified, enhanced view of block statistics. + +#### Key Functions + +- It provides a consolidated data model that encompasses all relevant block metrics. +- It combines data from three `source` subgraphs, and provides a comprehensive view of block statistics, enabling more complex queries and analyses. To deploy this subgraph locally, run the following commands: + +```bash +npm install +npm run codegen +npm run build +npm run create-local +npm run deploy-local +``` + +## Key Takeaways + +- This powerful tool will scale your subgraph development and allow you to combine multiple Subgraphs. +- The setup includes the deployment of three source Subgraphs and one final deployment of the composed Subgraph. +- This feature unlocks scalability, simplifying both development and maintenance efficiency. + +## Additional Resources + +- Add advanced features in your subgraph. Check out [subgraph advance features](/developing/creating/advanced/) and the [subgraph composition repo](https://github.com/incrypto32/subgraph-composition-sample-subgraph). +- Check out the Github repo [for this example] (https://github.com/isum/subgraph-composition-example). diff --git a/website/src/pages/cs/subgraphs/cookbook/_meta.js b/website/src/pages/cs/subgraphs/cookbook/_meta.js index e642f12ef11d..ae67ab7baed1 100644 --- a/website/src/pages/cs/subgraphs/cookbook/_meta.js +++ b/website/src/pages/cs/subgraphs/cookbook/_meta.js @@ -8,4 +8,5 @@ export default { enums: '', 'secure-api-keys-nextjs': '', polymarket: '', + 'subgraph-composition-three-sources': '', } diff --git a/website/src/pages/cs/subgraphs/cookbook/subgraph-composition-three-source.mdx b/website/src/pages/cs/subgraphs/cookbook/subgraph-composition-three-source.mdx new file mode 100644 index 000000000000..80b86a24d036 --- /dev/null +++ b/website/src/pages/cs/subgraphs/cookbook/subgraph-composition-three-source.mdx @@ -0,0 +1,121 @@ +--- +title: Integrating Three Subgraphs Using Subgraph Composition +sidebarTitle: 'Subgraph Composition with Three Source Subgraphs' +--- + +Optimize your Subgraph by merging data from three independent, `source` Subgraphs into a single composable Subgraph to enhance data aggregation. + +> Important Reminders + +> - Subgraph composition is built into the CLI, and you can deploy with [Subgraph Studio](https://thegraph.com/studio/). +> - This feature requires spec version 1.3.0. + +## Overview + +Subgraph composition empowers developer to leverage a Subgraph with other Subgraphs as data sources, seamlessly integrating and reacting to data updates and entity changes. This capability enhances efficiency and responsiveness in data handling. + +## Prerequisites + +To deploy **all** Subgraphs locally, you must have the following: + +- A [graph-node](https://github.com/graphprotocol/graph-node) instance running locally +- An [IPFS](https://docs.ipfs.tech/) instance running locally +- [Node.js.](https://nodejs.org/en) and npm + +## Get Started + +The following guide provides examples for defining three `source` Subgraphs to create one powerful composed Subgraph. + +### Specifics + +- To keep this example simple, all `source` subgraphs use only block handlers, but in a real environment, each source Subgraph will use data from different smart contracts. +- The examples below show how to import and extend the schema of another Subgraph to enhance its functionality. +- Each source Subgraph is optimized with a specific entity. +- All the commands listed install the necessary dependencies, generate code based on the GraphQL schema, build the Subgraph, and deploy it to your local Graph Node instance. + +### Step 1. Deploy Block Time Source Subgraph + +This first source Subgraph calculates the block time for each block. + +- It imports schemas from other Subgraphs and adds a `block` entity with a `timestamp` field, representing the time each block was mined. +- It listens to time-related blockchain events (e.g., block timestamps) and processes this data to update the Subgraph's entities accordingly. + +To deploy this Subgraph locally, run the following commands: + +```bash +npm install +npm run codegen +npm run build +npm run create-local +npm run deploy-local +``` + +### Step 1. Deploy Block Cost Source Subgraph + +This second `source` Subgraph indexes the cost of each block. + +#### Key Functions + +- It imports schemas from other Subgraphs and adds a `block` entity with cost-related fields. +- It listens to blockchain events related to costs (e.g. gas fees, transaction costs) and processes this data to update the Subgraph's entities accordingly. + +To deploy this Subgraph locally, run the following commands: + +```bash +npm install +npm run codegen +npm run build +npm run create-local +npm run deploy-local +``` + +### Step 2. Define Block Size in Source Subgraph + +This third `source` Subgraph indexes the size of each block. + +#### Key Functions + +- It imports existing schemas from other Subgraphs and adds a `Block` entity with a `size` field representing each block's size. +- It listens to blockchain events related to block sizes (e.g., storage or volume) and processes this data to update the Subgraph's entities accordingly. + +To deploy this Subgraph locally, run the following commands: + +```bash +npm install +npm run codegen +npm run build +npm run create-local +npm run deploy-local +``` + +### Step 3. Combine Into Block Stats Subgraph + +This composed Subgraph combines and aggregates the information from the three source Subgraphs above. + +> [!NOTE] Any change to a source Subgraph will likely generate a new deployment ID. Be sure to update the deployment ID in the data source address of the Subgraph manifest to take advantage of the latest changes. [!IMPORTANT] All source Subgraphs should be deployed before the composed Subgraph is deployed. + +This composed Subgraph demonstrates how to create a subgraph that aggregates data from three source subgraphs, providing a unified, enhanced view of block statistics. + +#### Key Functions + +- It provides a consolidated data model that encompasses all relevant block metrics. +- It combines data from three `source` subgraphs, and provides a comprehensive view of block statistics, enabling more complex queries and analyses. To deploy this subgraph locally, run the following commands: + +```bash +npm install +npm run codegen +npm run build +npm run create-local +npm run deploy-local +``` + +## Key Takeaways + +- This powerful tool will scale your subgraph development and allow you to combine multiple Subgraphs. +- The setup includes the deployment of three source Subgraphs and one final deployment of the composed Subgraph. +- This feature unlocks scalability, simplifying both development and maintenance efficiency. + +## Additional Resources + +- Add advanced features in your subgraph. Check out [subgraph advance features](/developing/creating/advanced/) and the [subgraph composition repo](https://github.com/incrypto32/subgraph-composition-sample-subgraph). +- Check out the Github repo [for this example] (https://github.com/isum/subgraph-composition-example). diff --git a/website/src/pages/de/subgraphs/cookbook/_meta.js b/website/src/pages/de/subgraphs/cookbook/_meta.js index e642f12ef11d..ae67ab7baed1 100644 --- a/website/src/pages/de/subgraphs/cookbook/_meta.js +++ b/website/src/pages/de/subgraphs/cookbook/_meta.js @@ -8,4 +8,5 @@ export default { enums: '', 'secure-api-keys-nextjs': '', polymarket: '', + 'subgraph-composition-three-sources': '', } diff --git a/website/src/pages/de/subgraphs/cookbook/subgraph-composition-three-source.mdx b/website/src/pages/de/subgraphs/cookbook/subgraph-composition-three-source.mdx new file mode 100644 index 000000000000..80b86a24d036 --- /dev/null +++ b/website/src/pages/de/subgraphs/cookbook/subgraph-composition-three-source.mdx @@ -0,0 +1,121 @@ +--- +title: Integrating Three Subgraphs Using Subgraph Composition +sidebarTitle: 'Subgraph Composition with Three Source Subgraphs' +--- + +Optimize your Subgraph by merging data from three independent, `source` Subgraphs into a single composable Subgraph to enhance data aggregation. + +> Important Reminders + +> - Subgraph composition is built into the CLI, and you can deploy with [Subgraph Studio](https://thegraph.com/studio/). +> - This feature requires spec version 1.3.0. + +## Overview + +Subgraph composition empowers developer to leverage a Subgraph with other Subgraphs as data sources, seamlessly integrating and reacting to data updates and entity changes. This capability enhances efficiency and responsiveness in data handling. + +## Prerequisites + +To deploy **all** Subgraphs locally, you must have the following: + +- A [graph-node](https://github.com/graphprotocol/graph-node) instance running locally +- An [IPFS](https://docs.ipfs.tech/) instance running locally +- [Node.js.](https://nodejs.org/en) and npm + +## Get Started + +The following guide provides examples for defining three `source` Subgraphs to create one powerful composed Subgraph. + +### Specifics + +- To keep this example simple, all `source` subgraphs use only block handlers, but in a real environment, each source Subgraph will use data from different smart contracts. +- The examples below show how to import and extend the schema of another Subgraph to enhance its functionality. +- Each source Subgraph is optimized with a specific entity. +- All the commands listed install the necessary dependencies, generate code based on the GraphQL schema, build the Subgraph, and deploy it to your local Graph Node instance. + +### Step 1. Deploy Block Time Source Subgraph + +This first source Subgraph calculates the block time for each block. + +- It imports schemas from other Subgraphs and adds a `block` entity with a `timestamp` field, representing the time each block was mined. +- It listens to time-related blockchain events (e.g., block timestamps) and processes this data to update the Subgraph's entities accordingly. + +To deploy this Subgraph locally, run the following commands: + +```bash +npm install +npm run codegen +npm run build +npm run create-local +npm run deploy-local +``` + +### Step 1. Deploy Block Cost Source Subgraph + +This second `source` Subgraph indexes the cost of each block. + +#### Key Functions + +- It imports schemas from other Subgraphs and adds a `block` entity with cost-related fields. +- It listens to blockchain events related to costs (e.g. gas fees, transaction costs) and processes this data to update the Subgraph's entities accordingly. + +To deploy this Subgraph locally, run the following commands: + +```bash +npm install +npm run codegen +npm run build +npm run create-local +npm run deploy-local +``` + +### Step 2. Define Block Size in Source Subgraph + +This third `source` Subgraph indexes the size of each block. + +#### Key Functions + +- It imports existing schemas from other Subgraphs and adds a `Block` entity with a `size` field representing each block's size. +- It listens to blockchain events related to block sizes (e.g., storage or volume) and processes this data to update the Subgraph's entities accordingly. + +To deploy this Subgraph locally, run the following commands: + +```bash +npm install +npm run codegen +npm run build +npm run create-local +npm run deploy-local +``` + +### Step 3. Combine Into Block Stats Subgraph + +This composed Subgraph combines and aggregates the information from the three source Subgraphs above. + +> [!NOTE] Any change to a source Subgraph will likely generate a new deployment ID. Be sure to update the deployment ID in the data source address of the Subgraph manifest to take advantage of the latest changes. [!IMPORTANT] All source Subgraphs should be deployed before the composed Subgraph is deployed. + +This composed Subgraph demonstrates how to create a subgraph that aggregates data from three source subgraphs, providing a unified, enhanced view of block statistics. + +#### Key Functions + +- It provides a consolidated data model that encompasses all relevant block metrics. +- It combines data from three `source` subgraphs, and provides a comprehensive view of block statistics, enabling more complex queries and analyses. To deploy this subgraph locally, run the following commands: + +```bash +npm install +npm run codegen +npm run build +npm run create-local +npm run deploy-local +``` + +## Key Takeaways + +- This powerful tool will scale your subgraph development and allow you to combine multiple Subgraphs. +- The setup includes the deployment of three source Subgraphs and one final deployment of the composed Subgraph. +- This feature unlocks scalability, simplifying both development and maintenance efficiency. + +## Additional Resources + +- Add advanced features in your subgraph. Check out [subgraph advance features](/developing/creating/advanced/) and the [subgraph composition repo](https://github.com/incrypto32/subgraph-composition-sample-subgraph). +- Check out the Github repo [for this example] (https://github.com/isum/subgraph-composition-example). diff --git a/website/src/pages/en/subgraphs/cookbook/_meta.js b/website/src/pages/en/subgraphs/cookbook/_meta.js index e642f12ef11d..ae67ab7baed1 100644 --- a/website/src/pages/en/subgraphs/cookbook/_meta.js +++ b/website/src/pages/en/subgraphs/cookbook/_meta.js @@ -8,4 +8,5 @@ export default { enums: '', 'secure-api-keys-nextjs': '', polymarket: '', + 'subgraph-composition-three-sources': '', } diff --git a/website/src/pages/en/subgraphs/cookbook/subgraph-composition-three-sources.mdx b/website/src/pages/en/subgraphs/cookbook/subgraph-composition-three-sources.mdx new file mode 100644 index 000000000000..dcee0e838020 --- /dev/null +++ b/website/src/pages/en/subgraphs/cookbook/subgraph-composition-three-sources.mdx @@ -0,0 +1,121 @@ +--- +title: Integrating Three Subgraphs Using Subgraph Composition +sidebarTitle: 'Composable Subgraph with Three Source Subgraphs' +--- + +Optimize your Subgraph by merging data from three independent, `source` Subgraphs into a single composable Subgraph to enhance data aggregation. + +> Important Reminders + +> - Subgraph composition is built into the CLI, and you can deploy with [Subgraph Studio](https://thegraph.com/studio/). +> - This feature requires spec version 1.3.0. + +## Overview + +Subgraph composition empowers developer to leverage a Subgraph with other Subgraphs as data sources, seamlessly integrating and reacting to data updates and entity changes. This capability enhances efficiency and responsiveness in data handling. + +## Prerequisites + +To deploy **all** Subgraphs locally, you must have the following: + +- A [graph-node](https://github.com/graphprotocol/graph-node) instance running locally +- An [IPFS](https://docs.ipfs.tech/) instance running locally +- [Node.js.](https://nodejs.org/en) and npm + +## Get Started + +The following guide provides examples for defining three `source` Subgraphs to create one powerful composed Subgraph. + +### Specifics + +- To keep this example simple, all `source` subgraphs use only block handlers, but in a real environment, each source Subgraph will use data from different smart contracts. +- The examples below show how to import and extend the schema of another Subgraph to enhance its functionality. +- Each source Subgraph is optimized with a specific entity. +- All the commands listed install the necessary dependencies, generate code based on the GraphQL schema, build the Subgraph, and deploy it to your local Graph Node instance. + +### Step 1. Deploy Block Time Source Subgraph + +This first source Subgraph calculates the block time for each block. + +- It imports schemas from other Subgraphs and adds a `block` entity with a `timestamp` field, representing the time each block was mined. +- It listens to time-related blockchain events (e.g., block timestamps) and processes this data to update the Subgraph's entities accordingly. + +To deploy this Subgraph locally, run the following commands: + +```bash +npm install +npm run codegen +npm run build +npm run create-local +npm run deploy-local +``` + +### Step 1. Deploy Block Cost Source Subgraph + +This second `source` Subgraph indexes the cost of each block. + +#### Key Functions + +- It imports schemas from other Subgraphs and adds a `block` entity with cost-related fields. +- It listens to blockchain events related to costs (e.g. gas fees, transaction costs) and processes this data to update the Subgraph's entities accordingly. + +To deploy this Subgraph locally, run the following commands: + +```bash +npm install +npm run codegen +npm run build +npm run create-local +npm run deploy-local +``` + +### Step 2. Define Block Size in Source Subgraph + +This third `source` Subgraph indexes the size of each block. + +#### Key Functions + +- It imports existing schemas from other Subgraphs and adds a `Block` entity with a `size` field representing each block's size. +- It listens to blockchain events related to block sizes (e.g., storage or volume) and processes this data to update the Subgraph's entities accordingly. + +To deploy this Subgraph locally, run the following commands: + +```bash +npm install +npm run codegen +npm run build +npm run create-local +npm run deploy-local +``` + +### Step 3. Combine Into Block Stats Subgraph + +This composed Subgraph combines and aggregates the information from the three source Subgraphs above. + +> [!NOTE] Any change to a source Subgraph will likely generate a new deployment ID. Be sure to update the deployment ID in the data source address of the Subgraph manifest to take advantage of the latest changes. [!IMPORTANT] All source Subgraphs should be deployed before the composed Subgraph is deployed. + +This composed Subgraph demonstrates how to create a subgraph that aggregates data from three source subgraphs, providing a unified, enhanced view of block statistics. + +#### Key Functions + +- It provides a consolidated data model that encompasses all relevant block metrics. +- It combines data from three `source` subgraphs, and provides a comprehensive view of block statistics, enabling more complex queries and analyses. To deploy this subgraph locally, run the following commands: + +```bash +npm install +npm run codegen +npm run build +npm run create-local +npm run deploy-local +``` + +## Key Takeaways + +- This powerful tool will scale your subgraph development and allow you to combine multiple Subgraphs. +- The setup includes the deployment of three source Subgraphs and one final deployment of the composed Subgraph. +- This feature unlocks scalability, simplifying both development and maintenance efficiency. + +## Additional Resources + +- Add advanced features in your subgraph. Check out [subgraph advance features](/developing/creating/advanced/) and the [subgraph composition repo](https://github.com/incrypto32/subgraph-composition-sample-subgraph). +- Check out the Github repo [for this example] (https://github.com/isum/subgraph-composition-example). diff --git a/website/src/pages/es/subgraphs/cookbook/_meta.js b/website/src/pages/es/subgraphs/cookbook/_meta.js index e642f12ef11d..ae67ab7baed1 100644 --- a/website/src/pages/es/subgraphs/cookbook/_meta.js +++ b/website/src/pages/es/subgraphs/cookbook/_meta.js @@ -8,4 +8,5 @@ export default { enums: '', 'secure-api-keys-nextjs': '', polymarket: '', + 'subgraph-composition-three-sources': '', } diff --git a/website/src/pages/es/subgraphs/cookbook/subgraph-composition-three-source.mdx b/website/src/pages/es/subgraphs/cookbook/subgraph-composition-three-source.mdx new file mode 100644 index 000000000000..80b86a24d036 --- /dev/null +++ b/website/src/pages/es/subgraphs/cookbook/subgraph-composition-three-source.mdx @@ -0,0 +1,121 @@ +--- +title: Integrating Three Subgraphs Using Subgraph Composition +sidebarTitle: 'Subgraph Composition with Three Source Subgraphs' +--- + +Optimize your Subgraph by merging data from three independent, `source` Subgraphs into a single composable Subgraph to enhance data aggregation. + +> Important Reminders + +> - Subgraph composition is built into the CLI, and you can deploy with [Subgraph Studio](https://thegraph.com/studio/). +> - This feature requires spec version 1.3.0. + +## Overview + +Subgraph composition empowers developer to leverage a Subgraph with other Subgraphs as data sources, seamlessly integrating and reacting to data updates and entity changes. This capability enhances efficiency and responsiveness in data handling. + +## Prerequisites + +To deploy **all** Subgraphs locally, you must have the following: + +- A [graph-node](https://github.com/graphprotocol/graph-node) instance running locally +- An [IPFS](https://docs.ipfs.tech/) instance running locally +- [Node.js.](https://nodejs.org/en) and npm + +## Get Started + +The following guide provides examples for defining three `source` Subgraphs to create one powerful composed Subgraph. + +### Specifics + +- To keep this example simple, all `source` subgraphs use only block handlers, but in a real environment, each source Subgraph will use data from different smart contracts. +- The examples below show how to import and extend the schema of another Subgraph to enhance its functionality. +- Each source Subgraph is optimized with a specific entity. +- All the commands listed install the necessary dependencies, generate code based on the GraphQL schema, build the Subgraph, and deploy it to your local Graph Node instance. + +### Step 1. Deploy Block Time Source Subgraph + +This first source Subgraph calculates the block time for each block. + +- It imports schemas from other Subgraphs and adds a `block` entity with a `timestamp` field, representing the time each block was mined. +- It listens to time-related blockchain events (e.g., block timestamps) and processes this data to update the Subgraph's entities accordingly. + +To deploy this Subgraph locally, run the following commands: + +```bash +npm install +npm run codegen +npm run build +npm run create-local +npm run deploy-local +``` + +### Step 1. Deploy Block Cost Source Subgraph + +This second `source` Subgraph indexes the cost of each block. + +#### Key Functions + +- It imports schemas from other Subgraphs and adds a `block` entity with cost-related fields. +- It listens to blockchain events related to costs (e.g. gas fees, transaction costs) and processes this data to update the Subgraph's entities accordingly. + +To deploy this Subgraph locally, run the following commands: + +```bash +npm install +npm run codegen +npm run build +npm run create-local +npm run deploy-local +``` + +### Step 2. Define Block Size in Source Subgraph + +This third `source` Subgraph indexes the size of each block. + +#### Key Functions + +- It imports existing schemas from other Subgraphs and adds a `Block` entity with a `size` field representing each block's size. +- It listens to blockchain events related to block sizes (e.g., storage or volume) and processes this data to update the Subgraph's entities accordingly. + +To deploy this Subgraph locally, run the following commands: + +```bash +npm install +npm run codegen +npm run build +npm run create-local +npm run deploy-local +``` + +### Step 3. Combine Into Block Stats Subgraph + +This composed Subgraph combines and aggregates the information from the three source Subgraphs above. + +> [!NOTE] Any change to a source Subgraph will likely generate a new deployment ID. Be sure to update the deployment ID in the data source address of the Subgraph manifest to take advantage of the latest changes. [!IMPORTANT] All source Subgraphs should be deployed before the composed Subgraph is deployed. + +This composed Subgraph demonstrates how to create a subgraph that aggregates data from three source subgraphs, providing a unified, enhanced view of block statistics. + +#### Key Functions + +- It provides a consolidated data model that encompasses all relevant block metrics. +- It combines data from three `source` subgraphs, and provides a comprehensive view of block statistics, enabling more complex queries and analyses. To deploy this subgraph locally, run the following commands: + +```bash +npm install +npm run codegen +npm run build +npm run create-local +npm run deploy-local +``` + +## Key Takeaways + +- This powerful tool will scale your subgraph development and allow you to combine multiple Subgraphs. +- The setup includes the deployment of three source Subgraphs and one final deployment of the composed Subgraph. +- This feature unlocks scalability, simplifying both development and maintenance efficiency. + +## Additional Resources + +- Add advanced features in your subgraph. Check out [subgraph advance features](/developing/creating/advanced/) and the [subgraph composition repo](https://github.com/incrypto32/subgraph-composition-sample-subgraph). +- Check out the Github repo [for this example] (https://github.com/isum/subgraph-composition-example). diff --git a/website/src/pages/fr/subgraphs/cookbook/_meta.js b/website/src/pages/fr/subgraphs/cookbook/_meta.js index e642f12ef11d..ae67ab7baed1 100644 --- a/website/src/pages/fr/subgraphs/cookbook/_meta.js +++ b/website/src/pages/fr/subgraphs/cookbook/_meta.js @@ -8,4 +8,5 @@ export default { enums: '', 'secure-api-keys-nextjs': '', polymarket: '', + 'subgraph-composition-three-sources': '', } diff --git a/website/src/pages/fr/subgraphs/cookbook/subgraph-composition-three-source.mdx b/website/src/pages/fr/subgraphs/cookbook/subgraph-composition-three-source.mdx new file mode 100644 index 000000000000..80b86a24d036 --- /dev/null +++ b/website/src/pages/fr/subgraphs/cookbook/subgraph-composition-three-source.mdx @@ -0,0 +1,121 @@ +--- +title: Integrating Three Subgraphs Using Subgraph Composition +sidebarTitle: 'Subgraph Composition with Three Source Subgraphs' +--- + +Optimize your Subgraph by merging data from three independent, `source` Subgraphs into a single composable Subgraph to enhance data aggregation. + +> Important Reminders + +> - Subgraph composition is built into the CLI, and you can deploy with [Subgraph Studio](https://thegraph.com/studio/). +> - This feature requires spec version 1.3.0. + +## Overview + +Subgraph composition empowers developer to leverage a Subgraph with other Subgraphs as data sources, seamlessly integrating and reacting to data updates and entity changes. This capability enhances efficiency and responsiveness in data handling. + +## Prerequisites + +To deploy **all** Subgraphs locally, you must have the following: + +- A [graph-node](https://github.com/graphprotocol/graph-node) instance running locally +- An [IPFS](https://docs.ipfs.tech/) instance running locally +- [Node.js.](https://nodejs.org/en) and npm + +## Get Started + +The following guide provides examples for defining three `source` Subgraphs to create one powerful composed Subgraph. + +### Specifics + +- To keep this example simple, all `source` subgraphs use only block handlers, but in a real environment, each source Subgraph will use data from different smart contracts. +- The examples below show how to import and extend the schema of another Subgraph to enhance its functionality. +- Each source Subgraph is optimized with a specific entity. +- All the commands listed install the necessary dependencies, generate code based on the GraphQL schema, build the Subgraph, and deploy it to your local Graph Node instance. + +### Step 1. Deploy Block Time Source Subgraph + +This first source Subgraph calculates the block time for each block. + +- It imports schemas from other Subgraphs and adds a `block` entity with a `timestamp` field, representing the time each block was mined. +- It listens to time-related blockchain events (e.g., block timestamps) and processes this data to update the Subgraph's entities accordingly. + +To deploy this Subgraph locally, run the following commands: + +```bash +npm install +npm run codegen +npm run build +npm run create-local +npm run deploy-local +``` + +### Step 1. Deploy Block Cost Source Subgraph + +This second `source` Subgraph indexes the cost of each block. + +#### Key Functions + +- It imports schemas from other Subgraphs and adds a `block` entity with cost-related fields. +- It listens to blockchain events related to costs (e.g. gas fees, transaction costs) and processes this data to update the Subgraph's entities accordingly. + +To deploy this Subgraph locally, run the following commands: + +```bash +npm install +npm run codegen +npm run build +npm run create-local +npm run deploy-local +``` + +### Step 2. Define Block Size in Source Subgraph + +This third `source` Subgraph indexes the size of each block. + +#### Key Functions + +- It imports existing schemas from other Subgraphs and adds a `Block` entity with a `size` field representing each block's size. +- It listens to blockchain events related to block sizes (e.g., storage or volume) and processes this data to update the Subgraph's entities accordingly. + +To deploy this Subgraph locally, run the following commands: + +```bash +npm install +npm run codegen +npm run build +npm run create-local +npm run deploy-local +``` + +### Step 3. Combine Into Block Stats Subgraph + +This composed Subgraph combines and aggregates the information from the three source Subgraphs above. + +> [!NOTE] Any change to a source Subgraph will likely generate a new deployment ID. Be sure to update the deployment ID in the data source address of the Subgraph manifest to take advantage of the latest changes. [!IMPORTANT] All source Subgraphs should be deployed before the composed Subgraph is deployed. + +This composed Subgraph demonstrates how to create a subgraph that aggregates data from three source subgraphs, providing a unified, enhanced view of block statistics. + +#### Key Functions + +- It provides a consolidated data model that encompasses all relevant block metrics. +- It combines data from three `source` subgraphs, and provides a comprehensive view of block statistics, enabling more complex queries and analyses. To deploy this subgraph locally, run the following commands: + +```bash +npm install +npm run codegen +npm run build +npm run create-local +npm run deploy-local +``` + +## Key Takeaways + +- This powerful tool will scale your subgraph development and allow you to combine multiple Subgraphs. +- The setup includes the deployment of three source Subgraphs and one final deployment of the composed Subgraph. +- This feature unlocks scalability, simplifying both development and maintenance efficiency. + +## Additional Resources + +- Add advanced features in your subgraph. Check out [subgraph advance features](/developing/creating/advanced/) and the [subgraph composition repo](https://github.com/incrypto32/subgraph-composition-sample-subgraph). +- Check out the Github repo [for this example] (https://github.com/isum/subgraph-composition-example). diff --git a/website/src/pages/hi/subgraphs/cookbook/_meta.js b/website/src/pages/hi/subgraphs/cookbook/_meta.js index e642f12ef11d..ae67ab7baed1 100644 --- a/website/src/pages/hi/subgraphs/cookbook/_meta.js +++ b/website/src/pages/hi/subgraphs/cookbook/_meta.js @@ -8,4 +8,5 @@ export default { enums: '', 'secure-api-keys-nextjs': '', polymarket: '', + 'subgraph-composition-three-sources': '', } diff --git a/website/src/pages/hi/subgraphs/cookbook/subgraph-composition-three-source.mdx b/website/src/pages/hi/subgraphs/cookbook/subgraph-composition-three-source.mdx new file mode 100644 index 000000000000..80b86a24d036 --- /dev/null +++ b/website/src/pages/hi/subgraphs/cookbook/subgraph-composition-three-source.mdx @@ -0,0 +1,121 @@ +--- +title: Integrating Three Subgraphs Using Subgraph Composition +sidebarTitle: 'Subgraph Composition with Three Source Subgraphs' +--- + +Optimize your Subgraph by merging data from three independent, `source` Subgraphs into a single composable Subgraph to enhance data aggregation. + +> Important Reminders + +> - Subgraph composition is built into the CLI, and you can deploy with [Subgraph Studio](https://thegraph.com/studio/). +> - This feature requires spec version 1.3.0. + +## Overview + +Subgraph composition empowers developer to leverage a Subgraph with other Subgraphs as data sources, seamlessly integrating and reacting to data updates and entity changes. This capability enhances efficiency and responsiveness in data handling. + +## Prerequisites + +To deploy **all** Subgraphs locally, you must have the following: + +- A [graph-node](https://github.com/graphprotocol/graph-node) instance running locally +- An [IPFS](https://docs.ipfs.tech/) instance running locally +- [Node.js.](https://nodejs.org/en) and npm + +## Get Started + +The following guide provides examples for defining three `source` Subgraphs to create one powerful composed Subgraph. + +### Specifics + +- To keep this example simple, all `source` subgraphs use only block handlers, but in a real environment, each source Subgraph will use data from different smart contracts. +- The examples below show how to import and extend the schema of another Subgraph to enhance its functionality. +- Each source Subgraph is optimized with a specific entity. +- All the commands listed install the necessary dependencies, generate code based on the GraphQL schema, build the Subgraph, and deploy it to your local Graph Node instance. + +### Step 1. Deploy Block Time Source Subgraph + +This first source Subgraph calculates the block time for each block. + +- It imports schemas from other Subgraphs and adds a `block` entity with a `timestamp` field, representing the time each block was mined. +- It listens to time-related blockchain events (e.g., block timestamps) and processes this data to update the Subgraph's entities accordingly. + +To deploy this Subgraph locally, run the following commands: + +```bash +npm install +npm run codegen +npm run build +npm run create-local +npm run deploy-local +``` + +### Step 1. Deploy Block Cost Source Subgraph + +This second `source` Subgraph indexes the cost of each block. + +#### Key Functions + +- It imports schemas from other Subgraphs and adds a `block` entity with cost-related fields. +- It listens to blockchain events related to costs (e.g. gas fees, transaction costs) and processes this data to update the Subgraph's entities accordingly. + +To deploy this Subgraph locally, run the following commands: + +```bash +npm install +npm run codegen +npm run build +npm run create-local +npm run deploy-local +``` + +### Step 2. Define Block Size in Source Subgraph + +This third `source` Subgraph indexes the size of each block. + +#### Key Functions + +- It imports existing schemas from other Subgraphs and adds a `Block` entity with a `size` field representing each block's size. +- It listens to blockchain events related to block sizes (e.g., storage or volume) and processes this data to update the Subgraph's entities accordingly. + +To deploy this Subgraph locally, run the following commands: + +```bash +npm install +npm run codegen +npm run build +npm run create-local +npm run deploy-local +``` + +### Step 3. Combine Into Block Stats Subgraph + +This composed Subgraph combines and aggregates the information from the three source Subgraphs above. + +> [!NOTE] Any change to a source Subgraph will likely generate a new deployment ID. Be sure to update the deployment ID in the data source address of the Subgraph manifest to take advantage of the latest changes. [!IMPORTANT] All source Subgraphs should be deployed before the composed Subgraph is deployed. + +This composed Subgraph demonstrates how to create a subgraph that aggregates data from three source subgraphs, providing a unified, enhanced view of block statistics. + +#### Key Functions + +- It provides a consolidated data model that encompasses all relevant block metrics. +- It combines data from three `source` subgraphs, and provides a comprehensive view of block statistics, enabling more complex queries and analyses. To deploy this subgraph locally, run the following commands: + +```bash +npm install +npm run codegen +npm run build +npm run create-local +npm run deploy-local +``` + +## Key Takeaways + +- This powerful tool will scale your subgraph development and allow you to combine multiple Subgraphs. +- The setup includes the deployment of three source Subgraphs and one final deployment of the composed Subgraph. +- This feature unlocks scalability, simplifying both development and maintenance efficiency. + +## Additional Resources + +- Add advanced features in your subgraph. Check out [subgraph advance features](/developing/creating/advanced/) and the [subgraph composition repo](https://github.com/incrypto32/subgraph-composition-sample-subgraph). +- Check out the Github repo [for this example] (https://github.com/isum/subgraph-composition-example). diff --git a/website/src/pages/it/subgraphs/cookbook/_meta.js b/website/src/pages/it/subgraphs/cookbook/_meta.js index e642f12ef11d..ae67ab7baed1 100644 --- a/website/src/pages/it/subgraphs/cookbook/_meta.js +++ b/website/src/pages/it/subgraphs/cookbook/_meta.js @@ -8,4 +8,5 @@ export default { enums: '', 'secure-api-keys-nextjs': '', polymarket: '', + 'subgraph-composition-three-sources': '', } diff --git a/website/src/pages/it/subgraphs/cookbook/subgraph-composition-three-source.mdx b/website/src/pages/it/subgraphs/cookbook/subgraph-composition-three-source.mdx new file mode 100644 index 000000000000..80b86a24d036 --- /dev/null +++ b/website/src/pages/it/subgraphs/cookbook/subgraph-composition-three-source.mdx @@ -0,0 +1,121 @@ +--- +title: Integrating Three Subgraphs Using Subgraph Composition +sidebarTitle: 'Subgraph Composition with Three Source Subgraphs' +--- + +Optimize your Subgraph by merging data from three independent, `source` Subgraphs into a single composable Subgraph to enhance data aggregation. + +> Important Reminders + +> - Subgraph composition is built into the CLI, and you can deploy with [Subgraph Studio](https://thegraph.com/studio/). +> - This feature requires spec version 1.3.0. + +## Overview + +Subgraph composition empowers developer to leverage a Subgraph with other Subgraphs as data sources, seamlessly integrating and reacting to data updates and entity changes. This capability enhances efficiency and responsiveness in data handling. + +## Prerequisites + +To deploy **all** Subgraphs locally, you must have the following: + +- A [graph-node](https://github.com/graphprotocol/graph-node) instance running locally +- An [IPFS](https://docs.ipfs.tech/) instance running locally +- [Node.js.](https://nodejs.org/en) and npm + +## Get Started + +The following guide provides examples for defining three `source` Subgraphs to create one powerful composed Subgraph. + +### Specifics + +- To keep this example simple, all `source` subgraphs use only block handlers, but in a real environment, each source Subgraph will use data from different smart contracts. +- The examples below show how to import and extend the schema of another Subgraph to enhance its functionality. +- Each source Subgraph is optimized with a specific entity. +- All the commands listed install the necessary dependencies, generate code based on the GraphQL schema, build the Subgraph, and deploy it to your local Graph Node instance. + +### Step 1. Deploy Block Time Source Subgraph + +This first source Subgraph calculates the block time for each block. + +- It imports schemas from other Subgraphs and adds a `block` entity with a `timestamp` field, representing the time each block was mined. +- It listens to time-related blockchain events (e.g., block timestamps) and processes this data to update the Subgraph's entities accordingly. + +To deploy this Subgraph locally, run the following commands: + +```bash +npm install +npm run codegen +npm run build +npm run create-local +npm run deploy-local +``` + +### Step 1. Deploy Block Cost Source Subgraph + +This second `source` Subgraph indexes the cost of each block. + +#### Key Functions + +- It imports schemas from other Subgraphs and adds a `block` entity with cost-related fields. +- It listens to blockchain events related to costs (e.g. gas fees, transaction costs) and processes this data to update the Subgraph's entities accordingly. + +To deploy this Subgraph locally, run the following commands: + +```bash +npm install +npm run codegen +npm run build +npm run create-local +npm run deploy-local +``` + +### Step 2. Define Block Size in Source Subgraph + +This third `source` Subgraph indexes the size of each block. + +#### Key Functions + +- It imports existing schemas from other Subgraphs and adds a `Block` entity with a `size` field representing each block's size. +- It listens to blockchain events related to block sizes (e.g., storage or volume) and processes this data to update the Subgraph's entities accordingly. + +To deploy this Subgraph locally, run the following commands: + +```bash +npm install +npm run codegen +npm run build +npm run create-local +npm run deploy-local +``` + +### Step 3. Combine Into Block Stats Subgraph + +This composed Subgraph combines and aggregates the information from the three source Subgraphs above. + +> [!NOTE] Any change to a source Subgraph will likely generate a new deployment ID. Be sure to update the deployment ID in the data source address of the Subgraph manifest to take advantage of the latest changes. [!IMPORTANT] All source Subgraphs should be deployed before the composed Subgraph is deployed. + +This composed Subgraph demonstrates how to create a subgraph that aggregates data from three source subgraphs, providing a unified, enhanced view of block statistics. + +#### Key Functions + +- It provides a consolidated data model that encompasses all relevant block metrics. +- It combines data from three `source` subgraphs, and provides a comprehensive view of block statistics, enabling more complex queries and analyses. To deploy this subgraph locally, run the following commands: + +```bash +npm install +npm run codegen +npm run build +npm run create-local +npm run deploy-local +``` + +## Key Takeaways + +- This powerful tool will scale your subgraph development and allow you to combine multiple Subgraphs. +- The setup includes the deployment of three source Subgraphs and one final deployment of the composed Subgraph. +- This feature unlocks scalability, simplifying both development and maintenance efficiency. + +## Additional Resources + +- Add advanced features in your subgraph. Check out [subgraph advance features](/developing/creating/advanced/) and the [subgraph composition repo](https://github.com/incrypto32/subgraph-composition-sample-subgraph). +- Check out the Github repo [for this example] (https://github.com/isum/subgraph-composition-example). diff --git a/website/src/pages/ja/subgraphs/cookbook/_meta.js b/website/src/pages/ja/subgraphs/cookbook/_meta.js index e642f12ef11d..ae67ab7baed1 100644 --- a/website/src/pages/ja/subgraphs/cookbook/_meta.js +++ b/website/src/pages/ja/subgraphs/cookbook/_meta.js @@ -8,4 +8,5 @@ export default { enums: '', 'secure-api-keys-nextjs': '', polymarket: '', + 'subgraph-composition-three-sources': '', } diff --git a/website/src/pages/ja/subgraphs/cookbook/subgraph-composition-three-source.mdx b/website/src/pages/ja/subgraphs/cookbook/subgraph-composition-three-source.mdx new file mode 100644 index 000000000000..80b86a24d036 --- /dev/null +++ b/website/src/pages/ja/subgraphs/cookbook/subgraph-composition-three-source.mdx @@ -0,0 +1,121 @@ +--- +title: Integrating Three Subgraphs Using Subgraph Composition +sidebarTitle: 'Subgraph Composition with Three Source Subgraphs' +--- + +Optimize your Subgraph by merging data from three independent, `source` Subgraphs into a single composable Subgraph to enhance data aggregation. + +> Important Reminders + +> - Subgraph composition is built into the CLI, and you can deploy with [Subgraph Studio](https://thegraph.com/studio/). +> - This feature requires spec version 1.3.0. + +## Overview + +Subgraph composition empowers developer to leverage a Subgraph with other Subgraphs as data sources, seamlessly integrating and reacting to data updates and entity changes. This capability enhances efficiency and responsiveness in data handling. + +## Prerequisites + +To deploy **all** Subgraphs locally, you must have the following: + +- A [graph-node](https://github.com/graphprotocol/graph-node) instance running locally +- An [IPFS](https://docs.ipfs.tech/) instance running locally +- [Node.js.](https://nodejs.org/en) and npm + +## Get Started + +The following guide provides examples for defining three `source` Subgraphs to create one powerful composed Subgraph. + +### Specifics + +- To keep this example simple, all `source` subgraphs use only block handlers, but in a real environment, each source Subgraph will use data from different smart contracts. +- The examples below show how to import and extend the schema of another Subgraph to enhance its functionality. +- Each source Subgraph is optimized with a specific entity. +- All the commands listed install the necessary dependencies, generate code based on the GraphQL schema, build the Subgraph, and deploy it to your local Graph Node instance. + +### Step 1. Deploy Block Time Source Subgraph + +This first source Subgraph calculates the block time for each block. + +- It imports schemas from other Subgraphs and adds a `block` entity with a `timestamp` field, representing the time each block was mined. +- It listens to time-related blockchain events (e.g., block timestamps) and processes this data to update the Subgraph's entities accordingly. + +To deploy this Subgraph locally, run the following commands: + +```bash +npm install +npm run codegen +npm run build +npm run create-local +npm run deploy-local +``` + +### Step 1. Deploy Block Cost Source Subgraph + +This second `source` Subgraph indexes the cost of each block. + +#### Key Functions + +- It imports schemas from other Subgraphs and adds a `block` entity with cost-related fields. +- It listens to blockchain events related to costs (e.g. gas fees, transaction costs) and processes this data to update the Subgraph's entities accordingly. + +To deploy this Subgraph locally, run the following commands: + +```bash +npm install +npm run codegen +npm run build +npm run create-local +npm run deploy-local +``` + +### Step 2. Define Block Size in Source Subgraph + +This third `source` Subgraph indexes the size of each block. + +#### Key Functions + +- It imports existing schemas from other Subgraphs and adds a `Block` entity with a `size` field representing each block's size. +- It listens to blockchain events related to block sizes (e.g., storage or volume) and processes this data to update the Subgraph's entities accordingly. + +To deploy this Subgraph locally, run the following commands: + +```bash +npm install +npm run codegen +npm run build +npm run create-local +npm run deploy-local +``` + +### Step 3. Combine Into Block Stats Subgraph + +This composed Subgraph combines and aggregates the information from the three source Subgraphs above. + +> [!NOTE] Any change to a source Subgraph will likely generate a new deployment ID. Be sure to update the deployment ID in the data source address of the Subgraph manifest to take advantage of the latest changes. [!IMPORTANT] All source Subgraphs should be deployed before the composed Subgraph is deployed. + +This composed Subgraph demonstrates how to create a subgraph that aggregates data from three source subgraphs, providing a unified, enhanced view of block statistics. + +#### Key Functions + +- It provides a consolidated data model that encompasses all relevant block metrics. +- It combines data from three `source` subgraphs, and provides a comprehensive view of block statistics, enabling more complex queries and analyses. To deploy this subgraph locally, run the following commands: + +```bash +npm install +npm run codegen +npm run build +npm run create-local +npm run deploy-local +``` + +## Key Takeaways + +- This powerful tool will scale your subgraph development and allow you to combine multiple Subgraphs. +- The setup includes the deployment of three source Subgraphs and one final deployment of the composed Subgraph. +- This feature unlocks scalability, simplifying both development and maintenance efficiency. + +## Additional Resources + +- Add advanced features in your subgraph. Check out [subgraph advance features](/developing/creating/advanced/) and the [subgraph composition repo](https://github.com/incrypto32/subgraph-composition-sample-subgraph). +- Check out the Github repo [for this example] (https://github.com/isum/subgraph-composition-example). diff --git a/website/src/pages/ko/subgraphs/cookbook/_meta.js b/website/src/pages/ko/subgraphs/cookbook/_meta.js index e642f12ef11d..ae67ab7baed1 100644 --- a/website/src/pages/ko/subgraphs/cookbook/_meta.js +++ b/website/src/pages/ko/subgraphs/cookbook/_meta.js @@ -8,4 +8,5 @@ export default { enums: '', 'secure-api-keys-nextjs': '', polymarket: '', + 'subgraph-composition-three-sources': '', } diff --git a/website/src/pages/ko/subgraphs/cookbook/subgraph-composition-three-source.mdx b/website/src/pages/ko/subgraphs/cookbook/subgraph-composition-three-source.mdx new file mode 100644 index 000000000000..80b86a24d036 --- /dev/null +++ b/website/src/pages/ko/subgraphs/cookbook/subgraph-composition-three-source.mdx @@ -0,0 +1,121 @@ +--- +title: Integrating Three Subgraphs Using Subgraph Composition +sidebarTitle: 'Subgraph Composition with Three Source Subgraphs' +--- + +Optimize your Subgraph by merging data from three independent, `source` Subgraphs into a single composable Subgraph to enhance data aggregation. + +> Important Reminders + +> - Subgraph composition is built into the CLI, and you can deploy with [Subgraph Studio](https://thegraph.com/studio/). +> - This feature requires spec version 1.3.0. + +## Overview + +Subgraph composition empowers developer to leverage a Subgraph with other Subgraphs as data sources, seamlessly integrating and reacting to data updates and entity changes. This capability enhances efficiency and responsiveness in data handling. + +## Prerequisites + +To deploy **all** Subgraphs locally, you must have the following: + +- A [graph-node](https://github.com/graphprotocol/graph-node) instance running locally +- An [IPFS](https://docs.ipfs.tech/) instance running locally +- [Node.js.](https://nodejs.org/en) and npm + +## Get Started + +The following guide provides examples for defining three `source` Subgraphs to create one powerful composed Subgraph. + +### Specifics + +- To keep this example simple, all `source` subgraphs use only block handlers, but in a real environment, each source Subgraph will use data from different smart contracts. +- The examples below show how to import and extend the schema of another Subgraph to enhance its functionality. +- Each source Subgraph is optimized with a specific entity. +- All the commands listed install the necessary dependencies, generate code based on the GraphQL schema, build the Subgraph, and deploy it to your local Graph Node instance. + +### Step 1. Deploy Block Time Source Subgraph + +This first source Subgraph calculates the block time for each block. + +- It imports schemas from other Subgraphs and adds a `block` entity with a `timestamp` field, representing the time each block was mined. +- It listens to time-related blockchain events (e.g., block timestamps) and processes this data to update the Subgraph's entities accordingly. + +To deploy this Subgraph locally, run the following commands: + +```bash +npm install +npm run codegen +npm run build +npm run create-local +npm run deploy-local +``` + +### Step 1. Deploy Block Cost Source Subgraph + +This second `source` Subgraph indexes the cost of each block. + +#### Key Functions + +- It imports schemas from other Subgraphs and adds a `block` entity with cost-related fields. +- It listens to blockchain events related to costs (e.g. gas fees, transaction costs) and processes this data to update the Subgraph's entities accordingly. + +To deploy this Subgraph locally, run the following commands: + +```bash +npm install +npm run codegen +npm run build +npm run create-local +npm run deploy-local +``` + +### Step 2. Define Block Size in Source Subgraph + +This third `source` Subgraph indexes the size of each block. + +#### Key Functions + +- It imports existing schemas from other Subgraphs and adds a `Block` entity with a `size` field representing each block's size. +- It listens to blockchain events related to block sizes (e.g., storage or volume) and processes this data to update the Subgraph's entities accordingly. + +To deploy this Subgraph locally, run the following commands: + +```bash +npm install +npm run codegen +npm run build +npm run create-local +npm run deploy-local +``` + +### Step 3. Combine Into Block Stats Subgraph + +This composed Subgraph combines and aggregates the information from the three source Subgraphs above. + +> [!NOTE] Any change to a source Subgraph will likely generate a new deployment ID. Be sure to update the deployment ID in the data source address of the Subgraph manifest to take advantage of the latest changes. [!IMPORTANT] All source Subgraphs should be deployed before the composed Subgraph is deployed. + +This composed Subgraph demonstrates how to create a subgraph that aggregates data from three source subgraphs, providing a unified, enhanced view of block statistics. + +#### Key Functions + +- It provides a consolidated data model that encompasses all relevant block metrics. +- It combines data from three `source` subgraphs, and provides a comprehensive view of block statistics, enabling more complex queries and analyses. To deploy this subgraph locally, run the following commands: + +```bash +npm install +npm run codegen +npm run build +npm run create-local +npm run deploy-local +``` + +## Key Takeaways + +- This powerful tool will scale your subgraph development and allow you to combine multiple Subgraphs. +- The setup includes the deployment of three source Subgraphs and one final deployment of the composed Subgraph. +- This feature unlocks scalability, simplifying both development and maintenance efficiency. + +## Additional Resources + +- Add advanced features in your subgraph. Check out [subgraph advance features](/developing/creating/advanced/) and the [subgraph composition repo](https://github.com/incrypto32/subgraph-composition-sample-subgraph). +- Check out the Github repo [for this example] (https://github.com/isum/subgraph-composition-example). diff --git a/website/src/pages/mr/subgraphs/cookbook/_meta.js b/website/src/pages/mr/subgraphs/cookbook/_meta.js index e642f12ef11d..ae67ab7baed1 100644 --- a/website/src/pages/mr/subgraphs/cookbook/_meta.js +++ b/website/src/pages/mr/subgraphs/cookbook/_meta.js @@ -8,4 +8,5 @@ export default { enums: '', 'secure-api-keys-nextjs': '', polymarket: '', + 'subgraph-composition-three-sources': '', } diff --git a/website/src/pages/mr/subgraphs/cookbook/subgraph-composition-three-source.mdx b/website/src/pages/mr/subgraphs/cookbook/subgraph-composition-three-source.mdx new file mode 100644 index 000000000000..80b86a24d036 --- /dev/null +++ b/website/src/pages/mr/subgraphs/cookbook/subgraph-composition-three-source.mdx @@ -0,0 +1,121 @@ +--- +title: Integrating Three Subgraphs Using Subgraph Composition +sidebarTitle: 'Subgraph Composition with Three Source Subgraphs' +--- + +Optimize your Subgraph by merging data from three independent, `source` Subgraphs into a single composable Subgraph to enhance data aggregation. + +> Important Reminders + +> - Subgraph composition is built into the CLI, and you can deploy with [Subgraph Studio](https://thegraph.com/studio/). +> - This feature requires spec version 1.3.0. + +## Overview + +Subgraph composition empowers developer to leverage a Subgraph with other Subgraphs as data sources, seamlessly integrating and reacting to data updates and entity changes. This capability enhances efficiency and responsiveness in data handling. + +## Prerequisites + +To deploy **all** Subgraphs locally, you must have the following: + +- A [graph-node](https://github.com/graphprotocol/graph-node) instance running locally +- An [IPFS](https://docs.ipfs.tech/) instance running locally +- [Node.js.](https://nodejs.org/en) and npm + +## Get Started + +The following guide provides examples for defining three `source` Subgraphs to create one powerful composed Subgraph. + +### Specifics + +- To keep this example simple, all `source` subgraphs use only block handlers, but in a real environment, each source Subgraph will use data from different smart contracts. +- The examples below show how to import and extend the schema of another Subgraph to enhance its functionality. +- Each source Subgraph is optimized with a specific entity. +- All the commands listed install the necessary dependencies, generate code based on the GraphQL schema, build the Subgraph, and deploy it to your local Graph Node instance. + +### Step 1. Deploy Block Time Source Subgraph + +This first source Subgraph calculates the block time for each block. + +- It imports schemas from other Subgraphs and adds a `block` entity with a `timestamp` field, representing the time each block was mined. +- It listens to time-related blockchain events (e.g., block timestamps) and processes this data to update the Subgraph's entities accordingly. + +To deploy this Subgraph locally, run the following commands: + +```bash +npm install +npm run codegen +npm run build +npm run create-local +npm run deploy-local +``` + +### Step 1. Deploy Block Cost Source Subgraph + +This second `source` Subgraph indexes the cost of each block. + +#### Key Functions + +- It imports schemas from other Subgraphs and adds a `block` entity with cost-related fields. +- It listens to blockchain events related to costs (e.g. gas fees, transaction costs) and processes this data to update the Subgraph's entities accordingly. + +To deploy this Subgraph locally, run the following commands: + +```bash +npm install +npm run codegen +npm run build +npm run create-local +npm run deploy-local +``` + +### Step 2. Define Block Size in Source Subgraph + +This third `source` Subgraph indexes the size of each block. + +#### Key Functions + +- It imports existing schemas from other Subgraphs and adds a `Block` entity with a `size` field representing each block's size. +- It listens to blockchain events related to block sizes (e.g., storage or volume) and processes this data to update the Subgraph's entities accordingly. + +To deploy this Subgraph locally, run the following commands: + +```bash +npm install +npm run codegen +npm run build +npm run create-local +npm run deploy-local +``` + +### Step 3. Combine Into Block Stats Subgraph + +This composed Subgraph combines and aggregates the information from the three source Subgraphs above. + +> [!NOTE] Any change to a source Subgraph will likely generate a new deployment ID. Be sure to update the deployment ID in the data source address of the Subgraph manifest to take advantage of the latest changes. [!IMPORTANT] All source Subgraphs should be deployed before the composed Subgraph is deployed. + +This composed Subgraph demonstrates how to create a subgraph that aggregates data from three source subgraphs, providing a unified, enhanced view of block statistics. + +#### Key Functions + +- It provides a consolidated data model that encompasses all relevant block metrics. +- It combines data from three `source` subgraphs, and provides a comprehensive view of block statistics, enabling more complex queries and analyses. To deploy this subgraph locally, run the following commands: + +```bash +npm install +npm run codegen +npm run build +npm run create-local +npm run deploy-local +``` + +## Key Takeaways + +- This powerful tool will scale your subgraph development and allow you to combine multiple Subgraphs. +- The setup includes the deployment of three source Subgraphs and one final deployment of the composed Subgraph. +- This feature unlocks scalability, simplifying both development and maintenance efficiency. + +## Additional Resources + +- Add advanced features in your subgraph. Check out [subgraph advance features](/developing/creating/advanced/) and the [subgraph composition repo](https://github.com/incrypto32/subgraph-composition-sample-subgraph). +- Check out the Github repo [for this example] (https://github.com/isum/subgraph-composition-example). diff --git a/website/src/pages/nl/subgraphs/cookbook/_meta.js b/website/src/pages/nl/subgraphs/cookbook/_meta.js index e642f12ef11d..ae67ab7baed1 100644 --- a/website/src/pages/nl/subgraphs/cookbook/_meta.js +++ b/website/src/pages/nl/subgraphs/cookbook/_meta.js @@ -8,4 +8,5 @@ export default { enums: '', 'secure-api-keys-nextjs': '', polymarket: '', + 'subgraph-composition-three-sources': '', } diff --git a/website/src/pages/nl/subgraphs/cookbook/subgraph-composition-three-source.mdx b/website/src/pages/nl/subgraphs/cookbook/subgraph-composition-three-source.mdx new file mode 100644 index 000000000000..80b86a24d036 --- /dev/null +++ b/website/src/pages/nl/subgraphs/cookbook/subgraph-composition-three-source.mdx @@ -0,0 +1,121 @@ +--- +title: Integrating Three Subgraphs Using Subgraph Composition +sidebarTitle: 'Subgraph Composition with Three Source Subgraphs' +--- + +Optimize your Subgraph by merging data from three independent, `source` Subgraphs into a single composable Subgraph to enhance data aggregation. + +> Important Reminders + +> - Subgraph composition is built into the CLI, and you can deploy with [Subgraph Studio](https://thegraph.com/studio/). +> - This feature requires spec version 1.3.0. + +## Overview + +Subgraph composition empowers developer to leverage a Subgraph with other Subgraphs as data sources, seamlessly integrating and reacting to data updates and entity changes. This capability enhances efficiency and responsiveness in data handling. + +## Prerequisites + +To deploy **all** Subgraphs locally, you must have the following: + +- A [graph-node](https://github.com/graphprotocol/graph-node) instance running locally +- An [IPFS](https://docs.ipfs.tech/) instance running locally +- [Node.js.](https://nodejs.org/en) and npm + +## Get Started + +The following guide provides examples for defining three `source` Subgraphs to create one powerful composed Subgraph. + +### Specifics + +- To keep this example simple, all `source` subgraphs use only block handlers, but in a real environment, each source Subgraph will use data from different smart contracts. +- The examples below show how to import and extend the schema of another Subgraph to enhance its functionality. +- Each source Subgraph is optimized with a specific entity. +- All the commands listed install the necessary dependencies, generate code based on the GraphQL schema, build the Subgraph, and deploy it to your local Graph Node instance. + +### Step 1. Deploy Block Time Source Subgraph + +This first source Subgraph calculates the block time for each block. + +- It imports schemas from other Subgraphs and adds a `block` entity with a `timestamp` field, representing the time each block was mined. +- It listens to time-related blockchain events (e.g., block timestamps) and processes this data to update the Subgraph's entities accordingly. + +To deploy this Subgraph locally, run the following commands: + +```bash +npm install +npm run codegen +npm run build +npm run create-local +npm run deploy-local +``` + +### Step 1. Deploy Block Cost Source Subgraph + +This second `source` Subgraph indexes the cost of each block. + +#### Key Functions + +- It imports schemas from other Subgraphs and adds a `block` entity with cost-related fields. +- It listens to blockchain events related to costs (e.g. gas fees, transaction costs) and processes this data to update the Subgraph's entities accordingly. + +To deploy this Subgraph locally, run the following commands: + +```bash +npm install +npm run codegen +npm run build +npm run create-local +npm run deploy-local +``` + +### Step 2. Define Block Size in Source Subgraph + +This third `source` Subgraph indexes the size of each block. + +#### Key Functions + +- It imports existing schemas from other Subgraphs and adds a `Block` entity with a `size` field representing each block's size. +- It listens to blockchain events related to block sizes (e.g., storage or volume) and processes this data to update the Subgraph's entities accordingly. + +To deploy this Subgraph locally, run the following commands: + +```bash +npm install +npm run codegen +npm run build +npm run create-local +npm run deploy-local +``` + +### Step 3. Combine Into Block Stats Subgraph + +This composed Subgraph combines and aggregates the information from the three source Subgraphs above. + +> [!NOTE] Any change to a source Subgraph will likely generate a new deployment ID. Be sure to update the deployment ID in the data source address of the Subgraph manifest to take advantage of the latest changes. [!IMPORTANT] All source Subgraphs should be deployed before the composed Subgraph is deployed. + +This composed Subgraph demonstrates how to create a subgraph that aggregates data from three source subgraphs, providing a unified, enhanced view of block statistics. + +#### Key Functions + +- It provides a consolidated data model that encompasses all relevant block metrics. +- It combines data from three `source` subgraphs, and provides a comprehensive view of block statistics, enabling more complex queries and analyses. To deploy this subgraph locally, run the following commands: + +```bash +npm install +npm run codegen +npm run build +npm run create-local +npm run deploy-local +``` + +## Key Takeaways + +- This powerful tool will scale your subgraph development and allow you to combine multiple Subgraphs. +- The setup includes the deployment of three source Subgraphs and one final deployment of the composed Subgraph. +- This feature unlocks scalability, simplifying both development and maintenance efficiency. + +## Additional Resources + +- Add advanced features in your subgraph. Check out [subgraph advance features](/developing/creating/advanced/) and the [subgraph composition repo](https://github.com/incrypto32/subgraph-composition-sample-subgraph). +- Check out the Github repo [for this example] (https://github.com/isum/subgraph-composition-example). diff --git a/website/src/pages/pl/subgraphs/cookbook/_meta.js b/website/src/pages/pl/subgraphs/cookbook/_meta.js index e642f12ef11d..ae67ab7baed1 100644 --- a/website/src/pages/pl/subgraphs/cookbook/_meta.js +++ b/website/src/pages/pl/subgraphs/cookbook/_meta.js @@ -8,4 +8,5 @@ export default { enums: '', 'secure-api-keys-nextjs': '', polymarket: '', + 'subgraph-composition-three-sources': '', } diff --git a/website/src/pages/pl/subgraphs/cookbook/subgraph-composition-three-source.mdx b/website/src/pages/pl/subgraphs/cookbook/subgraph-composition-three-source.mdx new file mode 100644 index 000000000000..80b86a24d036 --- /dev/null +++ b/website/src/pages/pl/subgraphs/cookbook/subgraph-composition-three-source.mdx @@ -0,0 +1,121 @@ +--- +title: Integrating Three Subgraphs Using Subgraph Composition +sidebarTitle: 'Subgraph Composition with Three Source Subgraphs' +--- + +Optimize your Subgraph by merging data from three independent, `source` Subgraphs into a single composable Subgraph to enhance data aggregation. + +> Important Reminders + +> - Subgraph composition is built into the CLI, and you can deploy with [Subgraph Studio](https://thegraph.com/studio/). +> - This feature requires spec version 1.3.0. + +## Overview + +Subgraph composition empowers developer to leverage a Subgraph with other Subgraphs as data sources, seamlessly integrating and reacting to data updates and entity changes. This capability enhances efficiency and responsiveness in data handling. + +## Prerequisites + +To deploy **all** Subgraphs locally, you must have the following: + +- A [graph-node](https://github.com/graphprotocol/graph-node) instance running locally +- An [IPFS](https://docs.ipfs.tech/) instance running locally +- [Node.js.](https://nodejs.org/en) and npm + +## Get Started + +The following guide provides examples for defining three `source` Subgraphs to create one powerful composed Subgraph. + +### Specifics + +- To keep this example simple, all `source` subgraphs use only block handlers, but in a real environment, each source Subgraph will use data from different smart contracts. +- The examples below show how to import and extend the schema of another Subgraph to enhance its functionality. +- Each source Subgraph is optimized with a specific entity. +- All the commands listed install the necessary dependencies, generate code based on the GraphQL schema, build the Subgraph, and deploy it to your local Graph Node instance. + +### Step 1. Deploy Block Time Source Subgraph + +This first source Subgraph calculates the block time for each block. + +- It imports schemas from other Subgraphs and adds a `block` entity with a `timestamp` field, representing the time each block was mined. +- It listens to time-related blockchain events (e.g., block timestamps) and processes this data to update the Subgraph's entities accordingly. + +To deploy this Subgraph locally, run the following commands: + +```bash +npm install +npm run codegen +npm run build +npm run create-local +npm run deploy-local +``` + +### Step 1. Deploy Block Cost Source Subgraph + +This second `source` Subgraph indexes the cost of each block. + +#### Key Functions + +- It imports schemas from other Subgraphs and adds a `block` entity with cost-related fields. +- It listens to blockchain events related to costs (e.g. gas fees, transaction costs) and processes this data to update the Subgraph's entities accordingly. + +To deploy this Subgraph locally, run the following commands: + +```bash +npm install +npm run codegen +npm run build +npm run create-local +npm run deploy-local +``` + +### Step 2. Define Block Size in Source Subgraph + +This third `source` Subgraph indexes the size of each block. + +#### Key Functions + +- It imports existing schemas from other Subgraphs and adds a `Block` entity with a `size` field representing each block's size. +- It listens to blockchain events related to block sizes (e.g., storage or volume) and processes this data to update the Subgraph's entities accordingly. + +To deploy this Subgraph locally, run the following commands: + +```bash +npm install +npm run codegen +npm run build +npm run create-local +npm run deploy-local +``` + +### Step 3. Combine Into Block Stats Subgraph + +This composed Subgraph combines and aggregates the information from the three source Subgraphs above. + +> [!NOTE] Any change to a source Subgraph will likely generate a new deployment ID. Be sure to update the deployment ID in the data source address of the Subgraph manifest to take advantage of the latest changes. [!IMPORTANT] All source Subgraphs should be deployed before the composed Subgraph is deployed. + +This composed Subgraph demonstrates how to create a subgraph that aggregates data from three source subgraphs, providing a unified, enhanced view of block statistics. + +#### Key Functions + +- It provides a consolidated data model that encompasses all relevant block metrics. +- It combines data from three `source` subgraphs, and provides a comprehensive view of block statistics, enabling more complex queries and analyses. To deploy this subgraph locally, run the following commands: + +```bash +npm install +npm run codegen +npm run build +npm run create-local +npm run deploy-local +``` + +## Key Takeaways + +- This powerful tool will scale your subgraph development and allow you to combine multiple Subgraphs. +- The setup includes the deployment of three source Subgraphs and one final deployment of the composed Subgraph. +- This feature unlocks scalability, simplifying both development and maintenance efficiency. + +## Additional Resources + +- Add advanced features in your subgraph. Check out [subgraph advance features](/developing/creating/advanced/) and the [subgraph composition repo](https://github.com/incrypto32/subgraph-composition-sample-subgraph). +- Check out the Github repo [for this example] (https://github.com/isum/subgraph-composition-example). diff --git a/website/src/pages/pt/subgraphs/cookbook/_meta.js b/website/src/pages/pt/subgraphs/cookbook/_meta.js index e642f12ef11d..ae67ab7baed1 100644 --- a/website/src/pages/pt/subgraphs/cookbook/_meta.js +++ b/website/src/pages/pt/subgraphs/cookbook/_meta.js @@ -8,4 +8,5 @@ export default { enums: '', 'secure-api-keys-nextjs': '', polymarket: '', + 'subgraph-composition-three-sources': '', } diff --git a/website/src/pages/pt/subgraphs/cookbook/subgraph-composition-three-source.mdx b/website/src/pages/pt/subgraphs/cookbook/subgraph-composition-three-source.mdx new file mode 100644 index 000000000000..80b86a24d036 --- /dev/null +++ b/website/src/pages/pt/subgraphs/cookbook/subgraph-composition-three-source.mdx @@ -0,0 +1,121 @@ +--- +title: Integrating Three Subgraphs Using Subgraph Composition +sidebarTitle: 'Subgraph Composition with Three Source Subgraphs' +--- + +Optimize your Subgraph by merging data from three independent, `source` Subgraphs into a single composable Subgraph to enhance data aggregation. + +> Important Reminders + +> - Subgraph composition is built into the CLI, and you can deploy with [Subgraph Studio](https://thegraph.com/studio/). +> - This feature requires spec version 1.3.0. + +## Overview + +Subgraph composition empowers developer to leverage a Subgraph with other Subgraphs as data sources, seamlessly integrating and reacting to data updates and entity changes. This capability enhances efficiency and responsiveness in data handling. + +## Prerequisites + +To deploy **all** Subgraphs locally, you must have the following: + +- A [graph-node](https://github.com/graphprotocol/graph-node) instance running locally +- An [IPFS](https://docs.ipfs.tech/) instance running locally +- [Node.js.](https://nodejs.org/en) and npm + +## Get Started + +The following guide provides examples for defining three `source` Subgraphs to create one powerful composed Subgraph. + +### Specifics + +- To keep this example simple, all `source` subgraphs use only block handlers, but in a real environment, each source Subgraph will use data from different smart contracts. +- The examples below show how to import and extend the schema of another Subgraph to enhance its functionality. +- Each source Subgraph is optimized with a specific entity. +- All the commands listed install the necessary dependencies, generate code based on the GraphQL schema, build the Subgraph, and deploy it to your local Graph Node instance. + +### Step 1. Deploy Block Time Source Subgraph + +This first source Subgraph calculates the block time for each block. + +- It imports schemas from other Subgraphs and adds a `block` entity with a `timestamp` field, representing the time each block was mined. +- It listens to time-related blockchain events (e.g., block timestamps) and processes this data to update the Subgraph's entities accordingly. + +To deploy this Subgraph locally, run the following commands: + +```bash +npm install +npm run codegen +npm run build +npm run create-local +npm run deploy-local +``` + +### Step 1. Deploy Block Cost Source Subgraph + +This second `source` Subgraph indexes the cost of each block. + +#### Key Functions + +- It imports schemas from other Subgraphs and adds a `block` entity with cost-related fields. +- It listens to blockchain events related to costs (e.g. gas fees, transaction costs) and processes this data to update the Subgraph's entities accordingly. + +To deploy this Subgraph locally, run the following commands: + +```bash +npm install +npm run codegen +npm run build +npm run create-local +npm run deploy-local +``` + +### Step 2. Define Block Size in Source Subgraph + +This third `source` Subgraph indexes the size of each block. + +#### Key Functions + +- It imports existing schemas from other Subgraphs and adds a `Block` entity with a `size` field representing each block's size. +- It listens to blockchain events related to block sizes (e.g., storage or volume) and processes this data to update the Subgraph's entities accordingly. + +To deploy this Subgraph locally, run the following commands: + +```bash +npm install +npm run codegen +npm run build +npm run create-local +npm run deploy-local +``` + +### Step 3. Combine Into Block Stats Subgraph + +This composed Subgraph combines and aggregates the information from the three source Subgraphs above. + +> [!NOTE] Any change to a source Subgraph will likely generate a new deployment ID. Be sure to update the deployment ID in the data source address of the Subgraph manifest to take advantage of the latest changes. [!IMPORTANT] All source Subgraphs should be deployed before the composed Subgraph is deployed. + +This composed Subgraph demonstrates how to create a subgraph that aggregates data from three source subgraphs, providing a unified, enhanced view of block statistics. + +#### Key Functions + +- It provides a consolidated data model that encompasses all relevant block metrics. +- It combines data from three `source` subgraphs, and provides a comprehensive view of block statistics, enabling more complex queries and analyses. To deploy this subgraph locally, run the following commands: + +```bash +npm install +npm run codegen +npm run build +npm run create-local +npm run deploy-local +``` + +## Key Takeaways + +- This powerful tool will scale your subgraph development and allow you to combine multiple Subgraphs. +- The setup includes the deployment of three source Subgraphs and one final deployment of the composed Subgraph. +- This feature unlocks scalability, simplifying both development and maintenance efficiency. + +## Additional Resources + +- Add advanced features in your subgraph. Check out [subgraph advance features](/developing/creating/advanced/) and the [subgraph composition repo](https://github.com/incrypto32/subgraph-composition-sample-subgraph). +- Check out the Github repo [for this example] (https://github.com/isum/subgraph-composition-example). diff --git a/website/src/pages/ro/subgraphs/cookbook/_meta.js b/website/src/pages/ro/subgraphs/cookbook/_meta.js index e642f12ef11d..ae67ab7baed1 100644 --- a/website/src/pages/ro/subgraphs/cookbook/_meta.js +++ b/website/src/pages/ro/subgraphs/cookbook/_meta.js @@ -8,4 +8,5 @@ export default { enums: '', 'secure-api-keys-nextjs': '', polymarket: '', + 'subgraph-composition-three-sources': '', } diff --git a/website/src/pages/ro/subgraphs/cookbook/subgraph-composition-three-source.mdx b/website/src/pages/ro/subgraphs/cookbook/subgraph-composition-three-source.mdx new file mode 100644 index 000000000000..80b86a24d036 --- /dev/null +++ b/website/src/pages/ro/subgraphs/cookbook/subgraph-composition-three-source.mdx @@ -0,0 +1,121 @@ +--- +title: Integrating Three Subgraphs Using Subgraph Composition +sidebarTitle: 'Subgraph Composition with Three Source Subgraphs' +--- + +Optimize your Subgraph by merging data from three independent, `source` Subgraphs into a single composable Subgraph to enhance data aggregation. + +> Important Reminders + +> - Subgraph composition is built into the CLI, and you can deploy with [Subgraph Studio](https://thegraph.com/studio/). +> - This feature requires spec version 1.3.0. + +## Overview + +Subgraph composition empowers developer to leverage a Subgraph with other Subgraphs as data sources, seamlessly integrating and reacting to data updates and entity changes. This capability enhances efficiency and responsiveness in data handling. + +## Prerequisites + +To deploy **all** Subgraphs locally, you must have the following: + +- A [graph-node](https://github.com/graphprotocol/graph-node) instance running locally +- An [IPFS](https://docs.ipfs.tech/) instance running locally +- [Node.js.](https://nodejs.org/en) and npm + +## Get Started + +The following guide provides examples for defining three `source` Subgraphs to create one powerful composed Subgraph. + +### Specifics + +- To keep this example simple, all `source` subgraphs use only block handlers, but in a real environment, each source Subgraph will use data from different smart contracts. +- The examples below show how to import and extend the schema of another Subgraph to enhance its functionality. +- Each source Subgraph is optimized with a specific entity. +- All the commands listed install the necessary dependencies, generate code based on the GraphQL schema, build the Subgraph, and deploy it to your local Graph Node instance. + +### Step 1. Deploy Block Time Source Subgraph + +This first source Subgraph calculates the block time for each block. + +- It imports schemas from other Subgraphs and adds a `block` entity with a `timestamp` field, representing the time each block was mined. +- It listens to time-related blockchain events (e.g., block timestamps) and processes this data to update the Subgraph's entities accordingly. + +To deploy this Subgraph locally, run the following commands: + +```bash +npm install +npm run codegen +npm run build +npm run create-local +npm run deploy-local +``` + +### Step 1. Deploy Block Cost Source Subgraph + +This second `source` Subgraph indexes the cost of each block. + +#### Key Functions + +- It imports schemas from other Subgraphs and adds a `block` entity with cost-related fields. +- It listens to blockchain events related to costs (e.g. gas fees, transaction costs) and processes this data to update the Subgraph's entities accordingly. + +To deploy this Subgraph locally, run the following commands: + +```bash +npm install +npm run codegen +npm run build +npm run create-local +npm run deploy-local +``` + +### Step 2. Define Block Size in Source Subgraph + +This third `source` Subgraph indexes the size of each block. + +#### Key Functions + +- It imports existing schemas from other Subgraphs and adds a `Block` entity with a `size` field representing each block's size. +- It listens to blockchain events related to block sizes (e.g., storage or volume) and processes this data to update the Subgraph's entities accordingly. + +To deploy this Subgraph locally, run the following commands: + +```bash +npm install +npm run codegen +npm run build +npm run create-local +npm run deploy-local +``` + +### Step 3. Combine Into Block Stats Subgraph + +This composed Subgraph combines and aggregates the information from the three source Subgraphs above. + +> [!NOTE] Any change to a source Subgraph will likely generate a new deployment ID. Be sure to update the deployment ID in the data source address of the Subgraph manifest to take advantage of the latest changes. [!IMPORTANT] All source Subgraphs should be deployed before the composed Subgraph is deployed. + +This composed Subgraph demonstrates how to create a subgraph that aggregates data from three source subgraphs, providing a unified, enhanced view of block statistics. + +#### Key Functions + +- It provides a consolidated data model that encompasses all relevant block metrics. +- It combines data from three `source` subgraphs, and provides a comprehensive view of block statistics, enabling more complex queries and analyses. To deploy this subgraph locally, run the following commands: + +```bash +npm install +npm run codegen +npm run build +npm run create-local +npm run deploy-local +``` + +## Key Takeaways + +- This powerful tool will scale your subgraph development and allow you to combine multiple Subgraphs. +- The setup includes the deployment of three source Subgraphs and one final deployment of the composed Subgraph. +- This feature unlocks scalability, simplifying both development and maintenance efficiency. + +## Additional Resources + +- Add advanced features in your subgraph. Check out [subgraph advance features](/developing/creating/advanced/) and the [subgraph composition repo](https://github.com/incrypto32/subgraph-composition-sample-subgraph). +- Check out the Github repo [for this example] (https://github.com/isum/subgraph-composition-example). diff --git a/website/src/pages/ru/subgraphs/cookbook/_meta.js b/website/src/pages/ru/subgraphs/cookbook/_meta.js index e642f12ef11d..ae67ab7baed1 100644 --- a/website/src/pages/ru/subgraphs/cookbook/_meta.js +++ b/website/src/pages/ru/subgraphs/cookbook/_meta.js @@ -8,4 +8,5 @@ export default { enums: '', 'secure-api-keys-nextjs': '', polymarket: '', + 'subgraph-composition-three-sources': '', } diff --git a/website/src/pages/ru/subgraphs/cookbook/subgraph-composition-three-source.mdx b/website/src/pages/ru/subgraphs/cookbook/subgraph-composition-three-source.mdx new file mode 100644 index 000000000000..80b86a24d036 --- /dev/null +++ b/website/src/pages/ru/subgraphs/cookbook/subgraph-composition-three-source.mdx @@ -0,0 +1,121 @@ +--- +title: Integrating Three Subgraphs Using Subgraph Composition +sidebarTitle: 'Subgraph Composition with Three Source Subgraphs' +--- + +Optimize your Subgraph by merging data from three independent, `source` Subgraphs into a single composable Subgraph to enhance data aggregation. + +> Important Reminders + +> - Subgraph composition is built into the CLI, and you can deploy with [Subgraph Studio](https://thegraph.com/studio/). +> - This feature requires spec version 1.3.0. + +## Overview + +Subgraph composition empowers developer to leverage a Subgraph with other Subgraphs as data sources, seamlessly integrating and reacting to data updates and entity changes. This capability enhances efficiency and responsiveness in data handling. + +## Prerequisites + +To deploy **all** Subgraphs locally, you must have the following: + +- A [graph-node](https://github.com/graphprotocol/graph-node) instance running locally +- An [IPFS](https://docs.ipfs.tech/) instance running locally +- [Node.js.](https://nodejs.org/en) and npm + +## Get Started + +The following guide provides examples for defining three `source` Subgraphs to create one powerful composed Subgraph. + +### Specifics + +- To keep this example simple, all `source` subgraphs use only block handlers, but in a real environment, each source Subgraph will use data from different smart contracts. +- The examples below show how to import and extend the schema of another Subgraph to enhance its functionality. +- Each source Subgraph is optimized with a specific entity. +- All the commands listed install the necessary dependencies, generate code based on the GraphQL schema, build the Subgraph, and deploy it to your local Graph Node instance. + +### Step 1. Deploy Block Time Source Subgraph + +This first source Subgraph calculates the block time for each block. + +- It imports schemas from other Subgraphs and adds a `block` entity with a `timestamp` field, representing the time each block was mined. +- It listens to time-related blockchain events (e.g., block timestamps) and processes this data to update the Subgraph's entities accordingly. + +To deploy this Subgraph locally, run the following commands: + +```bash +npm install +npm run codegen +npm run build +npm run create-local +npm run deploy-local +``` + +### Step 1. Deploy Block Cost Source Subgraph + +This second `source` Subgraph indexes the cost of each block. + +#### Key Functions + +- It imports schemas from other Subgraphs and adds a `block` entity with cost-related fields. +- It listens to blockchain events related to costs (e.g. gas fees, transaction costs) and processes this data to update the Subgraph's entities accordingly. + +To deploy this Subgraph locally, run the following commands: + +```bash +npm install +npm run codegen +npm run build +npm run create-local +npm run deploy-local +``` + +### Step 2. Define Block Size in Source Subgraph + +This third `source` Subgraph indexes the size of each block. + +#### Key Functions + +- It imports existing schemas from other Subgraphs and adds a `Block` entity with a `size` field representing each block's size. +- It listens to blockchain events related to block sizes (e.g., storage or volume) and processes this data to update the Subgraph's entities accordingly. + +To deploy this Subgraph locally, run the following commands: + +```bash +npm install +npm run codegen +npm run build +npm run create-local +npm run deploy-local +``` + +### Step 3. Combine Into Block Stats Subgraph + +This composed Subgraph combines and aggregates the information from the three source Subgraphs above. + +> [!NOTE] Any change to a source Subgraph will likely generate a new deployment ID. Be sure to update the deployment ID in the data source address of the Subgraph manifest to take advantage of the latest changes. [!IMPORTANT] All source Subgraphs should be deployed before the composed Subgraph is deployed. + +This composed Subgraph demonstrates how to create a subgraph that aggregates data from three source subgraphs, providing a unified, enhanced view of block statistics. + +#### Key Functions + +- It provides a consolidated data model that encompasses all relevant block metrics. +- It combines data from three `source` subgraphs, and provides a comprehensive view of block statistics, enabling more complex queries and analyses. To deploy this subgraph locally, run the following commands: + +```bash +npm install +npm run codegen +npm run build +npm run create-local +npm run deploy-local +``` + +## Key Takeaways + +- This powerful tool will scale your subgraph development and allow you to combine multiple Subgraphs. +- The setup includes the deployment of three source Subgraphs and one final deployment of the composed Subgraph. +- This feature unlocks scalability, simplifying both development and maintenance efficiency. + +## Additional Resources + +- Add advanced features in your subgraph. Check out [subgraph advance features](/developing/creating/advanced/) and the [subgraph composition repo](https://github.com/incrypto32/subgraph-composition-sample-subgraph). +- Check out the Github repo [for this example] (https://github.com/isum/subgraph-composition-example). diff --git a/website/src/pages/sv/subgraphs/cookbook/_meta.js b/website/src/pages/sv/subgraphs/cookbook/_meta.js index e642f12ef11d..ae67ab7baed1 100644 --- a/website/src/pages/sv/subgraphs/cookbook/_meta.js +++ b/website/src/pages/sv/subgraphs/cookbook/_meta.js @@ -8,4 +8,5 @@ export default { enums: '', 'secure-api-keys-nextjs': '', polymarket: '', + 'subgraph-composition-three-sources': '', } diff --git a/website/src/pages/sv/subgraphs/cookbook/subgraph-composition-three-source.mdx b/website/src/pages/sv/subgraphs/cookbook/subgraph-composition-three-source.mdx new file mode 100644 index 000000000000..80b86a24d036 --- /dev/null +++ b/website/src/pages/sv/subgraphs/cookbook/subgraph-composition-three-source.mdx @@ -0,0 +1,121 @@ +--- +title: Integrating Three Subgraphs Using Subgraph Composition +sidebarTitle: 'Subgraph Composition with Three Source Subgraphs' +--- + +Optimize your Subgraph by merging data from three independent, `source` Subgraphs into a single composable Subgraph to enhance data aggregation. + +> Important Reminders + +> - Subgraph composition is built into the CLI, and you can deploy with [Subgraph Studio](https://thegraph.com/studio/). +> - This feature requires spec version 1.3.0. + +## Overview + +Subgraph composition empowers developer to leverage a Subgraph with other Subgraphs as data sources, seamlessly integrating and reacting to data updates and entity changes. This capability enhances efficiency and responsiveness in data handling. + +## Prerequisites + +To deploy **all** Subgraphs locally, you must have the following: + +- A [graph-node](https://github.com/graphprotocol/graph-node) instance running locally +- An [IPFS](https://docs.ipfs.tech/) instance running locally +- [Node.js.](https://nodejs.org/en) and npm + +## Get Started + +The following guide provides examples for defining three `source` Subgraphs to create one powerful composed Subgraph. + +### Specifics + +- To keep this example simple, all `source` subgraphs use only block handlers, but in a real environment, each source Subgraph will use data from different smart contracts. +- The examples below show how to import and extend the schema of another Subgraph to enhance its functionality. +- Each source Subgraph is optimized with a specific entity. +- All the commands listed install the necessary dependencies, generate code based on the GraphQL schema, build the Subgraph, and deploy it to your local Graph Node instance. + +### Step 1. Deploy Block Time Source Subgraph + +This first source Subgraph calculates the block time for each block. + +- It imports schemas from other Subgraphs and adds a `block` entity with a `timestamp` field, representing the time each block was mined. +- It listens to time-related blockchain events (e.g., block timestamps) and processes this data to update the Subgraph's entities accordingly. + +To deploy this Subgraph locally, run the following commands: + +```bash +npm install +npm run codegen +npm run build +npm run create-local +npm run deploy-local +``` + +### Step 1. Deploy Block Cost Source Subgraph + +This second `source` Subgraph indexes the cost of each block. + +#### Key Functions + +- It imports schemas from other Subgraphs and adds a `block` entity with cost-related fields. +- It listens to blockchain events related to costs (e.g. gas fees, transaction costs) and processes this data to update the Subgraph's entities accordingly. + +To deploy this Subgraph locally, run the following commands: + +```bash +npm install +npm run codegen +npm run build +npm run create-local +npm run deploy-local +``` + +### Step 2. Define Block Size in Source Subgraph + +This third `source` Subgraph indexes the size of each block. + +#### Key Functions + +- It imports existing schemas from other Subgraphs and adds a `Block` entity with a `size` field representing each block's size. +- It listens to blockchain events related to block sizes (e.g., storage or volume) and processes this data to update the Subgraph's entities accordingly. + +To deploy this Subgraph locally, run the following commands: + +```bash +npm install +npm run codegen +npm run build +npm run create-local +npm run deploy-local +``` + +### Step 3. Combine Into Block Stats Subgraph + +This composed Subgraph combines and aggregates the information from the three source Subgraphs above. + +> [!NOTE] Any change to a source Subgraph will likely generate a new deployment ID. Be sure to update the deployment ID in the data source address of the Subgraph manifest to take advantage of the latest changes. [!IMPORTANT] All source Subgraphs should be deployed before the composed Subgraph is deployed. + +This composed Subgraph demonstrates how to create a subgraph that aggregates data from three source subgraphs, providing a unified, enhanced view of block statistics. + +#### Key Functions + +- It provides a consolidated data model that encompasses all relevant block metrics. +- It combines data from three `source` subgraphs, and provides a comprehensive view of block statistics, enabling more complex queries and analyses. To deploy this subgraph locally, run the following commands: + +```bash +npm install +npm run codegen +npm run build +npm run create-local +npm run deploy-local +``` + +## Key Takeaways + +- This powerful tool will scale your subgraph development and allow you to combine multiple Subgraphs. +- The setup includes the deployment of three source Subgraphs and one final deployment of the composed Subgraph. +- This feature unlocks scalability, simplifying both development and maintenance efficiency. + +## Additional Resources + +- Add advanced features in your subgraph. Check out [subgraph advance features](/developing/creating/advanced/) and the [subgraph composition repo](https://github.com/incrypto32/subgraph-composition-sample-subgraph). +- Check out the Github repo [for this example] (https://github.com/isum/subgraph-composition-example). diff --git a/website/src/pages/tr/subgraphs/cookbook/_meta.js b/website/src/pages/tr/subgraphs/cookbook/_meta.js index e642f12ef11d..ae67ab7baed1 100644 --- a/website/src/pages/tr/subgraphs/cookbook/_meta.js +++ b/website/src/pages/tr/subgraphs/cookbook/_meta.js @@ -8,4 +8,5 @@ export default { enums: '', 'secure-api-keys-nextjs': '', polymarket: '', + 'subgraph-composition-three-sources': '', } diff --git a/website/src/pages/tr/subgraphs/cookbook/subgraph-composition-three-source.mdx b/website/src/pages/tr/subgraphs/cookbook/subgraph-composition-three-source.mdx new file mode 100644 index 000000000000..80b86a24d036 --- /dev/null +++ b/website/src/pages/tr/subgraphs/cookbook/subgraph-composition-three-source.mdx @@ -0,0 +1,121 @@ +--- +title: Integrating Three Subgraphs Using Subgraph Composition +sidebarTitle: 'Subgraph Composition with Three Source Subgraphs' +--- + +Optimize your Subgraph by merging data from three independent, `source` Subgraphs into a single composable Subgraph to enhance data aggregation. + +> Important Reminders + +> - Subgraph composition is built into the CLI, and you can deploy with [Subgraph Studio](https://thegraph.com/studio/). +> - This feature requires spec version 1.3.0. + +## Overview + +Subgraph composition empowers developer to leverage a Subgraph with other Subgraphs as data sources, seamlessly integrating and reacting to data updates and entity changes. This capability enhances efficiency and responsiveness in data handling. + +## Prerequisites + +To deploy **all** Subgraphs locally, you must have the following: + +- A [graph-node](https://github.com/graphprotocol/graph-node) instance running locally +- An [IPFS](https://docs.ipfs.tech/) instance running locally +- [Node.js.](https://nodejs.org/en) and npm + +## Get Started + +The following guide provides examples for defining three `source` Subgraphs to create one powerful composed Subgraph. + +### Specifics + +- To keep this example simple, all `source` subgraphs use only block handlers, but in a real environment, each source Subgraph will use data from different smart contracts. +- The examples below show how to import and extend the schema of another Subgraph to enhance its functionality. +- Each source Subgraph is optimized with a specific entity. +- All the commands listed install the necessary dependencies, generate code based on the GraphQL schema, build the Subgraph, and deploy it to your local Graph Node instance. + +### Step 1. Deploy Block Time Source Subgraph + +This first source Subgraph calculates the block time for each block. + +- It imports schemas from other Subgraphs and adds a `block` entity with a `timestamp` field, representing the time each block was mined. +- It listens to time-related blockchain events (e.g., block timestamps) and processes this data to update the Subgraph's entities accordingly. + +To deploy this Subgraph locally, run the following commands: + +```bash +npm install +npm run codegen +npm run build +npm run create-local +npm run deploy-local +``` + +### Step 1. Deploy Block Cost Source Subgraph + +This second `source` Subgraph indexes the cost of each block. + +#### Key Functions + +- It imports schemas from other Subgraphs and adds a `block` entity with cost-related fields. +- It listens to blockchain events related to costs (e.g. gas fees, transaction costs) and processes this data to update the Subgraph's entities accordingly. + +To deploy this Subgraph locally, run the following commands: + +```bash +npm install +npm run codegen +npm run build +npm run create-local +npm run deploy-local +``` + +### Step 2. Define Block Size in Source Subgraph + +This third `source` Subgraph indexes the size of each block. + +#### Key Functions + +- It imports existing schemas from other Subgraphs and adds a `Block` entity with a `size` field representing each block's size. +- It listens to blockchain events related to block sizes (e.g., storage or volume) and processes this data to update the Subgraph's entities accordingly. + +To deploy this Subgraph locally, run the following commands: + +```bash +npm install +npm run codegen +npm run build +npm run create-local +npm run deploy-local +``` + +### Step 3. Combine Into Block Stats Subgraph + +This composed Subgraph combines and aggregates the information from the three source Subgraphs above. + +> [!NOTE] Any change to a source Subgraph will likely generate a new deployment ID. Be sure to update the deployment ID in the data source address of the Subgraph manifest to take advantage of the latest changes. [!IMPORTANT] All source Subgraphs should be deployed before the composed Subgraph is deployed. + +This composed Subgraph demonstrates how to create a subgraph that aggregates data from three source subgraphs, providing a unified, enhanced view of block statistics. + +#### Key Functions + +- It provides a consolidated data model that encompasses all relevant block metrics. +- It combines data from three `source` subgraphs, and provides a comprehensive view of block statistics, enabling more complex queries and analyses. To deploy this subgraph locally, run the following commands: + +```bash +npm install +npm run codegen +npm run build +npm run create-local +npm run deploy-local +``` + +## Key Takeaways + +- This powerful tool will scale your subgraph development and allow you to combine multiple Subgraphs. +- The setup includes the deployment of three source Subgraphs and one final deployment of the composed Subgraph. +- This feature unlocks scalability, simplifying both development and maintenance efficiency. + +## Additional Resources + +- Add advanced features in your subgraph. Check out [subgraph advance features](/developing/creating/advanced/) and the [subgraph composition repo](https://github.com/incrypto32/subgraph-composition-sample-subgraph). +- Check out the Github repo [for this example] (https://github.com/isum/subgraph-composition-example). diff --git a/website/src/pages/uk/subgraphs/cookbook/_meta.js b/website/src/pages/uk/subgraphs/cookbook/_meta.js index e642f12ef11d..ae67ab7baed1 100644 --- a/website/src/pages/uk/subgraphs/cookbook/_meta.js +++ b/website/src/pages/uk/subgraphs/cookbook/_meta.js @@ -8,4 +8,5 @@ export default { enums: '', 'secure-api-keys-nextjs': '', polymarket: '', + 'subgraph-composition-three-sources': '', } diff --git a/website/src/pages/uk/subgraphs/cookbook/subgraph-composition-three-source.mdx b/website/src/pages/uk/subgraphs/cookbook/subgraph-composition-three-source.mdx new file mode 100644 index 000000000000..80b86a24d036 --- /dev/null +++ b/website/src/pages/uk/subgraphs/cookbook/subgraph-composition-three-source.mdx @@ -0,0 +1,121 @@ +--- +title: Integrating Three Subgraphs Using Subgraph Composition +sidebarTitle: 'Subgraph Composition with Three Source Subgraphs' +--- + +Optimize your Subgraph by merging data from three independent, `source` Subgraphs into a single composable Subgraph to enhance data aggregation. + +> Important Reminders + +> - Subgraph composition is built into the CLI, and you can deploy with [Subgraph Studio](https://thegraph.com/studio/). +> - This feature requires spec version 1.3.0. + +## Overview + +Subgraph composition empowers developer to leverage a Subgraph with other Subgraphs as data sources, seamlessly integrating and reacting to data updates and entity changes. This capability enhances efficiency and responsiveness in data handling. + +## Prerequisites + +To deploy **all** Subgraphs locally, you must have the following: + +- A [graph-node](https://github.com/graphprotocol/graph-node) instance running locally +- An [IPFS](https://docs.ipfs.tech/) instance running locally +- [Node.js.](https://nodejs.org/en) and npm + +## Get Started + +The following guide provides examples for defining three `source` Subgraphs to create one powerful composed Subgraph. + +### Specifics + +- To keep this example simple, all `source` subgraphs use only block handlers, but in a real environment, each source Subgraph will use data from different smart contracts. +- The examples below show how to import and extend the schema of another Subgraph to enhance its functionality. +- Each source Subgraph is optimized with a specific entity. +- All the commands listed install the necessary dependencies, generate code based on the GraphQL schema, build the Subgraph, and deploy it to your local Graph Node instance. + +### Step 1. Deploy Block Time Source Subgraph + +This first source Subgraph calculates the block time for each block. + +- It imports schemas from other Subgraphs and adds a `block` entity with a `timestamp` field, representing the time each block was mined. +- It listens to time-related blockchain events (e.g., block timestamps) and processes this data to update the Subgraph's entities accordingly. + +To deploy this Subgraph locally, run the following commands: + +```bash +npm install +npm run codegen +npm run build +npm run create-local +npm run deploy-local +``` + +### Step 1. Deploy Block Cost Source Subgraph + +This second `source` Subgraph indexes the cost of each block. + +#### Key Functions + +- It imports schemas from other Subgraphs and adds a `block` entity with cost-related fields. +- It listens to blockchain events related to costs (e.g. gas fees, transaction costs) and processes this data to update the Subgraph's entities accordingly. + +To deploy this Subgraph locally, run the following commands: + +```bash +npm install +npm run codegen +npm run build +npm run create-local +npm run deploy-local +``` + +### Step 2. Define Block Size in Source Subgraph + +This third `source` Subgraph indexes the size of each block. + +#### Key Functions + +- It imports existing schemas from other Subgraphs and adds a `Block` entity with a `size` field representing each block's size. +- It listens to blockchain events related to block sizes (e.g., storage or volume) and processes this data to update the Subgraph's entities accordingly. + +To deploy this Subgraph locally, run the following commands: + +```bash +npm install +npm run codegen +npm run build +npm run create-local +npm run deploy-local +``` + +### Step 3. Combine Into Block Stats Subgraph + +This composed Subgraph combines and aggregates the information from the three source Subgraphs above. + +> [!NOTE] Any change to a source Subgraph will likely generate a new deployment ID. Be sure to update the deployment ID in the data source address of the Subgraph manifest to take advantage of the latest changes. [!IMPORTANT] All source Subgraphs should be deployed before the composed Subgraph is deployed. + +This composed Subgraph demonstrates how to create a subgraph that aggregates data from three source subgraphs, providing a unified, enhanced view of block statistics. + +#### Key Functions + +- It provides a consolidated data model that encompasses all relevant block metrics. +- It combines data from three `source` subgraphs, and provides a comprehensive view of block statistics, enabling more complex queries and analyses. To deploy this subgraph locally, run the following commands: + +```bash +npm install +npm run codegen +npm run build +npm run create-local +npm run deploy-local +``` + +## Key Takeaways + +- This powerful tool will scale your subgraph development and allow you to combine multiple Subgraphs. +- The setup includes the deployment of three source Subgraphs and one final deployment of the composed Subgraph. +- This feature unlocks scalability, simplifying both development and maintenance efficiency. + +## Additional Resources + +- Add advanced features in your subgraph. Check out [subgraph advance features](/developing/creating/advanced/) and the [subgraph composition repo](https://github.com/incrypto32/subgraph-composition-sample-subgraph). +- Check out the Github repo [for this example] (https://github.com/isum/subgraph-composition-example). diff --git a/website/src/pages/ur/subgraphs/cookbook/_meta.js b/website/src/pages/ur/subgraphs/cookbook/_meta.js index e642f12ef11d..ae67ab7baed1 100644 --- a/website/src/pages/ur/subgraphs/cookbook/_meta.js +++ b/website/src/pages/ur/subgraphs/cookbook/_meta.js @@ -8,4 +8,5 @@ export default { enums: '', 'secure-api-keys-nextjs': '', polymarket: '', + 'subgraph-composition-three-sources': '', } diff --git a/website/src/pages/ur/subgraphs/cookbook/subgraph-composition-three-source.mdx b/website/src/pages/ur/subgraphs/cookbook/subgraph-composition-three-source.mdx new file mode 100644 index 000000000000..80b86a24d036 --- /dev/null +++ b/website/src/pages/ur/subgraphs/cookbook/subgraph-composition-three-source.mdx @@ -0,0 +1,121 @@ +--- +title: Integrating Three Subgraphs Using Subgraph Composition +sidebarTitle: 'Subgraph Composition with Three Source Subgraphs' +--- + +Optimize your Subgraph by merging data from three independent, `source` Subgraphs into a single composable Subgraph to enhance data aggregation. + +> Important Reminders + +> - Subgraph composition is built into the CLI, and you can deploy with [Subgraph Studio](https://thegraph.com/studio/). +> - This feature requires spec version 1.3.0. + +## Overview + +Subgraph composition empowers developer to leverage a Subgraph with other Subgraphs as data sources, seamlessly integrating and reacting to data updates and entity changes. This capability enhances efficiency and responsiveness in data handling. + +## Prerequisites + +To deploy **all** Subgraphs locally, you must have the following: + +- A [graph-node](https://github.com/graphprotocol/graph-node) instance running locally +- An [IPFS](https://docs.ipfs.tech/) instance running locally +- [Node.js.](https://nodejs.org/en) and npm + +## Get Started + +The following guide provides examples for defining three `source` Subgraphs to create one powerful composed Subgraph. + +### Specifics + +- To keep this example simple, all `source` subgraphs use only block handlers, but in a real environment, each source Subgraph will use data from different smart contracts. +- The examples below show how to import and extend the schema of another Subgraph to enhance its functionality. +- Each source Subgraph is optimized with a specific entity. +- All the commands listed install the necessary dependencies, generate code based on the GraphQL schema, build the Subgraph, and deploy it to your local Graph Node instance. + +### Step 1. Deploy Block Time Source Subgraph + +This first source Subgraph calculates the block time for each block. + +- It imports schemas from other Subgraphs and adds a `block` entity with a `timestamp` field, representing the time each block was mined. +- It listens to time-related blockchain events (e.g., block timestamps) and processes this data to update the Subgraph's entities accordingly. + +To deploy this Subgraph locally, run the following commands: + +```bash +npm install +npm run codegen +npm run build +npm run create-local +npm run deploy-local +``` + +### Step 1. Deploy Block Cost Source Subgraph + +This second `source` Subgraph indexes the cost of each block. + +#### Key Functions + +- It imports schemas from other Subgraphs and adds a `block` entity with cost-related fields. +- It listens to blockchain events related to costs (e.g. gas fees, transaction costs) and processes this data to update the Subgraph's entities accordingly. + +To deploy this Subgraph locally, run the following commands: + +```bash +npm install +npm run codegen +npm run build +npm run create-local +npm run deploy-local +``` + +### Step 2. Define Block Size in Source Subgraph + +This third `source` Subgraph indexes the size of each block. + +#### Key Functions + +- It imports existing schemas from other Subgraphs and adds a `Block` entity with a `size` field representing each block's size. +- It listens to blockchain events related to block sizes (e.g., storage or volume) and processes this data to update the Subgraph's entities accordingly. + +To deploy this Subgraph locally, run the following commands: + +```bash +npm install +npm run codegen +npm run build +npm run create-local +npm run deploy-local +``` + +### Step 3. Combine Into Block Stats Subgraph + +This composed Subgraph combines and aggregates the information from the three source Subgraphs above. + +> [!NOTE] Any change to a source Subgraph will likely generate a new deployment ID. Be sure to update the deployment ID in the data source address of the Subgraph manifest to take advantage of the latest changes. [!IMPORTANT] All source Subgraphs should be deployed before the composed Subgraph is deployed. + +This composed Subgraph demonstrates how to create a subgraph that aggregates data from three source subgraphs, providing a unified, enhanced view of block statistics. + +#### Key Functions + +- It provides a consolidated data model that encompasses all relevant block metrics. +- It combines data from three `source` subgraphs, and provides a comprehensive view of block statistics, enabling more complex queries and analyses. To deploy this subgraph locally, run the following commands: + +```bash +npm install +npm run codegen +npm run build +npm run create-local +npm run deploy-local +``` + +## Key Takeaways + +- This powerful tool will scale your subgraph development and allow you to combine multiple Subgraphs. +- The setup includes the deployment of three source Subgraphs and one final deployment of the composed Subgraph. +- This feature unlocks scalability, simplifying both development and maintenance efficiency. + +## Additional Resources + +- Add advanced features in your subgraph. Check out [subgraph advance features](/developing/creating/advanced/) and the [subgraph composition repo](https://github.com/incrypto32/subgraph-composition-sample-subgraph). +- Check out the Github repo [for this example] (https://github.com/isum/subgraph-composition-example). diff --git a/website/src/pages/vi/subgraphs/cookbook/_meta.js b/website/src/pages/vi/subgraphs/cookbook/_meta.js index e642f12ef11d..ae67ab7baed1 100644 --- a/website/src/pages/vi/subgraphs/cookbook/_meta.js +++ b/website/src/pages/vi/subgraphs/cookbook/_meta.js @@ -8,4 +8,5 @@ export default { enums: '', 'secure-api-keys-nextjs': '', polymarket: '', + 'subgraph-composition-three-sources': '', } diff --git a/website/src/pages/vi/subgraphs/cookbook/subgraph-composition-three-source.mdx b/website/src/pages/vi/subgraphs/cookbook/subgraph-composition-three-source.mdx new file mode 100644 index 000000000000..80b86a24d036 --- /dev/null +++ b/website/src/pages/vi/subgraphs/cookbook/subgraph-composition-three-source.mdx @@ -0,0 +1,121 @@ +--- +title: Integrating Three Subgraphs Using Subgraph Composition +sidebarTitle: 'Subgraph Composition with Three Source Subgraphs' +--- + +Optimize your Subgraph by merging data from three independent, `source` Subgraphs into a single composable Subgraph to enhance data aggregation. + +> Important Reminders + +> - Subgraph composition is built into the CLI, and you can deploy with [Subgraph Studio](https://thegraph.com/studio/). +> - This feature requires spec version 1.3.0. + +## Overview + +Subgraph composition empowers developer to leverage a Subgraph with other Subgraphs as data sources, seamlessly integrating and reacting to data updates and entity changes. This capability enhances efficiency and responsiveness in data handling. + +## Prerequisites + +To deploy **all** Subgraphs locally, you must have the following: + +- A [graph-node](https://github.com/graphprotocol/graph-node) instance running locally +- An [IPFS](https://docs.ipfs.tech/) instance running locally +- [Node.js.](https://nodejs.org/en) and npm + +## Get Started + +The following guide provides examples for defining three `source` Subgraphs to create one powerful composed Subgraph. + +### Specifics + +- To keep this example simple, all `source` subgraphs use only block handlers, but in a real environment, each source Subgraph will use data from different smart contracts. +- The examples below show how to import and extend the schema of another Subgraph to enhance its functionality. +- Each source Subgraph is optimized with a specific entity. +- All the commands listed install the necessary dependencies, generate code based on the GraphQL schema, build the Subgraph, and deploy it to your local Graph Node instance. + +### Step 1. Deploy Block Time Source Subgraph + +This first source Subgraph calculates the block time for each block. + +- It imports schemas from other Subgraphs and adds a `block` entity with a `timestamp` field, representing the time each block was mined. +- It listens to time-related blockchain events (e.g., block timestamps) and processes this data to update the Subgraph's entities accordingly. + +To deploy this Subgraph locally, run the following commands: + +```bash +npm install +npm run codegen +npm run build +npm run create-local +npm run deploy-local +``` + +### Step 1. Deploy Block Cost Source Subgraph + +This second `source` Subgraph indexes the cost of each block. + +#### Key Functions + +- It imports schemas from other Subgraphs and adds a `block` entity with cost-related fields. +- It listens to blockchain events related to costs (e.g. gas fees, transaction costs) and processes this data to update the Subgraph's entities accordingly. + +To deploy this Subgraph locally, run the following commands: + +```bash +npm install +npm run codegen +npm run build +npm run create-local +npm run deploy-local +``` + +### Step 2. Define Block Size in Source Subgraph + +This third `source` Subgraph indexes the size of each block. + +#### Key Functions + +- It imports existing schemas from other Subgraphs and adds a `Block` entity with a `size` field representing each block's size. +- It listens to blockchain events related to block sizes (e.g., storage or volume) and processes this data to update the Subgraph's entities accordingly. + +To deploy this Subgraph locally, run the following commands: + +```bash +npm install +npm run codegen +npm run build +npm run create-local +npm run deploy-local +``` + +### Step 3. Combine Into Block Stats Subgraph + +This composed Subgraph combines and aggregates the information from the three source Subgraphs above. + +> [!NOTE] Any change to a source Subgraph will likely generate a new deployment ID. Be sure to update the deployment ID in the data source address of the Subgraph manifest to take advantage of the latest changes. [!IMPORTANT] All source Subgraphs should be deployed before the composed Subgraph is deployed. + +This composed Subgraph demonstrates how to create a subgraph that aggregates data from three source subgraphs, providing a unified, enhanced view of block statistics. + +#### Key Functions + +- It provides a consolidated data model that encompasses all relevant block metrics. +- It combines data from three `source` subgraphs, and provides a comprehensive view of block statistics, enabling more complex queries and analyses. To deploy this subgraph locally, run the following commands: + +```bash +npm install +npm run codegen +npm run build +npm run create-local +npm run deploy-local +``` + +## Key Takeaways + +- This powerful tool will scale your subgraph development and allow you to combine multiple Subgraphs. +- The setup includes the deployment of three source Subgraphs and one final deployment of the composed Subgraph. +- This feature unlocks scalability, simplifying both development and maintenance efficiency. + +## Additional Resources + +- Add advanced features in your subgraph. Check out [subgraph advance features](/developing/creating/advanced/) and the [subgraph composition repo](https://github.com/incrypto32/subgraph-composition-sample-subgraph). +- Check out the Github repo [for this example] (https://github.com/isum/subgraph-composition-example). diff --git a/website/src/pages/zh/subgraphs/cookbook/_meta.js b/website/src/pages/zh/subgraphs/cookbook/_meta.js index e642f12ef11d..ae67ab7baed1 100644 --- a/website/src/pages/zh/subgraphs/cookbook/_meta.js +++ b/website/src/pages/zh/subgraphs/cookbook/_meta.js @@ -8,4 +8,5 @@ export default { enums: '', 'secure-api-keys-nextjs': '', polymarket: '', + 'subgraph-composition-three-sources': '', } diff --git a/website/src/pages/zh/subgraphs/cookbook/subgraph-composition-three-source.mdx b/website/src/pages/zh/subgraphs/cookbook/subgraph-composition-three-source.mdx new file mode 100644 index 000000000000..80b86a24d036 --- /dev/null +++ b/website/src/pages/zh/subgraphs/cookbook/subgraph-composition-three-source.mdx @@ -0,0 +1,121 @@ +--- +title: Integrating Three Subgraphs Using Subgraph Composition +sidebarTitle: 'Subgraph Composition with Three Source Subgraphs' +--- + +Optimize your Subgraph by merging data from three independent, `source` Subgraphs into a single composable Subgraph to enhance data aggregation. + +> Important Reminders + +> - Subgraph composition is built into the CLI, and you can deploy with [Subgraph Studio](https://thegraph.com/studio/). +> - This feature requires spec version 1.3.0. + +## Overview + +Subgraph composition empowers developer to leverage a Subgraph with other Subgraphs as data sources, seamlessly integrating and reacting to data updates and entity changes. This capability enhances efficiency and responsiveness in data handling. + +## Prerequisites + +To deploy **all** Subgraphs locally, you must have the following: + +- A [graph-node](https://github.com/graphprotocol/graph-node) instance running locally +- An [IPFS](https://docs.ipfs.tech/) instance running locally +- [Node.js.](https://nodejs.org/en) and npm + +## Get Started + +The following guide provides examples for defining three `source` Subgraphs to create one powerful composed Subgraph. + +### Specifics + +- To keep this example simple, all `source` subgraphs use only block handlers, but in a real environment, each source Subgraph will use data from different smart contracts. +- The examples below show how to import and extend the schema of another Subgraph to enhance its functionality. +- Each source Subgraph is optimized with a specific entity. +- All the commands listed install the necessary dependencies, generate code based on the GraphQL schema, build the Subgraph, and deploy it to your local Graph Node instance. + +### Step 1. Deploy Block Time Source Subgraph + +This first source Subgraph calculates the block time for each block. + +- It imports schemas from other Subgraphs and adds a `block` entity with a `timestamp` field, representing the time each block was mined. +- It listens to time-related blockchain events (e.g., block timestamps) and processes this data to update the Subgraph's entities accordingly. + +To deploy this Subgraph locally, run the following commands: + +```bash +npm install +npm run codegen +npm run build +npm run create-local +npm run deploy-local +``` + +### Step 1. Deploy Block Cost Source Subgraph + +This second `source` Subgraph indexes the cost of each block. + +#### Key Functions + +- It imports schemas from other Subgraphs and adds a `block` entity with cost-related fields. +- It listens to blockchain events related to costs (e.g. gas fees, transaction costs) and processes this data to update the Subgraph's entities accordingly. + +To deploy this Subgraph locally, run the following commands: + +```bash +npm install +npm run codegen +npm run build +npm run create-local +npm run deploy-local +``` + +### Step 2. Define Block Size in Source Subgraph + +This third `source` Subgraph indexes the size of each block. + +#### Key Functions + +- It imports existing schemas from other Subgraphs and adds a `Block` entity with a `size` field representing each block's size. +- It listens to blockchain events related to block sizes (e.g., storage or volume) and processes this data to update the Subgraph's entities accordingly. + +To deploy this Subgraph locally, run the following commands: + +```bash +npm install +npm run codegen +npm run build +npm run create-local +npm run deploy-local +``` + +### Step 3. Combine Into Block Stats Subgraph + +This composed Subgraph combines and aggregates the information from the three source Subgraphs above. + +> [!NOTE] Any change to a source Subgraph will likely generate a new deployment ID. Be sure to update the deployment ID in the data source address of the Subgraph manifest to take advantage of the latest changes. [!IMPORTANT] All source Subgraphs should be deployed before the composed Subgraph is deployed. + +This composed Subgraph demonstrates how to create a subgraph that aggregates data from three source subgraphs, providing a unified, enhanced view of block statistics. + +#### Key Functions + +- It provides a consolidated data model that encompasses all relevant block metrics. +- It combines data from three `source` subgraphs, and provides a comprehensive view of block statistics, enabling more complex queries and analyses. To deploy this subgraph locally, run the following commands: + +```bash +npm install +npm run codegen +npm run build +npm run create-local +npm run deploy-local +``` + +## Key Takeaways + +- This powerful tool will scale your subgraph development and allow you to combine multiple Subgraphs. +- The setup includes the deployment of three source Subgraphs and one final deployment of the composed Subgraph. +- This feature unlocks scalability, simplifying both development and maintenance efficiency. + +## Additional Resources + +- Add advanced features in your subgraph. Check out [subgraph advance features](/developing/creating/advanced/) and the [subgraph composition repo](https://github.com/incrypto32/subgraph-composition-sample-subgraph). +- Check out the Github repo [for this example] (https://github.com/isum/subgraph-composition-example). From c63874b13052502624c96eb8c7d3ddc746467477 Mon Sep 17 00:00:00 2001 From: Idalith Bustos Date: Thu, 27 Feb 2025 16:21:00 -0800 Subject: [PATCH 02/14] Updating Copy --- .../src/pages/ar/subgraphs/cookbook/_meta.js | 2 +- ...=> subgraph-composition-three-sources.mdx} | 23 ++-- .../src/pages/cs/subgraphs/cookbook/_meta.js | 2 +- ...=> subgraph-composition-three-sources.mdx} | 23 ++-- .../src/pages/de/subgraphs/cookbook/_meta.js | 2 +- ...=> subgraph-composition-three-sources.mdx} | 23 ++-- .../src/pages/en/subgraphs/cookbook/_meta.js | 2 +- .../subgraph-composition-three-sources.mdx | 41 +++--- .../src/pages/es/subgraphs/cookbook/_meta.js | 2 +- ...=> subgraph-composition-three-sources.mdx} | 23 ++-- .../src/pages/fr/subgraphs/cookbook/_meta.js | 2 +- .../subgraph-composition-three-source.mdx | 121 ----------------- .../subgraph-composition-three-sources.mdx | 124 ++++++++++++++++++ .../src/pages/hi/subgraphs/cookbook/_meta.js | 2 +- .../subgraph-composition-three-source.mdx | 121 ----------------- .../subgraph-composition-three-sources.mdx | 124 ++++++++++++++++++ .../src/pages/it/subgraphs/cookbook/_meta.js | 2 +- .../subgraph-composition-three-source.mdx | 121 ----------------- .../subgraph-composition-three-sources.mdx | 124 ++++++++++++++++++ .../src/pages/ja/subgraphs/cookbook/_meta.js | 2 +- .../subgraph-composition-three-source.mdx | 121 ----------------- .../subgraph-composition-three-sources.mdx | 124 ++++++++++++++++++ .../src/pages/ko/subgraphs/cookbook/_meta.js | 2 +- .../subgraph-composition-three-source.mdx | 121 ----------------- .../subgraph-composition-three-sources.mdx | 124 ++++++++++++++++++ .../src/pages/mr/subgraphs/cookbook/_meta.js | 2 +- .../subgraph-composition-three-source.mdx | 121 ----------------- .../subgraph-composition-three-sources.mdx | 124 ++++++++++++++++++ .../src/pages/nl/subgraphs/cookbook/_meta.js | 2 +- .../subgraph-composition-three-source.mdx | 121 ----------------- .../subgraph-composition-three-sources.mdx | 124 ++++++++++++++++++ .../src/pages/pl/subgraphs/cookbook/_meta.js | 2 +- .../subgraph-composition-three-source.mdx | 121 ----------------- .../subgraph-composition-three-sources.mdx | 124 ++++++++++++++++++ .../src/pages/pt/subgraphs/cookbook/_meta.js | 2 +- .../subgraph-composition-three-source.mdx | 121 ----------------- .../subgraph-composition-three-sources.mdx | 124 ++++++++++++++++++ .../src/pages/ro/subgraphs/cookbook/_meta.js | 2 +- .../subgraph-composition-three-source.mdx | 121 ----------------- .../subgraph-composition-three-sources.mdx | 124 ++++++++++++++++++ .../src/pages/ru/subgraphs/cookbook/_meta.js | 2 +- .../subgraph-composition-three-source.mdx | 121 ----------------- .../subgraph-composition-three-sources.mdx | 124 ++++++++++++++++++ .../src/pages/sv/subgraphs/cookbook/_meta.js | 2 +- .../subgraph-composition-three-source.mdx | 121 ----------------- .../subgraph-composition-three-sources.mdx | 124 ++++++++++++++++++ .../src/pages/tr/subgraphs/cookbook/_meta.js | 2 +- .../subgraph-composition-three-source.mdx | 121 ----------------- .../subgraph-composition-three-sources.mdx | 124 ++++++++++++++++++ .../src/pages/uk/subgraphs/cookbook/_meta.js | 2 +- .../subgraph-composition-three-source.mdx | 121 ----------------- .../subgraph-composition-three-sources.mdx | 124 ++++++++++++++++++ .../src/pages/ur/subgraphs/cookbook/_meta.js | 2 +- .../subgraph-composition-three-source.mdx | 121 ----------------- .../subgraph-composition-three-sources.mdx | 124 ++++++++++++++++++ .../src/pages/vi/subgraphs/cookbook/_meta.js | 2 +- .../subgraph-composition-three-source.mdx | 121 ----------------- .../subgraph-composition-three-sources.mdx | 124 ++++++++++++++++++ .../src/pages/zh/subgraphs/cookbook/_meta.js | 2 +- .../subgraph-composition-three-source.mdx | 121 ----------------- .../subgraph-composition-three-sources.mdx | 124 ++++++++++++++++++ 61 files changed, 2204 insertions(+), 2138 deletions(-) rename website/src/pages/ar/subgraphs/cookbook/{subgraph-composition-three-source.mdx => subgraph-composition-three-sources.mdx} (76%) rename website/src/pages/cs/subgraphs/cookbook/{subgraph-composition-three-source.mdx => subgraph-composition-three-sources.mdx} (76%) rename website/src/pages/de/subgraphs/cookbook/{subgraph-composition-three-source.mdx => subgraph-composition-three-sources.mdx} (76%) rename website/src/pages/es/subgraphs/cookbook/{subgraph-composition-three-source.mdx => subgraph-composition-three-sources.mdx} (76%) delete mode 100644 website/src/pages/fr/subgraphs/cookbook/subgraph-composition-three-source.mdx create mode 100644 website/src/pages/fr/subgraphs/cookbook/subgraph-composition-three-sources.mdx delete mode 100644 website/src/pages/hi/subgraphs/cookbook/subgraph-composition-three-source.mdx create mode 100644 website/src/pages/hi/subgraphs/cookbook/subgraph-composition-three-sources.mdx delete mode 100644 website/src/pages/it/subgraphs/cookbook/subgraph-composition-three-source.mdx create mode 100644 website/src/pages/it/subgraphs/cookbook/subgraph-composition-three-sources.mdx delete mode 100644 website/src/pages/ja/subgraphs/cookbook/subgraph-composition-three-source.mdx create mode 100644 website/src/pages/ja/subgraphs/cookbook/subgraph-composition-three-sources.mdx delete mode 100644 website/src/pages/ko/subgraphs/cookbook/subgraph-composition-three-source.mdx create mode 100644 website/src/pages/ko/subgraphs/cookbook/subgraph-composition-three-sources.mdx delete mode 100644 website/src/pages/mr/subgraphs/cookbook/subgraph-composition-three-source.mdx create mode 100644 website/src/pages/mr/subgraphs/cookbook/subgraph-composition-three-sources.mdx delete mode 100644 website/src/pages/nl/subgraphs/cookbook/subgraph-composition-three-source.mdx create mode 100644 website/src/pages/nl/subgraphs/cookbook/subgraph-composition-three-sources.mdx delete mode 100644 website/src/pages/pl/subgraphs/cookbook/subgraph-composition-three-source.mdx create mode 100644 website/src/pages/pl/subgraphs/cookbook/subgraph-composition-three-sources.mdx delete mode 100644 website/src/pages/pt/subgraphs/cookbook/subgraph-composition-three-source.mdx create mode 100644 website/src/pages/pt/subgraphs/cookbook/subgraph-composition-three-sources.mdx delete mode 100644 website/src/pages/ro/subgraphs/cookbook/subgraph-composition-three-source.mdx create mode 100644 website/src/pages/ro/subgraphs/cookbook/subgraph-composition-three-sources.mdx delete mode 100644 website/src/pages/ru/subgraphs/cookbook/subgraph-composition-three-source.mdx create mode 100644 website/src/pages/ru/subgraphs/cookbook/subgraph-composition-three-sources.mdx delete mode 100644 website/src/pages/sv/subgraphs/cookbook/subgraph-composition-three-source.mdx create mode 100644 website/src/pages/sv/subgraphs/cookbook/subgraph-composition-three-sources.mdx delete mode 100644 website/src/pages/tr/subgraphs/cookbook/subgraph-composition-three-source.mdx create mode 100644 website/src/pages/tr/subgraphs/cookbook/subgraph-composition-three-sources.mdx delete mode 100644 website/src/pages/uk/subgraphs/cookbook/subgraph-composition-three-source.mdx create mode 100644 website/src/pages/uk/subgraphs/cookbook/subgraph-composition-three-sources.mdx delete mode 100644 website/src/pages/ur/subgraphs/cookbook/subgraph-composition-three-source.mdx create mode 100644 website/src/pages/ur/subgraphs/cookbook/subgraph-composition-three-sources.mdx delete mode 100644 website/src/pages/vi/subgraphs/cookbook/subgraph-composition-three-source.mdx create mode 100644 website/src/pages/vi/subgraphs/cookbook/subgraph-composition-three-sources.mdx delete mode 100644 website/src/pages/zh/subgraphs/cookbook/subgraph-composition-three-source.mdx create mode 100644 website/src/pages/zh/subgraphs/cookbook/subgraph-composition-three-sources.mdx diff --git a/website/src/pages/ar/subgraphs/cookbook/_meta.js b/website/src/pages/ar/subgraphs/cookbook/_meta.js index ae67ab7baed1..1b169037deee 100644 --- a/website/src/pages/ar/subgraphs/cookbook/_meta.js +++ b/website/src/pages/ar/subgraphs/cookbook/_meta.js @@ -1,4 +1,5 @@ export default { + 'subgraph-composition-three-sources': '', 'subgraph-debug-forking': '', near: '', arweave: '', @@ -8,5 +9,4 @@ export default { enums: '', 'secure-api-keys-nextjs': '', polymarket: '', - 'subgraph-composition-three-sources': '', } diff --git a/website/src/pages/ar/subgraphs/cookbook/subgraph-composition-three-source.mdx b/website/src/pages/ar/subgraphs/cookbook/subgraph-composition-three-sources.mdx similarity index 76% rename from website/src/pages/ar/subgraphs/cookbook/subgraph-composition-three-source.mdx rename to website/src/pages/ar/subgraphs/cookbook/subgraph-composition-three-sources.mdx index 80b86a24d036..024e79f5c7c5 100644 --- a/website/src/pages/ar/subgraphs/cookbook/subgraph-composition-three-source.mdx +++ b/website/src/pages/ar/subgraphs/cookbook/subgraph-composition-three-sources.mdx @@ -1,14 +1,17 @@ --- title: Integrating Three Subgraphs Using Subgraph Composition -sidebarTitle: 'Subgraph Composition with Three Source Subgraphs' +sidebarTitle: 'Composable Subgraph with Three Source Subgraphs' --- -Optimize your Subgraph by merging data from three independent, `source` Subgraphs into a single composable Subgraph to enhance data aggregation. +Optimize your Subgraph by merging data from three independent, source + +Subgraphs into a single composable Subgraph to enhance data aggregation. > Important Reminders > - Subgraph composition is built into the CLI, and you can deploy with [Subgraph Studio](https://thegraph.com/studio/). -> - This feature requires spec version 1.3.0. +> - This feature requires `specVersion` 1.3.0. +> - This example uses ## Overview @@ -24,11 +27,11 @@ To deploy **all** Subgraphs locally, you must have the following: ## Get Started -The following guide provides examples for defining three `source` Subgraphs to create one powerful composed Subgraph. +The following guide provides examples for defining three source Subgraphs to create one powerful composed Subgraph. ### Specifics -- To keep this example simple, all `source` subgraphs use only block handlers, but in a real environment, each source Subgraph will use data from different smart contracts. +- To keep this example simple, all source subgraphs use only block handlers, but in a real environment, each source Subgraph will use data from different smart contracts. - The examples below show how to import and extend the schema of another Subgraph to enhance its functionality. - Each source Subgraph is optimized with a specific entity. - All the commands listed install the necessary dependencies, generate code based on the GraphQL schema, build the Subgraph, and deploy it to your local Graph Node instance. @@ -52,7 +55,7 @@ npm run deploy-local ### Step 1. Deploy Block Cost Source Subgraph -This second `source` Subgraph indexes the cost of each block. +This second source Subgraph indexes the cost of each block. #### Key Functions @@ -71,7 +74,7 @@ npm run deploy-local ### Step 2. Define Block Size in Source Subgraph -This third `source` Subgraph indexes the size of each block. +This third source Subgraph indexes the size of each block. #### Key Functions @@ -90,7 +93,7 @@ npm run deploy-local ### Step 3. Combine Into Block Stats Subgraph -This composed Subgraph combines and aggregates the information from the three source Subgraphs above. +This composed Subgraph combines and aggregates the information from the three source Subgraphs above. To learn how to use aggregations, check out Subgraph [advanced features](https://thegraph.com/docs/en/subgraphs/developing/creating/advanced/#timeseries-and-aggregations). > [!NOTE] Any change to a source Subgraph will likely generate a new deployment ID. Be sure to update the deployment ID in the data source address of the Subgraph manifest to take advantage of the latest changes. [!IMPORTANT] All source Subgraphs should be deployed before the composed Subgraph is deployed. @@ -99,7 +102,7 @@ This composed Subgraph demonstrates how to create a subgraph that aggregates dat #### Key Functions - It provides a consolidated data model that encompasses all relevant block metrics. -- It combines data from three `source` subgraphs, and provides a comprehensive view of block statistics, enabling more complex queries and analyses. To deploy this subgraph locally, run the following commands: +- It combines data from three source subgraphs, and provides a comprehensive view of block statistics, enabling more complex queries and analyses. To deploy this subgraph locally, run the following commands: ```bash npm install @@ -118,4 +121,4 @@ npm run deploy-local ## Additional Resources - Add advanced features in your subgraph. Check out [subgraph advance features](/developing/creating/advanced/) and the [subgraph composition repo](https://github.com/incrypto32/subgraph-composition-sample-subgraph). -- Check out the Github repo [for this example] (https://github.com/isum/subgraph-composition-example). +- Check out all the code for this example in [the Github repo] (https://github.com/isum/subgraph-composition-example). diff --git a/website/src/pages/cs/subgraphs/cookbook/_meta.js b/website/src/pages/cs/subgraphs/cookbook/_meta.js index ae67ab7baed1..1b169037deee 100644 --- a/website/src/pages/cs/subgraphs/cookbook/_meta.js +++ b/website/src/pages/cs/subgraphs/cookbook/_meta.js @@ -1,4 +1,5 @@ export default { + 'subgraph-composition-three-sources': '', 'subgraph-debug-forking': '', near: '', arweave: '', @@ -8,5 +9,4 @@ export default { enums: '', 'secure-api-keys-nextjs': '', polymarket: '', - 'subgraph-composition-three-sources': '', } diff --git a/website/src/pages/cs/subgraphs/cookbook/subgraph-composition-three-source.mdx b/website/src/pages/cs/subgraphs/cookbook/subgraph-composition-three-sources.mdx similarity index 76% rename from website/src/pages/cs/subgraphs/cookbook/subgraph-composition-three-source.mdx rename to website/src/pages/cs/subgraphs/cookbook/subgraph-composition-three-sources.mdx index 80b86a24d036..024e79f5c7c5 100644 --- a/website/src/pages/cs/subgraphs/cookbook/subgraph-composition-three-source.mdx +++ b/website/src/pages/cs/subgraphs/cookbook/subgraph-composition-three-sources.mdx @@ -1,14 +1,17 @@ --- title: Integrating Three Subgraphs Using Subgraph Composition -sidebarTitle: 'Subgraph Composition with Three Source Subgraphs' +sidebarTitle: 'Composable Subgraph with Three Source Subgraphs' --- -Optimize your Subgraph by merging data from three independent, `source` Subgraphs into a single composable Subgraph to enhance data aggregation. +Optimize your Subgraph by merging data from three independent, source + +Subgraphs into a single composable Subgraph to enhance data aggregation. > Important Reminders > - Subgraph composition is built into the CLI, and you can deploy with [Subgraph Studio](https://thegraph.com/studio/). -> - This feature requires spec version 1.3.0. +> - This feature requires `specVersion` 1.3.0. +> - This example uses ## Overview @@ -24,11 +27,11 @@ To deploy **all** Subgraphs locally, you must have the following: ## Get Started -The following guide provides examples for defining three `source` Subgraphs to create one powerful composed Subgraph. +The following guide provides examples for defining three source Subgraphs to create one powerful composed Subgraph. ### Specifics -- To keep this example simple, all `source` subgraphs use only block handlers, but in a real environment, each source Subgraph will use data from different smart contracts. +- To keep this example simple, all source subgraphs use only block handlers, but in a real environment, each source Subgraph will use data from different smart contracts. - The examples below show how to import and extend the schema of another Subgraph to enhance its functionality. - Each source Subgraph is optimized with a specific entity. - All the commands listed install the necessary dependencies, generate code based on the GraphQL schema, build the Subgraph, and deploy it to your local Graph Node instance. @@ -52,7 +55,7 @@ npm run deploy-local ### Step 1. Deploy Block Cost Source Subgraph -This second `source` Subgraph indexes the cost of each block. +This second source Subgraph indexes the cost of each block. #### Key Functions @@ -71,7 +74,7 @@ npm run deploy-local ### Step 2. Define Block Size in Source Subgraph -This third `source` Subgraph indexes the size of each block. +This third source Subgraph indexes the size of each block. #### Key Functions @@ -90,7 +93,7 @@ npm run deploy-local ### Step 3. Combine Into Block Stats Subgraph -This composed Subgraph combines and aggregates the information from the three source Subgraphs above. +This composed Subgraph combines and aggregates the information from the three source Subgraphs above. To learn how to use aggregations, check out Subgraph [advanced features](https://thegraph.com/docs/en/subgraphs/developing/creating/advanced/#timeseries-and-aggregations). > [!NOTE] Any change to a source Subgraph will likely generate a new deployment ID. Be sure to update the deployment ID in the data source address of the Subgraph manifest to take advantage of the latest changes. [!IMPORTANT] All source Subgraphs should be deployed before the composed Subgraph is deployed. @@ -99,7 +102,7 @@ This composed Subgraph demonstrates how to create a subgraph that aggregates dat #### Key Functions - It provides a consolidated data model that encompasses all relevant block metrics. -- It combines data from three `source` subgraphs, and provides a comprehensive view of block statistics, enabling more complex queries and analyses. To deploy this subgraph locally, run the following commands: +- It combines data from three source subgraphs, and provides a comprehensive view of block statistics, enabling more complex queries and analyses. To deploy this subgraph locally, run the following commands: ```bash npm install @@ -118,4 +121,4 @@ npm run deploy-local ## Additional Resources - Add advanced features in your subgraph. Check out [subgraph advance features](/developing/creating/advanced/) and the [subgraph composition repo](https://github.com/incrypto32/subgraph-composition-sample-subgraph). -- Check out the Github repo [for this example] (https://github.com/isum/subgraph-composition-example). +- Check out all the code for this example in [the Github repo] (https://github.com/isum/subgraph-composition-example). diff --git a/website/src/pages/de/subgraphs/cookbook/_meta.js b/website/src/pages/de/subgraphs/cookbook/_meta.js index ae67ab7baed1..1b169037deee 100644 --- a/website/src/pages/de/subgraphs/cookbook/_meta.js +++ b/website/src/pages/de/subgraphs/cookbook/_meta.js @@ -1,4 +1,5 @@ export default { + 'subgraph-composition-three-sources': '', 'subgraph-debug-forking': '', near: '', arweave: '', @@ -8,5 +9,4 @@ export default { enums: '', 'secure-api-keys-nextjs': '', polymarket: '', - 'subgraph-composition-three-sources': '', } diff --git a/website/src/pages/de/subgraphs/cookbook/subgraph-composition-three-source.mdx b/website/src/pages/de/subgraphs/cookbook/subgraph-composition-three-sources.mdx similarity index 76% rename from website/src/pages/de/subgraphs/cookbook/subgraph-composition-three-source.mdx rename to website/src/pages/de/subgraphs/cookbook/subgraph-composition-three-sources.mdx index 80b86a24d036..024e79f5c7c5 100644 --- a/website/src/pages/de/subgraphs/cookbook/subgraph-composition-three-source.mdx +++ b/website/src/pages/de/subgraphs/cookbook/subgraph-composition-three-sources.mdx @@ -1,14 +1,17 @@ --- title: Integrating Three Subgraphs Using Subgraph Composition -sidebarTitle: 'Subgraph Composition with Three Source Subgraphs' +sidebarTitle: 'Composable Subgraph with Three Source Subgraphs' --- -Optimize your Subgraph by merging data from three independent, `source` Subgraphs into a single composable Subgraph to enhance data aggregation. +Optimize your Subgraph by merging data from three independent, source + +Subgraphs into a single composable Subgraph to enhance data aggregation. > Important Reminders > - Subgraph composition is built into the CLI, and you can deploy with [Subgraph Studio](https://thegraph.com/studio/). -> - This feature requires spec version 1.3.0. +> - This feature requires `specVersion` 1.3.0. +> - This example uses ## Overview @@ -24,11 +27,11 @@ To deploy **all** Subgraphs locally, you must have the following: ## Get Started -The following guide provides examples for defining three `source` Subgraphs to create one powerful composed Subgraph. +The following guide provides examples for defining three source Subgraphs to create one powerful composed Subgraph. ### Specifics -- To keep this example simple, all `source` subgraphs use only block handlers, but in a real environment, each source Subgraph will use data from different smart contracts. +- To keep this example simple, all source subgraphs use only block handlers, but in a real environment, each source Subgraph will use data from different smart contracts. - The examples below show how to import and extend the schema of another Subgraph to enhance its functionality. - Each source Subgraph is optimized with a specific entity. - All the commands listed install the necessary dependencies, generate code based on the GraphQL schema, build the Subgraph, and deploy it to your local Graph Node instance. @@ -52,7 +55,7 @@ npm run deploy-local ### Step 1. Deploy Block Cost Source Subgraph -This second `source` Subgraph indexes the cost of each block. +This second source Subgraph indexes the cost of each block. #### Key Functions @@ -71,7 +74,7 @@ npm run deploy-local ### Step 2. Define Block Size in Source Subgraph -This third `source` Subgraph indexes the size of each block. +This third source Subgraph indexes the size of each block. #### Key Functions @@ -90,7 +93,7 @@ npm run deploy-local ### Step 3. Combine Into Block Stats Subgraph -This composed Subgraph combines and aggregates the information from the three source Subgraphs above. +This composed Subgraph combines and aggregates the information from the three source Subgraphs above. To learn how to use aggregations, check out Subgraph [advanced features](https://thegraph.com/docs/en/subgraphs/developing/creating/advanced/#timeseries-and-aggregations). > [!NOTE] Any change to a source Subgraph will likely generate a new deployment ID. Be sure to update the deployment ID in the data source address of the Subgraph manifest to take advantage of the latest changes. [!IMPORTANT] All source Subgraphs should be deployed before the composed Subgraph is deployed. @@ -99,7 +102,7 @@ This composed Subgraph demonstrates how to create a subgraph that aggregates dat #### Key Functions - It provides a consolidated data model that encompasses all relevant block metrics. -- It combines data from three `source` subgraphs, and provides a comprehensive view of block statistics, enabling more complex queries and analyses. To deploy this subgraph locally, run the following commands: +- It combines data from three source subgraphs, and provides a comprehensive view of block statistics, enabling more complex queries and analyses. To deploy this subgraph locally, run the following commands: ```bash npm install @@ -118,4 +121,4 @@ npm run deploy-local ## Additional Resources - Add advanced features in your subgraph. Check out [subgraph advance features](/developing/creating/advanced/) and the [subgraph composition repo](https://github.com/incrypto32/subgraph-composition-sample-subgraph). -- Check out the Github repo [for this example] (https://github.com/isum/subgraph-composition-example). +- Check out all the code for this example in [the Github repo] (https://github.com/isum/subgraph-composition-example). diff --git a/website/src/pages/en/subgraphs/cookbook/_meta.js b/website/src/pages/en/subgraphs/cookbook/_meta.js index ae67ab7baed1..1b169037deee 100644 --- a/website/src/pages/en/subgraphs/cookbook/_meta.js +++ b/website/src/pages/en/subgraphs/cookbook/_meta.js @@ -1,4 +1,5 @@ export default { + 'subgraph-composition-three-sources': '', 'subgraph-debug-forking': '', near: '', arweave: '', @@ -8,5 +9,4 @@ export default { enums: '', 'secure-api-keys-nextjs': '', polymarket: '', - 'subgraph-composition-three-sources': '', } diff --git a/website/src/pages/en/subgraphs/cookbook/subgraph-composition-three-sources.mdx b/website/src/pages/en/subgraphs/cookbook/subgraph-composition-three-sources.mdx index dcee0e838020..dfb5d6405ff0 100644 --- a/website/src/pages/en/subgraphs/cookbook/subgraph-composition-three-sources.mdx +++ b/website/src/pages/en/subgraphs/cookbook/subgraph-composition-three-sources.mdx @@ -1,18 +1,18 @@ --- -title: Integrating Three Subgraphs Using Subgraph Composition -sidebarTitle: 'Composable Subgraph with Three Source Subgraphs' +title: Aggregate Data Using Subgraph Composition +sidebarTitle: 'Build a Composable Subgraph with Multiple Subgraphs' --- -Optimize your Subgraph by merging data from three independent, `source` Subgraphs into a single composable Subgraph to enhance data aggregation. - -> Important Reminders +Optimize your Subgraph by merging data from three independent, source Subgraphs into a single composable Subgraph to enhance data aggregation. +> Important Reminders: +> > - Subgraph composition is built into the CLI, and you can deploy with [Subgraph Studio](https://thegraph.com/studio/). -> - This feature requires spec version 1.3.0. +> - This feature requires `specVersion` 1.3.0. ## Overview -Subgraph composition empowers developer to leverage a Subgraph with other Subgraphs as data sources, seamlessly integrating and reacting to data updates and entity changes. This capability enhances efficiency and responsiveness in data handling. +Subgraph composition empowers you use one Subgraph as a data source for another, allowing it to consume and respond to entity changes. Instead of fetching on-chain data directly, a Subgraph can listen for updates from another Subgraph and react to changes. This is useful for aggregating data from multiple Subgraphs or triggering actions based on external updates. ## Prerequisites @@ -24,11 +24,11 @@ To deploy **all** Subgraphs locally, you must have the following: ## Get Started -The following guide provides examples for defining three `source` Subgraphs to create one powerful composed Subgraph. +The following guide provides examples for defining three source Subgraphs to create one powerful composed Subgraph. ### Specifics -- To keep this example simple, all `source` subgraphs use only block handlers, but in a real environment, each source Subgraph will use data from different smart contracts. +- To keep this example simple, all source Subgraphs use only block handlers. However, in a real environment, each source Subgraph will use data from different smart contracts. - The examples below show how to import and extend the schema of another Subgraph to enhance its functionality. - Each source Subgraph is optimized with a specific entity. - All the commands listed install the necessary dependencies, generate code based on the GraphQL schema, build the Subgraph, and deploy it to your local Graph Node instance. @@ -52,7 +52,7 @@ npm run deploy-local ### Step 1. Deploy Block Cost Source Subgraph -This second `source` Subgraph indexes the cost of each block. +This second source Subgraph indexes the cost of each block. #### Key Functions @@ -71,7 +71,7 @@ npm run deploy-local ### Step 2. Define Block Size in Source Subgraph -This third `source` Subgraph indexes the size of each block. +This third source Subgraph indexes the size of each block. #### Key Functions @@ -90,16 +90,18 @@ npm run deploy-local ### Step 3. Combine Into Block Stats Subgraph -This composed Subgraph combines and aggregates the information from the three source Subgraphs above. - -> [!NOTE] Any change to a source Subgraph will likely generate a new deployment ID. Be sure to update the deployment ID in the data source address of the Subgraph manifest to take advantage of the latest changes. [!IMPORTANT] All source Subgraphs should be deployed before the composed Subgraph is deployed. +This composed Subgraph combines and aggregates the information from the three source Subgraphs above, providing a unified view of block statistics. -This composed Subgraph demonstrates how to create a subgraph that aggregates data from three source subgraphs, providing a unified, enhanced view of block statistics. +> NOTE: +> +> - Any change to a source Subgraph will likely generate a new deployment ID. +> - Be sure to update the deployment ID in the data source address of the Subgraph manifest to take advantage of the latest changes. +> - All source Subgraphs should be deployed before the composed Subgraph is deployed. #### Key Functions - It provides a consolidated data model that encompasses all relevant block metrics. -- It combines data from three `source` subgraphs, and provides a comprehensive view of block statistics, enabling more complex queries and analyses. To deploy this subgraph locally, run the following commands: +- It combines data from three source Subgraphs, and provides a comprehensive view of block statistics, enabling more complex queries and analyses. To deploy this Subgraph locally, run the following commands: ```bash npm install @@ -111,11 +113,12 @@ npm run deploy-local ## Key Takeaways -- This powerful tool will scale your subgraph development and allow you to combine multiple Subgraphs. +- This powerful tool will scale your Subgraph development and allow you to combine multiple Subgraphs. - The setup includes the deployment of three source Subgraphs and one final deployment of the composed Subgraph. - This feature unlocks scalability, simplifying both development and maintenance efficiency. ## Additional Resources -- Add advanced features in your subgraph. Check out [subgraph advance features](/developing/creating/advanced/) and the [subgraph composition repo](https://github.com/incrypto32/subgraph-composition-sample-subgraph). -- Check out the Github repo [for this example] (https://github.com/isum/subgraph-composition-example). +- Check out all the code for this example in [the Github repo](https://github.com/isum/subgraph-composition-example). +- Add advanced features in your Subgraph. Check out [Subgraph advance features](/developing/creating/advanced/). +- To learn more about aggregations, check out Subgraph [advanced features](https://thegraph.com/docs/en/subgraphs/developing/creating/advanced/#timeseries-and-aggregations). diff --git a/website/src/pages/es/subgraphs/cookbook/_meta.js b/website/src/pages/es/subgraphs/cookbook/_meta.js index ae67ab7baed1..1b169037deee 100644 --- a/website/src/pages/es/subgraphs/cookbook/_meta.js +++ b/website/src/pages/es/subgraphs/cookbook/_meta.js @@ -1,4 +1,5 @@ export default { + 'subgraph-composition-three-sources': '', 'subgraph-debug-forking': '', near: '', arweave: '', @@ -8,5 +9,4 @@ export default { enums: '', 'secure-api-keys-nextjs': '', polymarket: '', - 'subgraph-composition-three-sources': '', } diff --git a/website/src/pages/es/subgraphs/cookbook/subgraph-composition-three-source.mdx b/website/src/pages/es/subgraphs/cookbook/subgraph-composition-three-sources.mdx similarity index 76% rename from website/src/pages/es/subgraphs/cookbook/subgraph-composition-three-source.mdx rename to website/src/pages/es/subgraphs/cookbook/subgraph-composition-three-sources.mdx index 80b86a24d036..024e79f5c7c5 100644 --- a/website/src/pages/es/subgraphs/cookbook/subgraph-composition-three-source.mdx +++ b/website/src/pages/es/subgraphs/cookbook/subgraph-composition-three-sources.mdx @@ -1,14 +1,17 @@ --- title: Integrating Three Subgraphs Using Subgraph Composition -sidebarTitle: 'Subgraph Composition with Three Source Subgraphs' +sidebarTitle: 'Composable Subgraph with Three Source Subgraphs' --- -Optimize your Subgraph by merging data from three independent, `source` Subgraphs into a single composable Subgraph to enhance data aggregation. +Optimize your Subgraph by merging data from three independent, source + +Subgraphs into a single composable Subgraph to enhance data aggregation. > Important Reminders > - Subgraph composition is built into the CLI, and you can deploy with [Subgraph Studio](https://thegraph.com/studio/). -> - This feature requires spec version 1.3.0. +> - This feature requires `specVersion` 1.3.0. +> - This example uses ## Overview @@ -24,11 +27,11 @@ To deploy **all** Subgraphs locally, you must have the following: ## Get Started -The following guide provides examples for defining three `source` Subgraphs to create one powerful composed Subgraph. +The following guide provides examples for defining three source Subgraphs to create one powerful composed Subgraph. ### Specifics -- To keep this example simple, all `source` subgraphs use only block handlers, but in a real environment, each source Subgraph will use data from different smart contracts. +- To keep this example simple, all source subgraphs use only block handlers, but in a real environment, each source Subgraph will use data from different smart contracts. - The examples below show how to import and extend the schema of another Subgraph to enhance its functionality. - Each source Subgraph is optimized with a specific entity. - All the commands listed install the necessary dependencies, generate code based on the GraphQL schema, build the Subgraph, and deploy it to your local Graph Node instance. @@ -52,7 +55,7 @@ npm run deploy-local ### Step 1. Deploy Block Cost Source Subgraph -This second `source` Subgraph indexes the cost of each block. +This second source Subgraph indexes the cost of each block. #### Key Functions @@ -71,7 +74,7 @@ npm run deploy-local ### Step 2. Define Block Size in Source Subgraph -This third `source` Subgraph indexes the size of each block. +This third source Subgraph indexes the size of each block. #### Key Functions @@ -90,7 +93,7 @@ npm run deploy-local ### Step 3. Combine Into Block Stats Subgraph -This composed Subgraph combines and aggregates the information from the three source Subgraphs above. +This composed Subgraph combines and aggregates the information from the three source Subgraphs above. To learn how to use aggregations, check out Subgraph [advanced features](https://thegraph.com/docs/en/subgraphs/developing/creating/advanced/#timeseries-and-aggregations). > [!NOTE] Any change to a source Subgraph will likely generate a new deployment ID. Be sure to update the deployment ID in the data source address of the Subgraph manifest to take advantage of the latest changes. [!IMPORTANT] All source Subgraphs should be deployed before the composed Subgraph is deployed. @@ -99,7 +102,7 @@ This composed Subgraph demonstrates how to create a subgraph that aggregates dat #### Key Functions - It provides a consolidated data model that encompasses all relevant block metrics. -- It combines data from three `source` subgraphs, and provides a comprehensive view of block statistics, enabling more complex queries and analyses. To deploy this subgraph locally, run the following commands: +- It combines data from three source subgraphs, and provides a comprehensive view of block statistics, enabling more complex queries and analyses. To deploy this subgraph locally, run the following commands: ```bash npm install @@ -118,4 +121,4 @@ npm run deploy-local ## Additional Resources - Add advanced features in your subgraph. Check out [subgraph advance features](/developing/creating/advanced/) and the [subgraph composition repo](https://github.com/incrypto32/subgraph-composition-sample-subgraph). -- Check out the Github repo [for this example] (https://github.com/isum/subgraph-composition-example). +- Check out all the code for this example in [the Github repo] (https://github.com/isum/subgraph-composition-example). diff --git a/website/src/pages/fr/subgraphs/cookbook/_meta.js b/website/src/pages/fr/subgraphs/cookbook/_meta.js index ae67ab7baed1..1b169037deee 100644 --- a/website/src/pages/fr/subgraphs/cookbook/_meta.js +++ b/website/src/pages/fr/subgraphs/cookbook/_meta.js @@ -1,4 +1,5 @@ export default { + 'subgraph-composition-three-sources': '', 'subgraph-debug-forking': '', near: '', arweave: '', @@ -8,5 +9,4 @@ export default { enums: '', 'secure-api-keys-nextjs': '', polymarket: '', - 'subgraph-composition-three-sources': '', } diff --git a/website/src/pages/fr/subgraphs/cookbook/subgraph-composition-three-source.mdx b/website/src/pages/fr/subgraphs/cookbook/subgraph-composition-three-source.mdx deleted file mode 100644 index 80b86a24d036..000000000000 --- a/website/src/pages/fr/subgraphs/cookbook/subgraph-composition-three-source.mdx +++ /dev/null @@ -1,121 +0,0 @@ ---- -title: Integrating Three Subgraphs Using Subgraph Composition -sidebarTitle: 'Subgraph Composition with Three Source Subgraphs' ---- - -Optimize your Subgraph by merging data from three independent, `source` Subgraphs into a single composable Subgraph to enhance data aggregation. - -> Important Reminders - -> - Subgraph composition is built into the CLI, and you can deploy with [Subgraph Studio](https://thegraph.com/studio/). -> - This feature requires spec version 1.3.0. - -## Overview - -Subgraph composition empowers developer to leverage a Subgraph with other Subgraphs as data sources, seamlessly integrating and reacting to data updates and entity changes. This capability enhances efficiency and responsiveness in data handling. - -## Prerequisites - -To deploy **all** Subgraphs locally, you must have the following: - -- A [graph-node](https://github.com/graphprotocol/graph-node) instance running locally -- An [IPFS](https://docs.ipfs.tech/) instance running locally -- [Node.js.](https://nodejs.org/en) and npm - -## Get Started - -The following guide provides examples for defining three `source` Subgraphs to create one powerful composed Subgraph. - -### Specifics - -- To keep this example simple, all `source` subgraphs use only block handlers, but in a real environment, each source Subgraph will use data from different smart contracts. -- The examples below show how to import and extend the schema of another Subgraph to enhance its functionality. -- Each source Subgraph is optimized with a specific entity. -- All the commands listed install the necessary dependencies, generate code based on the GraphQL schema, build the Subgraph, and deploy it to your local Graph Node instance. - -### Step 1. Deploy Block Time Source Subgraph - -This first source Subgraph calculates the block time for each block. - -- It imports schemas from other Subgraphs and adds a `block` entity with a `timestamp` field, representing the time each block was mined. -- It listens to time-related blockchain events (e.g., block timestamps) and processes this data to update the Subgraph's entities accordingly. - -To deploy this Subgraph locally, run the following commands: - -```bash -npm install -npm run codegen -npm run build -npm run create-local -npm run deploy-local -``` - -### Step 1. Deploy Block Cost Source Subgraph - -This second `source` Subgraph indexes the cost of each block. - -#### Key Functions - -- It imports schemas from other Subgraphs and adds a `block` entity with cost-related fields. -- It listens to blockchain events related to costs (e.g. gas fees, transaction costs) and processes this data to update the Subgraph's entities accordingly. - -To deploy this Subgraph locally, run the following commands: - -```bash -npm install -npm run codegen -npm run build -npm run create-local -npm run deploy-local -``` - -### Step 2. Define Block Size in Source Subgraph - -This third `source` Subgraph indexes the size of each block. - -#### Key Functions - -- It imports existing schemas from other Subgraphs and adds a `Block` entity with a `size` field representing each block's size. -- It listens to blockchain events related to block sizes (e.g., storage or volume) and processes this data to update the Subgraph's entities accordingly. - -To deploy this Subgraph locally, run the following commands: - -```bash -npm install -npm run codegen -npm run build -npm run create-local -npm run deploy-local -``` - -### Step 3. Combine Into Block Stats Subgraph - -This composed Subgraph combines and aggregates the information from the three source Subgraphs above. - -> [!NOTE] Any change to a source Subgraph will likely generate a new deployment ID. Be sure to update the deployment ID in the data source address of the Subgraph manifest to take advantage of the latest changes. [!IMPORTANT] All source Subgraphs should be deployed before the composed Subgraph is deployed. - -This composed Subgraph demonstrates how to create a subgraph that aggregates data from three source subgraphs, providing a unified, enhanced view of block statistics. - -#### Key Functions - -- It provides a consolidated data model that encompasses all relevant block metrics. -- It combines data from three `source` subgraphs, and provides a comprehensive view of block statistics, enabling more complex queries and analyses. To deploy this subgraph locally, run the following commands: - -```bash -npm install -npm run codegen -npm run build -npm run create-local -npm run deploy-local -``` - -## Key Takeaways - -- This powerful tool will scale your subgraph development and allow you to combine multiple Subgraphs. -- The setup includes the deployment of three source Subgraphs and one final deployment of the composed Subgraph. -- This feature unlocks scalability, simplifying both development and maintenance efficiency. - -## Additional Resources - -- Add advanced features in your subgraph. Check out [subgraph advance features](/developing/creating/advanced/) and the [subgraph composition repo](https://github.com/incrypto32/subgraph-composition-sample-subgraph). -- Check out the Github repo [for this example] (https://github.com/isum/subgraph-composition-example). diff --git a/website/src/pages/fr/subgraphs/cookbook/subgraph-composition-three-sources.mdx b/website/src/pages/fr/subgraphs/cookbook/subgraph-composition-three-sources.mdx new file mode 100644 index 000000000000..024e79f5c7c5 --- /dev/null +++ b/website/src/pages/fr/subgraphs/cookbook/subgraph-composition-three-sources.mdx @@ -0,0 +1,124 @@ +--- +title: Integrating Three Subgraphs Using Subgraph Composition +sidebarTitle: 'Composable Subgraph with Three Source Subgraphs' +--- + +Optimize your Subgraph by merging data from three independent, source + +Subgraphs into a single composable Subgraph to enhance data aggregation. + +> Important Reminders + +> - Subgraph composition is built into the CLI, and you can deploy with [Subgraph Studio](https://thegraph.com/studio/). +> - This feature requires `specVersion` 1.3.0. +> - This example uses + +## Overview + +Subgraph composition empowers developer to leverage a Subgraph with other Subgraphs as data sources, seamlessly integrating and reacting to data updates and entity changes. This capability enhances efficiency and responsiveness in data handling. + +## Prerequisites + +To deploy **all** Subgraphs locally, you must have the following: + +- A [graph-node](https://github.com/graphprotocol/graph-node) instance running locally +- An [IPFS](https://docs.ipfs.tech/) instance running locally +- [Node.js.](https://nodejs.org/en) and npm + +## Get Started + +The following guide provides examples for defining three source Subgraphs to create one powerful composed Subgraph. + +### Specifics + +- To keep this example simple, all source subgraphs use only block handlers, but in a real environment, each source Subgraph will use data from different smart contracts. +- The examples below show how to import and extend the schema of another Subgraph to enhance its functionality. +- Each source Subgraph is optimized with a specific entity. +- All the commands listed install the necessary dependencies, generate code based on the GraphQL schema, build the Subgraph, and deploy it to your local Graph Node instance. + +### Step 1. Deploy Block Time Source Subgraph + +This first source Subgraph calculates the block time for each block. + +- It imports schemas from other Subgraphs and adds a `block` entity with a `timestamp` field, representing the time each block was mined. +- It listens to time-related blockchain events (e.g., block timestamps) and processes this data to update the Subgraph's entities accordingly. + +To deploy this Subgraph locally, run the following commands: + +```bash +npm install +npm run codegen +npm run build +npm run create-local +npm run deploy-local +``` + +### Step 1. Deploy Block Cost Source Subgraph + +This second source Subgraph indexes the cost of each block. + +#### Key Functions + +- It imports schemas from other Subgraphs and adds a `block` entity with cost-related fields. +- It listens to blockchain events related to costs (e.g. gas fees, transaction costs) and processes this data to update the Subgraph's entities accordingly. + +To deploy this Subgraph locally, run the following commands: + +```bash +npm install +npm run codegen +npm run build +npm run create-local +npm run deploy-local +``` + +### Step 2. Define Block Size in Source Subgraph + +This third source Subgraph indexes the size of each block. + +#### Key Functions + +- It imports existing schemas from other Subgraphs and adds a `Block` entity with a `size` field representing each block's size. +- It listens to blockchain events related to block sizes (e.g., storage or volume) and processes this data to update the Subgraph's entities accordingly. + +To deploy this Subgraph locally, run the following commands: + +```bash +npm install +npm run codegen +npm run build +npm run create-local +npm run deploy-local +``` + +### Step 3. Combine Into Block Stats Subgraph + +This composed Subgraph combines and aggregates the information from the three source Subgraphs above. To learn how to use aggregations, check out Subgraph [advanced features](https://thegraph.com/docs/en/subgraphs/developing/creating/advanced/#timeseries-and-aggregations). + +> [!NOTE] Any change to a source Subgraph will likely generate a new deployment ID. Be sure to update the deployment ID in the data source address of the Subgraph manifest to take advantage of the latest changes. [!IMPORTANT] All source Subgraphs should be deployed before the composed Subgraph is deployed. + +This composed Subgraph demonstrates how to create a subgraph that aggregates data from three source subgraphs, providing a unified, enhanced view of block statistics. + +#### Key Functions + +- It provides a consolidated data model that encompasses all relevant block metrics. +- It combines data from three source subgraphs, and provides a comprehensive view of block statistics, enabling more complex queries and analyses. To deploy this subgraph locally, run the following commands: + +```bash +npm install +npm run codegen +npm run build +npm run create-local +npm run deploy-local +``` + +## Key Takeaways + +- This powerful tool will scale your subgraph development and allow you to combine multiple Subgraphs. +- The setup includes the deployment of three source Subgraphs and one final deployment of the composed Subgraph. +- This feature unlocks scalability, simplifying both development and maintenance efficiency. + +## Additional Resources + +- Add advanced features in your subgraph. Check out [subgraph advance features](/developing/creating/advanced/) and the [subgraph composition repo](https://github.com/incrypto32/subgraph-composition-sample-subgraph). +- Check out all the code for this example in [the Github repo] (https://github.com/isum/subgraph-composition-example). diff --git a/website/src/pages/hi/subgraphs/cookbook/_meta.js b/website/src/pages/hi/subgraphs/cookbook/_meta.js index ae67ab7baed1..1b169037deee 100644 --- a/website/src/pages/hi/subgraphs/cookbook/_meta.js +++ b/website/src/pages/hi/subgraphs/cookbook/_meta.js @@ -1,4 +1,5 @@ export default { + 'subgraph-composition-three-sources': '', 'subgraph-debug-forking': '', near: '', arweave: '', @@ -8,5 +9,4 @@ export default { enums: '', 'secure-api-keys-nextjs': '', polymarket: '', - 'subgraph-composition-three-sources': '', } diff --git a/website/src/pages/hi/subgraphs/cookbook/subgraph-composition-three-source.mdx b/website/src/pages/hi/subgraphs/cookbook/subgraph-composition-three-source.mdx deleted file mode 100644 index 80b86a24d036..000000000000 --- a/website/src/pages/hi/subgraphs/cookbook/subgraph-composition-three-source.mdx +++ /dev/null @@ -1,121 +0,0 @@ ---- -title: Integrating Three Subgraphs Using Subgraph Composition -sidebarTitle: 'Subgraph Composition with Three Source Subgraphs' ---- - -Optimize your Subgraph by merging data from three independent, `source` Subgraphs into a single composable Subgraph to enhance data aggregation. - -> Important Reminders - -> - Subgraph composition is built into the CLI, and you can deploy with [Subgraph Studio](https://thegraph.com/studio/). -> - This feature requires spec version 1.3.0. - -## Overview - -Subgraph composition empowers developer to leverage a Subgraph with other Subgraphs as data sources, seamlessly integrating and reacting to data updates and entity changes. This capability enhances efficiency and responsiveness in data handling. - -## Prerequisites - -To deploy **all** Subgraphs locally, you must have the following: - -- A [graph-node](https://github.com/graphprotocol/graph-node) instance running locally -- An [IPFS](https://docs.ipfs.tech/) instance running locally -- [Node.js.](https://nodejs.org/en) and npm - -## Get Started - -The following guide provides examples for defining three `source` Subgraphs to create one powerful composed Subgraph. - -### Specifics - -- To keep this example simple, all `source` subgraphs use only block handlers, but in a real environment, each source Subgraph will use data from different smart contracts. -- The examples below show how to import and extend the schema of another Subgraph to enhance its functionality. -- Each source Subgraph is optimized with a specific entity. -- All the commands listed install the necessary dependencies, generate code based on the GraphQL schema, build the Subgraph, and deploy it to your local Graph Node instance. - -### Step 1. Deploy Block Time Source Subgraph - -This first source Subgraph calculates the block time for each block. - -- It imports schemas from other Subgraphs and adds a `block` entity with a `timestamp` field, representing the time each block was mined. -- It listens to time-related blockchain events (e.g., block timestamps) and processes this data to update the Subgraph's entities accordingly. - -To deploy this Subgraph locally, run the following commands: - -```bash -npm install -npm run codegen -npm run build -npm run create-local -npm run deploy-local -``` - -### Step 1. Deploy Block Cost Source Subgraph - -This second `source` Subgraph indexes the cost of each block. - -#### Key Functions - -- It imports schemas from other Subgraphs and adds a `block` entity with cost-related fields. -- It listens to blockchain events related to costs (e.g. gas fees, transaction costs) and processes this data to update the Subgraph's entities accordingly. - -To deploy this Subgraph locally, run the following commands: - -```bash -npm install -npm run codegen -npm run build -npm run create-local -npm run deploy-local -``` - -### Step 2. Define Block Size in Source Subgraph - -This third `source` Subgraph indexes the size of each block. - -#### Key Functions - -- It imports existing schemas from other Subgraphs and adds a `Block` entity with a `size` field representing each block's size. -- It listens to blockchain events related to block sizes (e.g., storage or volume) and processes this data to update the Subgraph's entities accordingly. - -To deploy this Subgraph locally, run the following commands: - -```bash -npm install -npm run codegen -npm run build -npm run create-local -npm run deploy-local -``` - -### Step 3. Combine Into Block Stats Subgraph - -This composed Subgraph combines and aggregates the information from the three source Subgraphs above. - -> [!NOTE] Any change to a source Subgraph will likely generate a new deployment ID. Be sure to update the deployment ID in the data source address of the Subgraph manifest to take advantage of the latest changes. [!IMPORTANT] All source Subgraphs should be deployed before the composed Subgraph is deployed. - -This composed Subgraph demonstrates how to create a subgraph that aggregates data from three source subgraphs, providing a unified, enhanced view of block statistics. - -#### Key Functions - -- It provides a consolidated data model that encompasses all relevant block metrics. -- It combines data from three `source` subgraphs, and provides a comprehensive view of block statistics, enabling more complex queries and analyses. To deploy this subgraph locally, run the following commands: - -```bash -npm install -npm run codegen -npm run build -npm run create-local -npm run deploy-local -``` - -## Key Takeaways - -- This powerful tool will scale your subgraph development and allow you to combine multiple Subgraphs. -- The setup includes the deployment of three source Subgraphs and one final deployment of the composed Subgraph. -- This feature unlocks scalability, simplifying both development and maintenance efficiency. - -## Additional Resources - -- Add advanced features in your subgraph. Check out [subgraph advance features](/developing/creating/advanced/) and the [subgraph composition repo](https://github.com/incrypto32/subgraph-composition-sample-subgraph). -- Check out the Github repo [for this example] (https://github.com/isum/subgraph-composition-example). diff --git a/website/src/pages/hi/subgraphs/cookbook/subgraph-composition-three-sources.mdx b/website/src/pages/hi/subgraphs/cookbook/subgraph-composition-three-sources.mdx new file mode 100644 index 000000000000..024e79f5c7c5 --- /dev/null +++ b/website/src/pages/hi/subgraphs/cookbook/subgraph-composition-three-sources.mdx @@ -0,0 +1,124 @@ +--- +title: Integrating Three Subgraphs Using Subgraph Composition +sidebarTitle: 'Composable Subgraph with Three Source Subgraphs' +--- + +Optimize your Subgraph by merging data from three independent, source + +Subgraphs into a single composable Subgraph to enhance data aggregation. + +> Important Reminders + +> - Subgraph composition is built into the CLI, and you can deploy with [Subgraph Studio](https://thegraph.com/studio/). +> - This feature requires `specVersion` 1.3.0. +> - This example uses + +## Overview + +Subgraph composition empowers developer to leverage a Subgraph with other Subgraphs as data sources, seamlessly integrating and reacting to data updates and entity changes. This capability enhances efficiency and responsiveness in data handling. + +## Prerequisites + +To deploy **all** Subgraphs locally, you must have the following: + +- A [graph-node](https://github.com/graphprotocol/graph-node) instance running locally +- An [IPFS](https://docs.ipfs.tech/) instance running locally +- [Node.js.](https://nodejs.org/en) and npm + +## Get Started + +The following guide provides examples for defining three source Subgraphs to create one powerful composed Subgraph. + +### Specifics + +- To keep this example simple, all source subgraphs use only block handlers, but in a real environment, each source Subgraph will use data from different smart contracts. +- The examples below show how to import and extend the schema of another Subgraph to enhance its functionality. +- Each source Subgraph is optimized with a specific entity. +- All the commands listed install the necessary dependencies, generate code based on the GraphQL schema, build the Subgraph, and deploy it to your local Graph Node instance. + +### Step 1. Deploy Block Time Source Subgraph + +This first source Subgraph calculates the block time for each block. + +- It imports schemas from other Subgraphs and adds a `block` entity with a `timestamp` field, representing the time each block was mined. +- It listens to time-related blockchain events (e.g., block timestamps) and processes this data to update the Subgraph's entities accordingly. + +To deploy this Subgraph locally, run the following commands: + +```bash +npm install +npm run codegen +npm run build +npm run create-local +npm run deploy-local +``` + +### Step 1. Deploy Block Cost Source Subgraph + +This second source Subgraph indexes the cost of each block. + +#### Key Functions + +- It imports schemas from other Subgraphs and adds a `block` entity with cost-related fields. +- It listens to blockchain events related to costs (e.g. gas fees, transaction costs) and processes this data to update the Subgraph's entities accordingly. + +To deploy this Subgraph locally, run the following commands: + +```bash +npm install +npm run codegen +npm run build +npm run create-local +npm run deploy-local +``` + +### Step 2. Define Block Size in Source Subgraph + +This third source Subgraph indexes the size of each block. + +#### Key Functions + +- It imports existing schemas from other Subgraphs and adds a `Block` entity with a `size` field representing each block's size. +- It listens to blockchain events related to block sizes (e.g., storage or volume) and processes this data to update the Subgraph's entities accordingly. + +To deploy this Subgraph locally, run the following commands: + +```bash +npm install +npm run codegen +npm run build +npm run create-local +npm run deploy-local +``` + +### Step 3. Combine Into Block Stats Subgraph + +This composed Subgraph combines and aggregates the information from the three source Subgraphs above. To learn how to use aggregations, check out Subgraph [advanced features](https://thegraph.com/docs/en/subgraphs/developing/creating/advanced/#timeseries-and-aggregations). + +> [!NOTE] Any change to a source Subgraph will likely generate a new deployment ID. Be sure to update the deployment ID in the data source address of the Subgraph manifest to take advantage of the latest changes. [!IMPORTANT] All source Subgraphs should be deployed before the composed Subgraph is deployed. + +This composed Subgraph demonstrates how to create a subgraph that aggregates data from three source subgraphs, providing a unified, enhanced view of block statistics. + +#### Key Functions + +- It provides a consolidated data model that encompasses all relevant block metrics. +- It combines data from three source subgraphs, and provides a comprehensive view of block statistics, enabling more complex queries and analyses. To deploy this subgraph locally, run the following commands: + +```bash +npm install +npm run codegen +npm run build +npm run create-local +npm run deploy-local +``` + +## Key Takeaways + +- This powerful tool will scale your subgraph development and allow you to combine multiple Subgraphs. +- The setup includes the deployment of three source Subgraphs and one final deployment of the composed Subgraph. +- This feature unlocks scalability, simplifying both development and maintenance efficiency. + +## Additional Resources + +- Add advanced features in your subgraph. Check out [subgraph advance features](/developing/creating/advanced/) and the [subgraph composition repo](https://github.com/incrypto32/subgraph-composition-sample-subgraph). +- Check out all the code for this example in [the Github repo] (https://github.com/isum/subgraph-composition-example). diff --git a/website/src/pages/it/subgraphs/cookbook/_meta.js b/website/src/pages/it/subgraphs/cookbook/_meta.js index ae67ab7baed1..1b169037deee 100644 --- a/website/src/pages/it/subgraphs/cookbook/_meta.js +++ b/website/src/pages/it/subgraphs/cookbook/_meta.js @@ -1,4 +1,5 @@ export default { + 'subgraph-composition-three-sources': '', 'subgraph-debug-forking': '', near: '', arweave: '', @@ -8,5 +9,4 @@ export default { enums: '', 'secure-api-keys-nextjs': '', polymarket: '', - 'subgraph-composition-three-sources': '', } diff --git a/website/src/pages/it/subgraphs/cookbook/subgraph-composition-three-source.mdx b/website/src/pages/it/subgraphs/cookbook/subgraph-composition-three-source.mdx deleted file mode 100644 index 80b86a24d036..000000000000 --- a/website/src/pages/it/subgraphs/cookbook/subgraph-composition-three-source.mdx +++ /dev/null @@ -1,121 +0,0 @@ ---- -title: Integrating Three Subgraphs Using Subgraph Composition -sidebarTitle: 'Subgraph Composition with Three Source Subgraphs' ---- - -Optimize your Subgraph by merging data from three independent, `source` Subgraphs into a single composable Subgraph to enhance data aggregation. - -> Important Reminders - -> - Subgraph composition is built into the CLI, and you can deploy with [Subgraph Studio](https://thegraph.com/studio/). -> - This feature requires spec version 1.3.0. - -## Overview - -Subgraph composition empowers developer to leverage a Subgraph with other Subgraphs as data sources, seamlessly integrating and reacting to data updates and entity changes. This capability enhances efficiency and responsiveness in data handling. - -## Prerequisites - -To deploy **all** Subgraphs locally, you must have the following: - -- A [graph-node](https://github.com/graphprotocol/graph-node) instance running locally -- An [IPFS](https://docs.ipfs.tech/) instance running locally -- [Node.js.](https://nodejs.org/en) and npm - -## Get Started - -The following guide provides examples for defining three `source` Subgraphs to create one powerful composed Subgraph. - -### Specifics - -- To keep this example simple, all `source` subgraphs use only block handlers, but in a real environment, each source Subgraph will use data from different smart contracts. -- The examples below show how to import and extend the schema of another Subgraph to enhance its functionality. -- Each source Subgraph is optimized with a specific entity. -- All the commands listed install the necessary dependencies, generate code based on the GraphQL schema, build the Subgraph, and deploy it to your local Graph Node instance. - -### Step 1. Deploy Block Time Source Subgraph - -This first source Subgraph calculates the block time for each block. - -- It imports schemas from other Subgraphs and adds a `block` entity with a `timestamp` field, representing the time each block was mined. -- It listens to time-related blockchain events (e.g., block timestamps) and processes this data to update the Subgraph's entities accordingly. - -To deploy this Subgraph locally, run the following commands: - -```bash -npm install -npm run codegen -npm run build -npm run create-local -npm run deploy-local -``` - -### Step 1. Deploy Block Cost Source Subgraph - -This second `source` Subgraph indexes the cost of each block. - -#### Key Functions - -- It imports schemas from other Subgraphs and adds a `block` entity with cost-related fields. -- It listens to blockchain events related to costs (e.g. gas fees, transaction costs) and processes this data to update the Subgraph's entities accordingly. - -To deploy this Subgraph locally, run the following commands: - -```bash -npm install -npm run codegen -npm run build -npm run create-local -npm run deploy-local -``` - -### Step 2. Define Block Size in Source Subgraph - -This third `source` Subgraph indexes the size of each block. - -#### Key Functions - -- It imports existing schemas from other Subgraphs and adds a `Block` entity with a `size` field representing each block's size. -- It listens to blockchain events related to block sizes (e.g., storage or volume) and processes this data to update the Subgraph's entities accordingly. - -To deploy this Subgraph locally, run the following commands: - -```bash -npm install -npm run codegen -npm run build -npm run create-local -npm run deploy-local -``` - -### Step 3. Combine Into Block Stats Subgraph - -This composed Subgraph combines and aggregates the information from the three source Subgraphs above. - -> [!NOTE] Any change to a source Subgraph will likely generate a new deployment ID. Be sure to update the deployment ID in the data source address of the Subgraph manifest to take advantage of the latest changes. [!IMPORTANT] All source Subgraphs should be deployed before the composed Subgraph is deployed. - -This composed Subgraph demonstrates how to create a subgraph that aggregates data from three source subgraphs, providing a unified, enhanced view of block statistics. - -#### Key Functions - -- It provides a consolidated data model that encompasses all relevant block metrics. -- It combines data from three `source` subgraphs, and provides a comprehensive view of block statistics, enabling more complex queries and analyses. To deploy this subgraph locally, run the following commands: - -```bash -npm install -npm run codegen -npm run build -npm run create-local -npm run deploy-local -``` - -## Key Takeaways - -- This powerful tool will scale your subgraph development and allow you to combine multiple Subgraphs. -- The setup includes the deployment of three source Subgraphs and one final deployment of the composed Subgraph. -- This feature unlocks scalability, simplifying both development and maintenance efficiency. - -## Additional Resources - -- Add advanced features in your subgraph. Check out [subgraph advance features](/developing/creating/advanced/) and the [subgraph composition repo](https://github.com/incrypto32/subgraph-composition-sample-subgraph). -- Check out the Github repo [for this example] (https://github.com/isum/subgraph-composition-example). diff --git a/website/src/pages/it/subgraphs/cookbook/subgraph-composition-three-sources.mdx b/website/src/pages/it/subgraphs/cookbook/subgraph-composition-three-sources.mdx new file mode 100644 index 000000000000..024e79f5c7c5 --- /dev/null +++ b/website/src/pages/it/subgraphs/cookbook/subgraph-composition-three-sources.mdx @@ -0,0 +1,124 @@ +--- +title: Integrating Three Subgraphs Using Subgraph Composition +sidebarTitle: 'Composable Subgraph with Three Source Subgraphs' +--- + +Optimize your Subgraph by merging data from three independent, source + +Subgraphs into a single composable Subgraph to enhance data aggregation. + +> Important Reminders + +> - Subgraph composition is built into the CLI, and you can deploy with [Subgraph Studio](https://thegraph.com/studio/). +> - This feature requires `specVersion` 1.3.0. +> - This example uses + +## Overview + +Subgraph composition empowers developer to leverage a Subgraph with other Subgraphs as data sources, seamlessly integrating and reacting to data updates and entity changes. This capability enhances efficiency and responsiveness in data handling. + +## Prerequisites + +To deploy **all** Subgraphs locally, you must have the following: + +- A [graph-node](https://github.com/graphprotocol/graph-node) instance running locally +- An [IPFS](https://docs.ipfs.tech/) instance running locally +- [Node.js.](https://nodejs.org/en) and npm + +## Get Started + +The following guide provides examples for defining three source Subgraphs to create one powerful composed Subgraph. + +### Specifics + +- To keep this example simple, all source subgraphs use only block handlers, but in a real environment, each source Subgraph will use data from different smart contracts. +- The examples below show how to import and extend the schema of another Subgraph to enhance its functionality. +- Each source Subgraph is optimized with a specific entity. +- All the commands listed install the necessary dependencies, generate code based on the GraphQL schema, build the Subgraph, and deploy it to your local Graph Node instance. + +### Step 1. Deploy Block Time Source Subgraph + +This first source Subgraph calculates the block time for each block. + +- It imports schemas from other Subgraphs and adds a `block` entity with a `timestamp` field, representing the time each block was mined. +- It listens to time-related blockchain events (e.g., block timestamps) and processes this data to update the Subgraph's entities accordingly. + +To deploy this Subgraph locally, run the following commands: + +```bash +npm install +npm run codegen +npm run build +npm run create-local +npm run deploy-local +``` + +### Step 1. Deploy Block Cost Source Subgraph + +This second source Subgraph indexes the cost of each block. + +#### Key Functions + +- It imports schemas from other Subgraphs and adds a `block` entity with cost-related fields. +- It listens to blockchain events related to costs (e.g. gas fees, transaction costs) and processes this data to update the Subgraph's entities accordingly. + +To deploy this Subgraph locally, run the following commands: + +```bash +npm install +npm run codegen +npm run build +npm run create-local +npm run deploy-local +``` + +### Step 2. Define Block Size in Source Subgraph + +This third source Subgraph indexes the size of each block. + +#### Key Functions + +- It imports existing schemas from other Subgraphs and adds a `Block` entity with a `size` field representing each block's size. +- It listens to blockchain events related to block sizes (e.g., storage or volume) and processes this data to update the Subgraph's entities accordingly. + +To deploy this Subgraph locally, run the following commands: + +```bash +npm install +npm run codegen +npm run build +npm run create-local +npm run deploy-local +``` + +### Step 3. Combine Into Block Stats Subgraph + +This composed Subgraph combines and aggregates the information from the three source Subgraphs above. To learn how to use aggregations, check out Subgraph [advanced features](https://thegraph.com/docs/en/subgraphs/developing/creating/advanced/#timeseries-and-aggregations). + +> [!NOTE] Any change to a source Subgraph will likely generate a new deployment ID. Be sure to update the deployment ID in the data source address of the Subgraph manifest to take advantage of the latest changes. [!IMPORTANT] All source Subgraphs should be deployed before the composed Subgraph is deployed. + +This composed Subgraph demonstrates how to create a subgraph that aggregates data from three source subgraphs, providing a unified, enhanced view of block statistics. + +#### Key Functions + +- It provides a consolidated data model that encompasses all relevant block metrics. +- It combines data from three source subgraphs, and provides a comprehensive view of block statistics, enabling more complex queries and analyses. To deploy this subgraph locally, run the following commands: + +```bash +npm install +npm run codegen +npm run build +npm run create-local +npm run deploy-local +``` + +## Key Takeaways + +- This powerful tool will scale your subgraph development and allow you to combine multiple Subgraphs. +- The setup includes the deployment of three source Subgraphs and one final deployment of the composed Subgraph. +- This feature unlocks scalability, simplifying both development and maintenance efficiency. + +## Additional Resources + +- Add advanced features in your subgraph. Check out [subgraph advance features](/developing/creating/advanced/) and the [subgraph composition repo](https://github.com/incrypto32/subgraph-composition-sample-subgraph). +- Check out all the code for this example in [the Github repo] (https://github.com/isum/subgraph-composition-example). diff --git a/website/src/pages/ja/subgraphs/cookbook/_meta.js b/website/src/pages/ja/subgraphs/cookbook/_meta.js index ae67ab7baed1..1b169037deee 100644 --- a/website/src/pages/ja/subgraphs/cookbook/_meta.js +++ b/website/src/pages/ja/subgraphs/cookbook/_meta.js @@ -1,4 +1,5 @@ export default { + 'subgraph-composition-three-sources': '', 'subgraph-debug-forking': '', near: '', arweave: '', @@ -8,5 +9,4 @@ export default { enums: '', 'secure-api-keys-nextjs': '', polymarket: '', - 'subgraph-composition-three-sources': '', } diff --git a/website/src/pages/ja/subgraphs/cookbook/subgraph-composition-three-source.mdx b/website/src/pages/ja/subgraphs/cookbook/subgraph-composition-three-source.mdx deleted file mode 100644 index 80b86a24d036..000000000000 --- a/website/src/pages/ja/subgraphs/cookbook/subgraph-composition-three-source.mdx +++ /dev/null @@ -1,121 +0,0 @@ ---- -title: Integrating Three Subgraphs Using Subgraph Composition -sidebarTitle: 'Subgraph Composition with Three Source Subgraphs' ---- - -Optimize your Subgraph by merging data from three independent, `source` Subgraphs into a single composable Subgraph to enhance data aggregation. - -> Important Reminders - -> - Subgraph composition is built into the CLI, and you can deploy with [Subgraph Studio](https://thegraph.com/studio/). -> - This feature requires spec version 1.3.0. - -## Overview - -Subgraph composition empowers developer to leverage a Subgraph with other Subgraphs as data sources, seamlessly integrating and reacting to data updates and entity changes. This capability enhances efficiency and responsiveness in data handling. - -## Prerequisites - -To deploy **all** Subgraphs locally, you must have the following: - -- A [graph-node](https://github.com/graphprotocol/graph-node) instance running locally -- An [IPFS](https://docs.ipfs.tech/) instance running locally -- [Node.js.](https://nodejs.org/en) and npm - -## Get Started - -The following guide provides examples for defining three `source` Subgraphs to create one powerful composed Subgraph. - -### Specifics - -- To keep this example simple, all `source` subgraphs use only block handlers, but in a real environment, each source Subgraph will use data from different smart contracts. -- The examples below show how to import and extend the schema of another Subgraph to enhance its functionality. -- Each source Subgraph is optimized with a specific entity. -- All the commands listed install the necessary dependencies, generate code based on the GraphQL schema, build the Subgraph, and deploy it to your local Graph Node instance. - -### Step 1. Deploy Block Time Source Subgraph - -This first source Subgraph calculates the block time for each block. - -- It imports schemas from other Subgraphs and adds a `block` entity with a `timestamp` field, representing the time each block was mined. -- It listens to time-related blockchain events (e.g., block timestamps) and processes this data to update the Subgraph's entities accordingly. - -To deploy this Subgraph locally, run the following commands: - -```bash -npm install -npm run codegen -npm run build -npm run create-local -npm run deploy-local -``` - -### Step 1. Deploy Block Cost Source Subgraph - -This second `source` Subgraph indexes the cost of each block. - -#### Key Functions - -- It imports schemas from other Subgraphs and adds a `block` entity with cost-related fields. -- It listens to blockchain events related to costs (e.g. gas fees, transaction costs) and processes this data to update the Subgraph's entities accordingly. - -To deploy this Subgraph locally, run the following commands: - -```bash -npm install -npm run codegen -npm run build -npm run create-local -npm run deploy-local -``` - -### Step 2. Define Block Size in Source Subgraph - -This third `source` Subgraph indexes the size of each block. - -#### Key Functions - -- It imports existing schemas from other Subgraphs and adds a `Block` entity with a `size` field representing each block's size. -- It listens to blockchain events related to block sizes (e.g., storage or volume) and processes this data to update the Subgraph's entities accordingly. - -To deploy this Subgraph locally, run the following commands: - -```bash -npm install -npm run codegen -npm run build -npm run create-local -npm run deploy-local -``` - -### Step 3. Combine Into Block Stats Subgraph - -This composed Subgraph combines and aggregates the information from the three source Subgraphs above. - -> [!NOTE] Any change to a source Subgraph will likely generate a new deployment ID. Be sure to update the deployment ID in the data source address of the Subgraph manifest to take advantage of the latest changes. [!IMPORTANT] All source Subgraphs should be deployed before the composed Subgraph is deployed. - -This composed Subgraph demonstrates how to create a subgraph that aggregates data from three source subgraphs, providing a unified, enhanced view of block statistics. - -#### Key Functions - -- It provides a consolidated data model that encompasses all relevant block metrics. -- It combines data from three `source` subgraphs, and provides a comprehensive view of block statistics, enabling more complex queries and analyses. To deploy this subgraph locally, run the following commands: - -```bash -npm install -npm run codegen -npm run build -npm run create-local -npm run deploy-local -``` - -## Key Takeaways - -- This powerful tool will scale your subgraph development and allow you to combine multiple Subgraphs. -- The setup includes the deployment of three source Subgraphs and one final deployment of the composed Subgraph. -- This feature unlocks scalability, simplifying both development and maintenance efficiency. - -## Additional Resources - -- Add advanced features in your subgraph. Check out [subgraph advance features](/developing/creating/advanced/) and the [subgraph composition repo](https://github.com/incrypto32/subgraph-composition-sample-subgraph). -- Check out the Github repo [for this example] (https://github.com/isum/subgraph-composition-example). diff --git a/website/src/pages/ja/subgraphs/cookbook/subgraph-composition-three-sources.mdx b/website/src/pages/ja/subgraphs/cookbook/subgraph-composition-three-sources.mdx new file mode 100644 index 000000000000..024e79f5c7c5 --- /dev/null +++ b/website/src/pages/ja/subgraphs/cookbook/subgraph-composition-three-sources.mdx @@ -0,0 +1,124 @@ +--- +title: Integrating Three Subgraphs Using Subgraph Composition +sidebarTitle: 'Composable Subgraph with Three Source Subgraphs' +--- + +Optimize your Subgraph by merging data from three independent, source + +Subgraphs into a single composable Subgraph to enhance data aggregation. + +> Important Reminders + +> - Subgraph composition is built into the CLI, and you can deploy with [Subgraph Studio](https://thegraph.com/studio/). +> - This feature requires `specVersion` 1.3.0. +> - This example uses + +## Overview + +Subgraph composition empowers developer to leverage a Subgraph with other Subgraphs as data sources, seamlessly integrating and reacting to data updates and entity changes. This capability enhances efficiency and responsiveness in data handling. + +## Prerequisites + +To deploy **all** Subgraphs locally, you must have the following: + +- A [graph-node](https://github.com/graphprotocol/graph-node) instance running locally +- An [IPFS](https://docs.ipfs.tech/) instance running locally +- [Node.js.](https://nodejs.org/en) and npm + +## Get Started + +The following guide provides examples for defining three source Subgraphs to create one powerful composed Subgraph. + +### Specifics + +- To keep this example simple, all source subgraphs use only block handlers, but in a real environment, each source Subgraph will use data from different smart contracts. +- The examples below show how to import and extend the schema of another Subgraph to enhance its functionality. +- Each source Subgraph is optimized with a specific entity. +- All the commands listed install the necessary dependencies, generate code based on the GraphQL schema, build the Subgraph, and deploy it to your local Graph Node instance. + +### Step 1. Deploy Block Time Source Subgraph + +This first source Subgraph calculates the block time for each block. + +- It imports schemas from other Subgraphs and adds a `block` entity with a `timestamp` field, representing the time each block was mined. +- It listens to time-related blockchain events (e.g., block timestamps) and processes this data to update the Subgraph's entities accordingly. + +To deploy this Subgraph locally, run the following commands: + +```bash +npm install +npm run codegen +npm run build +npm run create-local +npm run deploy-local +``` + +### Step 1. Deploy Block Cost Source Subgraph + +This second source Subgraph indexes the cost of each block. + +#### Key Functions + +- It imports schemas from other Subgraphs and adds a `block` entity with cost-related fields. +- It listens to blockchain events related to costs (e.g. gas fees, transaction costs) and processes this data to update the Subgraph's entities accordingly. + +To deploy this Subgraph locally, run the following commands: + +```bash +npm install +npm run codegen +npm run build +npm run create-local +npm run deploy-local +``` + +### Step 2. Define Block Size in Source Subgraph + +This third source Subgraph indexes the size of each block. + +#### Key Functions + +- It imports existing schemas from other Subgraphs and adds a `Block` entity with a `size` field representing each block's size. +- It listens to blockchain events related to block sizes (e.g., storage or volume) and processes this data to update the Subgraph's entities accordingly. + +To deploy this Subgraph locally, run the following commands: + +```bash +npm install +npm run codegen +npm run build +npm run create-local +npm run deploy-local +``` + +### Step 3. Combine Into Block Stats Subgraph + +This composed Subgraph combines and aggregates the information from the three source Subgraphs above. To learn how to use aggregations, check out Subgraph [advanced features](https://thegraph.com/docs/en/subgraphs/developing/creating/advanced/#timeseries-and-aggregations). + +> [!NOTE] Any change to a source Subgraph will likely generate a new deployment ID. Be sure to update the deployment ID in the data source address of the Subgraph manifest to take advantage of the latest changes. [!IMPORTANT] All source Subgraphs should be deployed before the composed Subgraph is deployed. + +This composed Subgraph demonstrates how to create a subgraph that aggregates data from three source subgraphs, providing a unified, enhanced view of block statistics. + +#### Key Functions + +- It provides a consolidated data model that encompasses all relevant block metrics. +- It combines data from three source subgraphs, and provides a comprehensive view of block statistics, enabling more complex queries and analyses. To deploy this subgraph locally, run the following commands: + +```bash +npm install +npm run codegen +npm run build +npm run create-local +npm run deploy-local +``` + +## Key Takeaways + +- This powerful tool will scale your subgraph development and allow you to combine multiple Subgraphs. +- The setup includes the deployment of three source Subgraphs and one final deployment of the composed Subgraph. +- This feature unlocks scalability, simplifying both development and maintenance efficiency. + +## Additional Resources + +- Add advanced features in your subgraph. Check out [subgraph advance features](/developing/creating/advanced/) and the [subgraph composition repo](https://github.com/incrypto32/subgraph-composition-sample-subgraph). +- Check out all the code for this example in [the Github repo] (https://github.com/isum/subgraph-composition-example). diff --git a/website/src/pages/ko/subgraphs/cookbook/_meta.js b/website/src/pages/ko/subgraphs/cookbook/_meta.js index ae67ab7baed1..1b169037deee 100644 --- a/website/src/pages/ko/subgraphs/cookbook/_meta.js +++ b/website/src/pages/ko/subgraphs/cookbook/_meta.js @@ -1,4 +1,5 @@ export default { + 'subgraph-composition-three-sources': '', 'subgraph-debug-forking': '', near: '', arweave: '', @@ -8,5 +9,4 @@ export default { enums: '', 'secure-api-keys-nextjs': '', polymarket: '', - 'subgraph-composition-three-sources': '', } diff --git a/website/src/pages/ko/subgraphs/cookbook/subgraph-composition-three-source.mdx b/website/src/pages/ko/subgraphs/cookbook/subgraph-composition-three-source.mdx deleted file mode 100644 index 80b86a24d036..000000000000 --- a/website/src/pages/ko/subgraphs/cookbook/subgraph-composition-three-source.mdx +++ /dev/null @@ -1,121 +0,0 @@ ---- -title: Integrating Three Subgraphs Using Subgraph Composition -sidebarTitle: 'Subgraph Composition with Three Source Subgraphs' ---- - -Optimize your Subgraph by merging data from three independent, `source` Subgraphs into a single composable Subgraph to enhance data aggregation. - -> Important Reminders - -> - Subgraph composition is built into the CLI, and you can deploy with [Subgraph Studio](https://thegraph.com/studio/). -> - This feature requires spec version 1.3.0. - -## Overview - -Subgraph composition empowers developer to leverage a Subgraph with other Subgraphs as data sources, seamlessly integrating and reacting to data updates and entity changes. This capability enhances efficiency and responsiveness in data handling. - -## Prerequisites - -To deploy **all** Subgraphs locally, you must have the following: - -- A [graph-node](https://github.com/graphprotocol/graph-node) instance running locally -- An [IPFS](https://docs.ipfs.tech/) instance running locally -- [Node.js.](https://nodejs.org/en) and npm - -## Get Started - -The following guide provides examples for defining three `source` Subgraphs to create one powerful composed Subgraph. - -### Specifics - -- To keep this example simple, all `source` subgraphs use only block handlers, but in a real environment, each source Subgraph will use data from different smart contracts. -- The examples below show how to import and extend the schema of another Subgraph to enhance its functionality. -- Each source Subgraph is optimized with a specific entity. -- All the commands listed install the necessary dependencies, generate code based on the GraphQL schema, build the Subgraph, and deploy it to your local Graph Node instance. - -### Step 1. Deploy Block Time Source Subgraph - -This first source Subgraph calculates the block time for each block. - -- It imports schemas from other Subgraphs and adds a `block` entity with a `timestamp` field, representing the time each block was mined. -- It listens to time-related blockchain events (e.g., block timestamps) and processes this data to update the Subgraph's entities accordingly. - -To deploy this Subgraph locally, run the following commands: - -```bash -npm install -npm run codegen -npm run build -npm run create-local -npm run deploy-local -``` - -### Step 1. Deploy Block Cost Source Subgraph - -This second `source` Subgraph indexes the cost of each block. - -#### Key Functions - -- It imports schemas from other Subgraphs and adds a `block` entity with cost-related fields. -- It listens to blockchain events related to costs (e.g. gas fees, transaction costs) and processes this data to update the Subgraph's entities accordingly. - -To deploy this Subgraph locally, run the following commands: - -```bash -npm install -npm run codegen -npm run build -npm run create-local -npm run deploy-local -``` - -### Step 2. Define Block Size in Source Subgraph - -This third `source` Subgraph indexes the size of each block. - -#### Key Functions - -- It imports existing schemas from other Subgraphs and adds a `Block` entity with a `size` field representing each block's size. -- It listens to blockchain events related to block sizes (e.g., storage or volume) and processes this data to update the Subgraph's entities accordingly. - -To deploy this Subgraph locally, run the following commands: - -```bash -npm install -npm run codegen -npm run build -npm run create-local -npm run deploy-local -``` - -### Step 3. Combine Into Block Stats Subgraph - -This composed Subgraph combines and aggregates the information from the three source Subgraphs above. - -> [!NOTE] Any change to a source Subgraph will likely generate a new deployment ID. Be sure to update the deployment ID in the data source address of the Subgraph manifest to take advantage of the latest changes. [!IMPORTANT] All source Subgraphs should be deployed before the composed Subgraph is deployed. - -This composed Subgraph demonstrates how to create a subgraph that aggregates data from three source subgraphs, providing a unified, enhanced view of block statistics. - -#### Key Functions - -- It provides a consolidated data model that encompasses all relevant block metrics. -- It combines data from three `source` subgraphs, and provides a comprehensive view of block statistics, enabling more complex queries and analyses. To deploy this subgraph locally, run the following commands: - -```bash -npm install -npm run codegen -npm run build -npm run create-local -npm run deploy-local -``` - -## Key Takeaways - -- This powerful tool will scale your subgraph development and allow you to combine multiple Subgraphs. -- The setup includes the deployment of three source Subgraphs and one final deployment of the composed Subgraph. -- This feature unlocks scalability, simplifying both development and maintenance efficiency. - -## Additional Resources - -- Add advanced features in your subgraph. Check out [subgraph advance features](/developing/creating/advanced/) and the [subgraph composition repo](https://github.com/incrypto32/subgraph-composition-sample-subgraph). -- Check out the Github repo [for this example] (https://github.com/isum/subgraph-composition-example). diff --git a/website/src/pages/ko/subgraphs/cookbook/subgraph-composition-three-sources.mdx b/website/src/pages/ko/subgraphs/cookbook/subgraph-composition-three-sources.mdx new file mode 100644 index 000000000000..024e79f5c7c5 --- /dev/null +++ b/website/src/pages/ko/subgraphs/cookbook/subgraph-composition-three-sources.mdx @@ -0,0 +1,124 @@ +--- +title: Integrating Three Subgraphs Using Subgraph Composition +sidebarTitle: 'Composable Subgraph with Three Source Subgraphs' +--- + +Optimize your Subgraph by merging data from three independent, source + +Subgraphs into a single composable Subgraph to enhance data aggregation. + +> Important Reminders + +> - Subgraph composition is built into the CLI, and you can deploy with [Subgraph Studio](https://thegraph.com/studio/). +> - This feature requires `specVersion` 1.3.0. +> - This example uses + +## Overview + +Subgraph composition empowers developer to leverage a Subgraph with other Subgraphs as data sources, seamlessly integrating and reacting to data updates and entity changes. This capability enhances efficiency and responsiveness in data handling. + +## Prerequisites + +To deploy **all** Subgraphs locally, you must have the following: + +- A [graph-node](https://github.com/graphprotocol/graph-node) instance running locally +- An [IPFS](https://docs.ipfs.tech/) instance running locally +- [Node.js.](https://nodejs.org/en) and npm + +## Get Started + +The following guide provides examples for defining three source Subgraphs to create one powerful composed Subgraph. + +### Specifics + +- To keep this example simple, all source subgraphs use only block handlers, but in a real environment, each source Subgraph will use data from different smart contracts. +- The examples below show how to import and extend the schema of another Subgraph to enhance its functionality. +- Each source Subgraph is optimized with a specific entity. +- All the commands listed install the necessary dependencies, generate code based on the GraphQL schema, build the Subgraph, and deploy it to your local Graph Node instance. + +### Step 1. Deploy Block Time Source Subgraph + +This first source Subgraph calculates the block time for each block. + +- It imports schemas from other Subgraphs and adds a `block` entity with a `timestamp` field, representing the time each block was mined. +- It listens to time-related blockchain events (e.g., block timestamps) and processes this data to update the Subgraph's entities accordingly. + +To deploy this Subgraph locally, run the following commands: + +```bash +npm install +npm run codegen +npm run build +npm run create-local +npm run deploy-local +``` + +### Step 1. Deploy Block Cost Source Subgraph + +This second source Subgraph indexes the cost of each block. + +#### Key Functions + +- It imports schemas from other Subgraphs and adds a `block` entity with cost-related fields. +- It listens to blockchain events related to costs (e.g. gas fees, transaction costs) and processes this data to update the Subgraph's entities accordingly. + +To deploy this Subgraph locally, run the following commands: + +```bash +npm install +npm run codegen +npm run build +npm run create-local +npm run deploy-local +``` + +### Step 2. Define Block Size in Source Subgraph + +This third source Subgraph indexes the size of each block. + +#### Key Functions + +- It imports existing schemas from other Subgraphs and adds a `Block` entity with a `size` field representing each block's size. +- It listens to blockchain events related to block sizes (e.g., storage or volume) and processes this data to update the Subgraph's entities accordingly. + +To deploy this Subgraph locally, run the following commands: + +```bash +npm install +npm run codegen +npm run build +npm run create-local +npm run deploy-local +``` + +### Step 3. Combine Into Block Stats Subgraph + +This composed Subgraph combines and aggregates the information from the three source Subgraphs above. To learn how to use aggregations, check out Subgraph [advanced features](https://thegraph.com/docs/en/subgraphs/developing/creating/advanced/#timeseries-and-aggregations). + +> [!NOTE] Any change to a source Subgraph will likely generate a new deployment ID. Be sure to update the deployment ID in the data source address of the Subgraph manifest to take advantage of the latest changes. [!IMPORTANT] All source Subgraphs should be deployed before the composed Subgraph is deployed. + +This composed Subgraph demonstrates how to create a subgraph that aggregates data from three source subgraphs, providing a unified, enhanced view of block statistics. + +#### Key Functions + +- It provides a consolidated data model that encompasses all relevant block metrics. +- It combines data from three source subgraphs, and provides a comprehensive view of block statistics, enabling more complex queries and analyses. To deploy this subgraph locally, run the following commands: + +```bash +npm install +npm run codegen +npm run build +npm run create-local +npm run deploy-local +``` + +## Key Takeaways + +- This powerful tool will scale your subgraph development and allow you to combine multiple Subgraphs. +- The setup includes the deployment of three source Subgraphs and one final deployment of the composed Subgraph. +- This feature unlocks scalability, simplifying both development and maintenance efficiency. + +## Additional Resources + +- Add advanced features in your subgraph. Check out [subgraph advance features](/developing/creating/advanced/) and the [subgraph composition repo](https://github.com/incrypto32/subgraph-composition-sample-subgraph). +- Check out all the code for this example in [the Github repo] (https://github.com/isum/subgraph-composition-example). diff --git a/website/src/pages/mr/subgraphs/cookbook/_meta.js b/website/src/pages/mr/subgraphs/cookbook/_meta.js index ae67ab7baed1..1b169037deee 100644 --- a/website/src/pages/mr/subgraphs/cookbook/_meta.js +++ b/website/src/pages/mr/subgraphs/cookbook/_meta.js @@ -1,4 +1,5 @@ export default { + 'subgraph-composition-three-sources': '', 'subgraph-debug-forking': '', near: '', arweave: '', @@ -8,5 +9,4 @@ export default { enums: '', 'secure-api-keys-nextjs': '', polymarket: '', - 'subgraph-composition-three-sources': '', } diff --git a/website/src/pages/mr/subgraphs/cookbook/subgraph-composition-three-source.mdx b/website/src/pages/mr/subgraphs/cookbook/subgraph-composition-three-source.mdx deleted file mode 100644 index 80b86a24d036..000000000000 --- a/website/src/pages/mr/subgraphs/cookbook/subgraph-composition-three-source.mdx +++ /dev/null @@ -1,121 +0,0 @@ ---- -title: Integrating Three Subgraphs Using Subgraph Composition -sidebarTitle: 'Subgraph Composition with Three Source Subgraphs' ---- - -Optimize your Subgraph by merging data from three independent, `source` Subgraphs into a single composable Subgraph to enhance data aggregation. - -> Important Reminders - -> - Subgraph composition is built into the CLI, and you can deploy with [Subgraph Studio](https://thegraph.com/studio/). -> - This feature requires spec version 1.3.0. - -## Overview - -Subgraph composition empowers developer to leverage a Subgraph with other Subgraphs as data sources, seamlessly integrating and reacting to data updates and entity changes. This capability enhances efficiency and responsiveness in data handling. - -## Prerequisites - -To deploy **all** Subgraphs locally, you must have the following: - -- A [graph-node](https://github.com/graphprotocol/graph-node) instance running locally -- An [IPFS](https://docs.ipfs.tech/) instance running locally -- [Node.js.](https://nodejs.org/en) and npm - -## Get Started - -The following guide provides examples for defining three `source` Subgraphs to create one powerful composed Subgraph. - -### Specifics - -- To keep this example simple, all `source` subgraphs use only block handlers, but in a real environment, each source Subgraph will use data from different smart contracts. -- The examples below show how to import and extend the schema of another Subgraph to enhance its functionality. -- Each source Subgraph is optimized with a specific entity. -- All the commands listed install the necessary dependencies, generate code based on the GraphQL schema, build the Subgraph, and deploy it to your local Graph Node instance. - -### Step 1. Deploy Block Time Source Subgraph - -This first source Subgraph calculates the block time for each block. - -- It imports schemas from other Subgraphs and adds a `block` entity with a `timestamp` field, representing the time each block was mined. -- It listens to time-related blockchain events (e.g., block timestamps) and processes this data to update the Subgraph's entities accordingly. - -To deploy this Subgraph locally, run the following commands: - -```bash -npm install -npm run codegen -npm run build -npm run create-local -npm run deploy-local -``` - -### Step 1. Deploy Block Cost Source Subgraph - -This second `source` Subgraph indexes the cost of each block. - -#### Key Functions - -- It imports schemas from other Subgraphs and adds a `block` entity with cost-related fields. -- It listens to blockchain events related to costs (e.g. gas fees, transaction costs) and processes this data to update the Subgraph's entities accordingly. - -To deploy this Subgraph locally, run the following commands: - -```bash -npm install -npm run codegen -npm run build -npm run create-local -npm run deploy-local -``` - -### Step 2. Define Block Size in Source Subgraph - -This third `source` Subgraph indexes the size of each block. - -#### Key Functions - -- It imports existing schemas from other Subgraphs and adds a `Block` entity with a `size` field representing each block's size. -- It listens to blockchain events related to block sizes (e.g., storage or volume) and processes this data to update the Subgraph's entities accordingly. - -To deploy this Subgraph locally, run the following commands: - -```bash -npm install -npm run codegen -npm run build -npm run create-local -npm run deploy-local -``` - -### Step 3. Combine Into Block Stats Subgraph - -This composed Subgraph combines and aggregates the information from the three source Subgraphs above. - -> [!NOTE] Any change to a source Subgraph will likely generate a new deployment ID. Be sure to update the deployment ID in the data source address of the Subgraph manifest to take advantage of the latest changes. [!IMPORTANT] All source Subgraphs should be deployed before the composed Subgraph is deployed. - -This composed Subgraph demonstrates how to create a subgraph that aggregates data from three source subgraphs, providing a unified, enhanced view of block statistics. - -#### Key Functions - -- It provides a consolidated data model that encompasses all relevant block metrics. -- It combines data from three `source` subgraphs, and provides a comprehensive view of block statistics, enabling more complex queries and analyses. To deploy this subgraph locally, run the following commands: - -```bash -npm install -npm run codegen -npm run build -npm run create-local -npm run deploy-local -``` - -## Key Takeaways - -- This powerful tool will scale your subgraph development and allow you to combine multiple Subgraphs. -- The setup includes the deployment of three source Subgraphs and one final deployment of the composed Subgraph. -- This feature unlocks scalability, simplifying both development and maintenance efficiency. - -## Additional Resources - -- Add advanced features in your subgraph. Check out [subgraph advance features](/developing/creating/advanced/) and the [subgraph composition repo](https://github.com/incrypto32/subgraph-composition-sample-subgraph). -- Check out the Github repo [for this example] (https://github.com/isum/subgraph-composition-example). diff --git a/website/src/pages/mr/subgraphs/cookbook/subgraph-composition-three-sources.mdx b/website/src/pages/mr/subgraphs/cookbook/subgraph-composition-three-sources.mdx new file mode 100644 index 000000000000..024e79f5c7c5 --- /dev/null +++ b/website/src/pages/mr/subgraphs/cookbook/subgraph-composition-three-sources.mdx @@ -0,0 +1,124 @@ +--- +title: Integrating Three Subgraphs Using Subgraph Composition +sidebarTitle: 'Composable Subgraph with Three Source Subgraphs' +--- + +Optimize your Subgraph by merging data from three independent, source + +Subgraphs into a single composable Subgraph to enhance data aggregation. + +> Important Reminders + +> - Subgraph composition is built into the CLI, and you can deploy with [Subgraph Studio](https://thegraph.com/studio/). +> - This feature requires `specVersion` 1.3.0. +> - This example uses + +## Overview + +Subgraph composition empowers developer to leverage a Subgraph with other Subgraphs as data sources, seamlessly integrating and reacting to data updates and entity changes. This capability enhances efficiency and responsiveness in data handling. + +## Prerequisites + +To deploy **all** Subgraphs locally, you must have the following: + +- A [graph-node](https://github.com/graphprotocol/graph-node) instance running locally +- An [IPFS](https://docs.ipfs.tech/) instance running locally +- [Node.js.](https://nodejs.org/en) and npm + +## Get Started + +The following guide provides examples for defining three source Subgraphs to create one powerful composed Subgraph. + +### Specifics + +- To keep this example simple, all source subgraphs use only block handlers, but in a real environment, each source Subgraph will use data from different smart contracts. +- The examples below show how to import and extend the schema of another Subgraph to enhance its functionality. +- Each source Subgraph is optimized with a specific entity. +- All the commands listed install the necessary dependencies, generate code based on the GraphQL schema, build the Subgraph, and deploy it to your local Graph Node instance. + +### Step 1. Deploy Block Time Source Subgraph + +This first source Subgraph calculates the block time for each block. + +- It imports schemas from other Subgraphs and adds a `block` entity with a `timestamp` field, representing the time each block was mined. +- It listens to time-related blockchain events (e.g., block timestamps) and processes this data to update the Subgraph's entities accordingly. + +To deploy this Subgraph locally, run the following commands: + +```bash +npm install +npm run codegen +npm run build +npm run create-local +npm run deploy-local +``` + +### Step 1. Deploy Block Cost Source Subgraph + +This second source Subgraph indexes the cost of each block. + +#### Key Functions + +- It imports schemas from other Subgraphs and adds a `block` entity with cost-related fields. +- It listens to blockchain events related to costs (e.g. gas fees, transaction costs) and processes this data to update the Subgraph's entities accordingly. + +To deploy this Subgraph locally, run the following commands: + +```bash +npm install +npm run codegen +npm run build +npm run create-local +npm run deploy-local +``` + +### Step 2. Define Block Size in Source Subgraph + +This third source Subgraph indexes the size of each block. + +#### Key Functions + +- It imports existing schemas from other Subgraphs and adds a `Block` entity with a `size` field representing each block's size. +- It listens to blockchain events related to block sizes (e.g., storage or volume) and processes this data to update the Subgraph's entities accordingly. + +To deploy this Subgraph locally, run the following commands: + +```bash +npm install +npm run codegen +npm run build +npm run create-local +npm run deploy-local +``` + +### Step 3. Combine Into Block Stats Subgraph + +This composed Subgraph combines and aggregates the information from the three source Subgraphs above. To learn how to use aggregations, check out Subgraph [advanced features](https://thegraph.com/docs/en/subgraphs/developing/creating/advanced/#timeseries-and-aggregations). + +> [!NOTE] Any change to a source Subgraph will likely generate a new deployment ID. Be sure to update the deployment ID in the data source address of the Subgraph manifest to take advantage of the latest changes. [!IMPORTANT] All source Subgraphs should be deployed before the composed Subgraph is deployed. + +This composed Subgraph demonstrates how to create a subgraph that aggregates data from three source subgraphs, providing a unified, enhanced view of block statistics. + +#### Key Functions + +- It provides a consolidated data model that encompasses all relevant block metrics. +- It combines data from three source subgraphs, and provides a comprehensive view of block statistics, enabling more complex queries and analyses. To deploy this subgraph locally, run the following commands: + +```bash +npm install +npm run codegen +npm run build +npm run create-local +npm run deploy-local +``` + +## Key Takeaways + +- This powerful tool will scale your subgraph development and allow you to combine multiple Subgraphs. +- The setup includes the deployment of three source Subgraphs and one final deployment of the composed Subgraph. +- This feature unlocks scalability, simplifying both development and maintenance efficiency. + +## Additional Resources + +- Add advanced features in your subgraph. Check out [subgraph advance features](/developing/creating/advanced/) and the [subgraph composition repo](https://github.com/incrypto32/subgraph-composition-sample-subgraph). +- Check out all the code for this example in [the Github repo] (https://github.com/isum/subgraph-composition-example). diff --git a/website/src/pages/nl/subgraphs/cookbook/_meta.js b/website/src/pages/nl/subgraphs/cookbook/_meta.js index ae67ab7baed1..1b169037deee 100644 --- a/website/src/pages/nl/subgraphs/cookbook/_meta.js +++ b/website/src/pages/nl/subgraphs/cookbook/_meta.js @@ -1,4 +1,5 @@ export default { + 'subgraph-composition-three-sources': '', 'subgraph-debug-forking': '', near: '', arweave: '', @@ -8,5 +9,4 @@ export default { enums: '', 'secure-api-keys-nextjs': '', polymarket: '', - 'subgraph-composition-three-sources': '', } diff --git a/website/src/pages/nl/subgraphs/cookbook/subgraph-composition-three-source.mdx b/website/src/pages/nl/subgraphs/cookbook/subgraph-composition-three-source.mdx deleted file mode 100644 index 80b86a24d036..000000000000 --- a/website/src/pages/nl/subgraphs/cookbook/subgraph-composition-three-source.mdx +++ /dev/null @@ -1,121 +0,0 @@ ---- -title: Integrating Three Subgraphs Using Subgraph Composition -sidebarTitle: 'Subgraph Composition with Three Source Subgraphs' ---- - -Optimize your Subgraph by merging data from three independent, `source` Subgraphs into a single composable Subgraph to enhance data aggregation. - -> Important Reminders - -> - Subgraph composition is built into the CLI, and you can deploy with [Subgraph Studio](https://thegraph.com/studio/). -> - This feature requires spec version 1.3.0. - -## Overview - -Subgraph composition empowers developer to leverage a Subgraph with other Subgraphs as data sources, seamlessly integrating and reacting to data updates and entity changes. This capability enhances efficiency and responsiveness in data handling. - -## Prerequisites - -To deploy **all** Subgraphs locally, you must have the following: - -- A [graph-node](https://github.com/graphprotocol/graph-node) instance running locally -- An [IPFS](https://docs.ipfs.tech/) instance running locally -- [Node.js.](https://nodejs.org/en) and npm - -## Get Started - -The following guide provides examples for defining three `source` Subgraphs to create one powerful composed Subgraph. - -### Specifics - -- To keep this example simple, all `source` subgraphs use only block handlers, but in a real environment, each source Subgraph will use data from different smart contracts. -- The examples below show how to import and extend the schema of another Subgraph to enhance its functionality. -- Each source Subgraph is optimized with a specific entity. -- All the commands listed install the necessary dependencies, generate code based on the GraphQL schema, build the Subgraph, and deploy it to your local Graph Node instance. - -### Step 1. Deploy Block Time Source Subgraph - -This first source Subgraph calculates the block time for each block. - -- It imports schemas from other Subgraphs and adds a `block` entity with a `timestamp` field, representing the time each block was mined. -- It listens to time-related blockchain events (e.g., block timestamps) and processes this data to update the Subgraph's entities accordingly. - -To deploy this Subgraph locally, run the following commands: - -```bash -npm install -npm run codegen -npm run build -npm run create-local -npm run deploy-local -``` - -### Step 1. Deploy Block Cost Source Subgraph - -This second `source` Subgraph indexes the cost of each block. - -#### Key Functions - -- It imports schemas from other Subgraphs and adds a `block` entity with cost-related fields. -- It listens to blockchain events related to costs (e.g. gas fees, transaction costs) and processes this data to update the Subgraph's entities accordingly. - -To deploy this Subgraph locally, run the following commands: - -```bash -npm install -npm run codegen -npm run build -npm run create-local -npm run deploy-local -``` - -### Step 2. Define Block Size in Source Subgraph - -This third `source` Subgraph indexes the size of each block. - -#### Key Functions - -- It imports existing schemas from other Subgraphs and adds a `Block` entity with a `size` field representing each block's size. -- It listens to blockchain events related to block sizes (e.g., storage or volume) and processes this data to update the Subgraph's entities accordingly. - -To deploy this Subgraph locally, run the following commands: - -```bash -npm install -npm run codegen -npm run build -npm run create-local -npm run deploy-local -``` - -### Step 3. Combine Into Block Stats Subgraph - -This composed Subgraph combines and aggregates the information from the three source Subgraphs above. - -> [!NOTE] Any change to a source Subgraph will likely generate a new deployment ID. Be sure to update the deployment ID in the data source address of the Subgraph manifest to take advantage of the latest changes. [!IMPORTANT] All source Subgraphs should be deployed before the composed Subgraph is deployed. - -This composed Subgraph demonstrates how to create a subgraph that aggregates data from three source subgraphs, providing a unified, enhanced view of block statistics. - -#### Key Functions - -- It provides a consolidated data model that encompasses all relevant block metrics. -- It combines data from three `source` subgraphs, and provides a comprehensive view of block statistics, enabling more complex queries and analyses. To deploy this subgraph locally, run the following commands: - -```bash -npm install -npm run codegen -npm run build -npm run create-local -npm run deploy-local -``` - -## Key Takeaways - -- This powerful tool will scale your subgraph development and allow you to combine multiple Subgraphs. -- The setup includes the deployment of three source Subgraphs and one final deployment of the composed Subgraph. -- This feature unlocks scalability, simplifying both development and maintenance efficiency. - -## Additional Resources - -- Add advanced features in your subgraph. Check out [subgraph advance features](/developing/creating/advanced/) and the [subgraph composition repo](https://github.com/incrypto32/subgraph-composition-sample-subgraph). -- Check out the Github repo [for this example] (https://github.com/isum/subgraph-composition-example). diff --git a/website/src/pages/nl/subgraphs/cookbook/subgraph-composition-three-sources.mdx b/website/src/pages/nl/subgraphs/cookbook/subgraph-composition-three-sources.mdx new file mode 100644 index 000000000000..024e79f5c7c5 --- /dev/null +++ b/website/src/pages/nl/subgraphs/cookbook/subgraph-composition-three-sources.mdx @@ -0,0 +1,124 @@ +--- +title: Integrating Three Subgraphs Using Subgraph Composition +sidebarTitle: 'Composable Subgraph with Three Source Subgraphs' +--- + +Optimize your Subgraph by merging data from three independent, source + +Subgraphs into a single composable Subgraph to enhance data aggregation. + +> Important Reminders + +> - Subgraph composition is built into the CLI, and you can deploy with [Subgraph Studio](https://thegraph.com/studio/). +> - This feature requires `specVersion` 1.3.0. +> - This example uses + +## Overview + +Subgraph composition empowers developer to leverage a Subgraph with other Subgraphs as data sources, seamlessly integrating and reacting to data updates and entity changes. This capability enhances efficiency and responsiveness in data handling. + +## Prerequisites + +To deploy **all** Subgraphs locally, you must have the following: + +- A [graph-node](https://github.com/graphprotocol/graph-node) instance running locally +- An [IPFS](https://docs.ipfs.tech/) instance running locally +- [Node.js.](https://nodejs.org/en) and npm + +## Get Started + +The following guide provides examples for defining three source Subgraphs to create one powerful composed Subgraph. + +### Specifics + +- To keep this example simple, all source subgraphs use only block handlers, but in a real environment, each source Subgraph will use data from different smart contracts. +- The examples below show how to import and extend the schema of another Subgraph to enhance its functionality. +- Each source Subgraph is optimized with a specific entity. +- All the commands listed install the necessary dependencies, generate code based on the GraphQL schema, build the Subgraph, and deploy it to your local Graph Node instance. + +### Step 1. Deploy Block Time Source Subgraph + +This first source Subgraph calculates the block time for each block. + +- It imports schemas from other Subgraphs and adds a `block` entity with a `timestamp` field, representing the time each block was mined. +- It listens to time-related blockchain events (e.g., block timestamps) and processes this data to update the Subgraph's entities accordingly. + +To deploy this Subgraph locally, run the following commands: + +```bash +npm install +npm run codegen +npm run build +npm run create-local +npm run deploy-local +``` + +### Step 1. Deploy Block Cost Source Subgraph + +This second source Subgraph indexes the cost of each block. + +#### Key Functions + +- It imports schemas from other Subgraphs and adds a `block` entity with cost-related fields. +- It listens to blockchain events related to costs (e.g. gas fees, transaction costs) and processes this data to update the Subgraph's entities accordingly. + +To deploy this Subgraph locally, run the following commands: + +```bash +npm install +npm run codegen +npm run build +npm run create-local +npm run deploy-local +``` + +### Step 2. Define Block Size in Source Subgraph + +This third source Subgraph indexes the size of each block. + +#### Key Functions + +- It imports existing schemas from other Subgraphs and adds a `Block` entity with a `size` field representing each block's size. +- It listens to blockchain events related to block sizes (e.g., storage or volume) and processes this data to update the Subgraph's entities accordingly. + +To deploy this Subgraph locally, run the following commands: + +```bash +npm install +npm run codegen +npm run build +npm run create-local +npm run deploy-local +``` + +### Step 3. Combine Into Block Stats Subgraph + +This composed Subgraph combines and aggregates the information from the three source Subgraphs above. To learn how to use aggregations, check out Subgraph [advanced features](https://thegraph.com/docs/en/subgraphs/developing/creating/advanced/#timeseries-and-aggregations). + +> [!NOTE] Any change to a source Subgraph will likely generate a new deployment ID. Be sure to update the deployment ID in the data source address of the Subgraph manifest to take advantage of the latest changes. [!IMPORTANT] All source Subgraphs should be deployed before the composed Subgraph is deployed. + +This composed Subgraph demonstrates how to create a subgraph that aggregates data from three source subgraphs, providing a unified, enhanced view of block statistics. + +#### Key Functions + +- It provides a consolidated data model that encompasses all relevant block metrics. +- It combines data from three source subgraphs, and provides a comprehensive view of block statistics, enabling more complex queries and analyses. To deploy this subgraph locally, run the following commands: + +```bash +npm install +npm run codegen +npm run build +npm run create-local +npm run deploy-local +``` + +## Key Takeaways + +- This powerful tool will scale your subgraph development and allow you to combine multiple Subgraphs. +- The setup includes the deployment of three source Subgraphs and one final deployment of the composed Subgraph. +- This feature unlocks scalability, simplifying both development and maintenance efficiency. + +## Additional Resources + +- Add advanced features in your subgraph. Check out [subgraph advance features](/developing/creating/advanced/) and the [subgraph composition repo](https://github.com/incrypto32/subgraph-composition-sample-subgraph). +- Check out all the code for this example in [the Github repo] (https://github.com/isum/subgraph-composition-example). diff --git a/website/src/pages/pl/subgraphs/cookbook/_meta.js b/website/src/pages/pl/subgraphs/cookbook/_meta.js index ae67ab7baed1..1b169037deee 100644 --- a/website/src/pages/pl/subgraphs/cookbook/_meta.js +++ b/website/src/pages/pl/subgraphs/cookbook/_meta.js @@ -1,4 +1,5 @@ export default { + 'subgraph-composition-three-sources': '', 'subgraph-debug-forking': '', near: '', arweave: '', @@ -8,5 +9,4 @@ export default { enums: '', 'secure-api-keys-nextjs': '', polymarket: '', - 'subgraph-composition-three-sources': '', } diff --git a/website/src/pages/pl/subgraphs/cookbook/subgraph-composition-three-source.mdx b/website/src/pages/pl/subgraphs/cookbook/subgraph-composition-three-source.mdx deleted file mode 100644 index 80b86a24d036..000000000000 --- a/website/src/pages/pl/subgraphs/cookbook/subgraph-composition-three-source.mdx +++ /dev/null @@ -1,121 +0,0 @@ ---- -title: Integrating Three Subgraphs Using Subgraph Composition -sidebarTitle: 'Subgraph Composition with Three Source Subgraphs' ---- - -Optimize your Subgraph by merging data from three independent, `source` Subgraphs into a single composable Subgraph to enhance data aggregation. - -> Important Reminders - -> - Subgraph composition is built into the CLI, and you can deploy with [Subgraph Studio](https://thegraph.com/studio/). -> - This feature requires spec version 1.3.0. - -## Overview - -Subgraph composition empowers developer to leverage a Subgraph with other Subgraphs as data sources, seamlessly integrating and reacting to data updates and entity changes. This capability enhances efficiency and responsiveness in data handling. - -## Prerequisites - -To deploy **all** Subgraphs locally, you must have the following: - -- A [graph-node](https://github.com/graphprotocol/graph-node) instance running locally -- An [IPFS](https://docs.ipfs.tech/) instance running locally -- [Node.js.](https://nodejs.org/en) and npm - -## Get Started - -The following guide provides examples for defining three `source` Subgraphs to create one powerful composed Subgraph. - -### Specifics - -- To keep this example simple, all `source` subgraphs use only block handlers, but in a real environment, each source Subgraph will use data from different smart contracts. -- The examples below show how to import and extend the schema of another Subgraph to enhance its functionality. -- Each source Subgraph is optimized with a specific entity. -- All the commands listed install the necessary dependencies, generate code based on the GraphQL schema, build the Subgraph, and deploy it to your local Graph Node instance. - -### Step 1. Deploy Block Time Source Subgraph - -This first source Subgraph calculates the block time for each block. - -- It imports schemas from other Subgraphs and adds a `block` entity with a `timestamp` field, representing the time each block was mined. -- It listens to time-related blockchain events (e.g., block timestamps) and processes this data to update the Subgraph's entities accordingly. - -To deploy this Subgraph locally, run the following commands: - -```bash -npm install -npm run codegen -npm run build -npm run create-local -npm run deploy-local -``` - -### Step 1. Deploy Block Cost Source Subgraph - -This second `source` Subgraph indexes the cost of each block. - -#### Key Functions - -- It imports schemas from other Subgraphs and adds a `block` entity with cost-related fields. -- It listens to blockchain events related to costs (e.g. gas fees, transaction costs) and processes this data to update the Subgraph's entities accordingly. - -To deploy this Subgraph locally, run the following commands: - -```bash -npm install -npm run codegen -npm run build -npm run create-local -npm run deploy-local -``` - -### Step 2. Define Block Size in Source Subgraph - -This third `source` Subgraph indexes the size of each block. - -#### Key Functions - -- It imports existing schemas from other Subgraphs and adds a `Block` entity with a `size` field representing each block's size. -- It listens to blockchain events related to block sizes (e.g., storage or volume) and processes this data to update the Subgraph's entities accordingly. - -To deploy this Subgraph locally, run the following commands: - -```bash -npm install -npm run codegen -npm run build -npm run create-local -npm run deploy-local -``` - -### Step 3. Combine Into Block Stats Subgraph - -This composed Subgraph combines and aggregates the information from the three source Subgraphs above. - -> [!NOTE] Any change to a source Subgraph will likely generate a new deployment ID. Be sure to update the deployment ID in the data source address of the Subgraph manifest to take advantage of the latest changes. [!IMPORTANT] All source Subgraphs should be deployed before the composed Subgraph is deployed. - -This composed Subgraph demonstrates how to create a subgraph that aggregates data from three source subgraphs, providing a unified, enhanced view of block statistics. - -#### Key Functions - -- It provides a consolidated data model that encompasses all relevant block metrics. -- It combines data from three `source` subgraphs, and provides a comprehensive view of block statistics, enabling more complex queries and analyses. To deploy this subgraph locally, run the following commands: - -```bash -npm install -npm run codegen -npm run build -npm run create-local -npm run deploy-local -``` - -## Key Takeaways - -- This powerful tool will scale your subgraph development and allow you to combine multiple Subgraphs. -- The setup includes the deployment of three source Subgraphs and one final deployment of the composed Subgraph. -- This feature unlocks scalability, simplifying both development and maintenance efficiency. - -## Additional Resources - -- Add advanced features in your subgraph. Check out [subgraph advance features](/developing/creating/advanced/) and the [subgraph composition repo](https://github.com/incrypto32/subgraph-composition-sample-subgraph). -- Check out the Github repo [for this example] (https://github.com/isum/subgraph-composition-example). diff --git a/website/src/pages/pl/subgraphs/cookbook/subgraph-composition-three-sources.mdx b/website/src/pages/pl/subgraphs/cookbook/subgraph-composition-three-sources.mdx new file mode 100644 index 000000000000..024e79f5c7c5 --- /dev/null +++ b/website/src/pages/pl/subgraphs/cookbook/subgraph-composition-three-sources.mdx @@ -0,0 +1,124 @@ +--- +title: Integrating Three Subgraphs Using Subgraph Composition +sidebarTitle: 'Composable Subgraph with Three Source Subgraphs' +--- + +Optimize your Subgraph by merging data from three independent, source + +Subgraphs into a single composable Subgraph to enhance data aggregation. + +> Important Reminders + +> - Subgraph composition is built into the CLI, and you can deploy with [Subgraph Studio](https://thegraph.com/studio/). +> - This feature requires `specVersion` 1.3.0. +> - This example uses + +## Overview + +Subgraph composition empowers developer to leverage a Subgraph with other Subgraphs as data sources, seamlessly integrating and reacting to data updates and entity changes. This capability enhances efficiency and responsiveness in data handling. + +## Prerequisites + +To deploy **all** Subgraphs locally, you must have the following: + +- A [graph-node](https://github.com/graphprotocol/graph-node) instance running locally +- An [IPFS](https://docs.ipfs.tech/) instance running locally +- [Node.js.](https://nodejs.org/en) and npm + +## Get Started + +The following guide provides examples for defining three source Subgraphs to create one powerful composed Subgraph. + +### Specifics + +- To keep this example simple, all source subgraphs use only block handlers, but in a real environment, each source Subgraph will use data from different smart contracts. +- The examples below show how to import and extend the schema of another Subgraph to enhance its functionality. +- Each source Subgraph is optimized with a specific entity. +- All the commands listed install the necessary dependencies, generate code based on the GraphQL schema, build the Subgraph, and deploy it to your local Graph Node instance. + +### Step 1. Deploy Block Time Source Subgraph + +This first source Subgraph calculates the block time for each block. + +- It imports schemas from other Subgraphs and adds a `block` entity with a `timestamp` field, representing the time each block was mined. +- It listens to time-related blockchain events (e.g., block timestamps) and processes this data to update the Subgraph's entities accordingly. + +To deploy this Subgraph locally, run the following commands: + +```bash +npm install +npm run codegen +npm run build +npm run create-local +npm run deploy-local +``` + +### Step 1. Deploy Block Cost Source Subgraph + +This second source Subgraph indexes the cost of each block. + +#### Key Functions + +- It imports schemas from other Subgraphs and adds a `block` entity with cost-related fields. +- It listens to blockchain events related to costs (e.g. gas fees, transaction costs) and processes this data to update the Subgraph's entities accordingly. + +To deploy this Subgraph locally, run the following commands: + +```bash +npm install +npm run codegen +npm run build +npm run create-local +npm run deploy-local +``` + +### Step 2. Define Block Size in Source Subgraph + +This third source Subgraph indexes the size of each block. + +#### Key Functions + +- It imports existing schemas from other Subgraphs and adds a `Block` entity with a `size` field representing each block's size. +- It listens to blockchain events related to block sizes (e.g., storage or volume) and processes this data to update the Subgraph's entities accordingly. + +To deploy this Subgraph locally, run the following commands: + +```bash +npm install +npm run codegen +npm run build +npm run create-local +npm run deploy-local +``` + +### Step 3. Combine Into Block Stats Subgraph + +This composed Subgraph combines and aggregates the information from the three source Subgraphs above. To learn how to use aggregations, check out Subgraph [advanced features](https://thegraph.com/docs/en/subgraphs/developing/creating/advanced/#timeseries-and-aggregations). + +> [!NOTE] Any change to a source Subgraph will likely generate a new deployment ID. Be sure to update the deployment ID in the data source address of the Subgraph manifest to take advantage of the latest changes. [!IMPORTANT] All source Subgraphs should be deployed before the composed Subgraph is deployed. + +This composed Subgraph demonstrates how to create a subgraph that aggregates data from three source subgraphs, providing a unified, enhanced view of block statistics. + +#### Key Functions + +- It provides a consolidated data model that encompasses all relevant block metrics. +- It combines data from three source subgraphs, and provides a comprehensive view of block statistics, enabling more complex queries and analyses. To deploy this subgraph locally, run the following commands: + +```bash +npm install +npm run codegen +npm run build +npm run create-local +npm run deploy-local +``` + +## Key Takeaways + +- This powerful tool will scale your subgraph development and allow you to combine multiple Subgraphs. +- The setup includes the deployment of three source Subgraphs and one final deployment of the composed Subgraph. +- This feature unlocks scalability, simplifying both development and maintenance efficiency. + +## Additional Resources + +- Add advanced features in your subgraph. Check out [subgraph advance features](/developing/creating/advanced/) and the [subgraph composition repo](https://github.com/incrypto32/subgraph-composition-sample-subgraph). +- Check out all the code for this example in [the Github repo] (https://github.com/isum/subgraph-composition-example). diff --git a/website/src/pages/pt/subgraphs/cookbook/_meta.js b/website/src/pages/pt/subgraphs/cookbook/_meta.js index ae67ab7baed1..1b169037deee 100644 --- a/website/src/pages/pt/subgraphs/cookbook/_meta.js +++ b/website/src/pages/pt/subgraphs/cookbook/_meta.js @@ -1,4 +1,5 @@ export default { + 'subgraph-composition-three-sources': '', 'subgraph-debug-forking': '', near: '', arweave: '', @@ -8,5 +9,4 @@ export default { enums: '', 'secure-api-keys-nextjs': '', polymarket: '', - 'subgraph-composition-three-sources': '', } diff --git a/website/src/pages/pt/subgraphs/cookbook/subgraph-composition-three-source.mdx b/website/src/pages/pt/subgraphs/cookbook/subgraph-composition-three-source.mdx deleted file mode 100644 index 80b86a24d036..000000000000 --- a/website/src/pages/pt/subgraphs/cookbook/subgraph-composition-three-source.mdx +++ /dev/null @@ -1,121 +0,0 @@ ---- -title: Integrating Three Subgraphs Using Subgraph Composition -sidebarTitle: 'Subgraph Composition with Three Source Subgraphs' ---- - -Optimize your Subgraph by merging data from three independent, `source` Subgraphs into a single composable Subgraph to enhance data aggregation. - -> Important Reminders - -> - Subgraph composition is built into the CLI, and you can deploy with [Subgraph Studio](https://thegraph.com/studio/). -> - This feature requires spec version 1.3.0. - -## Overview - -Subgraph composition empowers developer to leverage a Subgraph with other Subgraphs as data sources, seamlessly integrating and reacting to data updates and entity changes. This capability enhances efficiency and responsiveness in data handling. - -## Prerequisites - -To deploy **all** Subgraphs locally, you must have the following: - -- A [graph-node](https://github.com/graphprotocol/graph-node) instance running locally -- An [IPFS](https://docs.ipfs.tech/) instance running locally -- [Node.js.](https://nodejs.org/en) and npm - -## Get Started - -The following guide provides examples for defining three `source` Subgraphs to create one powerful composed Subgraph. - -### Specifics - -- To keep this example simple, all `source` subgraphs use only block handlers, but in a real environment, each source Subgraph will use data from different smart contracts. -- The examples below show how to import and extend the schema of another Subgraph to enhance its functionality. -- Each source Subgraph is optimized with a specific entity. -- All the commands listed install the necessary dependencies, generate code based on the GraphQL schema, build the Subgraph, and deploy it to your local Graph Node instance. - -### Step 1. Deploy Block Time Source Subgraph - -This first source Subgraph calculates the block time for each block. - -- It imports schemas from other Subgraphs and adds a `block` entity with a `timestamp` field, representing the time each block was mined. -- It listens to time-related blockchain events (e.g., block timestamps) and processes this data to update the Subgraph's entities accordingly. - -To deploy this Subgraph locally, run the following commands: - -```bash -npm install -npm run codegen -npm run build -npm run create-local -npm run deploy-local -``` - -### Step 1. Deploy Block Cost Source Subgraph - -This second `source` Subgraph indexes the cost of each block. - -#### Key Functions - -- It imports schemas from other Subgraphs and adds a `block` entity with cost-related fields. -- It listens to blockchain events related to costs (e.g. gas fees, transaction costs) and processes this data to update the Subgraph's entities accordingly. - -To deploy this Subgraph locally, run the following commands: - -```bash -npm install -npm run codegen -npm run build -npm run create-local -npm run deploy-local -``` - -### Step 2. Define Block Size in Source Subgraph - -This third `source` Subgraph indexes the size of each block. - -#### Key Functions - -- It imports existing schemas from other Subgraphs and adds a `Block` entity with a `size` field representing each block's size. -- It listens to blockchain events related to block sizes (e.g., storage or volume) and processes this data to update the Subgraph's entities accordingly. - -To deploy this Subgraph locally, run the following commands: - -```bash -npm install -npm run codegen -npm run build -npm run create-local -npm run deploy-local -``` - -### Step 3. Combine Into Block Stats Subgraph - -This composed Subgraph combines and aggregates the information from the three source Subgraphs above. - -> [!NOTE] Any change to a source Subgraph will likely generate a new deployment ID. Be sure to update the deployment ID in the data source address of the Subgraph manifest to take advantage of the latest changes. [!IMPORTANT] All source Subgraphs should be deployed before the composed Subgraph is deployed. - -This composed Subgraph demonstrates how to create a subgraph that aggregates data from three source subgraphs, providing a unified, enhanced view of block statistics. - -#### Key Functions - -- It provides a consolidated data model that encompasses all relevant block metrics. -- It combines data from three `source` subgraphs, and provides a comprehensive view of block statistics, enabling more complex queries and analyses. To deploy this subgraph locally, run the following commands: - -```bash -npm install -npm run codegen -npm run build -npm run create-local -npm run deploy-local -``` - -## Key Takeaways - -- This powerful tool will scale your subgraph development and allow you to combine multiple Subgraphs. -- The setup includes the deployment of three source Subgraphs and one final deployment of the composed Subgraph. -- This feature unlocks scalability, simplifying both development and maintenance efficiency. - -## Additional Resources - -- Add advanced features in your subgraph. Check out [subgraph advance features](/developing/creating/advanced/) and the [subgraph composition repo](https://github.com/incrypto32/subgraph-composition-sample-subgraph). -- Check out the Github repo [for this example] (https://github.com/isum/subgraph-composition-example). diff --git a/website/src/pages/pt/subgraphs/cookbook/subgraph-composition-three-sources.mdx b/website/src/pages/pt/subgraphs/cookbook/subgraph-composition-three-sources.mdx new file mode 100644 index 000000000000..024e79f5c7c5 --- /dev/null +++ b/website/src/pages/pt/subgraphs/cookbook/subgraph-composition-three-sources.mdx @@ -0,0 +1,124 @@ +--- +title: Integrating Three Subgraphs Using Subgraph Composition +sidebarTitle: 'Composable Subgraph with Three Source Subgraphs' +--- + +Optimize your Subgraph by merging data from three independent, source + +Subgraphs into a single composable Subgraph to enhance data aggregation. + +> Important Reminders + +> - Subgraph composition is built into the CLI, and you can deploy with [Subgraph Studio](https://thegraph.com/studio/). +> - This feature requires `specVersion` 1.3.0. +> - This example uses + +## Overview + +Subgraph composition empowers developer to leverage a Subgraph with other Subgraphs as data sources, seamlessly integrating and reacting to data updates and entity changes. This capability enhances efficiency and responsiveness in data handling. + +## Prerequisites + +To deploy **all** Subgraphs locally, you must have the following: + +- A [graph-node](https://github.com/graphprotocol/graph-node) instance running locally +- An [IPFS](https://docs.ipfs.tech/) instance running locally +- [Node.js.](https://nodejs.org/en) and npm + +## Get Started + +The following guide provides examples for defining three source Subgraphs to create one powerful composed Subgraph. + +### Specifics + +- To keep this example simple, all source subgraphs use only block handlers, but in a real environment, each source Subgraph will use data from different smart contracts. +- The examples below show how to import and extend the schema of another Subgraph to enhance its functionality. +- Each source Subgraph is optimized with a specific entity. +- All the commands listed install the necessary dependencies, generate code based on the GraphQL schema, build the Subgraph, and deploy it to your local Graph Node instance. + +### Step 1. Deploy Block Time Source Subgraph + +This first source Subgraph calculates the block time for each block. + +- It imports schemas from other Subgraphs and adds a `block` entity with a `timestamp` field, representing the time each block was mined. +- It listens to time-related blockchain events (e.g., block timestamps) and processes this data to update the Subgraph's entities accordingly. + +To deploy this Subgraph locally, run the following commands: + +```bash +npm install +npm run codegen +npm run build +npm run create-local +npm run deploy-local +``` + +### Step 1. Deploy Block Cost Source Subgraph + +This second source Subgraph indexes the cost of each block. + +#### Key Functions + +- It imports schemas from other Subgraphs and adds a `block` entity with cost-related fields. +- It listens to blockchain events related to costs (e.g. gas fees, transaction costs) and processes this data to update the Subgraph's entities accordingly. + +To deploy this Subgraph locally, run the following commands: + +```bash +npm install +npm run codegen +npm run build +npm run create-local +npm run deploy-local +``` + +### Step 2. Define Block Size in Source Subgraph + +This third source Subgraph indexes the size of each block. + +#### Key Functions + +- It imports existing schemas from other Subgraphs and adds a `Block` entity with a `size` field representing each block's size. +- It listens to blockchain events related to block sizes (e.g., storage or volume) and processes this data to update the Subgraph's entities accordingly. + +To deploy this Subgraph locally, run the following commands: + +```bash +npm install +npm run codegen +npm run build +npm run create-local +npm run deploy-local +``` + +### Step 3. Combine Into Block Stats Subgraph + +This composed Subgraph combines and aggregates the information from the three source Subgraphs above. To learn how to use aggregations, check out Subgraph [advanced features](https://thegraph.com/docs/en/subgraphs/developing/creating/advanced/#timeseries-and-aggregations). + +> [!NOTE] Any change to a source Subgraph will likely generate a new deployment ID. Be sure to update the deployment ID in the data source address of the Subgraph manifest to take advantage of the latest changes. [!IMPORTANT] All source Subgraphs should be deployed before the composed Subgraph is deployed. + +This composed Subgraph demonstrates how to create a subgraph that aggregates data from three source subgraphs, providing a unified, enhanced view of block statistics. + +#### Key Functions + +- It provides a consolidated data model that encompasses all relevant block metrics. +- It combines data from three source subgraphs, and provides a comprehensive view of block statistics, enabling more complex queries and analyses. To deploy this subgraph locally, run the following commands: + +```bash +npm install +npm run codegen +npm run build +npm run create-local +npm run deploy-local +``` + +## Key Takeaways + +- This powerful tool will scale your subgraph development and allow you to combine multiple Subgraphs. +- The setup includes the deployment of three source Subgraphs and one final deployment of the composed Subgraph. +- This feature unlocks scalability, simplifying both development and maintenance efficiency. + +## Additional Resources + +- Add advanced features in your subgraph. Check out [subgraph advance features](/developing/creating/advanced/) and the [subgraph composition repo](https://github.com/incrypto32/subgraph-composition-sample-subgraph). +- Check out all the code for this example in [the Github repo] (https://github.com/isum/subgraph-composition-example). diff --git a/website/src/pages/ro/subgraphs/cookbook/_meta.js b/website/src/pages/ro/subgraphs/cookbook/_meta.js index ae67ab7baed1..1b169037deee 100644 --- a/website/src/pages/ro/subgraphs/cookbook/_meta.js +++ b/website/src/pages/ro/subgraphs/cookbook/_meta.js @@ -1,4 +1,5 @@ export default { + 'subgraph-composition-three-sources': '', 'subgraph-debug-forking': '', near: '', arweave: '', @@ -8,5 +9,4 @@ export default { enums: '', 'secure-api-keys-nextjs': '', polymarket: '', - 'subgraph-composition-three-sources': '', } diff --git a/website/src/pages/ro/subgraphs/cookbook/subgraph-composition-three-source.mdx b/website/src/pages/ro/subgraphs/cookbook/subgraph-composition-three-source.mdx deleted file mode 100644 index 80b86a24d036..000000000000 --- a/website/src/pages/ro/subgraphs/cookbook/subgraph-composition-three-source.mdx +++ /dev/null @@ -1,121 +0,0 @@ ---- -title: Integrating Three Subgraphs Using Subgraph Composition -sidebarTitle: 'Subgraph Composition with Three Source Subgraphs' ---- - -Optimize your Subgraph by merging data from three independent, `source` Subgraphs into a single composable Subgraph to enhance data aggregation. - -> Important Reminders - -> - Subgraph composition is built into the CLI, and you can deploy with [Subgraph Studio](https://thegraph.com/studio/). -> - This feature requires spec version 1.3.0. - -## Overview - -Subgraph composition empowers developer to leverage a Subgraph with other Subgraphs as data sources, seamlessly integrating and reacting to data updates and entity changes. This capability enhances efficiency and responsiveness in data handling. - -## Prerequisites - -To deploy **all** Subgraphs locally, you must have the following: - -- A [graph-node](https://github.com/graphprotocol/graph-node) instance running locally -- An [IPFS](https://docs.ipfs.tech/) instance running locally -- [Node.js.](https://nodejs.org/en) and npm - -## Get Started - -The following guide provides examples for defining three `source` Subgraphs to create one powerful composed Subgraph. - -### Specifics - -- To keep this example simple, all `source` subgraphs use only block handlers, but in a real environment, each source Subgraph will use data from different smart contracts. -- The examples below show how to import and extend the schema of another Subgraph to enhance its functionality. -- Each source Subgraph is optimized with a specific entity. -- All the commands listed install the necessary dependencies, generate code based on the GraphQL schema, build the Subgraph, and deploy it to your local Graph Node instance. - -### Step 1. Deploy Block Time Source Subgraph - -This first source Subgraph calculates the block time for each block. - -- It imports schemas from other Subgraphs and adds a `block` entity with a `timestamp` field, representing the time each block was mined. -- It listens to time-related blockchain events (e.g., block timestamps) and processes this data to update the Subgraph's entities accordingly. - -To deploy this Subgraph locally, run the following commands: - -```bash -npm install -npm run codegen -npm run build -npm run create-local -npm run deploy-local -``` - -### Step 1. Deploy Block Cost Source Subgraph - -This second `source` Subgraph indexes the cost of each block. - -#### Key Functions - -- It imports schemas from other Subgraphs and adds a `block` entity with cost-related fields. -- It listens to blockchain events related to costs (e.g. gas fees, transaction costs) and processes this data to update the Subgraph's entities accordingly. - -To deploy this Subgraph locally, run the following commands: - -```bash -npm install -npm run codegen -npm run build -npm run create-local -npm run deploy-local -``` - -### Step 2. Define Block Size in Source Subgraph - -This third `source` Subgraph indexes the size of each block. - -#### Key Functions - -- It imports existing schemas from other Subgraphs and adds a `Block` entity with a `size` field representing each block's size. -- It listens to blockchain events related to block sizes (e.g., storage or volume) and processes this data to update the Subgraph's entities accordingly. - -To deploy this Subgraph locally, run the following commands: - -```bash -npm install -npm run codegen -npm run build -npm run create-local -npm run deploy-local -``` - -### Step 3. Combine Into Block Stats Subgraph - -This composed Subgraph combines and aggregates the information from the three source Subgraphs above. - -> [!NOTE] Any change to a source Subgraph will likely generate a new deployment ID. Be sure to update the deployment ID in the data source address of the Subgraph manifest to take advantage of the latest changes. [!IMPORTANT] All source Subgraphs should be deployed before the composed Subgraph is deployed. - -This composed Subgraph demonstrates how to create a subgraph that aggregates data from three source subgraphs, providing a unified, enhanced view of block statistics. - -#### Key Functions - -- It provides a consolidated data model that encompasses all relevant block metrics. -- It combines data from three `source` subgraphs, and provides a comprehensive view of block statistics, enabling more complex queries and analyses. To deploy this subgraph locally, run the following commands: - -```bash -npm install -npm run codegen -npm run build -npm run create-local -npm run deploy-local -``` - -## Key Takeaways - -- This powerful tool will scale your subgraph development and allow you to combine multiple Subgraphs. -- The setup includes the deployment of three source Subgraphs and one final deployment of the composed Subgraph. -- This feature unlocks scalability, simplifying both development and maintenance efficiency. - -## Additional Resources - -- Add advanced features in your subgraph. Check out [subgraph advance features](/developing/creating/advanced/) and the [subgraph composition repo](https://github.com/incrypto32/subgraph-composition-sample-subgraph). -- Check out the Github repo [for this example] (https://github.com/isum/subgraph-composition-example). diff --git a/website/src/pages/ro/subgraphs/cookbook/subgraph-composition-three-sources.mdx b/website/src/pages/ro/subgraphs/cookbook/subgraph-composition-three-sources.mdx new file mode 100644 index 000000000000..024e79f5c7c5 --- /dev/null +++ b/website/src/pages/ro/subgraphs/cookbook/subgraph-composition-three-sources.mdx @@ -0,0 +1,124 @@ +--- +title: Integrating Three Subgraphs Using Subgraph Composition +sidebarTitle: 'Composable Subgraph with Three Source Subgraphs' +--- + +Optimize your Subgraph by merging data from three independent, source + +Subgraphs into a single composable Subgraph to enhance data aggregation. + +> Important Reminders + +> - Subgraph composition is built into the CLI, and you can deploy with [Subgraph Studio](https://thegraph.com/studio/). +> - This feature requires `specVersion` 1.3.0. +> - This example uses + +## Overview + +Subgraph composition empowers developer to leverage a Subgraph with other Subgraphs as data sources, seamlessly integrating and reacting to data updates and entity changes. This capability enhances efficiency and responsiveness in data handling. + +## Prerequisites + +To deploy **all** Subgraphs locally, you must have the following: + +- A [graph-node](https://github.com/graphprotocol/graph-node) instance running locally +- An [IPFS](https://docs.ipfs.tech/) instance running locally +- [Node.js.](https://nodejs.org/en) and npm + +## Get Started + +The following guide provides examples for defining three source Subgraphs to create one powerful composed Subgraph. + +### Specifics + +- To keep this example simple, all source subgraphs use only block handlers, but in a real environment, each source Subgraph will use data from different smart contracts. +- The examples below show how to import and extend the schema of another Subgraph to enhance its functionality. +- Each source Subgraph is optimized with a specific entity. +- All the commands listed install the necessary dependencies, generate code based on the GraphQL schema, build the Subgraph, and deploy it to your local Graph Node instance. + +### Step 1. Deploy Block Time Source Subgraph + +This first source Subgraph calculates the block time for each block. + +- It imports schemas from other Subgraphs and adds a `block` entity with a `timestamp` field, representing the time each block was mined. +- It listens to time-related blockchain events (e.g., block timestamps) and processes this data to update the Subgraph's entities accordingly. + +To deploy this Subgraph locally, run the following commands: + +```bash +npm install +npm run codegen +npm run build +npm run create-local +npm run deploy-local +``` + +### Step 1. Deploy Block Cost Source Subgraph + +This second source Subgraph indexes the cost of each block. + +#### Key Functions + +- It imports schemas from other Subgraphs and adds a `block` entity with cost-related fields. +- It listens to blockchain events related to costs (e.g. gas fees, transaction costs) and processes this data to update the Subgraph's entities accordingly. + +To deploy this Subgraph locally, run the following commands: + +```bash +npm install +npm run codegen +npm run build +npm run create-local +npm run deploy-local +``` + +### Step 2. Define Block Size in Source Subgraph + +This third source Subgraph indexes the size of each block. + +#### Key Functions + +- It imports existing schemas from other Subgraphs and adds a `Block` entity with a `size` field representing each block's size. +- It listens to blockchain events related to block sizes (e.g., storage or volume) and processes this data to update the Subgraph's entities accordingly. + +To deploy this Subgraph locally, run the following commands: + +```bash +npm install +npm run codegen +npm run build +npm run create-local +npm run deploy-local +``` + +### Step 3. Combine Into Block Stats Subgraph + +This composed Subgraph combines and aggregates the information from the three source Subgraphs above. To learn how to use aggregations, check out Subgraph [advanced features](https://thegraph.com/docs/en/subgraphs/developing/creating/advanced/#timeseries-and-aggregations). + +> [!NOTE] Any change to a source Subgraph will likely generate a new deployment ID. Be sure to update the deployment ID in the data source address of the Subgraph manifest to take advantage of the latest changes. [!IMPORTANT] All source Subgraphs should be deployed before the composed Subgraph is deployed. + +This composed Subgraph demonstrates how to create a subgraph that aggregates data from three source subgraphs, providing a unified, enhanced view of block statistics. + +#### Key Functions + +- It provides a consolidated data model that encompasses all relevant block metrics. +- It combines data from three source subgraphs, and provides a comprehensive view of block statistics, enabling more complex queries and analyses. To deploy this subgraph locally, run the following commands: + +```bash +npm install +npm run codegen +npm run build +npm run create-local +npm run deploy-local +``` + +## Key Takeaways + +- This powerful tool will scale your subgraph development and allow you to combine multiple Subgraphs. +- The setup includes the deployment of three source Subgraphs and one final deployment of the composed Subgraph. +- This feature unlocks scalability, simplifying both development and maintenance efficiency. + +## Additional Resources + +- Add advanced features in your subgraph. Check out [subgraph advance features](/developing/creating/advanced/) and the [subgraph composition repo](https://github.com/incrypto32/subgraph-composition-sample-subgraph). +- Check out all the code for this example in [the Github repo] (https://github.com/isum/subgraph-composition-example). diff --git a/website/src/pages/ru/subgraphs/cookbook/_meta.js b/website/src/pages/ru/subgraphs/cookbook/_meta.js index ae67ab7baed1..1b169037deee 100644 --- a/website/src/pages/ru/subgraphs/cookbook/_meta.js +++ b/website/src/pages/ru/subgraphs/cookbook/_meta.js @@ -1,4 +1,5 @@ export default { + 'subgraph-composition-three-sources': '', 'subgraph-debug-forking': '', near: '', arweave: '', @@ -8,5 +9,4 @@ export default { enums: '', 'secure-api-keys-nextjs': '', polymarket: '', - 'subgraph-composition-three-sources': '', } diff --git a/website/src/pages/ru/subgraphs/cookbook/subgraph-composition-three-source.mdx b/website/src/pages/ru/subgraphs/cookbook/subgraph-composition-three-source.mdx deleted file mode 100644 index 80b86a24d036..000000000000 --- a/website/src/pages/ru/subgraphs/cookbook/subgraph-composition-three-source.mdx +++ /dev/null @@ -1,121 +0,0 @@ ---- -title: Integrating Three Subgraphs Using Subgraph Composition -sidebarTitle: 'Subgraph Composition with Three Source Subgraphs' ---- - -Optimize your Subgraph by merging data from three independent, `source` Subgraphs into a single composable Subgraph to enhance data aggregation. - -> Important Reminders - -> - Subgraph composition is built into the CLI, and you can deploy with [Subgraph Studio](https://thegraph.com/studio/). -> - This feature requires spec version 1.3.0. - -## Overview - -Subgraph composition empowers developer to leverage a Subgraph with other Subgraphs as data sources, seamlessly integrating and reacting to data updates and entity changes. This capability enhances efficiency and responsiveness in data handling. - -## Prerequisites - -To deploy **all** Subgraphs locally, you must have the following: - -- A [graph-node](https://github.com/graphprotocol/graph-node) instance running locally -- An [IPFS](https://docs.ipfs.tech/) instance running locally -- [Node.js.](https://nodejs.org/en) and npm - -## Get Started - -The following guide provides examples for defining three `source` Subgraphs to create one powerful composed Subgraph. - -### Specifics - -- To keep this example simple, all `source` subgraphs use only block handlers, but in a real environment, each source Subgraph will use data from different smart contracts. -- The examples below show how to import and extend the schema of another Subgraph to enhance its functionality. -- Each source Subgraph is optimized with a specific entity. -- All the commands listed install the necessary dependencies, generate code based on the GraphQL schema, build the Subgraph, and deploy it to your local Graph Node instance. - -### Step 1. Deploy Block Time Source Subgraph - -This first source Subgraph calculates the block time for each block. - -- It imports schemas from other Subgraphs and adds a `block` entity with a `timestamp` field, representing the time each block was mined. -- It listens to time-related blockchain events (e.g., block timestamps) and processes this data to update the Subgraph's entities accordingly. - -To deploy this Subgraph locally, run the following commands: - -```bash -npm install -npm run codegen -npm run build -npm run create-local -npm run deploy-local -``` - -### Step 1. Deploy Block Cost Source Subgraph - -This second `source` Subgraph indexes the cost of each block. - -#### Key Functions - -- It imports schemas from other Subgraphs and adds a `block` entity with cost-related fields. -- It listens to blockchain events related to costs (e.g. gas fees, transaction costs) and processes this data to update the Subgraph's entities accordingly. - -To deploy this Subgraph locally, run the following commands: - -```bash -npm install -npm run codegen -npm run build -npm run create-local -npm run deploy-local -``` - -### Step 2. Define Block Size in Source Subgraph - -This third `source` Subgraph indexes the size of each block. - -#### Key Functions - -- It imports existing schemas from other Subgraphs and adds a `Block` entity with a `size` field representing each block's size. -- It listens to blockchain events related to block sizes (e.g., storage or volume) and processes this data to update the Subgraph's entities accordingly. - -To deploy this Subgraph locally, run the following commands: - -```bash -npm install -npm run codegen -npm run build -npm run create-local -npm run deploy-local -``` - -### Step 3. Combine Into Block Stats Subgraph - -This composed Subgraph combines and aggregates the information from the three source Subgraphs above. - -> [!NOTE] Any change to a source Subgraph will likely generate a new deployment ID. Be sure to update the deployment ID in the data source address of the Subgraph manifest to take advantage of the latest changes. [!IMPORTANT] All source Subgraphs should be deployed before the composed Subgraph is deployed. - -This composed Subgraph demonstrates how to create a subgraph that aggregates data from three source subgraphs, providing a unified, enhanced view of block statistics. - -#### Key Functions - -- It provides a consolidated data model that encompasses all relevant block metrics. -- It combines data from three `source` subgraphs, and provides a comprehensive view of block statistics, enabling more complex queries and analyses. To deploy this subgraph locally, run the following commands: - -```bash -npm install -npm run codegen -npm run build -npm run create-local -npm run deploy-local -``` - -## Key Takeaways - -- This powerful tool will scale your subgraph development and allow you to combine multiple Subgraphs. -- The setup includes the deployment of three source Subgraphs and one final deployment of the composed Subgraph. -- This feature unlocks scalability, simplifying both development and maintenance efficiency. - -## Additional Resources - -- Add advanced features in your subgraph. Check out [subgraph advance features](/developing/creating/advanced/) and the [subgraph composition repo](https://github.com/incrypto32/subgraph-composition-sample-subgraph). -- Check out the Github repo [for this example] (https://github.com/isum/subgraph-composition-example). diff --git a/website/src/pages/ru/subgraphs/cookbook/subgraph-composition-three-sources.mdx b/website/src/pages/ru/subgraphs/cookbook/subgraph-composition-three-sources.mdx new file mode 100644 index 000000000000..024e79f5c7c5 --- /dev/null +++ b/website/src/pages/ru/subgraphs/cookbook/subgraph-composition-three-sources.mdx @@ -0,0 +1,124 @@ +--- +title: Integrating Three Subgraphs Using Subgraph Composition +sidebarTitle: 'Composable Subgraph with Three Source Subgraphs' +--- + +Optimize your Subgraph by merging data from three independent, source + +Subgraphs into a single composable Subgraph to enhance data aggregation. + +> Important Reminders + +> - Subgraph composition is built into the CLI, and you can deploy with [Subgraph Studio](https://thegraph.com/studio/). +> - This feature requires `specVersion` 1.3.0. +> - This example uses + +## Overview + +Subgraph composition empowers developer to leverage a Subgraph with other Subgraphs as data sources, seamlessly integrating and reacting to data updates and entity changes. This capability enhances efficiency and responsiveness in data handling. + +## Prerequisites + +To deploy **all** Subgraphs locally, you must have the following: + +- A [graph-node](https://github.com/graphprotocol/graph-node) instance running locally +- An [IPFS](https://docs.ipfs.tech/) instance running locally +- [Node.js.](https://nodejs.org/en) and npm + +## Get Started + +The following guide provides examples for defining three source Subgraphs to create one powerful composed Subgraph. + +### Specifics + +- To keep this example simple, all source subgraphs use only block handlers, but in a real environment, each source Subgraph will use data from different smart contracts. +- The examples below show how to import and extend the schema of another Subgraph to enhance its functionality. +- Each source Subgraph is optimized with a specific entity. +- All the commands listed install the necessary dependencies, generate code based on the GraphQL schema, build the Subgraph, and deploy it to your local Graph Node instance. + +### Step 1. Deploy Block Time Source Subgraph + +This first source Subgraph calculates the block time for each block. + +- It imports schemas from other Subgraphs and adds a `block` entity with a `timestamp` field, representing the time each block was mined. +- It listens to time-related blockchain events (e.g., block timestamps) and processes this data to update the Subgraph's entities accordingly. + +To deploy this Subgraph locally, run the following commands: + +```bash +npm install +npm run codegen +npm run build +npm run create-local +npm run deploy-local +``` + +### Step 1. Deploy Block Cost Source Subgraph + +This second source Subgraph indexes the cost of each block. + +#### Key Functions + +- It imports schemas from other Subgraphs and adds a `block` entity with cost-related fields. +- It listens to blockchain events related to costs (e.g. gas fees, transaction costs) and processes this data to update the Subgraph's entities accordingly. + +To deploy this Subgraph locally, run the following commands: + +```bash +npm install +npm run codegen +npm run build +npm run create-local +npm run deploy-local +``` + +### Step 2. Define Block Size in Source Subgraph + +This third source Subgraph indexes the size of each block. + +#### Key Functions + +- It imports existing schemas from other Subgraphs and adds a `Block` entity with a `size` field representing each block's size. +- It listens to blockchain events related to block sizes (e.g., storage or volume) and processes this data to update the Subgraph's entities accordingly. + +To deploy this Subgraph locally, run the following commands: + +```bash +npm install +npm run codegen +npm run build +npm run create-local +npm run deploy-local +``` + +### Step 3. Combine Into Block Stats Subgraph + +This composed Subgraph combines and aggregates the information from the three source Subgraphs above. To learn how to use aggregations, check out Subgraph [advanced features](https://thegraph.com/docs/en/subgraphs/developing/creating/advanced/#timeseries-and-aggregations). + +> [!NOTE] Any change to a source Subgraph will likely generate a new deployment ID. Be sure to update the deployment ID in the data source address of the Subgraph manifest to take advantage of the latest changes. [!IMPORTANT] All source Subgraphs should be deployed before the composed Subgraph is deployed. + +This composed Subgraph demonstrates how to create a subgraph that aggregates data from three source subgraphs, providing a unified, enhanced view of block statistics. + +#### Key Functions + +- It provides a consolidated data model that encompasses all relevant block metrics. +- It combines data from three source subgraphs, and provides a comprehensive view of block statistics, enabling more complex queries and analyses. To deploy this subgraph locally, run the following commands: + +```bash +npm install +npm run codegen +npm run build +npm run create-local +npm run deploy-local +``` + +## Key Takeaways + +- This powerful tool will scale your subgraph development and allow you to combine multiple Subgraphs. +- The setup includes the deployment of three source Subgraphs and one final deployment of the composed Subgraph. +- This feature unlocks scalability, simplifying both development and maintenance efficiency. + +## Additional Resources + +- Add advanced features in your subgraph. Check out [subgraph advance features](/developing/creating/advanced/) and the [subgraph composition repo](https://github.com/incrypto32/subgraph-composition-sample-subgraph). +- Check out all the code for this example in [the Github repo] (https://github.com/isum/subgraph-composition-example). diff --git a/website/src/pages/sv/subgraphs/cookbook/_meta.js b/website/src/pages/sv/subgraphs/cookbook/_meta.js index ae67ab7baed1..1b169037deee 100644 --- a/website/src/pages/sv/subgraphs/cookbook/_meta.js +++ b/website/src/pages/sv/subgraphs/cookbook/_meta.js @@ -1,4 +1,5 @@ export default { + 'subgraph-composition-three-sources': '', 'subgraph-debug-forking': '', near: '', arweave: '', @@ -8,5 +9,4 @@ export default { enums: '', 'secure-api-keys-nextjs': '', polymarket: '', - 'subgraph-composition-three-sources': '', } diff --git a/website/src/pages/sv/subgraphs/cookbook/subgraph-composition-three-source.mdx b/website/src/pages/sv/subgraphs/cookbook/subgraph-composition-three-source.mdx deleted file mode 100644 index 80b86a24d036..000000000000 --- a/website/src/pages/sv/subgraphs/cookbook/subgraph-composition-three-source.mdx +++ /dev/null @@ -1,121 +0,0 @@ ---- -title: Integrating Three Subgraphs Using Subgraph Composition -sidebarTitle: 'Subgraph Composition with Three Source Subgraphs' ---- - -Optimize your Subgraph by merging data from three independent, `source` Subgraphs into a single composable Subgraph to enhance data aggregation. - -> Important Reminders - -> - Subgraph composition is built into the CLI, and you can deploy with [Subgraph Studio](https://thegraph.com/studio/). -> - This feature requires spec version 1.3.0. - -## Overview - -Subgraph composition empowers developer to leverage a Subgraph with other Subgraphs as data sources, seamlessly integrating and reacting to data updates and entity changes. This capability enhances efficiency and responsiveness in data handling. - -## Prerequisites - -To deploy **all** Subgraphs locally, you must have the following: - -- A [graph-node](https://github.com/graphprotocol/graph-node) instance running locally -- An [IPFS](https://docs.ipfs.tech/) instance running locally -- [Node.js.](https://nodejs.org/en) and npm - -## Get Started - -The following guide provides examples for defining three `source` Subgraphs to create one powerful composed Subgraph. - -### Specifics - -- To keep this example simple, all `source` subgraphs use only block handlers, but in a real environment, each source Subgraph will use data from different smart contracts. -- The examples below show how to import and extend the schema of another Subgraph to enhance its functionality. -- Each source Subgraph is optimized with a specific entity. -- All the commands listed install the necessary dependencies, generate code based on the GraphQL schema, build the Subgraph, and deploy it to your local Graph Node instance. - -### Step 1. Deploy Block Time Source Subgraph - -This first source Subgraph calculates the block time for each block. - -- It imports schemas from other Subgraphs and adds a `block` entity with a `timestamp` field, representing the time each block was mined. -- It listens to time-related blockchain events (e.g., block timestamps) and processes this data to update the Subgraph's entities accordingly. - -To deploy this Subgraph locally, run the following commands: - -```bash -npm install -npm run codegen -npm run build -npm run create-local -npm run deploy-local -``` - -### Step 1. Deploy Block Cost Source Subgraph - -This second `source` Subgraph indexes the cost of each block. - -#### Key Functions - -- It imports schemas from other Subgraphs and adds a `block` entity with cost-related fields. -- It listens to blockchain events related to costs (e.g. gas fees, transaction costs) and processes this data to update the Subgraph's entities accordingly. - -To deploy this Subgraph locally, run the following commands: - -```bash -npm install -npm run codegen -npm run build -npm run create-local -npm run deploy-local -``` - -### Step 2. Define Block Size in Source Subgraph - -This third `source` Subgraph indexes the size of each block. - -#### Key Functions - -- It imports existing schemas from other Subgraphs and adds a `Block` entity with a `size` field representing each block's size. -- It listens to blockchain events related to block sizes (e.g., storage or volume) and processes this data to update the Subgraph's entities accordingly. - -To deploy this Subgraph locally, run the following commands: - -```bash -npm install -npm run codegen -npm run build -npm run create-local -npm run deploy-local -``` - -### Step 3. Combine Into Block Stats Subgraph - -This composed Subgraph combines and aggregates the information from the three source Subgraphs above. - -> [!NOTE] Any change to a source Subgraph will likely generate a new deployment ID. Be sure to update the deployment ID in the data source address of the Subgraph manifest to take advantage of the latest changes. [!IMPORTANT] All source Subgraphs should be deployed before the composed Subgraph is deployed. - -This composed Subgraph demonstrates how to create a subgraph that aggregates data from three source subgraphs, providing a unified, enhanced view of block statistics. - -#### Key Functions - -- It provides a consolidated data model that encompasses all relevant block metrics. -- It combines data from three `source` subgraphs, and provides a comprehensive view of block statistics, enabling more complex queries and analyses. To deploy this subgraph locally, run the following commands: - -```bash -npm install -npm run codegen -npm run build -npm run create-local -npm run deploy-local -``` - -## Key Takeaways - -- This powerful tool will scale your subgraph development and allow you to combine multiple Subgraphs. -- The setup includes the deployment of three source Subgraphs and one final deployment of the composed Subgraph. -- This feature unlocks scalability, simplifying both development and maintenance efficiency. - -## Additional Resources - -- Add advanced features in your subgraph. Check out [subgraph advance features](/developing/creating/advanced/) and the [subgraph composition repo](https://github.com/incrypto32/subgraph-composition-sample-subgraph). -- Check out the Github repo [for this example] (https://github.com/isum/subgraph-composition-example). diff --git a/website/src/pages/sv/subgraphs/cookbook/subgraph-composition-three-sources.mdx b/website/src/pages/sv/subgraphs/cookbook/subgraph-composition-three-sources.mdx new file mode 100644 index 000000000000..024e79f5c7c5 --- /dev/null +++ b/website/src/pages/sv/subgraphs/cookbook/subgraph-composition-three-sources.mdx @@ -0,0 +1,124 @@ +--- +title: Integrating Three Subgraphs Using Subgraph Composition +sidebarTitle: 'Composable Subgraph with Three Source Subgraphs' +--- + +Optimize your Subgraph by merging data from three independent, source + +Subgraphs into a single composable Subgraph to enhance data aggregation. + +> Important Reminders + +> - Subgraph composition is built into the CLI, and you can deploy with [Subgraph Studio](https://thegraph.com/studio/). +> - This feature requires `specVersion` 1.3.0. +> - This example uses + +## Overview + +Subgraph composition empowers developer to leverage a Subgraph with other Subgraphs as data sources, seamlessly integrating and reacting to data updates and entity changes. This capability enhances efficiency and responsiveness in data handling. + +## Prerequisites + +To deploy **all** Subgraphs locally, you must have the following: + +- A [graph-node](https://github.com/graphprotocol/graph-node) instance running locally +- An [IPFS](https://docs.ipfs.tech/) instance running locally +- [Node.js.](https://nodejs.org/en) and npm + +## Get Started + +The following guide provides examples for defining three source Subgraphs to create one powerful composed Subgraph. + +### Specifics + +- To keep this example simple, all source subgraphs use only block handlers, but in a real environment, each source Subgraph will use data from different smart contracts. +- The examples below show how to import and extend the schema of another Subgraph to enhance its functionality. +- Each source Subgraph is optimized with a specific entity. +- All the commands listed install the necessary dependencies, generate code based on the GraphQL schema, build the Subgraph, and deploy it to your local Graph Node instance. + +### Step 1. Deploy Block Time Source Subgraph + +This first source Subgraph calculates the block time for each block. + +- It imports schemas from other Subgraphs and adds a `block` entity with a `timestamp` field, representing the time each block was mined. +- It listens to time-related blockchain events (e.g., block timestamps) and processes this data to update the Subgraph's entities accordingly. + +To deploy this Subgraph locally, run the following commands: + +```bash +npm install +npm run codegen +npm run build +npm run create-local +npm run deploy-local +``` + +### Step 1. Deploy Block Cost Source Subgraph + +This second source Subgraph indexes the cost of each block. + +#### Key Functions + +- It imports schemas from other Subgraphs and adds a `block` entity with cost-related fields. +- It listens to blockchain events related to costs (e.g. gas fees, transaction costs) and processes this data to update the Subgraph's entities accordingly. + +To deploy this Subgraph locally, run the following commands: + +```bash +npm install +npm run codegen +npm run build +npm run create-local +npm run deploy-local +``` + +### Step 2. Define Block Size in Source Subgraph + +This third source Subgraph indexes the size of each block. + +#### Key Functions + +- It imports existing schemas from other Subgraphs and adds a `Block` entity with a `size` field representing each block's size. +- It listens to blockchain events related to block sizes (e.g., storage or volume) and processes this data to update the Subgraph's entities accordingly. + +To deploy this Subgraph locally, run the following commands: + +```bash +npm install +npm run codegen +npm run build +npm run create-local +npm run deploy-local +``` + +### Step 3. Combine Into Block Stats Subgraph + +This composed Subgraph combines and aggregates the information from the three source Subgraphs above. To learn how to use aggregations, check out Subgraph [advanced features](https://thegraph.com/docs/en/subgraphs/developing/creating/advanced/#timeseries-and-aggregations). + +> [!NOTE] Any change to a source Subgraph will likely generate a new deployment ID. Be sure to update the deployment ID in the data source address of the Subgraph manifest to take advantage of the latest changes. [!IMPORTANT] All source Subgraphs should be deployed before the composed Subgraph is deployed. + +This composed Subgraph demonstrates how to create a subgraph that aggregates data from three source subgraphs, providing a unified, enhanced view of block statistics. + +#### Key Functions + +- It provides a consolidated data model that encompasses all relevant block metrics. +- It combines data from three source subgraphs, and provides a comprehensive view of block statistics, enabling more complex queries and analyses. To deploy this subgraph locally, run the following commands: + +```bash +npm install +npm run codegen +npm run build +npm run create-local +npm run deploy-local +``` + +## Key Takeaways + +- This powerful tool will scale your subgraph development and allow you to combine multiple Subgraphs. +- The setup includes the deployment of three source Subgraphs and one final deployment of the composed Subgraph. +- This feature unlocks scalability, simplifying both development and maintenance efficiency. + +## Additional Resources + +- Add advanced features in your subgraph. Check out [subgraph advance features](/developing/creating/advanced/) and the [subgraph composition repo](https://github.com/incrypto32/subgraph-composition-sample-subgraph). +- Check out all the code for this example in [the Github repo] (https://github.com/isum/subgraph-composition-example). diff --git a/website/src/pages/tr/subgraphs/cookbook/_meta.js b/website/src/pages/tr/subgraphs/cookbook/_meta.js index ae67ab7baed1..1b169037deee 100644 --- a/website/src/pages/tr/subgraphs/cookbook/_meta.js +++ b/website/src/pages/tr/subgraphs/cookbook/_meta.js @@ -1,4 +1,5 @@ export default { + 'subgraph-composition-three-sources': '', 'subgraph-debug-forking': '', near: '', arweave: '', @@ -8,5 +9,4 @@ export default { enums: '', 'secure-api-keys-nextjs': '', polymarket: '', - 'subgraph-composition-three-sources': '', } diff --git a/website/src/pages/tr/subgraphs/cookbook/subgraph-composition-three-source.mdx b/website/src/pages/tr/subgraphs/cookbook/subgraph-composition-three-source.mdx deleted file mode 100644 index 80b86a24d036..000000000000 --- a/website/src/pages/tr/subgraphs/cookbook/subgraph-composition-three-source.mdx +++ /dev/null @@ -1,121 +0,0 @@ ---- -title: Integrating Three Subgraphs Using Subgraph Composition -sidebarTitle: 'Subgraph Composition with Three Source Subgraphs' ---- - -Optimize your Subgraph by merging data from three independent, `source` Subgraphs into a single composable Subgraph to enhance data aggregation. - -> Important Reminders - -> - Subgraph composition is built into the CLI, and you can deploy with [Subgraph Studio](https://thegraph.com/studio/). -> - This feature requires spec version 1.3.0. - -## Overview - -Subgraph composition empowers developer to leverage a Subgraph with other Subgraphs as data sources, seamlessly integrating and reacting to data updates and entity changes. This capability enhances efficiency and responsiveness in data handling. - -## Prerequisites - -To deploy **all** Subgraphs locally, you must have the following: - -- A [graph-node](https://github.com/graphprotocol/graph-node) instance running locally -- An [IPFS](https://docs.ipfs.tech/) instance running locally -- [Node.js.](https://nodejs.org/en) and npm - -## Get Started - -The following guide provides examples for defining three `source` Subgraphs to create one powerful composed Subgraph. - -### Specifics - -- To keep this example simple, all `source` subgraphs use only block handlers, but in a real environment, each source Subgraph will use data from different smart contracts. -- The examples below show how to import and extend the schema of another Subgraph to enhance its functionality. -- Each source Subgraph is optimized with a specific entity. -- All the commands listed install the necessary dependencies, generate code based on the GraphQL schema, build the Subgraph, and deploy it to your local Graph Node instance. - -### Step 1. Deploy Block Time Source Subgraph - -This first source Subgraph calculates the block time for each block. - -- It imports schemas from other Subgraphs and adds a `block` entity with a `timestamp` field, representing the time each block was mined. -- It listens to time-related blockchain events (e.g., block timestamps) and processes this data to update the Subgraph's entities accordingly. - -To deploy this Subgraph locally, run the following commands: - -```bash -npm install -npm run codegen -npm run build -npm run create-local -npm run deploy-local -``` - -### Step 1. Deploy Block Cost Source Subgraph - -This second `source` Subgraph indexes the cost of each block. - -#### Key Functions - -- It imports schemas from other Subgraphs and adds a `block` entity with cost-related fields. -- It listens to blockchain events related to costs (e.g. gas fees, transaction costs) and processes this data to update the Subgraph's entities accordingly. - -To deploy this Subgraph locally, run the following commands: - -```bash -npm install -npm run codegen -npm run build -npm run create-local -npm run deploy-local -``` - -### Step 2. Define Block Size in Source Subgraph - -This third `source` Subgraph indexes the size of each block. - -#### Key Functions - -- It imports existing schemas from other Subgraphs and adds a `Block` entity with a `size` field representing each block's size. -- It listens to blockchain events related to block sizes (e.g., storage or volume) and processes this data to update the Subgraph's entities accordingly. - -To deploy this Subgraph locally, run the following commands: - -```bash -npm install -npm run codegen -npm run build -npm run create-local -npm run deploy-local -``` - -### Step 3. Combine Into Block Stats Subgraph - -This composed Subgraph combines and aggregates the information from the three source Subgraphs above. - -> [!NOTE] Any change to a source Subgraph will likely generate a new deployment ID. Be sure to update the deployment ID in the data source address of the Subgraph manifest to take advantage of the latest changes. [!IMPORTANT] All source Subgraphs should be deployed before the composed Subgraph is deployed. - -This composed Subgraph demonstrates how to create a subgraph that aggregates data from three source subgraphs, providing a unified, enhanced view of block statistics. - -#### Key Functions - -- It provides a consolidated data model that encompasses all relevant block metrics. -- It combines data from three `source` subgraphs, and provides a comprehensive view of block statistics, enabling more complex queries and analyses. To deploy this subgraph locally, run the following commands: - -```bash -npm install -npm run codegen -npm run build -npm run create-local -npm run deploy-local -``` - -## Key Takeaways - -- This powerful tool will scale your subgraph development and allow you to combine multiple Subgraphs. -- The setup includes the deployment of three source Subgraphs and one final deployment of the composed Subgraph. -- This feature unlocks scalability, simplifying both development and maintenance efficiency. - -## Additional Resources - -- Add advanced features in your subgraph. Check out [subgraph advance features](/developing/creating/advanced/) and the [subgraph composition repo](https://github.com/incrypto32/subgraph-composition-sample-subgraph). -- Check out the Github repo [for this example] (https://github.com/isum/subgraph-composition-example). diff --git a/website/src/pages/tr/subgraphs/cookbook/subgraph-composition-three-sources.mdx b/website/src/pages/tr/subgraphs/cookbook/subgraph-composition-three-sources.mdx new file mode 100644 index 000000000000..024e79f5c7c5 --- /dev/null +++ b/website/src/pages/tr/subgraphs/cookbook/subgraph-composition-three-sources.mdx @@ -0,0 +1,124 @@ +--- +title: Integrating Three Subgraphs Using Subgraph Composition +sidebarTitle: 'Composable Subgraph with Three Source Subgraphs' +--- + +Optimize your Subgraph by merging data from three independent, source + +Subgraphs into a single composable Subgraph to enhance data aggregation. + +> Important Reminders + +> - Subgraph composition is built into the CLI, and you can deploy with [Subgraph Studio](https://thegraph.com/studio/). +> - This feature requires `specVersion` 1.3.0. +> - This example uses + +## Overview + +Subgraph composition empowers developer to leverage a Subgraph with other Subgraphs as data sources, seamlessly integrating and reacting to data updates and entity changes. This capability enhances efficiency and responsiveness in data handling. + +## Prerequisites + +To deploy **all** Subgraphs locally, you must have the following: + +- A [graph-node](https://github.com/graphprotocol/graph-node) instance running locally +- An [IPFS](https://docs.ipfs.tech/) instance running locally +- [Node.js.](https://nodejs.org/en) and npm + +## Get Started + +The following guide provides examples for defining three source Subgraphs to create one powerful composed Subgraph. + +### Specifics + +- To keep this example simple, all source subgraphs use only block handlers, but in a real environment, each source Subgraph will use data from different smart contracts. +- The examples below show how to import and extend the schema of another Subgraph to enhance its functionality. +- Each source Subgraph is optimized with a specific entity. +- All the commands listed install the necessary dependencies, generate code based on the GraphQL schema, build the Subgraph, and deploy it to your local Graph Node instance. + +### Step 1. Deploy Block Time Source Subgraph + +This first source Subgraph calculates the block time for each block. + +- It imports schemas from other Subgraphs and adds a `block` entity with a `timestamp` field, representing the time each block was mined. +- It listens to time-related blockchain events (e.g., block timestamps) and processes this data to update the Subgraph's entities accordingly. + +To deploy this Subgraph locally, run the following commands: + +```bash +npm install +npm run codegen +npm run build +npm run create-local +npm run deploy-local +``` + +### Step 1. Deploy Block Cost Source Subgraph + +This second source Subgraph indexes the cost of each block. + +#### Key Functions + +- It imports schemas from other Subgraphs and adds a `block` entity with cost-related fields. +- It listens to blockchain events related to costs (e.g. gas fees, transaction costs) and processes this data to update the Subgraph's entities accordingly. + +To deploy this Subgraph locally, run the following commands: + +```bash +npm install +npm run codegen +npm run build +npm run create-local +npm run deploy-local +``` + +### Step 2. Define Block Size in Source Subgraph + +This third source Subgraph indexes the size of each block. + +#### Key Functions + +- It imports existing schemas from other Subgraphs and adds a `Block` entity with a `size` field representing each block's size. +- It listens to blockchain events related to block sizes (e.g., storage or volume) and processes this data to update the Subgraph's entities accordingly. + +To deploy this Subgraph locally, run the following commands: + +```bash +npm install +npm run codegen +npm run build +npm run create-local +npm run deploy-local +``` + +### Step 3. Combine Into Block Stats Subgraph + +This composed Subgraph combines and aggregates the information from the three source Subgraphs above. To learn how to use aggregations, check out Subgraph [advanced features](https://thegraph.com/docs/en/subgraphs/developing/creating/advanced/#timeseries-and-aggregations). + +> [!NOTE] Any change to a source Subgraph will likely generate a new deployment ID. Be sure to update the deployment ID in the data source address of the Subgraph manifest to take advantage of the latest changes. [!IMPORTANT] All source Subgraphs should be deployed before the composed Subgraph is deployed. + +This composed Subgraph demonstrates how to create a subgraph that aggregates data from three source subgraphs, providing a unified, enhanced view of block statistics. + +#### Key Functions + +- It provides a consolidated data model that encompasses all relevant block metrics. +- It combines data from three source subgraphs, and provides a comprehensive view of block statistics, enabling more complex queries and analyses. To deploy this subgraph locally, run the following commands: + +```bash +npm install +npm run codegen +npm run build +npm run create-local +npm run deploy-local +``` + +## Key Takeaways + +- This powerful tool will scale your subgraph development and allow you to combine multiple Subgraphs. +- The setup includes the deployment of three source Subgraphs and one final deployment of the composed Subgraph. +- This feature unlocks scalability, simplifying both development and maintenance efficiency. + +## Additional Resources + +- Add advanced features in your subgraph. Check out [subgraph advance features](/developing/creating/advanced/) and the [subgraph composition repo](https://github.com/incrypto32/subgraph-composition-sample-subgraph). +- Check out all the code for this example in [the Github repo] (https://github.com/isum/subgraph-composition-example). diff --git a/website/src/pages/uk/subgraphs/cookbook/_meta.js b/website/src/pages/uk/subgraphs/cookbook/_meta.js index ae67ab7baed1..1b169037deee 100644 --- a/website/src/pages/uk/subgraphs/cookbook/_meta.js +++ b/website/src/pages/uk/subgraphs/cookbook/_meta.js @@ -1,4 +1,5 @@ export default { + 'subgraph-composition-three-sources': '', 'subgraph-debug-forking': '', near: '', arweave: '', @@ -8,5 +9,4 @@ export default { enums: '', 'secure-api-keys-nextjs': '', polymarket: '', - 'subgraph-composition-three-sources': '', } diff --git a/website/src/pages/uk/subgraphs/cookbook/subgraph-composition-three-source.mdx b/website/src/pages/uk/subgraphs/cookbook/subgraph-composition-three-source.mdx deleted file mode 100644 index 80b86a24d036..000000000000 --- a/website/src/pages/uk/subgraphs/cookbook/subgraph-composition-three-source.mdx +++ /dev/null @@ -1,121 +0,0 @@ ---- -title: Integrating Three Subgraphs Using Subgraph Composition -sidebarTitle: 'Subgraph Composition with Three Source Subgraphs' ---- - -Optimize your Subgraph by merging data from three independent, `source` Subgraphs into a single composable Subgraph to enhance data aggregation. - -> Important Reminders - -> - Subgraph composition is built into the CLI, and you can deploy with [Subgraph Studio](https://thegraph.com/studio/). -> - This feature requires spec version 1.3.0. - -## Overview - -Subgraph composition empowers developer to leverage a Subgraph with other Subgraphs as data sources, seamlessly integrating and reacting to data updates and entity changes. This capability enhances efficiency and responsiveness in data handling. - -## Prerequisites - -To deploy **all** Subgraphs locally, you must have the following: - -- A [graph-node](https://github.com/graphprotocol/graph-node) instance running locally -- An [IPFS](https://docs.ipfs.tech/) instance running locally -- [Node.js.](https://nodejs.org/en) and npm - -## Get Started - -The following guide provides examples for defining three `source` Subgraphs to create one powerful composed Subgraph. - -### Specifics - -- To keep this example simple, all `source` subgraphs use only block handlers, but in a real environment, each source Subgraph will use data from different smart contracts. -- The examples below show how to import and extend the schema of another Subgraph to enhance its functionality. -- Each source Subgraph is optimized with a specific entity. -- All the commands listed install the necessary dependencies, generate code based on the GraphQL schema, build the Subgraph, and deploy it to your local Graph Node instance. - -### Step 1. Deploy Block Time Source Subgraph - -This first source Subgraph calculates the block time for each block. - -- It imports schemas from other Subgraphs and adds a `block` entity with a `timestamp` field, representing the time each block was mined. -- It listens to time-related blockchain events (e.g., block timestamps) and processes this data to update the Subgraph's entities accordingly. - -To deploy this Subgraph locally, run the following commands: - -```bash -npm install -npm run codegen -npm run build -npm run create-local -npm run deploy-local -``` - -### Step 1. Deploy Block Cost Source Subgraph - -This second `source` Subgraph indexes the cost of each block. - -#### Key Functions - -- It imports schemas from other Subgraphs and adds a `block` entity with cost-related fields. -- It listens to blockchain events related to costs (e.g. gas fees, transaction costs) and processes this data to update the Subgraph's entities accordingly. - -To deploy this Subgraph locally, run the following commands: - -```bash -npm install -npm run codegen -npm run build -npm run create-local -npm run deploy-local -``` - -### Step 2. Define Block Size in Source Subgraph - -This third `source` Subgraph indexes the size of each block. - -#### Key Functions - -- It imports existing schemas from other Subgraphs and adds a `Block` entity with a `size` field representing each block's size. -- It listens to blockchain events related to block sizes (e.g., storage or volume) and processes this data to update the Subgraph's entities accordingly. - -To deploy this Subgraph locally, run the following commands: - -```bash -npm install -npm run codegen -npm run build -npm run create-local -npm run deploy-local -``` - -### Step 3. Combine Into Block Stats Subgraph - -This composed Subgraph combines and aggregates the information from the three source Subgraphs above. - -> [!NOTE] Any change to a source Subgraph will likely generate a new deployment ID. Be sure to update the deployment ID in the data source address of the Subgraph manifest to take advantage of the latest changes. [!IMPORTANT] All source Subgraphs should be deployed before the composed Subgraph is deployed. - -This composed Subgraph demonstrates how to create a subgraph that aggregates data from three source subgraphs, providing a unified, enhanced view of block statistics. - -#### Key Functions - -- It provides a consolidated data model that encompasses all relevant block metrics. -- It combines data from three `source` subgraphs, and provides a comprehensive view of block statistics, enabling more complex queries and analyses. To deploy this subgraph locally, run the following commands: - -```bash -npm install -npm run codegen -npm run build -npm run create-local -npm run deploy-local -``` - -## Key Takeaways - -- This powerful tool will scale your subgraph development and allow you to combine multiple Subgraphs. -- The setup includes the deployment of three source Subgraphs and one final deployment of the composed Subgraph. -- This feature unlocks scalability, simplifying both development and maintenance efficiency. - -## Additional Resources - -- Add advanced features in your subgraph. Check out [subgraph advance features](/developing/creating/advanced/) and the [subgraph composition repo](https://github.com/incrypto32/subgraph-composition-sample-subgraph). -- Check out the Github repo [for this example] (https://github.com/isum/subgraph-composition-example). diff --git a/website/src/pages/uk/subgraphs/cookbook/subgraph-composition-three-sources.mdx b/website/src/pages/uk/subgraphs/cookbook/subgraph-composition-three-sources.mdx new file mode 100644 index 000000000000..024e79f5c7c5 --- /dev/null +++ b/website/src/pages/uk/subgraphs/cookbook/subgraph-composition-three-sources.mdx @@ -0,0 +1,124 @@ +--- +title: Integrating Three Subgraphs Using Subgraph Composition +sidebarTitle: 'Composable Subgraph with Three Source Subgraphs' +--- + +Optimize your Subgraph by merging data from three independent, source + +Subgraphs into a single composable Subgraph to enhance data aggregation. + +> Important Reminders + +> - Subgraph composition is built into the CLI, and you can deploy with [Subgraph Studio](https://thegraph.com/studio/). +> - This feature requires `specVersion` 1.3.0. +> - This example uses + +## Overview + +Subgraph composition empowers developer to leverage a Subgraph with other Subgraphs as data sources, seamlessly integrating and reacting to data updates and entity changes. This capability enhances efficiency and responsiveness in data handling. + +## Prerequisites + +To deploy **all** Subgraphs locally, you must have the following: + +- A [graph-node](https://github.com/graphprotocol/graph-node) instance running locally +- An [IPFS](https://docs.ipfs.tech/) instance running locally +- [Node.js.](https://nodejs.org/en) and npm + +## Get Started + +The following guide provides examples for defining three source Subgraphs to create one powerful composed Subgraph. + +### Specifics + +- To keep this example simple, all source subgraphs use only block handlers, but in a real environment, each source Subgraph will use data from different smart contracts. +- The examples below show how to import and extend the schema of another Subgraph to enhance its functionality. +- Each source Subgraph is optimized with a specific entity. +- All the commands listed install the necessary dependencies, generate code based on the GraphQL schema, build the Subgraph, and deploy it to your local Graph Node instance. + +### Step 1. Deploy Block Time Source Subgraph + +This first source Subgraph calculates the block time for each block. + +- It imports schemas from other Subgraphs and adds a `block` entity with a `timestamp` field, representing the time each block was mined. +- It listens to time-related blockchain events (e.g., block timestamps) and processes this data to update the Subgraph's entities accordingly. + +To deploy this Subgraph locally, run the following commands: + +```bash +npm install +npm run codegen +npm run build +npm run create-local +npm run deploy-local +``` + +### Step 1. Deploy Block Cost Source Subgraph + +This second source Subgraph indexes the cost of each block. + +#### Key Functions + +- It imports schemas from other Subgraphs and adds a `block` entity with cost-related fields. +- It listens to blockchain events related to costs (e.g. gas fees, transaction costs) and processes this data to update the Subgraph's entities accordingly. + +To deploy this Subgraph locally, run the following commands: + +```bash +npm install +npm run codegen +npm run build +npm run create-local +npm run deploy-local +``` + +### Step 2. Define Block Size in Source Subgraph + +This third source Subgraph indexes the size of each block. + +#### Key Functions + +- It imports existing schemas from other Subgraphs and adds a `Block` entity with a `size` field representing each block's size. +- It listens to blockchain events related to block sizes (e.g., storage or volume) and processes this data to update the Subgraph's entities accordingly. + +To deploy this Subgraph locally, run the following commands: + +```bash +npm install +npm run codegen +npm run build +npm run create-local +npm run deploy-local +``` + +### Step 3. Combine Into Block Stats Subgraph + +This composed Subgraph combines and aggregates the information from the three source Subgraphs above. To learn how to use aggregations, check out Subgraph [advanced features](https://thegraph.com/docs/en/subgraphs/developing/creating/advanced/#timeseries-and-aggregations). + +> [!NOTE] Any change to a source Subgraph will likely generate a new deployment ID. Be sure to update the deployment ID in the data source address of the Subgraph manifest to take advantage of the latest changes. [!IMPORTANT] All source Subgraphs should be deployed before the composed Subgraph is deployed. + +This composed Subgraph demonstrates how to create a subgraph that aggregates data from three source subgraphs, providing a unified, enhanced view of block statistics. + +#### Key Functions + +- It provides a consolidated data model that encompasses all relevant block metrics. +- It combines data from three source subgraphs, and provides a comprehensive view of block statistics, enabling more complex queries and analyses. To deploy this subgraph locally, run the following commands: + +```bash +npm install +npm run codegen +npm run build +npm run create-local +npm run deploy-local +``` + +## Key Takeaways + +- This powerful tool will scale your subgraph development and allow you to combine multiple Subgraphs. +- The setup includes the deployment of three source Subgraphs and one final deployment of the composed Subgraph. +- This feature unlocks scalability, simplifying both development and maintenance efficiency. + +## Additional Resources + +- Add advanced features in your subgraph. Check out [subgraph advance features](/developing/creating/advanced/) and the [subgraph composition repo](https://github.com/incrypto32/subgraph-composition-sample-subgraph). +- Check out all the code for this example in [the Github repo] (https://github.com/isum/subgraph-composition-example). diff --git a/website/src/pages/ur/subgraphs/cookbook/_meta.js b/website/src/pages/ur/subgraphs/cookbook/_meta.js index ae67ab7baed1..1b169037deee 100644 --- a/website/src/pages/ur/subgraphs/cookbook/_meta.js +++ b/website/src/pages/ur/subgraphs/cookbook/_meta.js @@ -1,4 +1,5 @@ export default { + 'subgraph-composition-three-sources': '', 'subgraph-debug-forking': '', near: '', arweave: '', @@ -8,5 +9,4 @@ export default { enums: '', 'secure-api-keys-nextjs': '', polymarket: '', - 'subgraph-composition-three-sources': '', } diff --git a/website/src/pages/ur/subgraphs/cookbook/subgraph-composition-three-source.mdx b/website/src/pages/ur/subgraphs/cookbook/subgraph-composition-three-source.mdx deleted file mode 100644 index 80b86a24d036..000000000000 --- a/website/src/pages/ur/subgraphs/cookbook/subgraph-composition-three-source.mdx +++ /dev/null @@ -1,121 +0,0 @@ ---- -title: Integrating Three Subgraphs Using Subgraph Composition -sidebarTitle: 'Subgraph Composition with Three Source Subgraphs' ---- - -Optimize your Subgraph by merging data from three independent, `source` Subgraphs into a single composable Subgraph to enhance data aggregation. - -> Important Reminders - -> - Subgraph composition is built into the CLI, and you can deploy with [Subgraph Studio](https://thegraph.com/studio/). -> - This feature requires spec version 1.3.0. - -## Overview - -Subgraph composition empowers developer to leverage a Subgraph with other Subgraphs as data sources, seamlessly integrating and reacting to data updates and entity changes. This capability enhances efficiency and responsiveness in data handling. - -## Prerequisites - -To deploy **all** Subgraphs locally, you must have the following: - -- A [graph-node](https://github.com/graphprotocol/graph-node) instance running locally -- An [IPFS](https://docs.ipfs.tech/) instance running locally -- [Node.js.](https://nodejs.org/en) and npm - -## Get Started - -The following guide provides examples for defining three `source` Subgraphs to create one powerful composed Subgraph. - -### Specifics - -- To keep this example simple, all `source` subgraphs use only block handlers, but in a real environment, each source Subgraph will use data from different smart contracts. -- The examples below show how to import and extend the schema of another Subgraph to enhance its functionality. -- Each source Subgraph is optimized with a specific entity. -- All the commands listed install the necessary dependencies, generate code based on the GraphQL schema, build the Subgraph, and deploy it to your local Graph Node instance. - -### Step 1. Deploy Block Time Source Subgraph - -This first source Subgraph calculates the block time for each block. - -- It imports schemas from other Subgraphs and adds a `block` entity with a `timestamp` field, representing the time each block was mined. -- It listens to time-related blockchain events (e.g., block timestamps) and processes this data to update the Subgraph's entities accordingly. - -To deploy this Subgraph locally, run the following commands: - -```bash -npm install -npm run codegen -npm run build -npm run create-local -npm run deploy-local -``` - -### Step 1. Deploy Block Cost Source Subgraph - -This second `source` Subgraph indexes the cost of each block. - -#### Key Functions - -- It imports schemas from other Subgraphs and adds a `block` entity with cost-related fields. -- It listens to blockchain events related to costs (e.g. gas fees, transaction costs) and processes this data to update the Subgraph's entities accordingly. - -To deploy this Subgraph locally, run the following commands: - -```bash -npm install -npm run codegen -npm run build -npm run create-local -npm run deploy-local -``` - -### Step 2. Define Block Size in Source Subgraph - -This third `source` Subgraph indexes the size of each block. - -#### Key Functions - -- It imports existing schemas from other Subgraphs and adds a `Block` entity with a `size` field representing each block's size. -- It listens to blockchain events related to block sizes (e.g., storage or volume) and processes this data to update the Subgraph's entities accordingly. - -To deploy this Subgraph locally, run the following commands: - -```bash -npm install -npm run codegen -npm run build -npm run create-local -npm run deploy-local -``` - -### Step 3. Combine Into Block Stats Subgraph - -This composed Subgraph combines and aggregates the information from the three source Subgraphs above. - -> [!NOTE] Any change to a source Subgraph will likely generate a new deployment ID. Be sure to update the deployment ID in the data source address of the Subgraph manifest to take advantage of the latest changes. [!IMPORTANT] All source Subgraphs should be deployed before the composed Subgraph is deployed. - -This composed Subgraph demonstrates how to create a subgraph that aggregates data from three source subgraphs, providing a unified, enhanced view of block statistics. - -#### Key Functions - -- It provides a consolidated data model that encompasses all relevant block metrics. -- It combines data from three `source` subgraphs, and provides a comprehensive view of block statistics, enabling more complex queries and analyses. To deploy this subgraph locally, run the following commands: - -```bash -npm install -npm run codegen -npm run build -npm run create-local -npm run deploy-local -``` - -## Key Takeaways - -- This powerful tool will scale your subgraph development and allow you to combine multiple Subgraphs. -- The setup includes the deployment of three source Subgraphs and one final deployment of the composed Subgraph. -- This feature unlocks scalability, simplifying both development and maintenance efficiency. - -## Additional Resources - -- Add advanced features in your subgraph. Check out [subgraph advance features](/developing/creating/advanced/) and the [subgraph composition repo](https://github.com/incrypto32/subgraph-composition-sample-subgraph). -- Check out the Github repo [for this example] (https://github.com/isum/subgraph-composition-example). diff --git a/website/src/pages/ur/subgraphs/cookbook/subgraph-composition-three-sources.mdx b/website/src/pages/ur/subgraphs/cookbook/subgraph-composition-three-sources.mdx new file mode 100644 index 000000000000..024e79f5c7c5 --- /dev/null +++ b/website/src/pages/ur/subgraphs/cookbook/subgraph-composition-three-sources.mdx @@ -0,0 +1,124 @@ +--- +title: Integrating Three Subgraphs Using Subgraph Composition +sidebarTitle: 'Composable Subgraph with Three Source Subgraphs' +--- + +Optimize your Subgraph by merging data from three independent, source + +Subgraphs into a single composable Subgraph to enhance data aggregation. + +> Important Reminders + +> - Subgraph composition is built into the CLI, and you can deploy with [Subgraph Studio](https://thegraph.com/studio/). +> - This feature requires `specVersion` 1.3.0. +> - This example uses + +## Overview + +Subgraph composition empowers developer to leverage a Subgraph with other Subgraphs as data sources, seamlessly integrating and reacting to data updates and entity changes. This capability enhances efficiency and responsiveness in data handling. + +## Prerequisites + +To deploy **all** Subgraphs locally, you must have the following: + +- A [graph-node](https://github.com/graphprotocol/graph-node) instance running locally +- An [IPFS](https://docs.ipfs.tech/) instance running locally +- [Node.js.](https://nodejs.org/en) and npm + +## Get Started + +The following guide provides examples for defining three source Subgraphs to create one powerful composed Subgraph. + +### Specifics + +- To keep this example simple, all source subgraphs use only block handlers, but in a real environment, each source Subgraph will use data from different smart contracts. +- The examples below show how to import and extend the schema of another Subgraph to enhance its functionality. +- Each source Subgraph is optimized with a specific entity. +- All the commands listed install the necessary dependencies, generate code based on the GraphQL schema, build the Subgraph, and deploy it to your local Graph Node instance. + +### Step 1. Deploy Block Time Source Subgraph + +This first source Subgraph calculates the block time for each block. + +- It imports schemas from other Subgraphs and adds a `block` entity with a `timestamp` field, representing the time each block was mined. +- It listens to time-related blockchain events (e.g., block timestamps) and processes this data to update the Subgraph's entities accordingly. + +To deploy this Subgraph locally, run the following commands: + +```bash +npm install +npm run codegen +npm run build +npm run create-local +npm run deploy-local +``` + +### Step 1. Deploy Block Cost Source Subgraph + +This second source Subgraph indexes the cost of each block. + +#### Key Functions + +- It imports schemas from other Subgraphs and adds a `block` entity with cost-related fields. +- It listens to blockchain events related to costs (e.g. gas fees, transaction costs) and processes this data to update the Subgraph's entities accordingly. + +To deploy this Subgraph locally, run the following commands: + +```bash +npm install +npm run codegen +npm run build +npm run create-local +npm run deploy-local +``` + +### Step 2. Define Block Size in Source Subgraph + +This third source Subgraph indexes the size of each block. + +#### Key Functions + +- It imports existing schemas from other Subgraphs and adds a `Block` entity with a `size` field representing each block's size. +- It listens to blockchain events related to block sizes (e.g., storage or volume) and processes this data to update the Subgraph's entities accordingly. + +To deploy this Subgraph locally, run the following commands: + +```bash +npm install +npm run codegen +npm run build +npm run create-local +npm run deploy-local +``` + +### Step 3. Combine Into Block Stats Subgraph + +This composed Subgraph combines and aggregates the information from the three source Subgraphs above. To learn how to use aggregations, check out Subgraph [advanced features](https://thegraph.com/docs/en/subgraphs/developing/creating/advanced/#timeseries-and-aggregations). + +> [!NOTE] Any change to a source Subgraph will likely generate a new deployment ID. Be sure to update the deployment ID in the data source address of the Subgraph manifest to take advantage of the latest changes. [!IMPORTANT] All source Subgraphs should be deployed before the composed Subgraph is deployed. + +This composed Subgraph demonstrates how to create a subgraph that aggregates data from three source subgraphs, providing a unified, enhanced view of block statistics. + +#### Key Functions + +- It provides a consolidated data model that encompasses all relevant block metrics. +- It combines data from three source subgraphs, and provides a comprehensive view of block statistics, enabling more complex queries and analyses. To deploy this subgraph locally, run the following commands: + +```bash +npm install +npm run codegen +npm run build +npm run create-local +npm run deploy-local +``` + +## Key Takeaways + +- This powerful tool will scale your subgraph development and allow you to combine multiple Subgraphs. +- The setup includes the deployment of three source Subgraphs and one final deployment of the composed Subgraph. +- This feature unlocks scalability, simplifying both development and maintenance efficiency. + +## Additional Resources + +- Add advanced features in your subgraph. Check out [subgraph advance features](/developing/creating/advanced/) and the [subgraph composition repo](https://github.com/incrypto32/subgraph-composition-sample-subgraph). +- Check out all the code for this example in [the Github repo] (https://github.com/isum/subgraph-composition-example). diff --git a/website/src/pages/vi/subgraphs/cookbook/_meta.js b/website/src/pages/vi/subgraphs/cookbook/_meta.js index ae67ab7baed1..1b169037deee 100644 --- a/website/src/pages/vi/subgraphs/cookbook/_meta.js +++ b/website/src/pages/vi/subgraphs/cookbook/_meta.js @@ -1,4 +1,5 @@ export default { + 'subgraph-composition-three-sources': '', 'subgraph-debug-forking': '', near: '', arweave: '', @@ -8,5 +9,4 @@ export default { enums: '', 'secure-api-keys-nextjs': '', polymarket: '', - 'subgraph-composition-three-sources': '', } diff --git a/website/src/pages/vi/subgraphs/cookbook/subgraph-composition-three-source.mdx b/website/src/pages/vi/subgraphs/cookbook/subgraph-composition-three-source.mdx deleted file mode 100644 index 80b86a24d036..000000000000 --- a/website/src/pages/vi/subgraphs/cookbook/subgraph-composition-three-source.mdx +++ /dev/null @@ -1,121 +0,0 @@ ---- -title: Integrating Three Subgraphs Using Subgraph Composition -sidebarTitle: 'Subgraph Composition with Three Source Subgraphs' ---- - -Optimize your Subgraph by merging data from three independent, `source` Subgraphs into a single composable Subgraph to enhance data aggregation. - -> Important Reminders - -> - Subgraph composition is built into the CLI, and you can deploy with [Subgraph Studio](https://thegraph.com/studio/). -> - This feature requires spec version 1.3.0. - -## Overview - -Subgraph composition empowers developer to leverage a Subgraph with other Subgraphs as data sources, seamlessly integrating and reacting to data updates and entity changes. This capability enhances efficiency and responsiveness in data handling. - -## Prerequisites - -To deploy **all** Subgraphs locally, you must have the following: - -- A [graph-node](https://github.com/graphprotocol/graph-node) instance running locally -- An [IPFS](https://docs.ipfs.tech/) instance running locally -- [Node.js.](https://nodejs.org/en) and npm - -## Get Started - -The following guide provides examples for defining three `source` Subgraphs to create one powerful composed Subgraph. - -### Specifics - -- To keep this example simple, all `source` subgraphs use only block handlers, but in a real environment, each source Subgraph will use data from different smart contracts. -- The examples below show how to import and extend the schema of another Subgraph to enhance its functionality. -- Each source Subgraph is optimized with a specific entity. -- All the commands listed install the necessary dependencies, generate code based on the GraphQL schema, build the Subgraph, and deploy it to your local Graph Node instance. - -### Step 1. Deploy Block Time Source Subgraph - -This first source Subgraph calculates the block time for each block. - -- It imports schemas from other Subgraphs and adds a `block` entity with a `timestamp` field, representing the time each block was mined. -- It listens to time-related blockchain events (e.g., block timestamps) and processes this data to update the Subgraph's entities accordingly. - -To deploy this Subgraph locally, run the following commands: - -```bash -npm install -npm run codegen -npm run build -npm run create-local -npm run deploy-local -``` - -### Step 1. Deploy Block Cost Source Subgraph - -This second `source` Subgraph indexes the cost of each block. - -#### Key Functions - -- It imports schemas from other Subgraphs and adds a `block` entity with cost-related fields. -- It listens to blockchain events related to costs (e.g. gas fees, transaction costs) and processes this data to update the Subgraph's entities accordingly. - -To deploy this Subgraph locally, run the following commands: - -```bash -npm install -npm run codegen -npm run build -npm run create-local -npm run deploy-local -``` - -### Step 2. Define Block Size in Source Subgraph - -This third `source` Subgraph indexes the size of each block. - -#### Key Functions - -- It imports existing schemas from other Subgraphs and adds a `Block` entity with a `size` field representing each block's size. -- It listens to blockchain events related to block sizes (e.g., storage or volume) and processes this data to update the Subgraph's entities accordingly. - -To deploy this Subgraph locally, run the following commands: - -```bash -npm install -npm run codegen -npm run build -npm run create-local -npm run deploy-local -``` - -### Step 3. Combine Into Block Stats Subgraph - -This composed Subgraph combines and aggregates the information from the three source Subgraphs above. - -> [!NOTE] Any change to a source Subgraph will likely generate a new deployment ID. Be sure to update the deployment ID in the data source address of the Subgraph manifest to take advantage of the latest changes. [!IMPORTANT] All source Subgraphs should be deployed before the composed Subgraph is deployed. - -This composed Subgraph demonstrates how to create a subgraph that aggregates data from three source subgraphs, providing a unified, enhanced view of block statistics. - -#### Key Functions - -- It provides a consolidated data model that encompasses all relevant block metrics. -- It combines data from three `source` subgraphs, and provides a comprehensive view of block statistics, enabling more complex queries and analyses. To deploy this subgraph locally, run the following commands: - -```bash -npm install -npm run codegen -npm run build -npm run create-local -npm run deploy-local -``` - -## Key Takeaways - -- This powerful tool will scale your subgraph development and allow you to combine multiple Subgraphs. -- The setup includes the deployment of three source Subgraphs and one final deployment of the composed Subgraph. -- This feature unlocks scalability, simplifying both development and maintenance efficiency. - -## Additional Resources - -- Add advanced features in your subgraph. Check out [subgraph advance features](/developing/creating/advanced/) and the [subgraph composition repo](https://github.com/incrypto32/subgraph-composition-sample-subgraph). -- Check out the Github repo [for this example] (https://github.com/isum/subgraph-composition-example). diff --git a/website/src/pages/vi/subgraphs/cookbook/subgraph-composition-three-sources.mdx b/website/src/pages/vi/subgraphs/cookbook/subgraph-composition-three-sources.mdx new file mode 100644 index 000000000000..024e79f5c7c5 --- /dev/null +++ b/website/src/pages/vi/subgraphs/cookbook/subgraph-composition-three-sources.mdx @@ -0,0 +1,124 @@ +--- +title: Integrating Three Subgraphs Using Subgraph Composition +sidebarTitle: 'Composable Subgraph with Three Source Subgraphs' +--- + +Optimize your Subgraph by merging data from three independent, source + +Subgraphs into a single composable Subgraph to enhance data aggregation. + +> Important Reminders + +> - Subgraph composition is built into the CLI, and you can deploy with [Subgraph Studio](https://thegraph.com/studio/). +> - This feature requires `specVersion` 1.3.0. +> - This example uses + +## Overview + +Subgraph composition empowers developer to leverage a Subgraph with other Subgraphs as data sources, seamlessly integrating and reacting to data updates and entity changes. This capability enhances efficiency and responsiveness in data handling. + +## Prerequisites + +To deploy **all** Subgraphs locally, you must have the following: + +- A [graph-node](https://github.com/graphprotocol/graph-node) instance running locally +- An [IPFS](https://docs.ipfs.tech/) instance running locally +- [Node.js.](https://nodejs.org/en) and npm + +## Get Started + +The following guide provides examples for defining three source Subgraphs to create one powerful composed Subgraph. + +### Specifics + +- To keep this example simple, all source subgraphs use only block handlers, but in a real environment, each source Subgraph will use data from different smart contracts. +- The examples below show how to import and extend the schema of another Subgraph to enhance its functionality. +- Each source Subgraph is optimized with a specific entity. +- All the commands listed install the necessary dependencies, generate code based on the GraphQL schema, build the Subgraph, and deploy it to your local Graph Node instance. + +### Step 1. Deploy Block Time Source Subgraph + +This first source Subgraph calculates the block time for each block. + +- It imports schemas from other Subgraphs and adds a `block` entity with a `timestamp` field, representing the time each block was mined. +- It listens to time-related blockchain events (e.g., block timestamps) and processes this data to update the Subgraph's entities accordingly. + +To deploy this Subgraph locally, run the following commands: + +```bash +npm install +npm run codegen +npm run build +npm run create-local +npm run deploy-local +``` + +### Step 1. Deploy Block Cost Source Subgraph + +This second source Subgraph indexes the cost of each block. + +#### Key Functions + +- It imports schemas from other Subgraphs and adds a `block` entity with cost-related fields. +- It listens to blockchain events related to costs (e.g. gas fees, transaction costs) and processes this data to update the Subgraph's entities accordingly. + +To deploy this Subgraph locally, run the following commands: + +```bash +npm install +npm run codegen +npm run build +npm run create-local +npm run deploy-local +``` + +### Step 2. Define Block Size in Source Subgraph + +This third source Subgraph indexes the size of each block. + +#### Key Functions + +- It imports existing schemas from other Subgraphs and adds a `Block` entity with a `size` field representing each block's size. +- It listens to blockchain events related to block sizes (e.g., storage or volume) and processes this data to update the Subgraph's entities accordingly. + +To deploy this Subgraph locally, run the following commands: + +```bash +npm install +npm run codegen +npm run build +npm run create-local +npm run deploy-local +``` + +### Step 3. Combine Into Block Stats Subgraph + +This composed Subgraph combines and aggregates the information from the three source Subgraphs above. To learn how to use aggregations, check out Subgraph [advanced features](https://thegraph.com/docs/en/subgraphs/developing/creating/advanced/#timeseries-and-aggregations). + +> [!NOTE] Any change to a source Subgraph will likely generate a new deployment ID. Be sure to update the deployment ID in the data source address of the Subgraph manifest to take advantage of the latest changes. [!IMPORTANT] All source Subgraphs should be deployed before the composed Subgraph is deployed. + +This composed Subgraph demonstrates how to create a subgraph that aggregates data from three source subgraphs, providing a unified, enhanced view of block statistics. + +#### Key Functions + +- It provides a consolidated data model that encompasses all relevant block metrics. +- It combines data from three source subgraphs, and provides a comprehensive view of block statistics, enabling more complex queries and analyses. To deploy this subgraph locally, run the following commands: + +```bash +npm install +npm run codegen +npm run build +npm run create-local +npm run deploy-local +``` + +## Key Takeaways + +- This powerful tool will scale your subgraph development and allow you to combine multiple Subgraphs. +- The setup includes the deployment of three source Subgraphs and one final deployment of the composed Subgraph. +- This feature unlocks scalability, simplifying both development and maintenance efficiency. + +## Additional Resources + +- Add advanced features in your subgraph. Check out [subgraph advance features](/developing/creating/advanced/) and the [subgraph composition repo](https://github.com/incrypto32/subgraph-composition-sample-subgraph). +- Check out all the code for this example in [the Github repo] (https://github.com/isum/subgraph-composition-example). diff --git a/website/src/pages/zh/subgraphs/cookbook/_meta.js b/website/src/pages/zh/subgraphs/cookbook/_meta.js index ae67ab7baed1..1b169037deee 100644 --- a/website/src/pages/zh/subgraphs/cookbook/_meta.js +++ b/website/src/pages/zh/subgraphs/cookbook/_meta.js @@ -1,4 +1,5 @@ export default { + 'subgraph-composition-three-sources': '', 'subgraph-debug-forking': '', near: '', arweave: '', @@ -8,5 +9,4 @@ export default { enums: '', 'secure-api-keys-nextjs': '', polymarket: '', - 'subgraph-composition-three-sources': '', } diff --git a/website/src/pages/zh/subgraphs/cookbook/subgraph-composition-three-source.mdx b/website/src/pages/zh/subgraphs/cookbook/subgraph-composition-three-source.mdx deleted file mode 100644 index 80b86a24d036..000000000000 --- a/website/src/pages/zh/subgraphs/cookbook/subgraph-composition-three-source.mdx +++ /dev/null @@ -1,121 +0,0 @@ ---- -title: Integrating Three Subgraphs Using Subgraph Composition -sidebarTitle: 'Subgraph Composition with Three Source Subgraphs' ---- - -Optimize your Subgraph by merging data from three independent, `source` Subgraphs into a single composable Subgraph to enhance data aggregation. - -> Important Reminders - -> - Subgraph composition is built into the CLI, and you can deploy with [Subgraph Studio](https://thegraph.com/studio/). -> - This feature requires spec version 1.3.0. - -## Overview - -Subgraph composition empowers developer to leverage a Subgraph with other Subgraphs as data sources, seamlessly integrating and reacting to data updates and entity changes. This capability enhances efficiency and responsiveness in data handling. - -## Prerequisites - -To deploy **all** Subgraphs locally, you must have the following: - -- A [graph-node](https://github.com/graphprotocol/graph-node) instance running locally -- An [IPFS](https://docs.ipfs.tech/) instance running locally -- [Node.js.](https://nodejs.org/en) and npm - -## Get Started - -The following guide provides examples for defining three `source` Subgraphs to create one powerful composed Subgraph. - -### Specifics - -- To keep this example simple, all `source` subgraphs use only block handlers, but in a real environment, each source Subgraph will use data from different smart contracts. -- The examples below show how to import and extend the schema of another Subgraph to enhance its functionality. -- Each source Subgraph is optimized with a specific entity. -- All the commands listed install the necessary dependencies, generate code based on the GraphQL schema, build the Subgraph, and deploy it to your local Graph Node instance. - -### Step 1. Deploy Block Time Source Subgraph - -This first source Subgraph calculates the block time for each block. - -- It imports schemas from other Subgraphs and adds a `block` entity with a `timestamp` field, representing the time each block was mined. -- It listens to time-related blockchain events (e.g., block timestamps) and processes this data to update the Subgraph's entities accordingly. - -To deploy this Subgraph locally, run the following commands: - -```bash -npm install -npm run codegen -npm run build -npm run create-local -npm run deploy-local -``` - -### Step 1. Deploy Block Cost Source Subgraph - -This second `source` Subgraph indexes the cost of each block. - -#### Key Functions - -- It imports schemas from other Subgraphs and adds a `block` entity with cost-related fields. -- It listens to blockchain events related to costs (e.g. gas fees, transaction costs) and processes this data to update the Subgraph's entities accordingly. - -To deploy this Subgraph locally, run the following commands: - -```bash -npm install -npm run codegen -npm run build -npm run create-local -npm run deploy-local -``` - -### Step 2. Define Block Size in Source Subgraph - -This third `source` Subgraph indexes the size of each block. - -#### Key Functions - -- It imports existing schemas from other Subgraphs and adds a `Block` entity with a `size` field representing each block's size. -- It listens to blockchain events related to block sizes (e.g., storage or volume) and processes this data to update the Subgraph's entities accordingly. - -To deploy this Subgraph locally, run the following commands: - -```bash -npm install -npm run codegen -npm run build -npm run create-local -npm run deploy-local -``` - -### Step 3. Combine Into Block Stats Subgraph - -This composed Subgraph combines and aggregates the information from the three source Subgraphs above. - -> [!NOTE] Any change to a source Subgraph will likely generate a new deployment ID. Be sure to update the deployment ID in the data source address of the Subgraph manifest to take advantage of the latest changes. [!IMPORTANT] All source Subgraphs should be deployed before the composed Subgraph is deployed. - -This composed Subgraph demonstrates how to create a subgraph that aggregates data from three source subgraphs, providing a unified, enhanced view of block statistics. - -#### Key Functions - -- It provides a consolidated data model that encompasses all relevant block metrics. -- It combines data from three `source` subgraphs, and provides a comprehensive view of block statistics, enabling more complex queries and analyses. To deploy this subgraph locally, run the following commands: - -```bash -npm install -npm run codegen -npm run build -npm run create-local -npm run deploy-local -``` - -## Key Takeaways - -- This powerful tool will scale your subgraph development and allow you to combine multiple Subgraphs. -- The setup includes the deployment of three source Subgraphs and one final deployment of the composed Subgraph. -- This feature unlocks scalability, simplifying both development and maintenance efficiency. - -## Additional Resources - -- Add advanced features in your subgraph. Check out [subgraph advance features](/developing/creating/advanced/) and the [subgraph composition repo](https://github.com/incrypto32/subgraph-composition-sample-subgraph). -- Check out the Github repo [for this example] (https://github.com/isum/subgraph-composition-example). diff --git a/website/src/pages/zh/subgraphs/cookbook/subgraph-composition-three-sources.mdx b/website/src/pages/zh/subgraphs/cookbook/subgraph-composition-three-sources.mdx new file mode 100644 index 000000000000..024e79f5c7c5 --- /dev/null +++ b/website/src/pages/zh/subgraphs/cookbook/subgraph-composition-three-sources.mdx @@ -0,0 +1,124 @@ +--- +title: Integrating Three Subgraphs Using Subgraph Composition +sidebarTitle: 'Composable Subgraph with Three Source Subgraphs' +--- + +Optimize your Subgraph by merging data from three independent, source + +Subgraphs into a single composable Subgraph to enhance data aggregation. + +> Important Reminders + +> - Subgraph composition is built into the CLI, and you can deploy with [Subgraph Studio](https://thegraph.com/studio/). +> - This feature requires `specVersion` 1.3.0. +> - This example uses + +## Overview + +Subgraph composition empowers developer to leverage a Subgraph with other Subgraphs as data sources, seamlessly integrating and reacting to data updates and entity changes. This capability enhances efficiency and responsiveness in data handling. + +## Prerequisites + +To deploy **all** Subgraphs locally, you must have the following: + +- A [graph-node](https://github.com/graphprotocol/graph-node) instance running locally +- An [IPFS](https://docs.ipfs.tech/) instance running locally +- [Node.js.](https://nodejs.org/en) and npm + +## Get Started + +The following guide provides examples for defining three source Subgraphs to create one powerful composed Subgraph. + +### Specifics + +- To keep this example simple, all source subgraphs use only block handlers, but in a real environment, each source Subgraph will use data from different smart contracts. +- The examples below show how to import and extend the schema of another Subgraph to enhance its functionality. +- Each source Subgraph is optimized with a specific entity. +- All the commands listed install the necessary dependencies, generate code based on the GraphQL schema, build the Subgraph, and deploy it to your local Graph Node instance. + +### Step 1. Deploy Block Time Source Subgraph + +This first source Subgraph calculates the block time for each block. + +- It imports schemas from other Subgraphs and adds a `block` entity with a `timestamp` field, representing the time each block was mined. +- It listens to time-related blockchain events (e.g., block timestamps) and processes this data to update the Subgraph's entities accordingly. + +To deploy this Subgraph locally, run the following commands: + +```bash +npm install +npm run codegen +npm run build +npm run create-local +npm run deploy-local +``` + +### Step 1. Deploy Block Cost Source Subgraph + +This second source Subgraph indexes the cost of each block. + +#### Key Functions + +- It imports schemas from other Subgraphs and adds a `block` entity with cost-related fields. +- It listens to blockchain events related to costs (e.g. gas fees, transaction costs) and processes this data to update the Subgraph's entities accordingly. + +To deploy this Subgraph locally, run the following commands: + +```bash +npm install +npm run codegen +npm run build +npm run create-local +npm run deploy-local +``` + +### Step 2. Define Block Size in Source Subgraph + +This third source Subgraph indexes the size of each block. + +#### Key Functions + +- It imports existing schemas from other Subgraphs and adds a `Block` entity with a `size` field representing each block's size. +- It listens to blockchain events related to block sizes (e.g., storage or volume) and processes this data to update the Subgraph's entities accordingly. + +To deploy this Subgraph locally, run the following commands: + +```bash +npm install +npm run codegen +npm run build +npm run create-local +npm run deploy-local +``` + +### Step 3. Combine Into Block Stats Subgraph + +This composed Subgraph combines and aggregates the information from the three source Subgraphs above. To learn how to use aggregations, check out Subgraph [advanced features](https://thegraph.com/docs/en/subgraphs/developing/creating/advanced/#timeseries-and-aggregations). + +> [!NOTE] Any change to a source Subgraph will likely generate a new deployment ID. Be sure to update the deployment ID in the data source address of the Subgraph manifest to take advantage of the latest changes. [!IMPORTANT] All source Subgraphs should be deployed before the composed Subgraph is deployed. + +This composed Subgraph demonstrates how to create a subgraph that aggregates data from three source subgraphs, providing a unified, enhanced view of block statistics. + +#### Key Functions + +- It provides a consolidated data model that encompasses all relevant block metrics. +- It combines data from three source subgraphs, and provides a comprehensive view of block statistics, enabling more complex queries and analyses. To deploy this subgraph locally, run the following commands: + +```bash +npm install +npm run codegen +npm run build +npm run create-local +npm run deploy-local +``` + +## Key Takeaways + +- This powerful tool will scale your subgraph development and allow you to combine multiple Subgraphs. +- The setup includes the deployment of three source Subgraphs and one final deployment of the composed Subgraph. +- This feature unlocks scalability, simplifying both development and maintenance efficiency. + +## Additional Resources + +- Add advanced features in your subgraph. Check out [subgraph advance features](/developing/creating/advanced/) and the [subgraph composition repo](https://github.com/incrypto32/subgraph-composition-sample-subgraph). +- Check out all the code for this example in [the Github repo] (https://github.com/isum/subgraph-composition-example). From 9da75df805a524e0b2a1311d3f9e9effef008d24 Mon Sep 17 00:00:00 2001 From: benface Date: Sun, 2 Mar 2025 11:31:45 -0500 Subject: [PATCH 03/14] Delete outdated duplicates --- .../subgraph-composition-three-sources.mdx | 124 ------------------ .../subgraph-composition-three-sources.mdx | 124 ------------------ .../subgraph-composition-three-sources.mdx | 124 ------------------ .../subgraph-composition-three-sources.mdx | 124 ------------------ .../subgraph-composition-three-sources.mdx | 124 ------------------ .../subgraph-composition-three-sources.mdx | 124 ------------------ .../subgraph-composition-three-sources.mdx | 124 ------------------ .../subgraph-composition-three-sources.mdx | 124 ------------------ .../subgraph-composition-three-sources.mdx | 124 ------------------ .../subgraph-composition-three-sources.mdx | 124 ------------------ .../subgraph-composition-three-sources.mdx | 124 ------------------ .../subgraph-composition-three-sources.mdx | 124 ------------------ .../subgraph-composition-three-sources.mdx | 124 ------------------ .../subgraph-composition-three-sources.mdx | 124 ------------------ .../subgraph-composition-three-sources.mdx | 124 ------------------ .../subgraph-composition-three-sources.mdx | 124 ------------------ .../subgraph-composition-three-sources.mdx | 124 ------------------ .../subgraph-composition-three-sources.mdx | 124 ------------------ .../subgraph-composition-three-sources.mdx | 124 ------------------ .../subgraph-composition-three-sources.mdx | 124 ------------------ .../subgraph-composition-three-sources.mdx | 124 ------------------ 21 files changed, 2604 deletions(-) delete mode 100644 website/src/pages/ar/subgraphs/cookbook/subgraph-composition-three-sources.mdx delete mode 100644 website/src/pages/cs/subgraphs/cookbook/subgraph-composition-three-sources.mdx delete mode 100644 website/src/pages/de/subgraphs/cookbook/subgraph-composition-three-sources.mdx delete mode 100644 website/src/pages/es/subgraphs/cookbook/subgraph-composition-three-sources.mdx delete mode 100644 website/src/pages/fr/subgraphs/cookbook/subgraph-composition-three-sources.mdx delete mode 100644 website/src/pages/hi/subgraphs/cookbook/subgraph-composition-three-sources.mdx delete mode 100644 website/src/pages/it/subgraphs/cookbook/subgraph-composition-three-sources.mdx delete mode 100644 website/src/pages/ja/subgraphs/cookbook/subgraph-composition-three-sources.mdx delete mode 100644 website/src/pages/ko/subgraphs/cookbook/subgraph-composition-three-sources.mdx delete mode 100644 website/src/pages/mr/subgraphs/cookbook/subgraph-composition-three-sources.mdx delete mode 100644 website/src/pages/nl/subgraphs/cookbook/subgraph-composition-three-sources.mdx delete mode 100644 website/src/pages/pl/subgraphs/cookbook/subgraph-composition-three-sources.mdx delete mode 100644 website/src/pages/pt/subgraphs/cookbook/subgraph-composition-three-sources.mdx delete mode 100644 website/src/pages/ro/subgraphs/cookbook/subgraph-composition-three-sources.mdx delete mode 100644 website/src/pages/ru/subgraphs/cookbook/subgraph-composition-three-sources.mdx delete mode 100644 website/src/pages/sv/subgraphs/cookbook/subgraph-composition-three-sources.mdx delete mode 100644 website/src/pages/tr/subgraphs/cookbook/subgraph-composition-three-sources.mdx delete mode 100644 website/src/pages/uk/subgraphs/cookbook/subgraph-composition-three-sources.mdx delete mode 100644 website/src/pages/ur/subgraphs/cookbook/subgraph-composition-three-sources.mdx delete mode 100644 website/src/pages/vi/subgraphs/cookbook/subgraph-composition-three-sources.mdx delete mode 100644 website/src/pages/zh/subgraphs/cookbook/subgraph-composition-three-sources.mdx diff --git a/website/src/pages/ar/subgraphs/cookbook/subgraph-composition-three-sources.mdx b/website/src/pages/ar/subgraphs/cookbook/subgraph-composition-three-sources.mdx deleted file mode 100644 index 024e79f5c7c5..000000000000 --- a/website/src/pages/ar/subgraphs/cookbook/subgraph-composition-three-sources.mdx +++ /dev/null @@ -1,124 +0,0 @@ ---- -title: Integrating Three Subgraphs Using Subgraph Composition -sidebarTitle: 'Composable Subgraph with Three Source Subgraphs' ---- - -Optimize your Subgraph by merging data from three independent, source - -Subgraphs into a single composable Subgraph to enhance data aggregation. - -> Important Reminders - -> - Subgraph composition is built into the CLI, and you can deploy with [Subgraph Studio](https://thegraph.com/studio/). -> - This feature requires `specVersion` 1.3.0. -> - This example uses - -## Overview - -Subgraph composition empowers developer to leverage a Subgraph with other Subgraphs as data sources, seamlessly integrating and reacting to data updates and entity changes. This capability enhances efficiency and responsiveness in data handling. - -## Prerequisites - -To deploy **all** Subgraphs locally, you must have the following: - -- A [graph-node](https://github.com/graphprotocol/graph-node) instance running locally -- An [IPFS](https://docs.ipfs.tech/) instance running locally -- [Node.js.](https://nodejs.org/en) and npm - -## Get Started - -The following guide provides examples for defining three source Subgraphs to create one powerful composed Subgraph. - -### Specifics - -- To keep this example simple, all source subgraphs use only block handlers, but in a real environment, each source Subgraph will use data from different smart contracts. -- The examples below show how to import and extend the schema of another Subgraph to enhance its functionality. -- Each source Subgraph is optimized with a specific entity. -- All the commands listed install the necessary dependencies, generate code based on the GraphQL schema, build the Subgraph, and deploy it to your local Graph Node instance. - -### Step 1. Deploy Block Time Source Subgraph - -This first source Subgraph calculates the block time for each block. - -- It imports schemas from other Subgraphs and adds a `block` entity with a `timestamp` field, representing the time each block was mined. -- It listens to time-related blockchain events (e.g., block timestamps) and processes this data to update the Subgraph's entities accordingly. - -To deploy this Subgraph locally, run the following commands: - -```bash -npm install -npm run codegen -npm run build -npm run create-local -npm run deploy-local -``` - -### Step 1. Deploy Block Cost Source Subgraph - -This second source Subgraph indexes the cost of each block. - -#### Key Functions - -- It imports schemas from other Subgraphs and adds a `block` entity with cost-related fields. -- It listens to blockchain events related to costs (e.g. gas fees, transaction costs) and processes this data to update the Subgraph's entities accordingly. - -To deploy this Subgraph locally, run the following commands: - -```bash -npm install -npm run codegen -npm run build -npm run create-local -npm run deploy-local -``` - -### Step 2. Define Block Size in Source Subgraph - -This third source Subgraph indexes the size of each block. - -#### Key Functions - -- It imports existing schemas from other Subgraphs and adds a `Block` entity with a `size` field representing each block's size. -- It listens to blockchain events related to block sizes (e.g., storage or volume) and processes this data to update the Subgraph's entities accordingly. - -To deploy this Subgraph locally, run the following commands: - -```bash -npm install -npm run codegen -npm run build -npm run create-local -npm run deploy-local -``` - -### Step 3. Combine Into Block Stats Subgraph - -This composed Subgraph combines and aggregates the information from the three source Subgraphs above. To learn how to use aggregations, check out Subgraph [advanced features](https://thegraph.com/docs/en/subgraphs/developing/creating/advanced/#timeseries-and-aggregations). - -> [!NOTE] Any change to a source Subgraph will likely generate a new deployment ID. Be sure to update the deployment ID in the data source address of the Subgraph manifest to take advantage of the latest changes. [!IMPORTANT] All source Subgraphs should be deployed before the composed Subgraph is deployed. - -This composed Subgraph demonstrates how to create a subgraph that aggregates data from three source subgraphs, providing a unified, enhanced view of block statistics. - -#### Key Functions - -- It provides a consolidated data model that encompasses all relevant block metrics. -- It combines data from three source subgraphs, and provides a comprehensive view of block statistics, enabling more complex queries and analyses. To deploy this subgraph locally, run the following commands: - -```bash -npm install -npm run codegen -npm run build -npm run create-local -npm run deploy-local -``` - -## Key Takeaways - -- This powerful tool will scale your subgraph development and allow you to combine multiple Subgraphs. -- The setup includes the deployment of three source Subgraphs and one final deployment of the composed Subgraph. -- This feature unlocks scalability, simplifying both development and maintenance efficiency. - -## Additional Resources - -- Add advanced features in your subgraph. Check out [subgraph advance features](/developing/creating/advanced/) and the [subgraph composition repo](https://github.com/incrypto32/subgraph-composition-sample-subgraph). -- Check out all the code for this example in [the Github repo] (https://github.com/isum/subgraph-composition-example). diff --git a/website/src/pages/cs/subgraphs/cookbook/subgraph-composition-three-sources.mdx b/website/src/pages/cs/subgraphs/cookbook/subgraph-composition-three-sources.mdx deleted file mode 100644 index 024e79f5c7c5..000000000000 --- a/website/src/pages/cs/subgraphs/cookbook/subgraph-composition-three-sources.mdx +++ /dev/null @@ -1,124 +0,0 @@ ---- -title: Integrating Three Subgraphs Using Subgraph Composition -sidebarTitle: 'Composable Subgraph with Three Source Subgraphs' ---- - -Optimize your Subgraph by merging data from three independent, source - -Subgraphs into a single composable Subgraph to enhance data aggregation. - -> Important Reminders - -> - Subgraph composition is built into the CLI, and you can deploy with [Subgraph Studio](https://thegraph.com/studio/). -> - This feature requires `specVersion` 1.3.0. -> - This example uses - -## Overview - -Subgraph composition empowers developer to leverage a Subgraph with other Subgraphs as data sources, seamlessly integrating and reacting to data updates and entity changes. This capability enhances efficiency and responsiveness in data handling. - -## Prerequisites - -To deploy **all** Subgraphs locally, you must have the following: - -- A [graph-node](https://github.com/graphprotocol/graph-node) instance running locally -- An [IPFS](https://docs.ipfs.tech/) instance running locally -- [Node.js.](https://nodejs.org/en) and npm - -## Get Started - -The following guide provides examples for defining three source Subgraphs to create one powerful composed Subgraph. - -### Specifics - -- To keep this example simple, all source subgraphs use only block handlers, but in a real environment, each source Subgraph will use data from different smart contracts. -- The examples below show how to import and extend the schema of another Subgraph to enhance its functionality. -- Each source Subgraph is optimized with a specific entity. -- All the commands listed install the necessary dependencies, generate code based on the GraphQL schema, build the Subgraph, and deploy it to your local Graph Node instance. - -### Step 1. Deploy Block Time Source Subgraph - -This first source Subgraph calculates the block time for each block. - -- It imports schemas from other Subgraphs and adds a `block` entity with a `timestamp` field, representing the time each block was mined. -- It listens to time-related blockchain events (e.g., block timestamps) and processes this data to update the Subgraph's entities accordingly. - -To deploy this Subgraph locally, run the following commands: - -```bash -npm install -npm run codegen -npm run build -npm run create-local -npm run deploy-local -``` - -### Step 1. Deploy Block Cost Source Subgraph - -This second source Subgraph indexes the cost of each block. - -#### Key Functions - -- It imports schemas from other Subgraphs and adds a `block` entity with cost-related fields. -- It listens to blockchain events related to costs (e.g. gas fees, transaction costs) and processes this data to update the Subgraph's entities accordingly. - -To deploy this Subgraph locally, run the following commands: - -```bash -npm install -npm run codegen -npm run build -npm run create-local -npm run deploy-local -``` - -### Step 2. Define Block Size in Source Subgraph - -This third source Subgraph indexes the size of each block. - -#### Key Functions - -- It imports existing schemas from other Subgraphs and adds a `Block` entity with a `size` field representing each block's size. -- It listens to blockchain events related to block sizes (e.g., storage or volume) and processes this data to update the Subgraph's entities accordingly. - -To deploy this Subgraph locally, run the following commands: - -```bash -npm install -npm run codegen -npm run build -npm run create-local -npm run deploy-local -``` - -### Step 3. Combine Into Block Stats Subgraph - -This composed Subgraph combines and aggregates the information from the three source Subgraphs above. To learn how to use aggregations, check out Subgraph [advanced features](https://thegraph.com/docs/en/subgraphs/developing/creating/advanced/#timeseries-and-aggregations). - -> [!NOTE] Any change to a source Subgraph will likely generate a new deployment ID. Be sure to update the deployment ID in the data source address of the Subgraph manifest to take advantage of the latest changes. [!IMPORTANT] All source Subgraphs should be deployed before the composed Subgraph is deployed. - -This composed Subgraph demonstrates how to create a subgraph that aggregates data from three source subgraphs, providing a unified, enhanced view of block statistics. - -#### Key Functions - -- It provides a consolidated data model that encompasses all relevant block metrics. -- It combines data from three source subgraphs, and provides a comprehensive view of block statistics, enabling more complex queries and analyses. To deploy this subgraph locally, run the following commands: - -```bash -npm install -npm run codegen -npm run build -npm run create-local -npm run deploy-local -``` - -## Key Takeaways - -- This powerful tool will scale your subgraph development and allow you to combine multiple Subgraphs. -- The setup includes the deployment of three source Subgraphs and one final deployment of the composed Subgraph. -- This feature unlocks scalability, simplifying both development and maintenance efficiency. - -## Additional Resources - -- Add advanced features in your subgraph. Check out [subgraph advance features](/developing/creating/advanced/) and the [subgraph composition repo](https://github.com/incrypto32/subgraph-composition-sample-subgraph). -- Check out all the code for this example in [the Github repo] (https://github.com/isum/subgraph-composition-example). diff --git a/website/src/pages/de/subgraphs/cookbook/subgraph-composition-three-sources.mdx b/website/src/pages/de/subgraphs/cookbook/subgraph-composition-three-sources.mdx deleted file mode 100644 index 024e79f5c7c5..000000000000 --- a/website/src/pages/de/subgraphs/cookbook/subgraph-composition-three-sources.mdx +++ /dev/null @@ -1,124 +0,0 @@ ---- -title: Integrating Three Subgraphs Using Subgraph Composition -sidebarTitle: 'Composable Subgraph with Three Source Subgraphs' ---- - -Optimize your Subgraph by merging data from three independent, source - -Subgraphs into a single composable Subgraph to enhance data aggregation. - -> Important Reminders - -> - Subgraph composition is built into the CLI, and you can deploy with [Subgraph Studio](https://thegraph.com/studio/). -> - This feature requires `specVersion` 1.3.0. -> - This example uses - -## Overview - -Subgraph composition empowers developer to leverage a Subgraph with other Subgraphs as data sources, seamlessly integrating and reacting to data updates and entity changes. This capability enhances efficiency and responsiveness in data handling. - -## Prerequisites - -To deploy **all** Subgraphs locally, you must have the following: - -- A [graph-node](https://github.com/graphprotocol/graph-node) instance running locally -- An [IPFS](https://docs.ipfs.tech/) instance running locally -- [Node.js.](https://nodejs.org/en) and npm - -## Get Started - -The following guide provides examples for defining three source Subgraphs to create one powerful composed Subgraph. - -### Specifics - -- To keep this example simple, all source subgraphs use only block handlers, but in a real environment, each source Subgraph will use data from different smart contracts. -- The examples below show how to import and extend the schema of another Subgraph to enhance its functionality. -- Each source Subgraph is optimized with a specific entity. -- All the commands listed install the necessary dependencies, generate code based on the GraphQL schema, build the Subgraph, and deploy it to your local Graph Node instance. - -### Step 1. Deploy Block Time Source Subgraph - -This first source Subgraph calculates the block time for each block. - -- It imports schemas from other Subgraphs and adds a `block` entity with a `timestamp` field, representing the time each block was mined. -- It listens to time-related blockchain events (e.g., block timestamps) and processes this data to update the Subgraph's entities accordingly. - -To deploy this Subgraph locally, run the following commands: - -```bash -npm install -npm run codegen -npm run build -npm run create-local -npm run deploy-local -``` - -### Step 1. Deploy Block Cost Source Subgraph - -This second source Subgraph indexes the cost of each block. - -#### Key Functions - -- It imports schemas from other Subgraphs and adds a `block` entity with cost-related fields. -- It listens to blockchain events related to costs (e.g. gas fees, transaction costs) and processes this data to update the Subgraph's entities accordingly. - -To deploy this Subgraph locally, run the following commands: - -```bash -npm install -npm run codegen -npm run build -npm run create-local -npm run deploy-local -``` - -### Step 2. Define Block Size in Source Subgraph - -This third source Subgraph indexes the size of each block. - -#### Key Functions - -- It imports existing schemas from other Subgraphs and adds a `Block` entity with a `size` field representing each block's size. -- It listens to blockchain events related to block sizes (e.g., storage or volume) and processes this data to update the Subgraph's entities accordingly. - -To deploy this Subgraph locally, run the following commands: - -```bash -npm install -npm run codegen -npm run build -npm run create-local -npm run deploy-local -``` - -### Step 3. Combine Into Block Stats Subgraph - -This composed Subgraph combines and aggregates the information from the three source Subgraphs above. To learn how to use aggregations, check out Subgraph [advanced features](https://thegraph.com/docs/en/subgraphs/developing/creating/advanced/#timeseries-and-aggregations). - -> [!NOTE] Any change to a source Subgraph will likely generate a new deployment ID. Be sure to update the deployment ID in the data source address of the Subgraph manifest to take advantage of the latest changes. [!IMPORTANT] All source Subgraphs should be deployed before the composed Subgraph is deployed. - -This composed Subgraph demonstrates how to create a subgraph that aggregates data from three source subgraphs, providing a unified, enhanced view of block statistics. - -#### Key Functions - -- It provides a consolidated data model that encompasses all relevant block metrics. -- It combines data from three source subgraphs, and provides a comprehensive view of block statistics, enabling more complex queries and analyses. To deploy this subgraph locally, run the following commands: - -```bash -npm install -npm run codegen -npm run build -npm run create-local -npm run deploy-local -``` - -## Key Takeaways - -- This powerful tool will scale your subgraph development and allow you to combine multiple Subgraphs. -- The setup includes the deployment of three source Subgraphs and one final deployment of the composed Subgraph. -- This feature unlocks scalability, simplifying both development and maintenance efficiency. - -## Additional Resources - -- Add advanced features in your subgraph. Check out [subgraph advance features](/developing/creating/advanced/) and the [subgraph composition repo](https://github.com/incrypto32/subgraph-composition-sample-subgraph). -- Check out all the code for this example in [the Github repo] (https://github.com/isum/subgraph-composition-example). diff --git a/website/src/pages/es/subgraphs/cookbook/subgraph-composition-three-sources.mdx b/website/src/pages/es/subgraphs/cookbook/subgraph-composition-three-sources.mdx deleted file mode 100644 index 024e79f5c7c5..000000000000 --- a/website/src/pages/es/subgraphs/cookbook/subgraph-composition-three-sources.mdx +++ /dev/null @@ -1,124 +0,0 @@ ---- -title: Integrating Three Subgraphs Using Subgraph Composition -sidebarTitle: 'Composable Subgraph with Three Source Subgraphs' ---- - -Optimize your Subgraph by merging data from three independent, source - -Subgraphs into a single composable Subgraph to enhance data aggregation. - -> Important Reminders - -> - Subgraph composition is built into the CLI, and you can deploy with [Subgraph Studio](https://thegraph.com/studio/). -> - This feature requires `specVersion` 1.3.0. -> - This example uses - -## Overview - -Subgraph composition empowers developer to leverage a Subgraph with other Subgraphs as data sources, seamlessly integrating and reacting to data updates and entity changes. This capability enhances efficiency and responsiveness in data handling. - -## Prerequisites - -To deploy **all** Subgraphs locally, you must have the following: - -- A [graph-node](https://github.com/graphprotocol/graph-node) instance running locally -- An [IPFS](https://docs.ipfs.tech/) instance running locally -- [Node.js.](https://nodejs.org/en) and npm - -## Get Started - -The following guide provides examples for defining three source Subgraphs to create one powerful composed Subgraph. - -### Specifics - -- To keep this example simple, all source subgraphs use only block handlers, but in a real environment, each source Subgraph will use data from different smart contracts. -- The examples below show how to import and extend the schema of another Subgraph to enhance its functionality. -- Each source Subgraph is optimized with a specific entity. -- All the commands listed install the necessary dependencies, generate code based on the GraphQL schema, build the Subgraph, and deploy it to your local Graph Node instance. - -### Step 1. Deploy Block Time Source Subgraph - -This first source Subgraph calculates the block time for each block. - -- It imports schemas from other Subgraphs and adds a `block` entity with a `timestamp` field, representing the time each block was mined. -- It listens to time-related blockchain events (e.g., block timestamps) and processes this data to update the Subgraph's entities accordingly. - -To deploy this Subgraph locally, run the following commands: - -```bash -npm install -npm run codegen -npm run build -npm run create-local -npm run deploy-local -``` - -### Step 1. Deploy Block Cost Source Subgraph - -This second source Subgraph indexes the cost of each block. - -#### Key Functions - -- It imports schemas from other Subgraphs and adds a `block` entity with cost-related fields. -- It listens to blockchain events related to costs (e.g. gas fees, transaction costs) and processes this data to update the Subgraph's entities accordingly. - -To deploy this Subgraph locally, run the following commands: - -```bash -npm install -npm run codegen -npm run build -npm run create-local -npm run deploy-local -``` - -### Step 2. Define Block Size in Source Subgraph - -This third source Subgraph indexes the size of each block. - -#### Key Functions - -- It imports existing schemas from other Subgraphs and adds a `Block` entity with a `size` field representing each block's size. -- It listens to blockchain events related to block sizes (e.g., storage or volume) and processes this data to update the Subgraph's entities accordingly. - -To deploy this Subgraph locally, run the following commands: - -```bash -npm install -npm run codegen -npm run build -npm run create-local -npm run deploy-local -``` - -### Step 3. Combine Into Block Stats Subgraph - -This composed Subgraph combines and aggregates the information from the three source Subgraphs above. To learn how to use aggregations, check out Subgraph [advanced features](https://thegraph.com/docs/en/subgraphs/developing/creating/advanced/#timeseries-and-aggregations). - -> [!NOTE] Any change to a source Subgraph will likely generate a new deployment ID. Be sure to update the deployment ID in the data source address of the Subgraph manifest to take advantage of the latest changes. [!IMPORTANT] All source Subgraphs should be deployed before the composed Subgraph is deployed. - -This composed Subgraph demonstrates how to create a subgraph that aggregates data from three source subgraphs, providing a unified, enhanced view of block statistics. - -#### Key Functions - -- It provides a consolidated data model that encompasses all relevant block metrics. -- It combines data from three source subgraphs, and provides a comprehensive view of block statistics, enabling more complex queries and analyses. To deploy this subgraph locally, run the following commands: - -```bash -npm install -npm run codegen -npm run build -npm run create-local -npm run deploy-local -``` - -## Key Takeaways - -- This powerful tool will scale your subgraph development and allow you to combine multiple Subgraphs. -- The setup includes the deployment of three source Subgraphs and one final deployment of the composed Subgraph. -- This feature unlocks scalability, simplifying both development and maintenance efficiency. - -## Additional Resources - -- Add advanced features in your subgraph. Check out [subgraph advance features](/developing/creating/advanced/) and the [subgraph composition repo](https://github.com/incrypto32/subgraph-composition-sample-subgraph). -- Check out all the code for this example in [the Github repo] (https://github.com/isum/subgraph-composition-example). diff --git a/website/src/pages/fr/subgraphs/cookbook/subgraph-composition-three-sources.mdx b/website/src/pages/fr/subgraphs/cookbook/subgraph-composition-three-sources.mdx deleted file mode 100644 index 024e79f5c7c5..000000000000 --- a/website/src/pages/fr/subgraphs/cookbook/subgraph-composition-three-sources.mdx +++ /dev/null @@ -1,124 +0,0 @@ ---- -title: Integrating Three Subgraphs Using Subgraph Composition -sidebarTitle: 'Composable Subgraph with Three Source Subgraphs' ---- - -Optimize your Subgraph by merging data from three independent, source - -Subgraphs into a single composable Subgraph to enhance data aggregation. - -> Important Reminders - -> - Subgraph composition is built into the CLI, and you can deploy with [Subgraph Studio](https://thegraph.com/studio/). -> - This feature requires `specVersion` 1.3.0. -> - This example uses - -## Overview - -Subgraph composition empowers developer to leverage a Subgraph with other Subgraphs as data sources, seamlessly integrating and reacting to data updates and entity changes. This capability enhances efficiency and responsiveness in data handling. - -## Prerequisites - -To deploy **all** Subgraphs locally, you must have the following: - -- A [graph-node](https://github.com/graphprotocol/graph-node) instance running locally -- An [IPFS](https://docs.ipfs.tech/) instance running locally -- [Node.js.](https://nodejs.org/en) and npm - -## Get Started - -The following guide provides examples for defining three source Subgraphs to create one powerful composed Subgraph. - -### Specifics - -- To keep this example simple, all source subgraphs use only block handlers, but in a real environment, each source Subgraph will use data from different smart contracts. -- The examples below show how to import and extend the schema of another Subgraph to enhance its functionality. -- Each source Subgraph is optimized with a specific entity. -- All the commands listed install the necessary dependencies, generate code based on the GraphQL schema, build the Subgraph, and deploy it to your local Graph Node instance. - -### Step 1. Deploy Block Time Source Subgraph - -This first source Subgraph calculates the block time for each block. - -- It imports schemas from other Subgraphs and adds a `block` entity with a `timestamp` field, representing the time each block was mined. -- It listens to time-related blockchain events (e.g., block timestamps) and processes this data to update the Subgraph's entities accordingly. - -To deploy this Subgraph locally, run the following commands: - -```bash -npm install -npm run codegen -npm run build -npm run create-local -npm run deploy-local -``` - -### Step 1. Deploy Block Cost Source Subgraph - -This second source Subgraph indexes the cost of each block. - -#### Key Functions - -- It imports schemas from other Subgraphs and adds a `block` entity with cost-related fields. -- It listens to blockchain events related to costs (e.g. gas fees, transaction costs) and processes this data to update the Subgraph's entities accordingly. - -To deploy this Subgraph locally, run the following commands: - -```bash -npm install -npm run codegen -npm run build -npm run create-local -npm run deploy-local -``` - -### Step 2. Define Block Size in Source Subgraph - -This third source Subgraph indexes the size of each block. - -#### Key Functions - -- It imports existing schemas from other Subgraphs and adds a `Block` entity with a `size` field representing each block's size. -- It listens to blockchain events related to block sizes (e.g., storage or volume) and processes this data to update the Subgraph's entities accordingly. - -To deploy this Subgraph locally, run the following commands: - -```bash -npm install -npm run codegen -npm run build -npm run create-local -npm run deploy-local -``` - -### Step 3. Combine Into Block Stats Subgraph - -This composed Subgraph combines and aggregates the information from the three source Subgraphs above. To learn how to use aggregations, check out Subgraph [advanced features](https://thegraph.com/docs/en/subgraphs/developing/creating/advanced/#timeseries-and-aggregations). - -> [!NOTE] Any change to a source Subgraph will likely generate a new deployment ID. Be sure to update the deployment ID in the data source address of the Subgraph manifest to take advantage of the latest changes. [!IMPORTANT] All source Subgraphs should be deployed before the composed Subgraph is deployed. - -This composed Subgraph demonstrates how to create a subgraph that aggregates data from three source subgraphs, providing a unified, enhanced view of block statistics. - -#### Key Functions - -- It provides a consolidated data model that encompasses all relevant block metrics. -- It combines data from three source subgraphs, and provides a comprehensive view of block statistics, enabling more complex queries and analyses. To deploy this subgraph locally, run the following commands: - -```bash -npm install -npm run codegen -npm run build -npm run create-local -npm run deploy-local -``` - -## Key Takeaways - -- This powerful tool will scale your subgraph development and allow you to combine multiple Subgraphs. -- The setup includes the deployment of three source Subgraphs and one final deployment of the composed Subgraph. -- This feature unlocks scalability, simplifying both development and maintenance efficiency. - -## Additional Resources - -- Add advanced features in your subgraph. Check out [subgraph advance features](/developing/creating/advanced/) and the [subgraph composition repo](https://github.com/incrypto32/subgraph-composition-sample-subgraph). -- Check out all the code for this example in [the Github repo] (https://github.com/isum/subgraph-composition-example). diff --git a/website/src/pages/hi/subgraphs/cookbook/subgraph-composition-three-sources.mdx b/website/src/pages/hi/subgraphs/cookbook/subgraph-composition-three-sources.mdx deleted file mode 100644 index 024e79f5c7c5..000000000000 --- a/website/src/pages/hi/subgraphs/cookbook/subgraph-composition-three-sources.mdx +++ /dev/null @@ -1,124 +0,0 @@ ---- -title: Integrating Three Subgraphs Using Subgraph Composition -sidebarTitle: 'Composable Subgraph with Three Source Subgraphs' ---- - -Optimize your Subgraph by merging data from three independent, source - -Subgraphs into a single composable Subgraph to enhance data aggregation. - -> Important Reminders - -> - Subgraph composition is built into the CLI, and you can deploy with [Subgraph Studio](https://thegraph.com/studio/). -> - This feature requires `specVersion` 1.3.0. -> - This example uses - -## Overview - -Subgraph composition empowers developer to leverage a Subgraph with other Subgraphs as data sources, seamlessly integrating and reacting to data updates and entity changes. This capability enhances efficiency and responsiveness in data handling. - -## Prerequisites - -To deploy **all** Subgraphs locally, you must have the following: - -- A [graph-node](https://github.com/graphprotocol/graph-node) instance running locally -- An [IPFS](https://docs.ipfs.tech/) instance running locally -- [Node.js.](https://nodejs.org/en) and npm - -## Get Started - -The following guide provides examples for defining three source Subgraphs to create one powerful composed Subgraph. - -### Specifics - -- To keep this example simple, all source subgraphs use only block handlers, but in a real environment, each source Subgraph will use data from different smart contracts. -- The examples below show how to import and extend the schema of another Subgraph to enhance its functionality. -- Each source Subgraph is optimized with a specific entity. -- All the commands listed install the necessary dependencies, generate code based on the GraphQL schema, build the Subgraph, and deploy it to your local Graph Node instance. - -### Step 1. Deploy Block Time Source Subgraph - -This first source Subgraph calculates the block time for each block. - -- It imports schemas from other Subgraphs and adds a `block` entity with a `timestamp` field, representing the time each block was mined. -- It listens to time-related blockchain events (e.g., block timestamps) and processes this data to update the Subgraph's entities accordingly. - -To deploy this Subgraph locally, run the following commands: - -```bash -npm install -npm run codegen -npm run build -npm run create-local -npm run deploy-local -``` - -### Step 1. Deploy Block Cost Source Subgraph - -This second source Subgraph indexes the cost of each block. - -#### Key Functions - -- It imports schemas from other Subgraphs and adds a `block` entity with cost-related fields. -- It listens to blockchain events related to costs (e.g. gas fees, transaction costs) and processes this data to update the Subgraph's entities accordingly. - -To deploy this Subgraph locally, run the following commands: - -```bash -npm install -npm run codegen -npm run build -npm run create-local -npm run deploy-local -``` - -### Step 2. Define Block Size in Source Subgraph - -This third source Subgraph indexes the size of each block. - -#### Key Functions - -- It imports existing schemas from other Subgraphs and adds a `Block` entity with a `size` field representing each block's size. -- It listens to blockchain events related to block sizes (e.g., storage or volume) and processes this data to update the Subgraph's entities accordingly. - -To deploy this Subgraph locally, run the following commands: - -```bash -npm install -npm run codegen -npm run build -npm run create-local -npm run deploy-local -``` - -### Step 3. Combine Into Block Stats Subgraph - -This composed Subgraph combines and aggregates the information from the three source Subgraphs above. To learn how to use aggregations, check out Subgraph [advanced features](https://thegraph.com/docs/en/subgraphs/developing/creating/advanced/#timeseries-and-aggregations). - -> [!NOTE] Any change to a source Subgraph will likely generate a new deployment ID. Be sure to update the deployment ID in the data source address of the Subgraph manifest to take advantage of the latest changes. [!IMPORTANT] All source Subgraphs should be deployed before the composed Subgraph is deployed. - -This composed Subgraph demonstrates how to create a subgraph that aggregates data from three source subgraphs, providing a unified, enhanced view of block statistics. - -#### Key Functions - -- It provides a consolidated data model that encompasses all relevant block metrics. -- It combines data from three source subgraphs, and provides a comprehensive view of block statistics, enabling more complex queries and analyses. To deploy this subgraph locally, run the following commands: - -```bash -npm install -npm run codegen -npm run build -npm run create-local -npm run deploy-local -``` - -## Key Takeaways - -- This powerful tool will scale your subgraph development and allow you to combine multiple Subgraphs. -- The setup includes the deployment of three source Subgraphs and one final deployment of the composed Subgraph. -- This feature unlocks scalability, simplifying both development and maintenance efficiency. - -## Additional Resources - -- Add advanced features in your subgraph. Check out [subgraph advance features](/developing/creating/advanced/) and the [subgraph composition repo](https://github.com/incrypto32/subgraph-composition-sample-subgraph). -- Check out all the code for this example in [the Github repo] (https://github.com/isum/subgraph-composition-example). diff --git a/website/src/pages/it/subgraphs/cookbook/subgraph-composition-three-sources.mdx b/website/src/pages/it/subgraphs/cookbook/subgraph-composition-three-sources.mdx deleted file mode 100644 index 024e79f5c7c5..000000000000 --- a/website/src/pages/it/subgraphs/cookbook/subgraph-composition-three-sources.mdx +++ /dev/null @@ -1,124 +0,0 @@ ---- -title: Integrating Three Subgraphs Using Subgraph Composition -sidebarTitle: 'Composable Subgraph with Three Source Subgraphs' ---- - -Optimize your Subgraph by merging data from three independent, source - -Subgraphs into a single composable Subgraph to enhance data aggregation. - -> Important Reminders - -> - Subgraph composition is built into the CLI, and you can deploy with [Subgraph Studio](https://thegraph.com/studio/). -> - This feature requires `specVersion` 1.3.0. -> - This example uses - -## Overview - -Subgraph composition empowers developer to leverage a Subgraph with other Subgraphs as data sources, seamlessly integrating and reacting to data updates and entity changes. This capability enhances efficiency and responsiveness in data handling. - -## Prerequisites - -To deploy **all** Subgraphs locally, you must have the following: - -- A [graph-node](https://github.com/graphprotocol/graph-node) instance running locally -- An [IPFS](https://docs.ipfs.tech/) instance running locally -- [Node.js.](https://nodejs.org/en) and npm - -## Get Started - -The following guide provides examples for defining three source Subgraphs to create one powerful composed Subgraph. - -### Specifics - -- To keep this example simple, all source subgraphs use only block handlers, but in a real environment, each source Subgraph will use data from different smart contracts. -- The examples below show how to import and extend the schema of another Subgraph to enhance its functionality. -- Each source Subgraph is optimized with a specific entity. -- All the commands listed install the necessary dependencies, generate code based on the GraphQL schema, build the Subgraph, and deploy it to your local Graph Node instance. - -### Step 1. Deploy Block Time Source Subgraph - -This first source Subgraph calculates the block time for each block. - -- It imports schemas from other Subgraphs and adds a `block` entity with a `timestamp` field, representing the time each block was mined. -- It listens to time-related blockchain events (e.g., block timestamps) and processes this data to update the Subgraph's entities accordingly. - -To deploy this Subgraph locally, run the following commands: - -```bash -npm install -npm run codegen -npm run build -npm run create-local -npm run deploy-local -``` - -### Step 1. Deploy Block Cost Source Subgraph - -This second source Subgraph indexes the cost of each block. - -#### Key Functions - -- It imports schemas from other Subgraphs and adds a `block` entity with cost-related fields. -- It listens to blockchain events related to costs (e.g. gas fees, transaction costs) and processes this data to update the Subgraph's entities accordingly. - -To deploy this Subgraph locally, run the following commands: - -```bash -npm install -npm run codegen -npm run build -npm run create-local -npm run deploy-local -``` - -### Step 2. Define Block Size in Source Subgraph - -This third source Subgraph indexes the size of each block. - -#### Key Functions - -- It imports existing schemas from other Subgraphs and adds a `Block` entity with a `size` field representing each block's size. -- It listens to blockchain events related to block sizes (e.g., storage or volume) and processes this data to update the Subgraph's entities accordingly. - -To deploy this Subgraph locally, run the following commands: - -```bash -npm install -npm run codegen -npm run build -npm run create-local -npm run deploy-local -``` - -### Step 3. Combine Into Block Stats Subgraph - -This composed Subgraph combines and aggregates the information from the three source Subgraphs above. To learn how to use aggregations, check out Subgraph [advanced features](https://thegraph.com/docs/en/subgraphs/developing/creating/advanced/#timeseries-and-aggregations). - -> [!NOTE] Any change to a source Subgraph will likely generate a new deployment ID. Be sure to update the deployment ID in the data source address of the Subgraph manifest to take advantage of the latest changes. [!IMPORTANT] All source Subgraphs should be deployed before the composed Subgraph is deployed. - -This composed Subgraph demonstrates how to create a subgraph that aggregates data from three source subgraphs, providing a unified, enhanced view of block statistics. - -#### Key Functions - -- It provides a consolidated data model that encompasses all relevant block metrics. -- It combines data from three source subgraphs, and provides a comprehensive view of block statistics, enabling more complex queries and analyses. To deploy this subgraph locally, run the following commands: - -```bash -npm install -npm run codegen -npm run build -npm run create-local -npm run deploy-local -``` - -## Key Takeaways - -- This powerful tool will scale your subgraph development and allow you to combine multiple Subgraphs. -- The setup includes the deployment of three source Subgraphs and one final deployment of the composed Subgraph. -- This feature unlocks scalability, simplifying both development and maintenance efficiency. - -## Additional Resources - -- Add advanced features in your subgraph. Check out [subgraph advance features](/developing/creating/advanced/) and the [subgraph composition repo](https://github.com/incrypto32/subgraph-composition-sample-subgraph). -- Check out all the code for this example in [the Github repo] (https://github.com/isum/subgraph-composition-example). diff --git a/website/src/pages/ja/subgraphs/cookbook/subgraph-composition-three-sources.mdx b/website/src/pages/ja/subgraphs/cookbook/subgraph-composition-three-sources.mdx deleted file mode 100644 index 024e79f5c7c5..000000000000 --- a/website/src/pages/ja/subgraphs/cookbook/subgraph-composition-three-sources.mdx +++ /dev/null @@ -1,124 +0,0 @@ ---- -title: Integrating Three Subgraphs Using Subgraph Composition -sidebarTitle: 'Composable Subgraph with Three Source Subgraphs' ---- - -Optimize your Subgraph by merging data from three independent, source - -Subgraphs into a single composable Subgraph to enhance data aggregation. - -> Important Reminders - -> - Subgraph composition is built into the CLI, and you can deploy with [Subgraph Studio](https://thegraph.com/studio/). -> - This feature requires `specVersion` 1.3.0. -> - This example uses - -## Overview - -Subgraph composition empowers developer to leverage a Subgraph with other Subgraphs as data sources, seamlessly integrating and reacting to data updates and entity changes. This capability enhances efficiency and responsiveness in data handling. - -## Prerequisites - -To deploy **all** Subgraphs locally, you must have the following: - -- A [graph-node](https://github.com/graphprotocol/graph-node) instance running locally -- An [IPFS](https://docs.ipfs.tech/) instance running locally -- [Node.js.](https://nodejs.org/en) and npm - -## Get Started - -The following guide provides examples for defining three source Subgraphs to create one powerful composed Subgraph. - -### Specifics - -- To keep this example simple, all source subgraphs use only block handlers, but in a real environment, each source Subgraph will use data from different smart contracts. -- The examples below show how to import and extend the schema of another Subgraph to enhance its functionality. -- Each source Subgraph is optimized with a specific entity. -- All the commands listed install the necessary dependencies, generate code based on the GraphQL schema, build the Subgraph, and deploy it to your local Graph Node instance. - -### Step 1. Deploy Block Time Source Subgraph - -This first source Subgraph calculates the block time for each block. - -- It imports schemas from other Subgraphs and adds a `block` entity with a `timestamp` field, representing the time each block was mined. -- It listens to time-related blockchain events (e.g., block timestamps) and processes this data to update the Subgraph's entities accordingly. - -To deploy this Subgraph locally, run the following commands: - -```bash -npm install -npm run codegen -npm run build -npm run create-local -npm run deploy-local -``` - -### Step 1. Deploy Block Cost Source Subgraph - -This second source Subgraph indexes the cost of each block. - -#### Key Functions - -- It imports schemas from other Subgraphs and adds a `block` entity with cost-related fields. -- It listens to blockchain events related to costs (e.g. gas fees, transaction costs) and processes this data to update the Subgraph's entities accordingly. - -To deploy this Subgraph locally, run the following commands: - -```bash -npm install -npm run codegen -npm run build -npm run create-local -npm run deploy-local -``` - -### Step 2. Define Block Size in Source Subgraph - -This third source Subgraph indexes the size of each block. - -#### Key Functions - -- It imports existing schemas from other Subgraphs and adds a `Block` entity with a `size` field representing each block's size. -- It listens to blockchain events related to block sizes (e.g., storage or volume) and processes this data to update the Subgraph's entities accordingly. - -To deploy this Subgraph locally, run the following commands: - -```bash -npm install -npm run codegen -npm run build -npm run create-local -npm run deploy-local -``` - -### Step 3. Combine Into Block Stats Subgraph - -This composed Subgraph combines and aggregates the information from the three source Subgraphs above. To learn how to use aggregations, check out Subgraph [advanced features](https://thegraph.com/docs/en/subgraphs/developing/creating/advanced/#timeseries-and-aggregations). - -> [!NOTE] Any change to a source Subgraph will likely generate a new deployment ID. Be sure to update the deployment ID in the data source address of the Subgraph manifest to take advantage of the latest changes. [!IMPORTANT] All source Subgraphs should be deployed before the composed Subgraph is deployed. - -This composed Subgraph demonstrates how to create a subgraph that aggregates data from three source subgraphs, providing a unified, enhanced view of block statistics. - -#### Key Functions - -- It provides a consolidated data model that encompasses all relevant block metrics. -- It combines data from three source subgraphs, and provides a comprehensive view of block statistics, enabling more complex queries and analyses. To deploy this subgraph locally, run the following commands: - -```bash -npm install -npm run codegen -npm run build -npm run create-local -npm run deploy-local -``` - -## Key Takeaways - -- This powerful tool will scale your subgraph development and allow you to combine multiple Subgraphs. -- The setup includes the deployment of three source Subgraphs and one final deployment of the composed Subgraph. -- This feature unlocks scalability, simplifying both development and maintenance efficiency. - -## Additional Resources - -- Add advanced features in your subgraph. Check out [subgraph advance features](/developing/creating/advanced/) and the [subgraph composition repo](https://github.com/incrypto32/subgraph-composition-sample-subgraph). -- Check out all the code for this example in [the Github repo] (https://github.com/isum/subgraph-composition-example). diff --git a/website/src/pages/ko/subgraphs/cookbook/subgraph-composition-three-sources.mdx b/website/src/pages/ko/subgraphs/cookbook/subgraph-composition-three-sources.mdx deleted file mode 100644 index 024e79f5c7c5..000000000000 --- a/website/src/pages/ko/subgraphs/cookbook/subgraph-composition-three-sources.mdx +++ /dev/null @@ -1,124 +0,0 @@ ---- -title: Integrating Three Subgraphs Using Subgraph Composition -sidebarTitle: 'Composable Subgraph with Three Source Subgraphs' ---- - -Optimize your Subgraph by merging data from three independent, source - -Subgraphs into a single composable Subgraph to enhance data aggregation. - -> Important Reminders - -> - Subgraph composition is built into the CLI, and you can deploy with [Subgraph Studio](https://thegraph.com/studio/). -> - This feature requires `specVersion` 1.3.0. -> - This example uses - -## Overview - -Subgraph composition empowers developer to leverage a Subgraph with other Subgraphs as data sources, seamlessly integrating and reacting to data updates and entity changes. This capability enhances efficiency and responsiveness in data handling. - -## Prerequisites - -To deploy **all** Subgraphs locally, you must have the following: - -- A [graph-node](https://github.com/graphprotocol/graph-node) instance running locally -- An [IPFS](https://docs.ipfs.tech/) instance running locally -- [Node.js.](https://nodejs.org/en) and npm - -## Get Started - -The following guide provides examples for defining three source Subgraphs to create one powerful composed Subgraph. - -### Specifics - -- To keep this example simple, all source subgraphs use only block handlers, but in a real environment, each source Subgraph will use data from different smart contracts. -- The examples below show how to import and extend the schema of another Subgraph to enhance its functionality. -- Each source Subgraph is optimized with a specific entity. -- All the commands listed install the necessary dependencies, generate code based on the GraphQL schema, build the Subgraph, and deploy it to your local Graph Node instance. - -### Step 1. Deploy Block Time Source Subgraph - -This first source Subgraph calculates the block time for each block. - -- It imports schemas from other Subgraphs and adds a `block` entity with a `timestamp` field, representing the time each block was mined. -- It listens to time-related blockchain events (e.g., block timestamps) and processes this data to update the Subgraph's entities accordingly. - -To deploy this Subgraph locally, run the following commands: - -```bash -npm install -npm run codegen -npm run build -npm run create-local -npm run deploy-local -``` - -### Step 1. Deploy Block Cost Source Subgraph - -This second source Subgraph indexes the cost of each block. - -#### Key Functions - -- It imports schemas from other Subgraphs and adds a `block` entity with cost-related fields. -- It listens to blockchain events related to costs (e.g. gas fees, transaction costs) and processes this data to update the Subgraph's entities accordingly. - -To deploy this Subgraph locally, run the following commands: - -```bash -npm install -npm run codegen -npm run build -npm run create-local -npm run deploy-local -``` - -### Step 2. Define Block Size in Source Subgraph - -This third source Subgraph indexes the size of each block. - -#### Key Functions - -- It imports existing schemas from other Subgraphs and adds a `Block` entity with a `size` field representing each block's size. -- It listens to blockchain events related to block sizes (e.g., storage or volume) and processes this data to update the Subgraph's entities accordingly. - -To deploy this Subgraph locally, run the following commands: - -```bash -npm install -npm run codegen -npm run build -npm run create-local -npm run deploy-local -``` - -### Step 3. Combine Into Block Stats Subgraph - -This composed Subgraph combines and aggregates the information from the three source Subgraphs above. To learn how to use aggregations, check out Subgraph [advanced features](https://thegraph.com/docs/en/subgraphs/developing/creating/advanced/#timeseries-and-aggregations). - -> [!NOTE] Any change to a source Subgraph will likely generate a new deployment ID. Be sure to update the deployment ID in the data source address of the Subgraph manifest to take advantage of the latest changes. [!IMPORTANT] All source Subgraphs should be deployed before the composed Subgraph is deployed. - -This composed Subgraph demonstrates how to create a subgraph that aggregates data from three source subgraphs, providing a unified, enhanced view of block statistics. - -#### Key Functions - -- It provides a consolidated data model that encompasses all relevant block metrics. -- It combines data from three source subgraphs, and provides a comprehensive view of block statistics, enabling more complex queries and analyses. To deploy this subgraph locally, run the following commands: - -```bash -npm install -npm run codegen -npm run build -npm run create-local -npm run deploy-local -``` - -## Key Takeaways - -- This powerful tool will scale your subgraph development and allow you to combine multiple Subgraphs. -- The setup includes the deployment of three source Subgraphs and one final deployment of the composed Subgraph. -- This feature unlocks scalability, simplifying both development and maintenance efficiency. - -## Additional Resources - -- Add advanced features in your subgraph. Check out [subgraph advance features](/developing/creating/advanced/) and the [subgraph composition repo](https://github.com/incrypto32/subgraph-composition-sample-subgraph). -- Check out all the code for this example in [the Github repo] (https://github.com/isum/subgraph-composition-example). diff --git a/website/src/pages/mr/subgraphs/cookbook/subgraph-composition-three-sources.mdx b/website/src/pages/mr/subgraphs/cookbook/subgraph-composition-three-sources.mdx deleted file mode 100644 index 024e79f5c7c5..000000000000 --- a/website/src/pages/mr/subgraphs/cookbook/subgraph-composition-three-sources.mdx +++ /dev/null @@ -1,124 +0,0 @@ ---- -title: Integrating Three Subgraphs Using Subgraph Composition -sidebarTitle: 'Composable Subgraph with Three Source Subgraphs' ---- - -Optimize your Subgraph by merging data from three independent, source - -Subgraphs into a single composable Subgraph to enhance data aggregation. - -> Important Reminders - -> - Subgraph composition is built into the CLI, and you can deploy with [Subgraph Studio](https://thegraph.com/studio/). -> - This feature requires `specVersion` 1.3.0. -> - This example uses - -## Overview - -Subgraph composition empowers developer to leverage a Subgraph with other Subgraphs as data sources, seamlessly integrating and reacting to data updates and entity changes. This capability enhances efficiency and responsiveness in data handling. - -## Prerequisites - -To deploy **all** Subgraphs locally, you must have the following: - -- A [graph-node](https://github.com/graphprotocol/graph-node) instance running locally -- An [IPFS](https://docs.ipfs.tech/) instance running locally -- [Node.js.](https://nodejs.org/en) and npm - -## Get Started - -The following guide provides examples for defining three source Subgraphs to create one powerful composed Subgraph. - -### Specifics - -- To keep this example simple, all source subgraphs use only block handlers, but in a real environment, each source Subgraph will use data from different smart contracts. -- The examples below show how to import and extend the schema of another Subgraph to enhance its functionality. -- Each source Subgraph is optimized with a specific entity. -- All the commands listed install the necessary dependencies, generate code based on the GraphQL schema, build the Subgraph, and deploy it to your local Graph Node instance. - -### Step 1. Deploy Block Time Source Subgraph - -This first source Subgraph calculates the block time for each block. - -- It imports schemas from other Subgraphs and adds a `block` entity with a `timestamp` field, representing the time each block was mined. -- It listens to time-related blockchain events (e.g., block timestamps) and processes this data to update the Subgraph's entities accordingly. - -To deploy this Subgraph locally, run the following commands: - -```bash -npm install -npm run codegen -npm run build -npm run create-local -npm run deploy-local -``` - -### Step 1. Deploy Block Cost Source Subgraph - -This second source Subgraph indexes the cost of each block. - -#### Key Functions - -- It imports schemas from other Subgraphs and adds a `block` entity with cost-related fields. -- It listens to blockchain events related to costs (e.g. gas fees, transaction costs) and processes this data to update the Subgraph's entities accordingly. - -To deploy this Subgraph locally, run the following commands: - -```bash -npm install -npm run codegen -npm run build -npm run create-local -npm run deploy-local -``` - -### Step 2. Define Block Size in Source Subgraph - -This third source Subgraph indexes the size of each block. - -#### Key Functions - -- It imports existing schemas from other Subgraphs and adds a `Block` entity with a `size` field representing each block's size. -- It listens to blockchain events related to block sizes (e.g., storage or volume) and processes this data to update the Subgraph's entities accordingly. - -To deploy this Subgraph locally, run the following commands: - -```bash -npm install -npm run codegen -npm run build -npm run create-local -npm run deploy-local -``` - -### Step 3. Combine Into Block Stats Subgraph - -This composed Subgraph combines and aggregates the information from the three source Subgraphs above. To learn how to use aggregations, check out Subgraph [advanced features](https://thegraph.com/docs/en/subgraphs/developing/creating/advanced/#timeseries-and-aggregations). - -> [!NOTE] Any change to a source Subgraph will likely generate a new deployment ID. Be sure to update the deployment ID in the data source address of the Subgraph manifest to take advantage of the latest changes. [!IMPORTANT] All source Subgraphs should be deployed before the composed Subgraph is deployed. - -This composed Subgraph demonstrates how to create a subgraph that aggregates data from three source subgraphs, providing a unified, enhanced view of block statistics. - -#### Key Functions - -- It provides a consolidated data model that encompasses all relevant block metrics. -- It combines data from three source subgraphs, and provides a comprehensive view of block statistics, enabling more complex queries and analyses. To deploy this subgraph locally, run the following commands: - -```bash -npm install -npm run codegen -npm run build -npm run create-local -npm run deploy-local -``` - -## Key Takeaways - -- This powerful tool will scale your subgraph development and allow you to combine multiple Subgraphs. -- The setup includes the deployment of three source Subgraphs and one final deployment of the composed Subgraph. -- This feature unlocks scalability, simplifying both development and maintenance efficiency. - -## Additional Resources - -- Add advanced features in your subgraph. Check out [subgraph advance features](/developing/creating/advanced/) and the [subgraph composition repo](https://github.com/incrypto32/subgraph-composition-sample-subgraph). -- Check out all the code for this example in [the Github repo] (https://github.com/isum/subgraph-composition-example). diff --git a/website/src/pages/nl/subgraphs/cookbook/subgraph-composition-three-sources.mdx b/website/src/pages/nl/subgraphs/cookbook/subgraph-composition-three-sources.mdx deleted file mode 100644 index 024e79f5c7c5..000000000000 --- a/website/src/pages/nl/subgraphs/cookbook/subgraph-composition-three-sources.mdx +++ /dev/null @@ -1,124 +0,0 @@ ---- -title: Integrating Three Subgraphs Using Subgraph Composition -sidebarTitle: 'Composable Subgraph with Three Source Subgraphs' ---- - -Optimize your Subgraph by merging data from three independent, source - -Subgraphs into a single composable Subgraph to enhance data aggregation. - -> Important Reminders - -> - Subgraph composition is built into the CLI, and you can deploy with [Subgraph Studio](https://thegraph.com/studio/). -> - This feature requires `specVersion` 1.3.0. -> - This example uses - -## Overview - -Subgraph composition empowers developer to leverage a Subgraph with other Subgraphs as data sources, seamlessly integrating and reacting to data updates and entity changes. This capability enhances efficiency and responsiveness in data handling. - -## Prerequisites - -To deploy **all** Subgraphs locally, you must have the following: - -- A [graph-node](https://github.com/graphprotocol/graph-node) instance running locally -- An [IPFS](https://docs.ipfs.tech/) instance running locally -- [Node.js.](https://nodejs.org/en) and npm - -## Get Started - -The following guide provides examples for defining three source Subgraphs to create one powerful composed Subgraph. - -### Specifics - -- To keep this example simple, all source subgraphs use only block handlers, but in a real environment, each source Subgraph will use data from different smart contracts. -- The examples below show how to import and extend the schema of another Subgraph to enhance its functionality. -- Each source Subgraph is optimized with a specific entity. -- All the commands listed install the necessary dependencies, generate code based on the GraphQL schema, build the Subgraph, and deploy it to your local Graph Node instance. - -### Step 1. Deploy Block Time Source Subgraph - -This first source Subgraph calculates the block time for each block. - -- It imports schemas from other Subgraphs and adds a `block` entity with a `timestamp` field, representing the time each block was mined. -- It listens to time-related blockchain events (e.g., block timestamps) and processes this data to update the Subgraph's entities accordingly. - -To deploy this Subgraph locally, run the following commands: - -```bash -npm install -npm run codegen -npm run build -npm run create-local -npm run deploy-local -``` - -### Step 1. Deploy Block Cost Source Subgraph - -This second source Subgraph indexes the cost of each block. - -#### Key Functions - -- It imports schemas from other Subgraphs and adds a `block` entity with cost-related fields. -- It listens to blockchain events related to costs (e.g. gas fees, transaction costs) and processes this data to update the Subgraph's entities accordingly. - -To deploy this Subgraph locally, run the following commands: - -```bash -npm install -npm run codegen -npm run build -npm run create-local -npm run deploy-local -``` - -### Step 2. Define Block Size in Source Subgraph - -This third source Subgraph indexes the size of each block. - -#### Key Functions - -- It imports existing schemas from other Subgraphs and adds a `Block` entity with a `size` field representing each block's size. -- It listens to blockchain events related to block sizes (e.g., storage or volume) and processes this data to update the Subgraph's entities accordingly. - -To deploy this Subgraph locally, run the following commands: - -```bash -npm install -npm run codegen -npm run build -npm run create-local -npm run deploy-local -``` - -### Step 3. Combine Into Block Stats Subgraph - -This composed Subgraph combines and aggregates the information from the three source Subgraphs above. To learn how to use aggregations, check out Subgraph [advanced features](https://thegraph.com/docs/en/subgraphs/developing/creating/advanced/#timeseries-and-aggregations). - -> [!NOTE] Any change to a source Subgraph will likely generate a new deployment ID. Be sure to update the deployment ID in the data source address of the Subgraph manifest to take advantage of the latest changes. [!IMPORTANT] All source Subgraphs should be deployed before the composed Subgraph is deployed. - -This composed Subgraph demonstrates how to create a subgraph that aggregates data from three source subgraphs, providing a unified, enhanced view of block statistics. - -#### Key Functions - -- It provides a consolidated data model that encompasses all relevant block metrics. -- It combines data from three source subgraphs, and provides a comprehensive view of block statistics, enabling more complex queries and analyses. To deploy this subgraph locally, run the following commands: - -```bash -npm install -npm run codegen -npm run build -npm run create-local -npm run deploy-local -``` - -## Key Takeaways - -- This powerful tool will scale your subgraph development and allow you to combine multiple Subgraphs. -- The setup includes the deployment of three source Subgraphs and one final deployment of the composed Subgraph. -- This feature unlocks scalability, simplifying both development and maintenance efficiency. - -## Additional Resources - -- Add advanced features in your subgraph. Check out [subgraph advance features](/developing/creating/advanced/) and the [subgraph composition repo](https://github.com/incrypto32/subgraph-composition-sample-subgraph). -- Check out all the code for this example in [the Github repo] (https://github.com/isum/subgraph-composition-example). diff --git a/website/src/pages/pl/subgraphs/cookbook/subgraph-composition-three-sources.mdx b/website/src/pages/pl/subgraphs/cookbook/subgraph-composition-three-sources.mdx deleted file mode 100644 index 024e79f5c7c5..000000000000 --- a/website/src/pages/pl/subgraphs/cookbook/subgraph-composition-three-sources.mdx +++ /dev/null @@ -1,124 +0,0 @@ ---- -title: Integrating Three Subgraphs Using Subgraph Composition -sidebarTitle: 'Composable Subgraph with Three Source Subgraphs' ---- - -Optimize your Subgraph by merging data from three independent, source - -Subgraphs into a single composable Subgraph to enhance data aggregation. - -> Important Reminders - -> - Subgraph composition is built into the CLI, and you can deploy with [Subgraph Studio](https://thegraph.com/studio/). -> - This feature requires `specVersion` 1.3.0. -> - This example uses - -## Overview - -Subgraph composition empowers developer to leverage a Subgraph with other Subgraphs as data sources, seamlessly integrating and reacting to data updates and entity changes. This capability enhances efficiency and responsiveness in data handling. - -## Prerequisites - -To deploy **all** Subgraphs locally, you must have the following: - -- A [graph-node](https://github.com/graphprotocol/graph-node) instance running locally -- An [IPFS](https://docs.ipfs.tech/) instance running locally -- [Node.js.](https://nodejs.org/en) and npm - -## Get Started - -The following guide provides examples for defining three source Subgraphs to create one powerful composed Subgraph. - -### Specifics - -- To keep this example simple, all source subgraphs use only block handlers, but in a real environment, each source Subgraph will use data from different smart contracts. -- The examples below show how to import and extend the schema of another Subgraph to enhance its functionality. -- Each source Subgraph is optimized with a specific entity. -- All the commands listed install the necessary dependencies, generate code based on the GraphQL schema, build the Subgraph, and deploy it to your local Graph Node instance. - -### Step 1. Deploy Block Time Source Subgraph - -This first source Subgraph calculates the block time for each block. - -- It imports schemas from other Subgraphs and adds a `block` entity with a `timestamp` field, representing the time each block was mined. -- It listens to time-related blockchain events (e.g., block timestamps) and processes this data to update the Subgraph's entities accordingly. - -To deploy this Subgraph locally, run the following commands: - -```bash -npm install -npm run codegen -npm run build -npm run create-local -npm run deploy-local -``` - -### Step 1. Deploy Block Cost Source Subgraph - -This second source Subgraph indexes the cost of each block. - -#### Key Functions - -- It imports schemas from other Subgraphs and adds a `block` entity with cost-related fields. -- It listens to blockchain events related to costs (e.g. gas fees, transaction costs) and processes this data to update the Subgraph's entities accordingly. - -To deploy this Subgraph locally, run the following commands: - -```bash -npm install -npm run codegen -npm run build -npm run create-local -npm run deploy-local -``` - -### Step 2. Define Block Size in Source Subgraph - -This third source Subgraph indexes the size of each block. - -#### Key Functions - -- It imports existing schemas from other Subgraphs and adds a `Block` entity with a `size` field representing each block's size. -- It listens to blockchain events related to block sizes (e.g., storage or volume) and processes this data to update the Subgraph's entities accordingly. - -To deploy this Subgraph locally, run the following commands: - -```bash -npm install -npm run codegen -npm run build -npm run create-local -npm run deploy-local -``` - -### Step 3. Combine Into Block Stats Subgraph - -This composed Subgraph combines and aggregates the information from the three source Subgraphs above. To learn how to use aggregations, check out Subgraph [advanced features](https://thegraph.com/docs/en/subgraphs/developing/creating/advanced/#timeseries-and-aggregations). - -> [!NOTE] Any change to a source Subgraph will likely generate a new deployment ID. Be sure to update the deployment ID in the data source address of the Subgraph manifest to take advantage of the latest changes. [!IMPORTANT] All source Subgraphs should be deployed before the composed Subgraph is deployed. - -This composed Subgraph demonstrates how to create a subgraph that aggregates data from three source subgraphs, providing a unified, enhanced view of block statistics. - -#### Key Functions - -- It provides a consolidated data model that encompasses all relevant block metrics. -- It combines data from three source subgraphs, and provides a comprehensive view of block statistics, enabling more complex queries and analyses. To deploy this subgraph locally, run the following commands: - -```bash -npm install -npm run codegen -npm run build -npm run create-local -npm run deploy-local -``` - -## Key Takeaways - -- This powerful tool will scale your subgraph development and allow you to combine multiple Subgraphs. -- The setup includes the deployment of three source Subgraphs and one final deployment of the composed Subgraph. -- This feature unlocks scalability, simplifying both development and maintenance efficiency. - -## Additional Resources - -- Add advanced features in your subgraph. Check out [subgraph advance features](/developing/creating/advanced/) and the [subgraph composition repo](https://github.com/incrypto32/subgraph-composition-sample-subgraph). -- Check out all the code for this example in [the Github repo] (https://github.com/isum/subgraph-composition-example). diff --git a/website/src/pages/pt/subgraphs/cookbook/subgraph-composition-three-sources.mdx b/website/src/pages/pt/subgraphs/cookbook/subgraph-composition-three-sources.mdx deleted file mode 100644 index 024e79f5c7c5..000000000000 --- a/website/src/pages/pt/subgraphs/cookbook/subgraph-composition-three-sources.mdx +++ /dev/null @@ -1,124 +0,0 @@ ---- -title: Integrating Three Subgraphs Using Subgraph Composition -sidebarTitle: 'Composable Subgraph with Three Source Subgraphs' ---- - -Optimize your Subgraph by merging data from three independent, source - -Subgraphs into a single composable Subgraph to enhance data aggregation. - -> Important Reminders - -> - Subgraph composition is built into the CLI, and you can deploy with [Subgraph Studio](https://thegraph.com/studio/). -> - This feature requires `specVersion` 1.3.0. -> - This example uses - -## Overview - -Subgraph composition empowers developer to leverage a Subgraph with other Subgraphs as data sources, seamlessly integrating and reacting to data updates and entity changes. This capability enhances efficiency and responsiveness in data handling. - -## Prerequisites - -To deploy **all** Subgraphs locally, you must have the following: - -- A [graph-node](https://github.com/graphprotocol/graph-node) instance running locally -- An [IPFS](https://docs.ipfs.tech/) instance running locally -- [Node.js.](https://nodejs.org/en) and npm - -## Get Started - -The following guide provides examples for defining three source Subgraphs to create one powerful composed Subgraph. - -### Specifics - -- To keep this example simple, all source subgraphs use only block handlers, but in a real environment, each source Subgraph will use data from different smart contracts. -- The examples below show how to import and extend the schema of another Subgraph to enhance its functionality. -- Each source Subgraph is optimized with a specific entity. -- All the commands listed install the necessary dependencies, generate code based on the GraphQL schema, build the Subgraph, and deploy it to your local Graph Node instance. - -### Step 1. Deploy Block Time Source Subgraph - -This first source Subgraph calculates the block time for each block. - -- It imports schemas from other Subgraphs and adds a `block` entity with a `timestamp` field, representing the time each block was mined. -- It listens to time-related blockchain events (e.g., block timestamps) and processes this data to update the Subgraph's entities accordingly. - -To deploy this Subgraph locally, run the following commands: - -```bash -npm install -npm run codegen -npm run build -npm run create-local -npm run deploy-local -``` - -### Step 1. Deploy Block Cost Source Subgraph - -This second source Subgraph indexes the cost of each block. - -#### Key Functions - -- It imports schemas from other Subgraphs and adds a `block` entity with cost-related fields. -- It listens to blockchain events related to costs (e.g. gas fees, transaction costs) and processes this data to update the Subgraph's entities accordingly. - -To deploy this Subgraph locally, run the following commands: - -```bash -npm install -npm run codegen -npm run build -npm run create-local -npm run deploy-local -``` - -### Step 2. Define Block Size in Source Subgraph - -This third source Subgraph indexes the size of each block. - -#### Key Functions - -- It imports existing schemas from other Subgraphs and adds a `Block` entity with a `size` field representing each block's size. -- It listens to blockchain events related to block sizes (e.g., storage or volume) and processes this data to update the Subgraph's entities accordingly. - -To deploy this Subgraph locally, run the following commands: - -```bash -npm install -npm run codegen -npm run build -npm run create-local -npm run deploy-local -``` - -### Step 3. Combine Into Block Stats Subgraph - -This composed Subgraph combines and aggregates the information from the three source Subgraphs above. To learn how to use aggregations, check out Subgraph [advanced features](https://thegraph.com/docs/en/subgraphs/developing/creating/advanced/#timeseries-and-aggregations). - -> [!NOTE] Any change to a source Subgraph will likely generate a new deployment ID. Be sure to update the deployment ID in the data source address of the Subgraph manifest to take advantage of the latest changes. [!IMPORTANT] All source Subgraphs should be deployed before the composed Subgraph is deployed. - -This composed Subgraph demonstrates how to create a subgraph that aggregates data from three source subgraphs, providing a unified, enhanced view of block statistics. - -#### Key Functions - -- It provides a consolidated data model that encompasses all relevant block metrics. -- It combines data from three source subgraphs, and provides a comprehensive view of block statistics, enabling more complex queries and analyses. To deploy this subgraph locally, run the following commands: - -```bash -npm install -npm run codegen -npm run build -npm run create-local -npm run deploy-local -``` - -## Key Takeaways - -- This powerful tool will scale your subgraph development and allow you to combine multiple Subgraphs. -- The setup includes the deployment of three source Subgraphs and one final deployment of the composed Subgraph. -- This feature unlocks scalability, simplifying both development and maintenance efficiency. - -## Additional Resources - -- Add advanced features in your subgraph. Check out [subgraph advance features](/developing/creating/advanced/) and the [subgraph composition repo](https://github.com/incrypto32/subgraph-composition-sample-subgraph). -- Check out all the code for this example in [the Github repo] (https://github.com/isum/subgraph-composition-example). diff --git a/website/src/pages/ro/subgraphs/cookbook/subgraph-composition-three-sources.mdx b/website/src/pages/ro/subgraphs/cookbook/subgraph-composition-three-sources.mdx deleted file mode 100644 index 024e79f5c7c5..000000000000 --- a/website/src/pages/ro/subgraphs/cookbook/subgraph-composition-three-sources.mdx +++ /dev/null @@ -1,124 +0,0 @@ ---- -title: Integrating Three Subgraphs Using Subgraph Composition -sidebarTitle: 'Composable Subgraph with Three Source Subgraphs' ---- - -Optimize your Subgraph by merging data from three independent, source - -Subgraphs into a single composable Subgraph to enhance data aggregation. - -> Important Reminders - -> - Subgraph composition is built into the CLI, and you can deploy with [Subgraph Studio](https://thegraph.com/studio/). -> - This feature requires `specVersion` 1.3.0. -> - This example uses - -## Overview - -Subgraph composition empowers developer to leverage a Subgraph with other Subgraphs as data sources, seamlessly integrating and reacting to data updates and entity changes. This capability enhances efficiency and responsiveness in data handling. - -## Prerequisites - -To deploy **all** Subgraphs locally, you must have the following: - -- A [graph-node](https://github.com/graphprotocol/graph-node) instance running locally -- An [IPFS](https://docs.ipfs.tech/) instance running locally -- [Node.js.](https://nodejs.org/en) and npm - -## Get Started - -The following guide provides examples for defining three source Subgraphs to create one powerful composed Subgraph. - -### Specifics - -- To keep this example simple, all source subgraphs use only block handlers, but in a real environment, each source Subgraph will use data from different smart contracts. -- The examples below show how to import and extend the schema of another Subgraph to enhance its functionality. -- Each source Subgraph is optimized with a specific entity. -- All the commands listed install the necessary dependencies, generate code based on the GraphQL schema, build the Subgraph, and deploy it to your local Graph Node instance. - -### Step 1. Deploy Block Time Source Subgraph - -This first source Subgraph calculates the block time for each block. - -- It imports schemas from other Subgraphs and adds a `block` entity with a `timestamp` field, representing the time each block was mined. -- It listens to time-related blockchain events (e.g., block timestamps) and processes this data to update the Subgraph's entities accordingly. - -To deploy this Subgraph locally, run the following commands: - -```bash -npm install -npm run codegen -npm run build -npm run create-local -npm run deploy-local -``` - -### Step 1. Deploy Block Cost Source Subgraph - -This second source Subgraph indexes the cost of each block. - -#### Key Functions - -- It imports schemas from other Subgraphs and adds a `block` entity with cost-related fields. -- It listens to blockchain events related to costs (e.g. gas fees, transaction costs) and processes this data to update the Subgraph's entities accordingly. - -To deploy this Subgraph locally, run the following commands: - -```bash -npm install -npm run codegen -npm run build -npm run create-local -npm run deploy-local -``` - -### Step 2. Define Block Size in Source Subgraph - -This third source Subgraph indexes the size of each block. - -#### Key Functions - -- It imports existing schemas from other Subgraphs and adds a `Block` entity with a `size` field representing each block's size. -- It listens to blockchain events related to block sizes (e.g., storage or volume) and processes this data to update the Subgraph's entities accordingly. - -To deploy this Subgraph locally, run the following commands: - -```bash -npm install -npm run codegen -npm run build -npm run create-local -npm run deploy-local -``` - -### Step 3. Combine Into Block Stats Subgraph - -This composed Subgraph combines and aggregates the information from the three source Subgraphs above. To learn how to use aggregations, check out Subgraph [advanced features](https://thegraph.com/docs/en/subgraphs/developing/creating/advanced/#timeseries-and-aggregations). - -> [!NOTE] Any change to a source Subgraph will likely generate a new deployment ID. Be sure to update the deployment ID in the data source address of the Subgraph manifest to take advantage of the latest changes. [!IMPORTANT] All source Subgraphs should be deployed before the composed Subgraph is deployed. - -This composed Subgraph demonstrates how to create a subgraph that aggregates data from three source subgraphs, providing a unified, enhanced view of block statistics. - -#### Key Functions - -- It provides a consolidated data model that encompasses all relevant block metrics. -- It combines data from three source subgraphs, and provides a comprehensive view of block statistics, enabling more complex queries and analyses. To deploy this subgraph locally, run the following commands: - -```bash -npm install -npm run codegen -npm run build -npm run create-local -npm run deploy-local -``` - -## Key Takeaways - -- This powerful tool will scale your subgraph development and allow you to combine multiple Subgraphs. -- The setup includes the deployment of three source Subgraphs and one final deployment of the composed Subgraph. -- This feature unlocks scalability, simplifying both development and maintenance efficiency. - -## Additional Resources - -- Add advanced features in your subgraph. Check out [subgraph advance features](/developing/creating/advanced/) and the [subgraph composition repo](https://github.com/incrypto32/subgraph-composition-sample-subgraph). -- Check out all the code for this example in [the Github repo] (https://github.com/isum/subgraph-composition-example). diff --git a/website/src/pages/ru/subgraphs/cookbook/subgraph-composition-three-sources.mdx b/website/src/pages/ru/subgraphs/cookbook/subgraph-composition-three-sources.mdx deleted file mode 100644 index 024e79f5c7c5..000000000000 --- a/website/src/pages/ru/subgraphs/cookbook/subgraph-composition-three-sources.mdx +++ /dev/null @@ -1,124 +0,0 @@ ---- -title: Integrating Three Subgraphs Using Subgraph Composition -sidebarTitle: 'Composable Subgraph with Three Source Subgraphs' ---- - -Optimize your Subgraph by merging data from three independent, source - -Subgraphs into a single composable Subgraph to enhance data aggregation. - -> Important Reminders - -> - Subgraph composition is built into the CLI, and you can deploy with [Subgraph Studio](https://thegraph.com/studio/). -> - This feature requires `specVersion` 1.3.0. -> - This example uses - -## Overview - -Subgraph composition empowers developer to leverage a Subgraph with other Subgraphs as data sources, seamlessly integrating and reacting to data updates and entity changes. This capability enhances efficiency and responsiveness in data handling. - -## Prerequisites - -To deploy **all** Subgraphs locally, you must have the following: - -- A [graph-node](https://github.com/graphprotocol/graph-node) instance running locally -- An [IPFS](https://docs.ipfs.tech/) instance running locally -- [Node.js.](https://nodejs.org/en) and npm - -## Get Started - -The following guide provides examples for defining three source Subgraphs to create one powerful composed Subgraph. - -### Specifics - -- To keep this example simple, all source subgraphs use only block handlers, but in a real environment, each source Subgraph will use data from different smart contracts. -- The examples below show how to import and extend the schema of another Subgraph to enhance its functionality. -- Each source Subgraph is optimized with a specific entity. -- All the commands listed install the necessary dependencies, generate code based on the GraphQL schema, build the Subgraph, and deploy it to your local Graph Node instance. - -### Step 1. Deploy Block Time Source Subgraph - -This first source Subgraph calculates the block time for each block. - -- It imports schemas from other Subgraphs and adds a `block` entity with a `timestamp` field, representing the time each block was mined. -- It listens to time-related blockchain events (e.g., block timestamps) and processes this data to update the Subgraph's entities accordingly. - -To deploy this Subgraph locally, run the following commands: - -```bash -npm install -npm run codegen -npm run build -npm run create-local -npm run deploy-local -``` - -### Step 1. Deploy Block Cost Source Subgraph - -This second source Subgraph indexes the cost of each block. - -#### Key Functions - -- It imports schemas from other Subgraphs and adds a `block` entity with cost-related fields. -- It listens to blockchain events related to costs (e.g. gas fees, transaction costs) and processes this data to update the Subgraph's entities accordingly. - -To deploy this Subgraph locally, run the following commands: - -```bash -npm install -npm run codegen -npm run build -npm run create-local -npm run deploy-local -``` - -### Step 2. Define Block Size in Source Subgraph - -This third source Subgraph indexes the size of each block. - -#### Key Functions - -- It imports existing schemas from other Subgraphs and adds a `Block` entity with a `size` field representing each block's size. -- It listens to blockchain events related to block sizes (e.g., storage or volume) and processes this data to update the Subgraph's entities accordingly. - -To deploy this Subgraph locally, run the following commands: - -```bash -npm install -npm run codegen -npm run build -npm run create-local -npm run deploy-local -``` - -### Step 3. Combine Into Block Stats Subgraph - -This composed Subgraph combines and aggregates the information from the three source Subgraphs above. To learn how to use aggregations, check out Subgraph [advanced features](https://thegraph.com/docs/en/subgraphs/developing/creating/advanced/#timeseries-and-aggregations). - -> [!NOTE] Any change to a source Subgraph will likely generate a new deployment ID. Be sure to update the deployment ID in the data source address of the Subgraph manifest to take advantage of the latest changes. [!IMPORTANT] All source Subgraphs should be deployed before the composed Subgraph is deployed. - -This composed Subgraph demonstrates how to create a subgraph that aggregates data from three source subgraphs, providing a unified, enhanced view of block statistics. - -#### Key Functions - -- It provides a consolidated data model that encompasses all relevant block metrics. -- It combines data from three source subgraphs, and provides a comprehensive view of block statistics, enabling more complex queries and analyses. To deploy this subgraph locally, run the following commands: - -```bash -npm install -npm run codegen -npm run build -npm run create-local -npm run deploy-local -``` - -## Key Takeaways - -- This powerful tool will scale your subgraph development and allow you to combine multiple Subgraphs. -- The setup includes the deployment of three source Subgraphs and one final deployment of the composed Subgraph. -- This feature unlocks scalability, simplifying both development and maintenance efficiency. - -## Additional Resources - -- Add advanced features in your subgraph. Check out [subgraph advance features](/developing/creating/advanced/) and the [subgraph composition repo](https://github.com/incrypto32/subgraph-composition-sample-subgraph). -- Check out all the code for this example in [the Github repo] (https://github.com/isum/subgraph-composition-example). diff --git a/website/src/pages/sv/subgraphs/cookbook/subgraph-composition-three-sources.mdx b/website/src/pages/sv/subgraphs/cookbook/subgraph-composition-three-sources.mdx deleted file mode 100644 index 024e79f5c7c5..000000000000 --- a/website/src/pages/sv/subgraphs/cookbook/subgraph-composition-three-sources.mdx +++ /dev/null @@ -1,124 +0,0 @@ ---- -title: Integrating Three Subgraphs Using Subgraph Composition -sidebarTitle: 'Composable Subgraph with Three Source Subgraphs' ---- - -Optimize your Subgraph by merging data from three independent, source - -Subgraphs into a single composable Subgraph to enhance data aggregation. - -> Important Reminders - -> - Subgraph composition is built into the CLI, and you can deploy with [Subgraph Studio](https://thegraph.com/studio/). -> - This feature requires `specVersion` 1.3.0. -> - This example uses - -## Overview - -Subgraph composition empowers developer to leverage a Subgraph with other Subgraphs as data sources, seamlessly integrating and reacting to data updates and entity changes. This capability enhances efficiency and responsiveness in data handling. - -## Prerequisites - -To deploy **all** Subgraphs locally, you must have the following: - -- A [graph-node](https://github.com/graphprotocol/graph-node) instance running locally -- An [IPFS](https://docs.ipfs.tech/) instance running locally -- [Node.js.](https://nodejs.org/en) and npm - -## Get Started - -The following guide provides examples for defining three source Subgraphs to create one powerful composed Subgraph. - -### Specifics - -- To keep this example simple, all source subgraphs use only block handlers, but in a real environment, each source Subgraph will use data from different smart contracts. -- The examples below show how to import and extend the schema of another Subgraph to enhance its functionality. -- Each source Subgraph is optimized with a specific entity. -- All the commands listed install the necessary dependencies, generate code based on the GraphQL schema, build the Subgraph, and deploy it to your local Graph Node instance. - -### Step 1. Deploy Block Time Source Subgraph - -This first source Subgraph calculates the block time for each block. - -- It imports schemas from other Subgraphs and adds a `block` entity with a `timestamp` field, representing the time each block was mined. -- It listens to time-related blockchain events (e.g., block timestamps) and processes this data to update the Subgraph's entities accordingly. - -To deploy this Subgraph locally, run the following commands: - -```bash -npm install -npm run codegen -npm run build -npm run create-local -npm run deploy-local -``` - -### Step 1. Deploy Block Cost Source Subgraph - -This second source Subgraph indexes the cost of each block. - -#### Key Functions - -- It imports schemas from other Subgraphs and adds a `block` entity with cost-related fields. -- It listens to blockchain events related to costs (e.g. gas fees, transaction costs) and processes this data to update the Subgraph's entities accordingly. - -To deploy this Subgraph locally, run the following commands: - -```bash -npm install -npm run codegen -npm run build -npm run create-local -npm run deploy-local -``` - -### Step 2. Define Block Size in Source Subgraph - -This third source Subgraph indexes the size of each block. - -#### Key Functions - -- It imports existing schemas from other Subgraphs and adds a `Block` entity with a `size` field representing each block's size. -- It listens to blockchain events related to block sizes (e.g., storage or volume) and processes this data to update the Subgraph's entities accordingly. - -To deploy this Subgraph locally, run the following commands: - -```bash -npm install -npm run codegen -npm run build -npm run create-local -npm run deploy-local -``` - -### Step 3. Combine Into Block Stats Subgraph - -This composed Subgraph combines and aggregates the information from the three source Subgraphs above. To learn how to use aggregations, check out Subgraph [advanced features](https://thegraph.com/docs/en/subgraphs/developing/creating/advanced/#timeseries-and-aggregations). - -> [!NOTE] Any change to a source Subgraph will likely generate a new deployment ID. Be sure to update the deployment ID in the data source address of the Subgraph manifest to take advantage of the latest changes. [!IMPORTANT] All source Subgraphs should be deployed before the composed Subgraph is deployed. - -This composed Subgraph demonstrates how to create a subgraph that aggregates data from three source subgraphs, providing a unified, enhanced view of block statistics. - -#### Key Functions - -- It provides a consolidated data model that encompasses all relevant block metrics. -- It combines data from three source subgraphs, and provides a comprehensive view of block statistics, enabling more complex queries and analyses. To deploy this subgraph locally, run the following commands: - -```bash -npm install -npm run codegen -npm run build -npm run create-local -npm run deploy-local -``` - -## Key Takeaways - -- This powerful tool will scale your subgraph development and allow you to combine multiple Subgraphs. -- The setup includes the deployment of three source Subgraphs and one final deployment of the composed Subgraph. -- This feature unlocks scalability, simplifying both development and maintenance efficiency. - -## Additional Resources - -- Add advanced features in your subgraph. Check out [subgraph advance features](/developing/creating/advanced/) and the [subgraph composition repo](https://github.com/incrypto32/subgraph-composition-sample-subgraph). -- Check out all the code for this example in [the Github repo] (https://github.com/isum/subgraph-composition-example). diff --git a/website/src/pages/tr/subgraphs/cookbook/subgraph-composition-three-sources.mdx b/website/src/pages/tr/subgraphs/cookbook/subgraph-composition-three-sources.mdx deleted file mode 100644 index 024e79f5c7c5..000000000000 --- a/website/src/pages/tr/subgraphs/cookbook/subgraph-composition-three-sources.mdx +++ /dev/null @@ -1,124 +0,0 @@ ---- -title: Integrating Three Subgraphs Using Subgraph Composition -sidebarTitle: 'Composable Subgraph with Three Source Subgraphs' ---- - -Optimize your Subgraph by merging data from three independent, source - -Subgraphs into a single composable Subgraph to enhance data aggregation. - -> Important Reminders - -> - Subgraph composition is built into the CLI, and you can deploy with [Subgraph Studio](https://thegraph.com/studio/). -> - This feature requires `specVersion` 1.3.0. -> - This example uses - -## Overview - -Subgraph composition empowers developer to leverage a Subgraph with other Subgraphs as data sources, seamlessly integrating and reacting to data updates and entity changes. This capability enhances efficiency and responsiveness in data handling. - -## Prerequisites - -To deploy **all** Subgraphs locally, you must have the following: - -- A [graph-node](https://github.com/graphprotocol/graph-node) instance running locally -- An [IPFS](https://docs.ipfs.tech/) instance running locally -- [Node.js.](https://nodejs.org/en) and npm - -## Get Started - -The following guide provides examples for defining three source Subgraphs to create one powerful composed Subgraph. - -### Specifics - -- To keep this example simple, all source subgraphs use only block handlers, but in a real environment, each source Subgraph will use data from different smart contracts. -- The examples below show how to import and extend the schema of another Subgraph to enhance its functionality. -- Each source Subgraph is optimized with a specific entity. -- All the commands listed install the necessary dependencies, generate code based on the GraphQL schema, build the Subgraph, and deploy it to your local Graph Node instance. - -### Step 1. Deploy Block Time Source Subgraph - -This first source Subgraph calculates the block time for each block. - -- It imports schemas from other Subgraphs and adds a `block` entity with a `timestamp` field, representing the time each block was mined. -- It listens to time-related blockchain events (e.g., block timestamps) and processes this data to update the Subgraph's entities accordingly. - -To deploy this Subgraph locally, run the following commands: - -```bash -npm install -npm run codegen -npm run build -npm run create-local -npm run deploy-local -``` - -### Step 1. Deploy Block Cost Source Subgraph - -This second source Subgraph indexes the cost of each block. - -#### Key Functions - -- It imports schemas from other Subgraphs and adds a `block` entity with cost-related fields. -- It listens to blockchain events related to costs (e.g. gas fees, transaction costs) and processes this data to update the Subgraph's entities accordingly. - -To deploy this Subgraph locally, run the following commands: - -```bash -npm install -npm run codegen -npm run build -npm run create-local -npm run deploy-local -``` - -### Step 2. Define Block Size in Source Subgraph - -This third source Subgraph indexes the size of each block. - -#### Key Functions - -- It imports existing schemas from other Subgraphs and adds a `Block` entity with a `size` field representing each block's size. -- It listens to blockchain events related to block sizes (e.g., storage or volume) and processes this data to update the Subgraph's entities accordingly. - -To deploy this Subgraph locally, run the following commands: - -```bash -npm install -npm run codegen -npm run build -npm run create-local -npm run deploy-local -``` - -### Step 3. Combine Into Block Stats Subgraph - -This composed Subgraph combines and aggregates the information from the three source Subgraphs above. To learn how to use aggregations, check out Subgraph [advanced features](https://thegraph.com/docs/en/subgraphs/developing/creating/advanced/#timeseries-and-aggregations). - -> [!NOTE] Any change to a source Subgraph will likely generate a new deployment ID. Be sure to update the deployment ID in the data source address of the Subgraph manifest to take advantage of the latest changes. [!IMPORTANT] All source Subgraphs should be deployed before the composed Subgraph is deployed. - -This composed Subgraph demonstrates how to create a subgraph that aggregates data from three source subgraphs, providing a unified, enhanced view of block statistics. - -#### Key Functions - -- It provides a consolidated data model that encompasses all relevant block metrics. -- It combines data from three source subgraphs, and provides a comprehensive view of block statistics, enabling more complex queries and analyses. To deploy this subgraph locally, run the following commands: - -```bash -npm install -npm run codegen -npm run build -npm run create-local -npm run deploy-local -``` - -## Key Takeaways - -- This powerful tool will scale your subgraph development and allow you to combine multiple Subgraphs. -- The setup includes the deployment of three source Subgraphs and one final deployment of the composed Subgraph. -- This feature unlocks scalability, simplifying both development and maintenance efficiency. - -## Additional Resources - -- Add advanced features in your subgraph. Check out [subgraph advance features](/developing/creating/advanced/) and the [subgraph composition repo](https://github.com/incrypto32/subgraph-composition-sample-subgraph). -- Check out all the code for this example in [the Github repo] (https://github.com/isum/subgraph-composition-example). diff --git a/website/src/pages/uk/subgraphs/cookbook/subgraph-composition-three-sources.mdx b/website/src/pages/uk/subgraphs/cookbook/subgraph-composition-three-sources.mdx deleted file mode 100644 index 024e79f5c7c5..000000000000 --- a/website/src/pages/uk/subgraphs/cookbook/subgraph-composition-three-sources.mdx +++ /dev/null @@ -1,124 +0,0 @@ ---- -title: Integrating Three Subgraphs Using Subgraph Composition -sidebarTitle: 'Composable Subgraph with Three Source Subgraphs' ---- - -Optimize your Subgraph by merging data from three independent, source - -Subgraphs into a single composable Subgraph to enhance data aggregation. - -> Important Reminders - -> - Subgraph composition is built into the CLI, and you can deploy with [Subgraph Studio](https://thegraph.com/studio/). -> - This feature requires `specVersion` 1.3.0. -> - This example uses - -## Overview - -Subgraph composition empowers developer to leverage a Subgraph with other Subgraphs as data sources, seamlessly integrating and reacting to data updates and entity changes. This capability enhances efficiency and responsiveness in data handling. - -## Prerequisites - -To deploy **all** Subgraphs locally, you must have the following: - -- A [graph-node](https://github.com/graphprotocol/graph-node) instance running locally -- An [IPFS](https://docs.ipfs.tech/) instance running locally -- [Node.js.](https://nodejs.org/en) and npm - -## Get Started - -The following guide provides examples for defining three source Subgraphs to create one powerful composed Subgraph. - -### Specifics - -- To keep this example simple, all source subgraphs use only block handlers, but in a real environment, each source Subgraph will use data from different smart contracts. -- The examples below show how to import and extend the schema of another Subgraph to enhance its functionality. -- Each source Subgraph is optimized with a specific entity. -- All the commands listed install the necessary dependencies, generate code based on the GraphQL schema, build the Subgraph, and deploy it to your local Graph Node instance. - -### Step 1. Deploy Block Time Source Subgraph - -This first source Subgraph calculates the block time for each block. - -- It imports schemas from other Subgraphs and adds a `block` entity with a `timestamp` field, representing the time each block was mined. -- It listens to time-related blockchain events (e.g., block timestamps) and processes this data to update the Subgraph's entities accordingly. - -To deploy this Subgraph locally, run the following commands: - -```bash -npm install -npm run codegen -npm run build -npm run create-local -npm run deploy-local -``` - -### Step 1. Deploy Block Cost Source Subgraph - -This second source Subgraph indexes the cost of each block. - -#### Key Functions - -- It imports schemas from other Subgraphs and adds a `block` entity with cost-related fields. -- It listens to blockchain events related to costs (e.g. gas fees, transaction costs) and processes this data to update the Subgraph's entities accordingly. - -To deploy this Subgraph locally, run the following commands: - -```bash -npm install -npm run codegen -npm run build -npm run create-local -npm run deploy-local -``` - -### Step 2. Define Block Size in Source Subgraph - -This third source Subgraph indexes the size of each block. - -#### Key Functions - -- It imports existing schemas from other Subgraphs and adds a `Block` entity with a `size` field representing each block's size. -- It listens to blockchain events related to block sizes (e.g., storage or volume) and processes this data to update the Subgraph's entities accordingly. - -To deploy this Subgraph locally, run the following commands: - -```bash -npm install -npm run codegen -npm run build -npm run create-local -npm run deploy-local -``` - -### Step 3. Combine Into Block Stats Subgraph - -This composed Subgraph combines and aggregates the information from the three source Subgraphs above. To learn how to use aggregations, check out Subgraph [advanced features](https://thegraph.com/docs/en/subgraphs/developing/creating/advanced/#timeseries-and-aggregations). - -> [!NOTE] Any change to a source Subgraph will likely generate a new deployment ID. Be sure to update the deployment ID in the data source address of the Subgraph manifest to take advantage of the latest changes. [!IMPORTANT] All source Subgraphs should be deployed before the composed Subgraph is deployed. - -This composed Subgraph demonstrates how to create a subgraph that aggregates data from three source subgraphs, providing a unified, enhanced view of block statistics. - -#### Key Functions - -- It provides a consolidated data model that encompasses all relevant block metrics. -- It combines data from three source subgraphs, and provides a comprehensive view of block statistics, enabling more complex queries and analyses. To deploy this subgraph locally, run the following commands: - -```bash -npm install -npm run codegen -npm run build -npm run create-local -npm run deploy-local -``` - -## Key Takeaways - -- This powerful tool will scale your subgraph development and allow you to combine multiple Subgraphs. -- The setup includes the deployment of three source Subgraphs and one final deployment of the composed Subgraph. -- This feature unlocks scalability, simplifying both development and maintenance efficiency. - -## Additional Resources - -- Add advanced features in your subgraph. Check out [subgraph advance features](/developing/creating/advanced/) and the [subgraph composition repo](https://github.com/incrypto32/subgraph-composition-sample-subgraph). -- Check out all the code for this example in [the Github repo] (https://github.com/isum/subgraph-composition-example). diff --git a/website/src/pages/ur/subgraphs/cookbook/subgraph-composition-three-sources.mdx b/website/src/pages/ur/subgraphs/cookbook/subgraph-composition-three-sources.mdx deleted file mode 100644 index 024e79f5c7c5..000000000000 --- a/website/src/pages/ur/subgraphs/cookbook/subgraph-composition-three-sources.mdx +++ /dev/null @@ -1,124 +0,0 @@ ---- -title: Integrating Three Subgraphs Using Subgraph Composition -sidebarTitle: 'Composable Subgraph with Three Source Subgraphs' ---- - -Optimize your Subgraph by merging data from three independent, source - -Subgraphs into a single composable Subgraph to enhance data aggregation. - -> Important Reminders - -> - Subgraph composition is built into the CLI, and you can deploy with [Subgraph Studio](https://thegraph.com/studio/). -> - This feature requires `specVersion` 1.3.0. -> - This example uses - -## Overview - -Subgraph composition empowers developer to leverage a Subgraph with other Subgraphs as data sources, seamlessly integrating and reacting to data updates and entity changes. This capability enhances efficiency and responsiveness in data handling. - -## Prerequisites - -To deploy **all** Subgraphs locally, you must have the following: - -- A [graph-node](https://github.com/graphprotocol/graph-node) instance running locally -- An [IPFS](https://docs.ipfs.tech/) instance running locally -- [Node.js.](https://nodejs.org/en) and npm - -## Get Started - -The following guide provides examples for defining three source Subgraphs to create one powerful composed Subgraph. - -### Specifics - -- To keep this example simple, all source subgraphs use only block handlers, but in a real environment, each source Subgraph will use data from different smart contracts. -- The examples below show how to import and extend the schema of another Subgraph to enhance its functionality. -- Each source Subgraph is optimized with a specific entity. -- All the commands listed install the necessary dependencies, generate code based on the GraphQL schema, build the Subgraph, and deploy it to your local Graph Node instance. - -### Step 1. Deploy Block Time Source Subgraph - -This first source Subgraph calculates the block time for each block. - -- It imports schemas from other Subgraphs and adds a `block` entity with a `timestamp` field, representing the time each block was mined. -- It listens to time-related blockchain events (e.g., block timestamps) and processes this data to update the Subgraph's entities accordingly. - -To deploy this Subgraph locally, run the following commands: - -```bash -npm install -npm run codegen -npm run build -npm run create-local -npm run deploy-local -``` - -### Step 1. Deploy Block Cost Source Subgraph - -This second source Subgraph indexes the cost of each block. - -#### Key Functions - -- It imports schemas from other Subgraphs and adds a `block` entity with cost-related fields. -- It listens to blockchain events related to costs (e.g. gas fees, transaction costs) and processes this data to update the Subgraph's entities accordingly. - -To deploy this Subgraph locally, run the following commands: - -```bash -npm install -npm run codegen -npm run build -npm run create-local -npm run deploy-local -``` - -### Step 2. Define Block Size in Source Subgraph - -This third source Subgraph indexes the size of each block. - -#### Key Functions - -- It imports existing schemas from other Subgraphs and adds a `Block` entity with a `size` field representing each block's size. -- It listens to blockchain events related to block sizes (e.g., storage or volume) and processes this data to update the Subgraph's entities accordingly. - -To deploy this Subgraph locally, run the following commands: - -```bash -npm install -npm run codegen -npm run build -npm run create-local -npm run deploy-local -``` - -### Step 3. Combine Into Block Stats Subgraph - -This composed Subgraph combines and aggregates the information from the three source Subgraphs above. To learn how to use aggregations, check out Subgraph [advanced features](https://thegraph.com/docs/en/subgraphs/developing/creating/advanced/#timeseries-and-aggregations). - -> [!NOTE] Any change to a source Subgraph will likely generate a new deployment ID. Be sure to update the deployment ID in the data source address of the Subgraph manifest to take advantage of the latest changes. [!IMPORTANT] All source Subgraphs should be deployed before the composed Subgraph is deployed. - -This composed Subgraph demonstrates how to create a subgraph that aggregates data from three source subgraphs, providing a unified, enhanced view of block statistics. - -#### Key Functions - -- It provides a consolidated data model that encompasses all relevant block metrics. -- It combines data from three source subgraphs, and provides a comprehensive view of block statistics, enabling more complex queries and analyses. To deploy this subgraph locally, run the following commands: - -```bash -npm install -npm run codegen -npm run build -npm run create-local -npm run deploy-local -``` - -## Key Takeaways - -- This powerful tool will scale your subgraph development and allow you to combine multiple Subgraphs. -- The setup includes the deployment of three source Subgraphs and one final deployment of the composed Subgraph. -- This feature unlocks scalability, simplifying both development and maintenance efficiency. - -## Additional Resources - -- Add advanced features in your subgraph. Check out [subgraph advance features](/developing/creating/advanced/) and the [subgraph composition repo](https://github.com/incrypto32/subgraph-composition-sample-subgraph). -- Check out all the code for this example in [the Github repo] (https://github.com/isum/subgraph-composition-example). diff --git a/website/src/pages/vi/subgraphs/cookbook/subgraph-composition-three-sources.mdx b/website/src/pages/vi/subgraphs/cookbook/subgraph-composition-three-sources.mdx deleted file mode 100644 index 024e79f5c7c5..000000000000 --- a/website/src/pages/vi/subgraphs/cookbook/subgraph-composition-three-sources.mdx +++ /dev/null @@ -1,124 +0,0 @@ ---- -title: Integrating Three Subgraphs Using Subgraph Composition -sidebarTitle: 'Composable Subgraph with Three Source Subgraphs' ---- - -Optimize your Subgraph by merging data from three independent, source - -Subgraphs into a single composable Subgraph to enhance data aggregation. - -> Important Reminders - -> - Subgraph composition is built into the CLI, and you can deploy with [Subgraph Studio](https://thegraph.com/studio/). -> - This feature requires `specVersion` 1.3.0. -> - This example uses - -## Overview - -Subgraph composition empowers developer to leverage a Subgraph with other Subgraphs as data sources, seamlessly integrating and reacting to data updates and entity changes. This capability enhances efficiency and responsiveness in data handling. - -## Prerequisites - -To deploy **all** Subgraphs locally, you must have the following: - -- A [graph-node](https://github.com/graphprotocol/graph-node) instance running locally -- An [IPFS](https://docs.ipfs.tech/) instance running locally -- [Node.js.](https://nodejs.org/en) and npm - -## Get Started - -The following guide provides examples for defining three source Subgraphs to create one powerful composed Subgraph. - -### Specifics - -- To keep this example simple, all source subgraphs use only block handlers, but in a real environment, each source Subgraph will use data from different smart contracts. -- The examples below show how to import and extend the schema of another Subgraph to enhance its functionality. -- Each source Subgraph is optimized with a specific entity. -- All the commands listed install the necessary dependencies, generate code based on the GraphQL schema, build the Subgraph, and deploy it to your local Graph Node instance. - -### Step 1. Deploy Block Time Source Subgraph - -This first source Subgraph calculates the block time for each block. - -- It imports schemas from other Subgraphs and adds a `block` entity with a `timestamp` field, representing the time each block was mined. -- It listens to time-related blockchain events (e.g., block timestamps) and processes this data to update the Subgraph's entities accordingly. - -To deploy this Subgraph locally, run the following commands: - -```bash -npm install -npm run codegen -npm run build -npm run create-local -npm run deploy-local -``` - -### Step 1. Deploy Block Cost Source Subgraph - -This second source Subgraph indexes the cost of each block. - -#### Key Functions - -- It imports schemas from other Subgraphs and adds a `block` entity with cost-related fields. -- It listens to blockchain events related to costs (e.g. gas fees, transaction costs) and processes this data to update the Subgraph's entities accordingly. - -To deploy this Subgraph locally, run the following commands: - -```bash -npm install -npm run codegen -npm run build -npm run create-local -npm run deploy-local -``` - -### Step 2. Define Block Size in Source Subgraph - -This third source Subgraph indexes the size of each block. - -#### Key Functions - -- It imports existing schemas from other Subgraphs and adds a `Block` entity with a `size` field representing each block's size. -- It listens to blockchain events related to block sizes (e.g., storage or volume) and processes this data to update the Subgraph's entities accordingly. - -To deploy this Subgraph locally, run the following commands: - -```bash -npm install -npm run codegen -npm run build -npm run create-local -npm run deploy-local -``` - -### Step 3. Combine Into Block Stats Subgraph - -This composed Subgraph combines and aggregates the information from the three source Subgraphs above. To learn how to use aggregations, check out Subgraph [advanced features](https://thegraph.com/docs/en/subgraphs/developing/creating/advanced/#timeseries-and-aggregations). - -> [!NOTE] Any change to a source Subgraph will likely generate a new deployment ID. Be sure to update the deployment ID in the data source address of the Subgraph manifest to take advantage of the latest changes. [!IMPORTANT] All source Subgraphs should be deployed before the composed Subgraph is deployed. - -This composed Subgraph demonstrates how to create a subgraph that aggregates data from three source subgraphs, providing a unified, enhanced view of block statistics. - -#### Key Functions - -- It provides a consolidated data model that encompasses all relevant block metrics. -- It combines data from three source subgraphs, and provides a comprehensive view of block statistics, enabling more complex queries and analyses. To deploy this subgraph locally, run the following commands: - -```bash -npm install -npm run codegen -npm run build -npm run create-local -npm run deploy-local -``` - -## Key Takeaways - -- This powerful tool will scale your subgraph development and allow you to combine multiple Subgraphs. -- The setup includes the deployment of three source Subgraphs and one final deployment of the composed Subgraph. -- This feature unlocks scalability, simplifying both development and maintenance efficiency. - -## Additional Resources - -- Add advanced features in your subgraph. Check out [subgraph advance features](/developing/creating/advanced/) and the [subgraph composition repo](https://github.com/incrypto32/subgraph-composition-sample-subgraph). -- Check out all the code for this example in [the Github repo] (https://github.com/isum/subgraph-composition-example). diff --git a/website/src/pages/zh/subgraphs/cookbook/subgraph-composition-three-sources.mdx b/website/src/pages/zh/subgraphs/cookbook/subgraph-composition-three-sources.mdx deleted file mode 100644 index 024e79f5c7c5..000000000000 --- a/website/src/pages/zh/subgraphs/cookbook/subgraph-composition-three-sources.mdx +++ /dev/null @@ -1,124 +0,0 @@ ---- -title: Integrating Three Subgraphs Using Subgraph Composition -sidebarTitle: 'Composable Subgraph with Three Source Subgraphs' ---- - -Optimize your Subgraph by merging data from three independent, source - -Subgraphs into a single composable Subgraph to enhance data aggregation. - -> Important Reminders - -> - Subgraph composition is built into the CLI, and you can deploy with [Subgraph Studio](https://thegraph.com/studio/). -> - This feature requires `specVersion` 1.3.0. -> - This example uses - -## Overview - -Subgraph composition empowers developer to leverage a Subgraph with other Subgraphs as data sources, seamlessly integrating and reacting to data updates and entity changes. This capability enhances efficiency and responsiveness in data handling. - -## Prerequisites - -To deploy **all** Subgraphs locally, you must have the following: - -- A [graph-node](https://github.com/graphprotocol/graph-node) instance running locally -- An [IPFS](https://docs.ipfs.tech/) instance running locally -- [Node.js.](https://nodejs.org/en) and npm - -## Get Started - -The following guide provides examples for defining three source Subgraphs to create one powerful composed Subgraph. - -### Specifics - -- To keep this example simple, all source subgraphs use only block handlers, but in a real environment, each source Subgraph will use data from different smart contracts. -- The examples below show how to import and extend the schema of another Subgraph to enhance its functionality. -- Each source Subgraph is optimized with a specific entity. -- All the commands listed install the necessary dependencies, generate code based on the GraphQL schema, build the Subgraph, and deploy it to your local Graph Node instance. - -### Step 1. Deploy Block Time Source Subgraph - -This first source Subgraph calculates the block time for each block. - -- It imports schemas from other Subgraphs and adds a `block` entity with a `timestamp` field, representing the time each block was mined. -- It listens to time-related blockchain events (e.g., block timestamps) and processes this data to update the Subgraph's entities accordingly. - -To deploy this Subgraph locally, run the following commands: - -```bash -npm install -npm run codegen -npm run build -npm run create-local -npm run deploy-local -``` - -### Step 1. Deploy Block Cost Source Subgraph - -This second source Subgraph indexes the cost of each block. - -#### Key Functions - -- It imports schemas from other Subgraphs and adds a `block` entity with cost-related fields. -- It listens to blockchain events related to costs (e.g. gas fees, transaction costs) and processes this data to update the Subgraph's entities accordingly. - -To deploy this Subgraph locally, run the following commands: - -```bash -npm install -npm run codegen -npm run build -npm run create-local -npm run deploy-local -``` - -### Step 2. Define Block Size in Source Subgraph - -This third source Subgraph indexes the size of each block. - -#### Key Functions - -- It imports existing schemas from other Subgraphs and adds a `Block` entity with a `size` field representing each block's size. -- It listens to blockchain events related to block sizes (e.g., storage or volume) and processes this data to update the Subgraph's entities accordingly. - -To deploy this Subgraph locally, run the following commands: - -```bash -npm install -npm run codegen -npm run build -npm run create-local -npm run deploy-local -``` - -### Step 3. Combine Into Block Stats Subgraph - -This composed Subgraph combines and aggregates the information from the three source Subgraphs above. To learn how to use aggregations, check out Subgraph [advanced features](https://thegraph.com/docs/en/subgraphs/developing/creating/advanced/#timeseries-and-aggregations). - -> [!NOTE] Any change to a source Subgraph will likely generate a new deployment ID. Be sure to update the deployment ID in the data source address of the Subgraph manifest to take advantage of the latest changes. [!IMPORTANT] All source Subgraphs should be deployed before the composed Subgraph is deployed. - -This composed Subgraph demonstrates how to create a subgraph that aggregates data from three source subgraphs, providing a unified, enhanced view of block statistics. - -#### Key Functions - -- It provides a consolidated data model that encompasses all relevant block metrics. -- It combines data from three source subgraphs, and provides a comprehensive view of block statistics, enabling more complex queries and analyses. To deploy this subgraph locally, run the following commands: - -```bash -npm install -npm run codegen -npm run build -npm run create-local -npm run deploy-local -``` - -## Key Takeaways - -- This powerful tool will scale your subgraph development and allow you to combine multiple Subgraphs. -- The setup includes the deployment of three source Subgraphs and one final deployment of the composed Subgraph. -- This feature unlocks scalability, simplifying both development and maintenance efficiency. - -## Additional Resources - -- Add advanced features in your subgraph. Check out [subgraph advance features](/developing/creating/advanced/) and the [subgraph composition repo](https://github.com/incrypto32/subgraph-composition-sample-subgraph). -- Check out all the code for this example in [the Github repo] (https://github.com/isum/subgraph-composition-example). From 04ccf09d574d913f124f5c4cc60025e64e07e607 Mon Sep 17 00:00:00 2001 From: Michael Macaulay <56690114+MichaelMacaulay@users.noreply.github.com> Date: Mon, 3 Mar 2025 09:40:29 -0500 Subject: [PATCH 04/14] Update website/src/pages/en/subgraphs/cookbook/subgraph-composition-three-sources.mdx MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Benoît Rouleau --- .../subgraphs/cookbook/subgraph-composition-three-sources.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/src/pages/en/subgraphs/cookbook/subgraph-composition-three-sources.mdx b/website/src/pages/en/subgraphs/cookbook/subgraph-composition-three-sources.mdx index dfb5d6405ff0..ee5a88c0ab99 100644 --- a/website/src/pages/en/subgraphs/cookbook/subgraph-composition-three-sources.mdx +++ b/website/src/pages/en/subgraphs/cookbook/subgraph-composition-three-sources.mdx @@ -20,7 +20,7 @@ To deploy **all** Subgraphs locally, you must have the following: - A [graph-node](https://github.com/graphprotocol/graph-node) instance running locally - An [IPFS](https://docs.ipfs.tech/) instance running locally -- [Node.js.](https://nodejs.org/en) and npm +- [Node.js](https://nodejs.org) and npm ## Get Started From 6a4a940953672d53e715f5ccf847b16dfe166faa Mon Sep 17 00:00:00 2001 From: Michael Macaulay <56690114+MichaelMacaulay@users.noreply.github.com> Date: Mon, 3 Mar 2025 09:40:38 -0500 Subject: [PATCH 05/14] Update website/src/pages/en/subgraphs/cookbook/subgraph-composition-three-sources.mdx MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Benoît Rouleau --- .../subgraphs/cookbook/subgraph-composition-three-sources.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/src/pages/en/subgraphs/cookbook/subgraph-composition-three-sources.mdx b/website/src/pages/en/subgraphs/cookbook/subgraph-composition-three-sources.mdx index ee5a88c0ab99..80289f86b0db 100644 --- a/website/src/pages/en/subgraphs/cookbook/subgraph-composition-three-sources.mdx +++ b/website/src/pages/en/subgraphs/cookbook/subgraph-composition-three-sources.mdx @@ -50,7 +50,7 @@ npm run create-local npm run deploy-local ``` -### Step 1. Deploy Block Cost Source Subgraph +### Step 2. Deploy Block Cost Source Subgraph This second source Subgraph indexes the cost of each block. From 332e1f1d69ecc4b8ca41af67eeff5fe0b466ab57 Mon Sep 17 00:00:00 2001 From: Michael Macaulay <56690114+MichaelMacaulay@users.noreply.github.com> Date: Mon, 3 Mar 2025 09:40:46 -0500 Subject: [PATCH 06/14] Update website/src/pages/en/subgraphs/cookbook/subgraph-composition-three-sources.mdx MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Benoît Rouleau --- .../subgraphs/cookbook/subgraph-composition-three-sources.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/src/pages/en/subgraphs/cookbook/subgraph-composition-three-sources.mdx b/website/src/pages/en/subgraphs/cookbook/subgraph-composition-three-sources.mdx index 80289f86b0db..28244eca3cc9 100644 --- a/website/src/pages/en/subgraphs/cookbook/subgraph-composition-three-sources.mdx +++ b/website/src/pages/en/subgraphs/cookbook/subgraph-composition-three-sources.mdx @@ -69,7 +69,7 @@ npm run create-local npm run deploy-local ``` -### Step 2. Define Block Size in Source Subgraph +### Step 3. Define Block Size in Source Subgraph This third source Subgraph indexes the size of each block. From 886474c3b113bd585b3a90ae280e110b86b530a3 Mon Sep 17 00:00:00 2001 From: Michael Macaulay <56690114+MichaelMacaulay@users.noreply.github.com> Date: Mon, 3 Mar 2025 09:40:56 -0500 Subject: [PATCH 07/14] Update website/src/pages/en/subgraphs/cookbook/subgraph-composition-three-sources.mdx MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Benoît Rouleau --- .../subgraphs/cookbook/subgraph-composition-three-sources.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/src/pages/en/subgraphs/cookbook/subgraph-composition-three-sources.mdx b/website/src/pages/en/subgraphs/cookbook/subgraph-composition-three-sources.mdx index 28244eca3cc9..4a60d10d7921 100644 --- a/website/src/pages/en/subgraphs/cookbook/subgraph-composition-three-sources.mdx +++ b/website/src/pages/en/subgraphs/cookbook/subgraph-composition-three-sources.mdx @@ -88,7 +88,7 @@ npm run create-local npm run deploy-local ``` -### Step 3. Combine Into Block Stats Subgraph +### Step 4. Combine Into Block Stats Subgraph This composed Subgraph combines and aggregates the information from the three source Subgraphs above, providing a unified view of block statistics. From 1b83f28fdc5881340fb9a80f836ca092d8357c82 Mon Sep 17 00:00:00 2001 From: Michael Macaulay <56690114+MichaelMacaulay@users.noreply.github.com> Date: Mon, 3 Mar 2025 09:43:26 -0500 Subject: [PATCH 08/14] Update website/src/pages/en/subgraphs/cookbook/subgraph-composition-three-sources.mdx MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Benoît Rouleau --- .../subgraphs/cookbook/subgraph-composition-three-sources.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/src/pages/en/subgraphs/cookbook/subgraph-composition-three-sources.mdx b/website/src/pages/en/subgraphs/cookbook/subgraph-composition-three-sources.mdx index 4a60d10d7921..166d57f6d68e 100644 --- a/website/src/pages/en/subgraphs/cookbook/subgraph-composition-three-sources.mdx +++ b/website/src/pages/en/subgraphs/cookbook/subgraph-composition-three-sources.mdx @@ -92,7 +92,7 @@ npm run deploy-local This composed Subgraph combines and aggregates the information from the three source Subgraphs above, providing a unified view of block statistics. -> NOTE: +> Note: > > - Any change to a source Subgraph will likely generate a new deployment ID. > - Be sure to update the deployment ID in the data source address of the Subgraph manifest to take advantage of the latest changes. From 87c9d0845d3f47e5491b977be09412f16d5dddac Mon Sep 17 00:00:00 2001 From: Michael Macaulay <56690114+MichaelMacaulay@users.noreply.github.com> Date: Mon, 3 Mar 2025 09:43:42 -0500 Subject: [PATCH 09/14] Update website/src/pages/en/subgraphs/cookbook/subgraph-composition-three-sources.mdx MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Benoît Rouleau --- .../subgraphs/cookbook/subgraph-composition-three-sources.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/src/pages/en/subgraphs/cookbook/subgraph-composition-three-sources.mdx b/website/src/pages/en/subgraphs/cookbook/subgraph-composition-three-sources.mdx index 166d57f6d68e..c6eef281ae71 100644 --- a/website/src/pages/en/subgraphs/cookbook/subgraph-composition-three-sources.mdx +++ b/website/src/pages/en/subgraphs/cookbook/subgraph-composition-three-sources.mdx @@ -119,6 +119,6 @@ npm run deploy-local ## Additional Resources -- Check out all the code for this example in [the Github repo](https://github.com/isum/subgraph-composition-example). +- Check out all the code for this example in [this GitHub repo](https://github.com/isum/subgraph-composition-example). - Add advanced features in your Subgraph. Check out [Subgraph advance features](/developing/creating/advanced/). - To learn more about aggregations, check out Subgraph [advanced features](https://thegraph.com/docs/en/subgraphs/developing/creating/advanced/#timeseries-and-aggregations). From 0d03bd4ffd53da72941a630cba651ff9a591660a Mon Sep 17 00:00:00 2001 From: Michael Macaulay <56690114+MichaelMacaulay@users.noreply.github.com> Date: Mon, 3 Mar 2025 09:43:52 -0500 Subject: [PATCH 10/14] Update website/src/pages/en/subgraphs/cookbook/subgraph-composition-three-sources.mdx MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Benoît Rouleau --- .../subgraphs/cookbook/subgraph-composition-three-sources.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/src/pages/en/subgraphs/cookbook/subgraph-composition-three-sources.mdx b/website/src/pages/en/subgraphs/cookbook/subgraph-composition-three-sources.mdx index c6eef281ae71..6abec5e741e1 100644 --- a/website/src/pages/en/subgraphs/cookbook/subgraph-composition-three-sources.mdx +++ b/website/src/pages/en/subgraphs/cookbook/subgraph-composition-three-sources.mdx @@ -120,5 +120,5 @@ npm run deploy-local ## Additional Resources - Check out all the code for this example in [this GitHub repo](https://github.com/isum/subgraph-composition-example). -- Add advanced features in your Subgraph. Check out [Subgraph advance features](/developing/creating/advanced/). +- Add advanced features in your Subgraph. Check out [Subgraph advanced features](/developing/creating/advanced/). - To learn more about aggregations, check out Subgraph [advanced features](https://thegraph.com/docs/en/subgraphs/developing/creating/advanced/#timeseries-and-aggregations). From 28979b1d83a02c9a8c20205e2ccf8a5d57af84f0 Mon Sep 17 00:00:00 2001 From: Michael Macaulay <56690114+MichaelMacaulay@users.noreply.github.com> Date: Mon, 3 Mar 2025 09:44:50 -0500 Subject: [PATCH 11/14] Update website/src/pages/en/subgraphs/cookbook/subgraph-composition-three-sources.mdx MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Benoît Rouleau --- .../subgraphs/cookbook/subgraph-composition-three-sources.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/src/pages/en/subgraphs/cookbook/subgraph-composition-three-sources.mdx b/website/src/pages/en/subgraphs/cookbook/subgraph-composition-three-sources.mdx index 6abec5e741e1..25ccd6112b30 100644 --- a/website/src/pages/en/subgraphs/cookbook/subgraph-composition-three-sources.mdx +++ b/website/src/pages/en/subgraphs/cookbook/subgraph-composition-three-sources.mdx @@ -121,4 +121,4 @@ npm run deploy-local - Check out all the code for this example in [this GitHub repo](https://github.com/isum/subgraph-composition-example). - Add advanced features in your Subgraph. Check out [Subgraph advanced features](/developing/creating/advanced/). -- To learn more about aggregations, check out Subgraph [advanced features](https://thegraph.com/docs/en/subgraphs/developing/creating/advanced/#timeseries-and-aggregations). +- To learn more about aggregations, check out [Timeseries and Aggregations](/subgraphs/developing/creating/advanced/#timeseries-and-aggregations). From d5cd0073c6b5b8ab50107c41e25473b5374ed979 Mon Sep 17 00:00:00 2001 From: Michael Macaulay Date: Mon, 3 Mar 2025 09:52:43 -0500 Subject: [PATCH 12/14] Final feedback --- .../subgraph-composition-three-sources.mdx | 32 ++----------------- 1 file changed, 3 insertions(+), 29 deletions(-) diff --git a/website/src/pages/en/subgraphs/cookbook/subgraph-composition-three-sources.mdx b/website/src/pages/en/subgraphs/cookbook/subgraph-composition-three-sources.mdx index 25ccd6112b30..49a57ab19964 100644 --- a/website/src/pages/en/subgraphs/cookbook/subgraph-composition-three-sources.mdx +++ b/website/src/pages/en/subgraphs/cookbook/subgraph-composition-three-sources.mdx @@ -59,15 +59,7 @@ This second source Subgraph indexes the cost of each block. - It imports schemas from other Subgraphs and adds a `block` entity with cost-related fields. - It listens to blockchain events related to costs (e.g. gas fees, transaction costs) and processes this data to update the Subgraph's entities accordingly. -To deploy this Subgraph locally, run the following commands: - -```bash -npm install -npm run codegen -npm run build -npm run create-local -npm run deploy-local -``` +To deploy this Subgraph locally, run the same commands as above. ### Step 3. Define Block Size in Source Subgraph @@ -75,19 +67,9 @@ This third source Subgraph indexes the size of each block. #### Key Functions -- It imports existing schemas from other Subgraphs and adds a `Block` entity with a `size` field representing each block's size. +- It imports existing schemas from other Subgraphs and adds a `block` entity with a `size` field representing each block's size. - It listens to blockchain events related to block sizes (e.g., storage or volume) and processes this data to update the Subgraph's entities accordingly. -To deploy this Subgraph locally, run the following commands: - -```bash -npm install -npm run codegen -npm run build -npm run create-local -npm run deploy-local -``` - ### Step 4. Combine Into Block Stats Subgraph This composed Subgraph combines and aggregates the information from the three source Subgraphs above, providing a unified view of block statistics. @@ -101,15 +83,7 @@ This composed Subgraph combines and aggregates the information from the three so #### Key Functions - It provides a consolidated data model that encompasses all relevant block metrics. -- It combines data from three source Subgraphs, and provides a comprehensive view of block statistics, enabling more complex queries and analyses. To deploy this Subgraph locally, run the following commands: - -```bash -npm install -npm run codegen -npm run build -npm run create-local -npm run deploy-local -``` +- It combines data from three source Subgraphs, and provides a comprehensive view of block statistics, enabling more complex queries and analyses. ## Key Takeaways From c8b974a02020ba3b328b21a205644e7ea1cceab7 Mon Sep 17 00:00:00 2001 From: Michael Macaulay Date: Wed, 5 Mar 2025 09:56:20 -0500 Subject: [PATCH 13/14] Final feedback --- .../cookbook/subgraph-composition-three-sources.mdx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/website/src/pages/en/subgraphs/cookbook/subgraph-composition-three-sources.mdx b/website/src/pages/en/subgraphs/cookbook/subgraph-composition-three-sources.mdx index 49a57ab19964..ae8fa964912b 100644 --- a/website/src/pages/en/subgraphs/cookbook/subgraph-composition-three-sources.mdx +++ b/website/src/pages/en/subgraphs/cookbook/subgraph-composition-three-sources.mdx @@ -12,13 +12,13 @@ Optimize your Subgraph by merging data from three independent, source Subgraphs ## Overview -Subgraph composition empowers you use one Subgraph as a data source for another, allowing it to consume and respond to entity changes. Instead of fetching on-chain data directly, a Subgraph can listen for updates from another Subgraph and react to changes. This is useful for aggregating data from multiple Subgraphs or triggering actions based on external updates. +Subgraph composition empowers you to use one Subgraph as a data source for another, allowing it to consume and respond to entity changes. Instead of fetching onchain data directly, a Subgraph can listen for updates from another Subgraph and react to changes. This is useful for aggregating data from multiple Subgraphs or triggering actions based on external updates. ## Prerequisites To deploy **all** Subgraphs locally, you must have the following: -- A [graph-node](https://github.com/graphprotocol/graph-node) instance running locally +- A [Graph Node](https://github.com/graphprotocol/graph-node) instance running locally - An [IPFS](https://docs.ipfs.tech/) instance running locally - [Node.js](https://nodejs.org) and npm @@ -63,7 +63,7 @@ To deploy this Subgraph locally, run the same commands as above. ### Step 3. Define Block Size in Source Subgraph -This third source Subgraph indexes the size of each block. +This third source Subgraph indexes the size of each block. To deploy this Subgraph locally, run the same commands as above. #### Key Functions @@ -72,7 +72,7 @@ This third source Subgraph indexes the size of each block. ### Step 4. Combine Into Block Stats Subgraph -This composed Subgraph combines and aggregates the information from the three source Subgraphs above, providing a unified view of block statistics. +This composed Subgraph combines and aggregates the information from the three source Subgraphs above, providing a unified view of block statistics. To deploy this Subgraph locally, run the same commands as above. > Note: > From 45ee1c57794c436966c0a1ade0ab1f53d6d33652 Mon Sep 17 00:00:00 2001 From: Michael Macaulay <56690114+MichaelMacaulay@users.noreply.github.com> Date: Wed, 5 Mar 2025 09:56:51 -0500 Subject: [PATCH 14/14] Update website/src/pages/en/subgraphs/cookbook/subgraph-composition-three-sources.mdx MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Benoît Rouleau --- .../subgraphs/cookbook/subgraph-composition-three-sources.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/src/pages/en/subgraphs/cookbook/subgraph-composition-three-sources.mdx b/website/src/pages/en/subgraphs/cookbook/subgraph-composition-three-sources.mdx index ae8fa964912b..0c80e9d674c3 100644 --- a/website/src/pages/en/subgraphs/cookbook/subgraph-composition-three-sources.mdx +++ b/website/src/pages/en/subgraphs/cookbook/subgraph-composition-three-sources.mdx @@ -94,5 +94,5 @@ This composed Subgraph combines and aggregates the information from the three so ## Additional Resources - Check out all the code for this example in [this GitHub repo](https://github.com/isum/subgraph-composition-example). -- Add advanced features in your Subgraph. Check out [Subgraph advanced features](/developing/creating/advanced/). +- To add advanced features to your Subgraph, check out [Subgraph advanced features](/developing/creating/advanced/). - To learn more about aggregations, check out [Timeseries and Aggregations](/subgraphs/developing/creating/advanced/#timeseries-and-aggregations).