From 0a38ba666a78beb9c46a02000d9f00a1eaedabd6 Mon Sep 17 00:00:00 2001 From: Scott Twiname Date: Fri, 2 Aug 2024 19:57:09 +1200 Subject: [PATCH] Update endpoint config for eth sdk (#550) * Update endpoint config for eth sdk * Update endpoint docs --------- Co-authored-by: James Bayly --- docs/indexer/build/manifest/arbitrum.md | 45 +++++++++++++++++------- docs/indexer/build/manifest/avalanche.md | 35 ++++++++++++++---- docs/indexer/build/manifest/bsc.md | 43 ++++++++++++++++------ docs/indexer/build/manifest/ethereum.md | 44 ++++++++++++++++------- docs/indexer/build/manifest/flare.md | 34 ++++++++++++++---- docs/indexer/build/manifest/gnosis.md | 36 ++++++++++++++----- docs/indexer/build/manifest/optimism.md | 40 ++++++++++++++++----- docs/indexer/build/manifest/polkadot.md | 17 ++++----- docs/indexer/build/manifest/polygon.md | 42 ++++++++++++++++------ 9 files changed, 251 insertions(+), 85 deletions(-) diff --git a/docs/indexer/build/manifest/arbitrum.md b/docs/indexer/build/manifest/arbitrum.md index 7a6f3a56180..9fc9601ba77 100644 --- a/docs/indexer/build/manifest/arbitrum.md +++ b/docs/indexer/build/manifest/arbitrum.md @@ -51,7 +51,7 @@ const project: EthereumProject = { * When developing your project we suggest getting a private API key # We suggest providing an array of endpoints for increased speed and reliability */ - endpoint: ["https://arbitrum.api.onfinality.io/public"], + endpoint: ["https://arbitrum.rpc.subquery.network/public"], dictionary: "https://dict-tyk.subquery.network/query/arbitrum", }, dataSources: [ @@ -134,10 +134,8 @@ network: # This endpoint must be a public non-pruned archive node # We recommend providing more than one endpoint for improved reliability, performance, and uptime # Public nodes may be rate limited, which can affect indexing speed - # When developing your project we suggest getting a private API key - # You can get them from OnFinality for free https://app.onfinality.io - # https://documentation.onfinality.io/support/the-enhanced-api-service - endpoint: ["https://arbitrum.api.onfinality.io/public"] + # When developing your project we suggest getting a private API key and using the endpoint config + endpoint: ["https://arbitrum.rpc.subquery.network/public"] # Recommended to provide the HTTP endpoint of a full chain dictionary to speed up processing dictionary: "https://api.subquery.network/sq/subquery/arbitrum-one-dictionary" @@ -207,16 +205,16 @@ Additionally you will need to update the `endpoint`. This defines the (HTTP or W - Increased reliability - If an endpoint goes offline, SubQuery will automatically switch to other RPC providers to continue indexing without interruption. - Reduced load on RPC providers - Indexing is a computationally expensive process on RPC providers, by distributing requests among RPC providers you are lowering the chance that your project will be rate limited. -Public nodes may be rate limited which can affect indexing speed, when developing your project we suggest getting a private API key from a professional RPC provider like [OnFinality](https://onfinality.io/networks/arbitrum). +Public nodes may be rate limited which can affect indexing speed, when developing your project we suggest getting a private API key from a professional RPC provider. There is only a dictionary for Arbitrum One `https://gx.api.subquery.network/sq/subquery/arbitrum-one-dictionary`. For Arbitrum Nova, please omit the dictionary setting. -| Field | Type | Description | -| ---------------- | ------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| **chainId** | String | A network identifier for the blockchain | -| **endpoint** | String or String[] | Defines the endpoint of the blockchain to be indexed, this can be a string or an array of endpoints - **This must be a full archive node**. | -| **dictionary** | String | It is suggested to provide the HTTP endpoint of a full chain dictionary to speed up processing - read [how a SubQuery Dictionary works](../../academy/tutorials_examples/dictionary.md). | -| **bypassBlocks** | Array | Bypasses stated block numbers, the values can be a `range`(e.g. `"10- 50"`) or `integer`, see [Bypass Blocks](#bypass-blocks) | +| Field | Type | Description | +| ---------------- | ------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| **chainId** | String | A network identifier for the blockchain | +| **endpoint** | String or String[] or Record\ | Defines the endpoint of the blockchain to be indexed, this can be a string, an array of endpoints, or a record of endpoints to [endpoint configs](#endpoint-config) - **This must be a full archive node**. | +| **dictionary** | String | It is suggested to provide the HTTP endpoint of a full chain dictionary to speed up processing - read [how a SubQuery Dictionary works](../../academy/tutorials_examples/dictionary.md). | +| **bypassBlocks** | Array | Bypasses stated block numbers, the values can be a `range`(e.g. `"10- 50"`) or `integer`, see [Bypass Blocks](#bypass-blocks) | ### Runner Spec @@ -338,3 +336,26 @@ When declaring a `range` use an string in the format of `"start - end"`. Both st } } ``` + +## Endpoint Config + +This allows you to set specific options relevant to each specific RPC endpoint that you are indexing from. This is very useful when endpoints have unique authentication requirements, or they operate with different rate limits. + +Here is an example of how to set an API key in the header of RPC requests in your endpoint config. + + +```ts +{ + network: { + endpoint: { + "https://arbitrum.rpc.subquery.network/public": { + headers: { + "x-api-key": "your-api-key", + }, + // NOTE: setting this to 0 will not use batch requests + batchSize: 5 + } + } + } +} +``` diff --git a/docs/indexer/build/manifest/avalanche.md b/docs/indexer/build/manifest/avalanche.md index b2c150f290d..0bb2955a867 100644 --- a/docs/indexer/build/manifest/avalanche.md +++ b/docs/indexer/build/manifest/avalanche.md @@ -218,12 +218,13 @@ Additionally you will need to update the `endpoint`. This defines the (HTTP or W Public nodes may be rate limited which can affect indexing speed, when developing your project we suggest getting a private API key from a professional RPC provider like [OnFinality](https://onfinality.io/networks/avalanche). -| Field | Type | Description | -| ---------------- | ------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| **chainId** | String | A network identifier for the blockchain | -| **endpoint** | String or String[] | Defines the endpoint of the blockchain to be indexed, this can be a string or an array of endpoints - **This must be a full archive node**. | -| **dictionary** | String | It is suggested to provide the HTTP endpoint of a full chain dictionary to speed up processing - read [how a SubQuery Dictionary works](../../academy/tutorials_examples/dictionary.md). | -| **bypassBlocks** | Array | Bypasses stated block numbers, the values can be a `range`(e.g. `"10- 50"`) or `integer`, see [Bypass Blocks](#bypass-blocks) | +| Field | Type | Description | +| ---------------- | ------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| **chainId** | String | A network identifier for the blockchain | +| **endpoint** | String or String[] or Record\ | Defines the endpoint of the blockchain to be indexed, this can be a string, an array of endpoints, or a record of endpoints to [endpoint configs](#endpoint-config) - **This must be a full archive node**. | +| **dictionary** | String | It is suggested to provide the HTTP endpoint of a full chain dictionary to speed up processing - read [how a SubQuery Dictionary works](../../academy/tutorials_examples/dictionary.md). | +| **bypassBlocks** | Array | Bypasses stated block numbers, the values can be a `range`(e.g. `"10- 50"`) or `integer`, see [Bypass Blocks](#bypass-blocks) | + ### Runner Spec | Field | Type | Description | @@ -344,3 +345,25 @@ When declaring a `range` use an string in the format of `"start - end"`. Both st } } ``` + +## Endpoint Config + +This allows you to set specific options relevant to each specific RPC endpoint that you are indexing from. This is very useful when endpoints have unique authentication requirements, or they operate with different rate limits. + +Here is an example of how to set an API key in the header of RPC requests in your endpoint config. + +```ts +{ + network: { + endpoint: { + "https://arbitrum.rpc.subquery.network/public": { + headers: { + "x-api-key": "your-api-key", + }, + // NOTE: setting this to 0 will not use batch requests + batchSize: 5 + } + } + } +} +``` diff --git a/docs/indexer/build/manifest/bsc.md b/docs/indexer/build/manifest/bsc.md index 060365956c1..7a606906c0e 100644 --- a/docs/indexer/build/manifest/bsc.md +++ b/docs/indexer/build/manifest/bsc.md @@ -134,10 +134,8 @@ network: # This endpoint must be a public non-pruned archive node # We recommend providing more than one endpoint for improved reliability, performance, and uptime # Public nodes may be rate limited, which can affect indexing speed - # When developing your project we suggest getting a private API key - # You can get them from OnFinality for free https://app.onfinality.io - # https://documentation.onfinality.io/support/the-enhanced-api-service - endpoint: ["https://bsc-dataseed1.binance.org"] + # When developing your project we suggest getting a private API key and using endpoint config + endpoint: ["https://bnb.rpc.subquery.network/public"] # Recommended to provide the HTTP endpoint of a full chain dictionary to speed up processing dictionary: "https://gx.api.subquery.network/sq/subquery/bsc-dictionary" @@ -207,14 +205,15 @@ Additionally you will need to update the `endpoint`. This defines the (HTTP or W - Increased reliability - If an endpoint goes offline, SubQuery will automatically switch to other RPC providers to continue indexing without interruption. - Reduced load on RPC providers - Indexing is a computationally expensive process on RPC providers, by distributing requests among RPC providers you are lowering the chance that your project will be rate limited. -Public nodes may be rate limited which can affect indexing speed, when developing your project we suggest getting a private API key from a professional RPC provider like [OnFinality](https://onfinality.io/networks/bsc). +Public nodes may be rate limited which can affect indexing speed, when developing your project we suggest getting a private API key from a professional RPC provider. + +| Field | Type | Description | +| ---------------- | ------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| **chainId** | String | A network identifier for the blockchain | +| **endpoint** | String or String[] or Record\ | Defines the endpoint of the blockchain to be indexed, this can be a string, an array of endpoints, or a record of endpoints to [endpoint configs](#endpoint-config) - **This must be a full archive node**. | +| **dictionary** | String | It is suggested to provide the HTTP endpoint of a full chain dictionary to speed up processing - read [how a SubQuery Dictionary works](../../academy/tutorials_examples/dictionary.md). | +| **bypassBlocks** | Array | Bypasses stated block numbers, the values can be a `range`(e.g. `"10- 50"`) or `integer`, see [Bypass Blocks](#bypass-blocks) | -| Field | Type | Description | -| ---------------- | ------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| **chainId** | String | A network identifier for the blockchain | -| **endpoint** | String or String[] | Defines the endpoint of the blockchain to be indexed, this can be a string or an array of endpoints - **This must be a full archive node**. | -| **dictionary** | String | It is suggested to provide the HTTP endpoint of a full chain dictionary to speed up processing - read [how a SubQuery Dictionary works](../../academy/tutorials_examples/dictionary.md). | -| **bypassBlocks** | Array | Bypasses stated block numbers, the values can be a `range`(e.g. `"10- 50"`) or `integer`, see [Bypass Blocks](#bypass-blocks) | ### Runner Spec | Field | Type | Description | @@ -335,3 +334,25 @@ When declaring a `range` use an string in the format of `"start - end"`. Both st } } ``` + +## Endpoint Config + +This allows you to set specific options relevant to each specific RPC endpoint that you are indexing from. This is very useful when endpoints have unique authentication requirements, or they operate with different rate limits. + +Here is an example of how to set an API key in the header of RPC requests in your endpoint config. + +```ts +{ + network: { + endpoint: { + "https://bnb.rpc.subquery.network/public": { + headers: { + "x-api-key": "your-api-key", + }, + // NOTE: setting this to 0 will not use batch requests + batchSize: 5 + } + } + } +} +``` diff --git a/docs/indexer/build/manifest/ethereum.md b/docs/indexer/build/manifest/ethereum.md index 4f13886b9ed..facaea9c1f3 100644 --- a/docs/indexer/build/manifest/ethereum.md +++ b/docs/indexer/build/manifest/ethereum.md @@ -47,7 +47,7 @@ const project: EthereumProject = { * When developing your project we suggest getting a private API key # We suggest providing an array of endpoints for increased speed and reliability */ - endpoint: ["https://eth.api.onfinality.io/public"], + endpoint: ["https://ethereum.rpc.subquery.network/public"], dictionary: "https://gx.api.subquery.network/sq/subquery/eth-dictionary", }, dataSources: [ @@ -131,10 +131,8 @@ network: # This endpoint must be a public non-pruned archive node # We recommend providing more than one endpoint for improved reliability, performance, and uptime # Public nodes may be rate limited, which can affect indexing speed - # When developing your project we suggest getting a private API key - # You can get them from OnFinality for free https://app.onfinality.io - # https://documentation.onfinality.io/support/the-enhanced-api-service - endpoint: ["https://eth.api.onfinality.io/public"] + # When developing your project we suggest getting a private API key and using endpoint config + endpoint: ["https://ethereum.rpc.subquery.network/public"] # Recommended to provide the HTTP endpoint of a full chain dictionary to speed up processing dictionary: "https://gx.api.subquery.network/sq/subquery/eth-dictionary" @@ -205,14 +203,14 @@ Additionally you will need to update the `endpoint`. This defines the (HTTP or W - Increased reliability - If an endpoint goes offline, SubQuery will automatically switch to other RPC providers to continue indexing without interruption. - Reduced load on RPC providers - Indexing is a computationally expensive process on RPC providers, by distributing requests among RPC providers you are lowering the chance that your project will be rate limited. -Public nodes may be rate limited which can affect indexing speed, when developing your project we suggest getting a private API key from a professional RPC provider like [OnFinality](https://onfinality.io/networks/eth). +Public nodes may be rate limited which can affect indexing speed, when developing your project we suggest getting a private API key from a professional RPC provider. -| Field | Type | Description | -| ---------------- | ------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| **chainId** | String | A network identifier for the blockchain | -| **endpoint** | String or String[] | Defines the endpoint of the blockchain to be indexed, this can be a string or an array of endpoints - **This must be a full archive node**. | -| **dictionary** | String | It is suggested to provide the HTTP endpoint of a full chain dictionary to speed up processing - read [how a SubQuery Dictionary works](../../academy/tutorials_examples/dictionary.md). | -| **bypassBlocks** | Array | Bypasses stated block numbers, the values can be a `range`(e.g. `"10- 50"`) or `integer`, see [Bypass Blocks](#bypass-blocks) | +| Field | Type | Description | +| ---------------- | ------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| **chainId** | String | A network identifier for the blockchain | +| **endpoint** | String or String[] or Record\ | Defines the endpoint of the blockchain to be indexed, this can be a string, an array of endpoints, or a record of endpoints to [endpoint configs](#endpoint-config) - **This must be a full archive node**. | +| **dictionary** | String | It is suggested to provide the HTTP endpoint of a full chain dictionary to speed up processing - read [how a SubQuery Dictionary works](../../academy/tutorials_examples/dictionary.md). | +| **bypassBlocks** | Array | Bypasses stated block numbers, the values can be a `range`(e.g. `"10- 50"`) or `integer`, see [Bypass Blocks](#bypass-blocks) | ### Runner Spec @@ -338,3 +336,25 @@ When declaring a `range` use an string in the format of `"start - end"`. Both st } } ``` + +## Endpoint Config + +This allows you to set specific options relevant to each specific RPC endpoint that you are indexing from. This is very useful when endpoints have unique authentication requirements, or they operate with different rate limits. + +Here is an example of how to set an API key in the header of RPC requests in your endpoint config. + +```ts +{ + network: { + endpoint: { + "https://ethereum.rpc.subquery.network/public": { + headers: { + "x-api-key": "your-api-key", + }, + // NOTE: setting this to 0 will not use batch requests + batchSize: 5 + } + } + } +} +``` diff --git a/docs/indexer/build/manifest/flare.md b/docs/indexer/build/manifest/flare.md index d4106abc6ec..d5f61eb34dd 100644 --- a/docs/indexer/build/manifest/flare.md +++ b/docs/indexer/build/manifest/flare.md @@ -202,12 +202,12 @@ Additionally you will need to update the `endpoint`. This defines the (HTTP or W Public nodes may be rate limited which can affect indexing speed, when developing your project we suggest getting a private API key from a professional RPC provider like Flare's API Portal https://api-portal.flare.network/ -| Field | Type | Description | -| ---------------- | ------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| **chainId** | String | A network identifier for the blockchain | -| **endpoint** | String or String[] | Defines the endpoint of the blockchain to be indexed, this can be a string or an array of endpoints - **This must be a full archive node**. | -| **dictionary** | String | It is suggested to provide the HTTP endpoint of a full chain dictionary to speed up processing - read [how a SubQuery Dictionary works](../../academy/tutorials_examples/dictionary.md). | -| **bypassBlocks** | Array | Bypasses stated block numbers, the values can be a `range`(e.g. `"10- 50"`) or `integer`, see [Bypass Blocks](#bypass-blocks) | +| Field | Type | Description | +| ---------------- | ------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| **chainId** | String | A network identifier for the blockchain | +| **endpoint** | String or String[] or Record\ | Defines the endpoint of the blockchain to be indexed, this can be a string, an array of endpoints, or a record of endpoints to [endpoint configs](#endpoint-config) - **This must be a full archive node**. | +| **dictionary** | String | It is suggested to provide the HTTP endpoint of a full chain dictionary to speed up processing - read [how a SubQuery Dictionary works](../../academy/tutorials_examples/dictionary.md). | +| **bypassBlocks** | Array | Bypasses stated block numbers, the values can be a `range`(e.g. `"10- 50"`) or `integer`, see [Bypass Blocks](#bypass-blocks) | ### Runner Spec @@ -329,3 +329,25 @@ When declaring a `range` use an string in the format of `"start - end"`. Both st } } ``` + +## Endpoint Config + +This allows you to set specific options relevant to each specific RPC endpoint that you are indexing from. This is very useful when endpoints have unique authentication requirements, or they operate with different rate limits. + +Here is an example of how to set an API key in the header of RPC requests in your endpoint config. + +```ts +{ + network: { + endpoint: { + "https://flare-api.flare.network/ext/C/rpc": { + headers: { + "x-api-key": "your-api-key", + }, + // NOTE: setting this to 0 will not use batch requests + batchSize: 5 + } + } + } +} +``` diff --git a/docs/indexer/build/manifest/gnosis.md b/docs/indexer/build/manifest/gnosis.md index afb084a3542..99808e4af41 100644 --- a/docs/indexer/build/manifest/gnosis.md +++ b/docs/indexer/build/manifest/gnosis.md @@ -139,8 +139,6 @@ network: # We recommend providing more than one endpoint for improved reliability, performance, and uptime # Public nodes may be rate limited, which can affect indexing speed # When developing your project we suggest getting a private API key - # You can get them from OnFinality for free https://app.onfinality.io - # https://documentation.onfinality.io/support/the-enhanced-api-service endpoint: [ # "https://gnosis.api.onfinality.io/public", # "https://gnosischain-rpc.gateway.pokt.network", @@ -220,12 +218,12 @@ Public nodes may be rate limited which can affect indexing speed, when developin There is a dictionary for Gnosis which is `https://api.subquery.network/sq/subquery/gnosis-dictionary`. -| Field | Type | Description | -| ---------------- | ------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| **chainId** | String | A network identifier for the blockchain | -| **endpoint** | String or String[] | Defines the endpoint of the blockchain to be indexed, this can be a string or an array of endpoints - **This must be a full archive node**. | -| **dictionary** | String | It is suggested to provide the HTTP endpoint of a full chain dictionary to speed up processing - read [how a SubQuery Dictionary works](../../academy/tutorials_examples/dictionary.md). | -| **bypassBlocks** | Array | Bypasses stated block numbers, the values can be a `range`(e.g. `"10- 50"`) or `integer`, see [Bypass Blocks](#bypass-blocks) | +| Field | Type | Description | +| ---------------- | ------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| **chainId** | String | A network identifier for the blockchain | +| **endpoint** | String or String[] or Record\ | Defines the endpoint of the blockchain to be indexed, this can be a string, an array of endpoints, or a record of endpoints to [endpoint configs](#endpoint-config) - **This must be a full archive node**. | +| **dictionary** | String | It is suggested to provide the HTTP endpoint of a full chain dictionary to speed up processing - read [how a SubQuery Dictionary works](../../academy/tutorials_examples/dictionary.md). | +| **bypassBlocks** | Array | Bypasses stated block numbers, the values can be a `range`(e.g. `"10- 50"`) or `integer`, see [Bypass Blocks](#bypass-blocks) | ### Runner Spec @@ -347,3 +345,25 @@ When declaring a `range` use an string in the format of `"start - end"`. Both st } } ``` + +## Endpoint Config + +This allows you to set specific options relevant to each specific RPC endpoint that you are indexing from. This is very useful when endpoints have unique authentication requirements, or they operate with different rate limits. + +Here is an example of how to set an API key in the header of RPC requests in your endpoint config. + +```ts +{ + network: { + endpoint: { + "https://rpc.gnosischain.com": { + headers: { + "x-api-key": "your-api-key", + }, + // NOTE: setting this to 0 will not use batch requests + batchSize: 5 + } + } + } +} +``` diff --git a/docs/indexer/build/manifest/optimism.md b/docs/indexer/build/manifest/optimism.md index 8c40b0090f2..2f7575ceb67 100644 --- a/docs/indexer/build/manifest/optimism.md +++ b/docs/indexer/build/manifest/optimism.md @@ -52,6 +52,7 @@ const project: EthereumProject = { # We suggest providing an array of endpoints for increased speed and reliability */ endpoint: [ + "https://optimism.rpc.subquery.network/public", "https://optimism.api.onfinality.io/public", "https://mainnet.optimism.io", "https://endpoints.omniatech.io/v1/op/mainnet/public", @@ -141,10 +142,9 @@ network: # We recommend providing more than one endpoint for improved reliability, performance, and uptime # Public nodes may be rate limited, which can affect indexing speed # When developing your project we suggest getting a private API key - # You can get them from OnFinality for free https://app.onfinality.io - # https://documentation.onfinality.io/support/the-enhanced-api-service endpoint: [ + "https://optimism.rpc.subquery.network/public", "https://optimism.api.onfinality.io/public", "https://mainnet.optimism.io", "https://endpoints.omniatech.io/v1/op/mainnet/public", @@ -213,16 +213,16 @@ Additionally you will need to update the `endpoint`. This defines the (HTTP or W - Increased reliability - If an endpoint goes offline, SubQuery will automatically switch to other RPC providers to continue indexing without interruption. - Reduced load on RPC providers - Indexing is a computationally expensive process on RPC providers, by distributing requests among RPC providers you are lowering the chance that your project will be rate limited. -Public nodes may be rate limited which can affect indexing speed, when developing your project we suggest getting a private API key from a professional RPC provider like [OnFinality](https://onfinality.io/networks/optimism). +Public nodes may be rate limited which can affect indexing speed, when developing your project we suggest getting a private API key from a professional RPC provider. There is a dictionary for Optimism which is `https://api.subquery.network/sq/subquery/optimism-dictionary`. -| Field | Type | Description | -| ---------------- | ------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| **chainId** | String | A network identifier for the blockchain | -| **endpoint** | String or String[] | Defines the endpoint of the blockchain to be indexed, this can be a string or an array of endpoints - **This must be a full archive node**. | -| **dictionary** | String | It is suggested to provide the HTTP endpoint of a full chain dictionary to speed up processing - read [how a SubQuery Dictionary works](../../academy/tutorials_examples/dictionary.md). | -| **bypassBlocks** | Array | Bypasses stated block numbers, the values can be a `range`(e.g. `"10- 50"`) or `integer`, see [Bypass Blocks](#bypass-blocks) | +| Field | Type | Description | +| ---------------- | ------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| **chainId** | String | A network identifier for the blockchain | +| **endpoint** | String or String[] or Record\ | Defines the endpoint of the blockchain to be indexed, this can be a string, an array of endpoints, or a record of endpoints to [endpoint configs](#endpoint-config) - **This must be a full archive node**. | +| **dictionary** | String | It is suggested to provide the HTTP endpoint of a full chain dictionary to speed up processing - read [how a SubQuery Dictionary works](../../academy/tutorials_examples/dictionary.md). | +| **bypassBlocks** | Array | Bypasses stated block numbers, the values can be a `range`(e.g. `"10- 50"`) or `integer`, see [Bypass Blocks](#bypass-blocks) | ### Runner Spec @@ -344,3 +344,25 @@ When declaring a `range` use an string in the format of `"start - end"`. Both st } } ``` + +## Endpoint Config + +This allows you to set specific options relevant to each specific RPC endpoint that you are indexing from. This is very useful when endpoints have unique authentication requirements, or they operate with different rate limits. + +Here is an example of how to set an API key in the header of RPC requests in your endpoint config. + +```ts +{ + network: { + endpoint: { + "https://optimism.rpc.subquery.network/public": { + headers: { + "x-api-key": "your-api-key", + }, + // NOTE: setting this to 0 will not use batch requests + batchSize: 5 + } + } + } +} +``` diff --git a/docs/indexer/build/manifest/polkadot.md b/docs/indexer/build/manifest/polkadot.md index e4e581f4e49..53a8c202654 100644 --- a/docs/indexer/build/manifest/polkadot.md +++ b/docs/indexer/build/manifest/polkadot.md @@ -43,10 +43,8 @@ const project: SubstrateProject = { * This endpoint must be a public non-pruned archive node * Public nodes may be rate limited, which can affect indexing speed * When developing your project we suggest getting a private API key - * You can get them from OnFinality for free https://app.onfinality.io - * https://documentation.onfinality.io/support/the-enhanced-api-service */ - endpoint: "wss://polkadot.api.onfinality.io/public-ws", + endpoint: "https://polkadot.rpc.subquery.network/public", }, dataSources: [ { @@ -112,9 +110,7 @@ network: # We recommend providing more than one endpoint for improved reliability, performance, and uptime # Public nodes may be rate limited, which can affect indexing speed # When developing your project we suggest getting a private API key - # You can get them from OnFinality for free https://app.onfinality.io - # https://documentation.onfinality.io/support/the-enhanced-api-service - endpoint: ["wss://polkadot.api.onfinality.io/public-ws"] + endpoint: ["https://polkadot.rpc.subquery.network/public"] # Optionally provide the HTTP endpoint of a full chain dictionary to speed up processing dictionary: "https://api.subquery.network/sq/subquery/polkadot-dictionary" # Optionally provide a list of blocks that you wish to bypass @@ -175,12 +171,12 @@ Additionally you will need to update the `endpoint`. This defines the (HTTP or W - Increased reliability - If an endpoint goes offline, SubQuery will automatically switch to other RPC providers to continue indexing without interruption. - Reduced load on RPC providers - Indexing is a computationally expensive process on RPC providers, by distributing requests among RPC providers you are lowering the chance that your project will be rate limited. -Public nodes may be rate limited which can affect indexing speed, when developing your project we suggest getting a private API key from a professional RPC provider like [OnFinality](https://onfinality.io/networks/eth). +Public nodes may be rate limited which can affect indexing speed, when developing your project we suggest getting a private API key from a professional RPC provider. | Field | v1.0.0 | Description | | ---------------- | ------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | **chainId** | String | A network identifier for the blockchain (`genesisHash` in Substrate) | -| **endpoint** | String or String[] or Record\ | Defines the endpoint of the blockchain to be indexed, this can be a string, an array of endpoints, or a record of endpoints to [endpoint configs](#endpoint-config) - **This must be a full archive node**. You can retrieve endpoints for all parachains for free from [OnFinality](https://app.onfinality.io) | +| **endpoint** | String or String[] or Record\ | Defines the endpoint of the blockchain to be indexed, this can be a string, an array of endpoints, or a record of endpoints to [endpoint configs](#endpoint-config) - **This must be a full archive node**. | | **dictionary** | String | It is suggested to provide the HTTP endpoint of a full chain dictionary to speed up processing - read [how a SubQuery Dictionary works](../../academy/tutorials_examples/dictionary.md). | | **chaintypes** | {file:String} | Path to chain types file, accept `.json` or `.yaml` format | | **bypassBlocks** | Array | Bypasses stated block numbers, the values can be a `range`(e.g. `"10- 50"`) or `integer`, see [Bypass Blocks](#bypass-blocks) | @@ -446,12 +442,13 @@ When declaring a `range` use an string in the format of `"start - end"`. Both st This option allows specifying options that are applied specific to an endpoint. As of now this just allows setting headers on a per endpoint basis. -Here is an example of how to set an API key in the header. +Here is an example of how to set an API key in the header of RPC requests in your endpoint config. + ```ts { network: { endpoint: { - "wss://polkadot.api.onfinality.io/public-ws": { + "https://polkadot.rpc.subquery.network/public": { headers: { "x-api-key": "your-api-key", } diff --git a/docs/indexer/build/manifest/polygon.md b/docs/indexer/build/manifest/polygon.md index b3565238153..677f972cabe 100644 --- a/docs/indexer/build/manifest/polygon.md +++ b/docs/indexer/build/manifest/polygon.md @@ -51,7 +51,7 @@ const project: EthereumProject = { * When developing your project we suggest getting a private API key # We suggest providing an array of endpoints for increased speed and reliability */ - endpoint: ["https://polygon.api.onfinality.io/public"], + endpoint: ["https://polygon.rpc.subquery.network/public"], // Recommended to provide the HTTP endpoint of a full chain dictionary to speed up processing dictionary: "https://gx.api.subquery.network/sq/subquery/polygon-dictionary", @@ -136,9 +136,7 @@ network: # We recommend providing more than one endpoint for improved reliability, performance, and uptime # Public nodes may be rate limited, which can affect indexing speed # When developing your project we suggest getting a private API key - # You can get them from OnFinality for free https://app.onfinality.io - # https://documentation.onfinality.io/support/the-enhanced-api-service - endpoint: ["https://polygon.api.onfinality.io/public"] + endpoint: ["https://polygon.rpc.subquery.network/public"] # Recommended to provide the HTTP endpoint of a full chain dictionary to speed up processing dictionary: "https://gx.api.subquery.network/sq/subquery/polygon-dictionary" @@ -208,14 +206,14 @@ Additionally you will need to update the `endpoint`. This defines the (HTTP or W - Increased reliability - If an endpoint goes offline, SubQuery will automatically switch to other RPC providers to continue indexing without interruption. - Reduced load on RPC providers - Indexing is a computationally expensive process on RPC providers, by distributing requests among RPC providers you are lowering the chance that your project will be rate limited. -Public nodes may be rate limited which can affect indexing speed, when developing your project we suggest getting a private API key from a professional RPC provider like [OnFinality](https://onfinality.io/networks/polygon). +Public nodes may be rate limited which can affect indexing speed, when developing your project we suggest getting a private API key from a professional RPC provider. -| Field | Type | Description | -| ---------------- | ------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| **chainId** | String | A network identifier for the blockchain | -| **endpoint** | String or String[] | Defines the endpoint of the blockchain to be indexed, this can be a string or an array of endpoints - **This must be a full archive node**. | -| **dictionary** | String | It is suggested to provide the HTTP endpoint of a full chain dictionary to speed up processing - read [how a SubQuery Dictionary works](../../academy/tutorials_examples/dictionary.md). | -| **bypassBlocks** | Array | Bypasses stated block numbers, the values can be a `range`(e.g. `"10- 50"`) or `integer`, see [Bypass Blocks](#bypass-blocks) | +| Field | Type | Description | +| ---------------- | ------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| **chainId** | String | A network identifier for the blockchain | +| **endpoint** | String or String[] or Record\ | Defines the endpoint of the blockchain to be indexed, this can be a string, an array of endpoints, or a record of endpoints to [endpoint configs](#endpoint-config) - **This must be a full archive node**. | +| **dictionary** | String | It is suggested to provide the HTTP endpoint of a full chain dictionary to speed up processing - read [how a SubQuery Dictionary works](../../academy/tutorials_examples/dictionary.md). | +| **bypassBlocks** | Array | Bypasses stated block numbers, the values can be a `range`(e.g. `"10- 50"`) or `integer`, see [Bypass Blocks](#bypass-blocks) | ### Runner Spec @@ -337,3 +335,25 @@ When declaring a `range` use an string in the format of `"start - end"`. Both st } } ``` + +## Endpoint Config + +This allows you to set specific options relevant to each specific RPC endpoint that you are indexing from. This is very useful when endpoints have unique authentication requirements, or they operate with different rate limits. + +Here is an example of how to set an API key in the header of RPC requests in your endpoint config. + +```ts +{ + network: { + endpoint: { + "https://polygon.rpc.subquery.network/public": { + headers: { + "x-api-key": "your-api-key", + }, + // NOTE: setting this to 0 will not use batch requests + batchSize: 5 + } + } + } +} +```