getBlockFee
This method obtains the base and max priority fees for a chain.
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
chains | [String!]! | Yes | List of chain IDs to query. |
chains
Type: [Chain!]!
Allowed Values: An array of chain IDs from the list of supported chains.
[!NOTE] This query only gets current fees, so it works on all the supported chains.
Response
| Field | Type | Description |
|---|---|---|
chain | String | The chain ID. |
baseFeePerGas | String | The base fee per gas. |
maxPriorityFeePerGas | String | The max priority fee per gas. |
error | String | Error message if query failed. |
Query Example
Query
query GetBlockFee($chains: [String!]!) {
getBlockFee(chains: $chains) {
chain
baseFeePerGas
maxPriorityFeePerGas
error
}
}Variables
{
"chains": ["CHAIN_0X1", "CHAIN_0X89", "CHAIN_0X38", "CHAIN_0X64"]
}Curl
curl -X POST https://your-api-endpoint/graphql \
-H "Content-Type: application/json" \
-d '{
"query": "query GetBlockFee($chains: [String!]!) { getBlockFee(chains: $chains) { chain baseFeePerGas maxPriorityFeePerGas error } }",
"variables": {
"chains": ["CHAIN_0X1", "CHAIN_0X89", "CHAIN_0X38", "CHAIN_0X64"]
}
}'Response Example
{
"data": {
"getBlockFee": [
{
"chain": "CHAIN_0X1",
"baseFeePerGas": "0.185158901",
"maxPriorityFeePerGas": "0.185158901",
"error": null
},
{
"chain": "CHAIN_0X89",
"baseFeePerGas": "15.117275875",
"maxPriorityFeePerGas": "15.117275875",
"error": null
},
{
"chain": "CHAIN_0X38",
"baseFeePerGas": "0.0",
"maxPriorityFeePerGas": "0.0",
"error": null
},
{
"chain": "CHAIN_0X64",
"baseFeePerGas": "0.002893025",
"maxPriorityFeePerGas": "0.002893025",
"error": null
}
]
}
}