getBlockHeights
This method obtains the current block height of the chains passed as parameters.
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
chains | [Chain!]! | 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 heights, so it works on all the supported chains.
Response
| Field | Type | Description |
|---|---|---|
chain | String | The chain ID. |
height | String | Latest block number/height. |
error | String | Error message if query failed. |
Query Example
Query
query GetBlockHeights($chains: [String!]!) {
getBlockHeights(chains: $chains) {
chain
height
error
}
}Variables
{
"chains": ["CHAIN_0X1", "CHAIN_SOLANA_MAINNET", "CHAIN_0X89", "CHAIN_0X38", "CHAIN_BITCOIN_MAINNET", "CHAIN_COSMOSHUB_4", "CHAIN_NOBLE_1"]
}Curl
curl -X POST https://your-api-endpoint/graphql \
-H "Content-Type: application/json" \
-d '{"query":"query GetBlockHeights($chains: [Chain!]!) { getBlockHeights(chains: $chains) { chain height error } }","variables":{"chains":["CHAIN_0X1", "CHAIN_SOLANA_MAINNET", "CHAIN_0X89", "CHAIN_0X38", "CHAIN_BITCOIN_MAINNET", "CHAIN_COSMOSHUB_4", "CHAIN_NOBLE_1"]}}'Response Example
{
"data": {
"getBlockHeights": [
{
"chain": "CHAIN_0X1",
"height": "23496397",
"error": null
},
{
"chain": "CHAIN_SOLANA_MAINNET",
"height": "370889831",
"error": null
},
{
"chain": "CHAIN_0X89",
"height": "77203578",
"error": null
},
{
"chain": "CHAIN_0X38",
"height": "63294166",
"error": null
},
{
"chain": "CHAIN_BITCOIN_MAINNET",
"height": "917485",
"error": null
},
{
"chain": "CHAIN_COSMOSHUB_4",
"height": "27798981",
"error": null
},
{
"chain": "CHAIN_NOBLE_1",
"height": "36143686",
"error": null
}
]
}
}