ManagedBlockchainQuery / Client / get_token_balance
get_token_balance#
- ManagedBlockchainQuery.Client.get_token_balance(**kwargs)#
Gets the balance of a specific token, including native tokens, for a given address (wallet or contract) on the blockchain.
Note
Only the native tokens BTC and ETH, and the ERC-20, ERC-721, and ERC 1155 token standards are supported.
See also: AWS API Documentation
Request Syntax
response = client.get_token_balance( tokenIdentifier={ 'network': 'ETHEREUM_MAINNET'|'ETHEREUM_SEPOLIA_TESTNET'|'BITCOIN_MAINNET'|'BITCOIN_TESTNET', 'contractAddress': 'string', 'tokenId': 'string' }, ownerIdentifier={ 'address': 'string' }, atBlockchainInstant={ 'time': datetime(2015, 1, 1) } )
- Parameters:
tokenIdentifier (dict) –
[REQUIRED]
The container for the identifier for the token, including the unique token ID and its blockchain network.
network (string) – [REQUIRED]
The blockchain network of the token.
contractAddress (string) –
This is the token’s contract address.
tokenId (string) –
The unique identifier of the token.
Note
For native tokens, use the 3 character abbreviation that best matches your token. For example, btc for Bitcoin, eth for Ether, etc. For all other token types you must specify the
tokenId
in the 64 character hexadecimaltokenid
format.
ownerIdentifier (dict) –
[REQUIRED]
The container for the identifier for the owner.
address (string) – [REQUIRED]
The contract or wallet address for the owner.
atBlockchainInstant (dict) –
The time for when the TokenBalance is requested or the current time if a time is not provided in the request.
Note
This time will only be recorded up to the second.
time (datetime) –
The container of the
Timestamp
of the blockchain instant.Note
This
timestamp
will only be recorded up to the second.
- Return type:
dict
- Returns:
Response Syntax
{ 'ownerIdentifier': { 'address': 'string' }, 'tokenIdentifier': { 'network': 'ETHEREUM_MAINNET'|'ETHEREUM_SEPOLIA_TESTNET'|'BITCOIN_MAINNET'|'BITCOIN_TESTNET', 'contractAddress': 'string', 'tokenId': 'string' }, 'balance': 'string', 'atBlockchainInstant': { 'time': datetime(2015, 1, 1) }, 'lastUpdatedTime': { 'time': datetime(2015, 1, 1) } }
Response Structure
(dict) –
ownerIdentifier (dict) –
The container for the identifier of the owner.
address (string) –
The contract or wallet address for the owner.
tokenIdentifier (dict) –
The container for the identifier for the token including the unique token ID and its blockchain network.
Note
Only the native tokens BTC and ETH, and the ERC-20, ERC-721, and ERC 1155 token standards are supported.
network (string) –
The blockchain network of the token.
contractAddress (string) –
This is the token’s contract address.
tokenId (string) –
The unique identifier of the token.
Note
For native tokens, use the 3 character abbreviation that best matches your token. For example, btc for Bitcoin, eth for Ether, etc. For all other token types you must specify the
tokenId
in the 64 character hexadecimaltokenid
format.
balance (string) –
The container for the token balance.
atBlockchainInstant (dict) –
The container for time.
time (datetime) –
The container of the
Timestamp
of the blockchain instant.Note
This
timestamp
will only be recorded up to the second.
lastUpdatedTime (dict) –
The container for time.
time (datetime) –
The container of the
Timestamp
of the blockchain instant.Note
This
timestamp
will only be recorded up to the second.
Exceptions
ManagedBlockchainQuery.Client.exceptions.ThrottlingException
ManagedBlockchainQuery.Client.exceptions.ValidationException
ManagedBlockchainQuery.Client.exceptions.ResourceNotFoundException
ManagedBlockchainQuery.Client.exceptions.AccessDeniedException
ManagedBlockchainQuery.Client.exceptions.InternalServerException
ManagedBlockchainQuery.Client.exceptions.ServiceQuotaExceededException