Skip to main content

getContractAssetBalance Query

Retrieves the balance of a specific asset for a given contract.

Updated on
Oct 16, 2024

getContractAssetBalance Query

Parameters

contract
string
REQUIRED
The contract address for which the balance is to be fetched
asset
string
REQUIRED
The unique identifier of an asset

Returns

data
object
The data object which contains the following fields:
contractBalance
object
The object containing details about the contract's balance for a specific asset
contract
string
The ID of the contract
amount
string
The balance amount of the asset in the contract
assetId
string
The unique identifier of the asset associated with the contract
Request
1
curl --location 'https://docs-demo.fuel-mainnet.quiknode.pro/v1/graphql' \
2
--header 'Accept: application/json' \
3
--header 'Content-Type: application/json' \
4
--data '{
5
"query": "query ContractBalance($contract: ContractId, $asset: AssetId) { contractBalance(contract: $contract, asset: $asset) { contract amount assetId } }",
6
"variables": {
7
"contract": "0x7777777777777777777777777777777777777777777777777777777777777777",
8
"asset": "0x2a0d0ed9d2217ec7f32dcd9a1902ce2a66d68437aeff84e3a3cc8bebee0d2eea"
9
}
10
}'
Don't have an account yet?
Create your QuickNode endpoint in seconds and start building
Get started for free