ManagedBlockchainQuery / Client / list_token_balances
list_token_balances¶
- ManagedBlockchainQuery.Client.list_token_balances(**kwargs)¶
- This action returns the following for a given blockchain network: - Lists all token balances owned by an address (either a contract address or a wallet address). 
- Lists all token balances for all tokens created by a contract. 
- Lists all token balances for a given token. 
 - Note- You must always specify the network property of the - tokenFilterwhen using this operation.- See also: AWS API Documentation - Request Syntax- response = client.list_token_balances( ownerFilter={ 'address': 'string' }, tokenFilter={ 'network': 'ETHEREUM_MAINNET'|'ETHEREUM_SEPOLIA_TESTNET'|'BITCOIN_MAINNET'|'BITCOIN_TESTNET', 'contractAddress': 'string', 'tokenId': 'string' }, nextToken='string', maxResults=123 ) - Parameters:
- ownerFilter (dict) – - The contract or wallet address on the blockchain network by which to filter the request. You must specify the - addressproperty of the- ownerFilterwhen listing balances of tokens owned by the address.- address (string) – [REQUIRED] - The contract or wallet address. 
 
- tokenFilter (dict) – - [REQUIRED] - The contract address or a token identifier on the blockchain network by which to filter the request. You must specify the - contractAddressproperty of this container when listing tokens minted by a contract.- Note- You must always specify the network property of this container when using this operation. - network (string) – [REQUIRED] - The blockchain network of the token. 
- contractAddress (string) – - This is the address of the contract. 
- tokenId (string) – - The unique identifier of the token. 
 
- nextToken (string) – The pagination token that indicates the next set of results to retrieve. 
- maxResults (integer) – - The maximum number of token balances to return. - Default: - 100- Note- Even if additional results can be retrieved, the request can return less results than - maxResultsor an empty array of results.- To retrieve the next set of results, make another request with the returned - nextTokenvalue. The value of- nextTokenis- nullwhen there are no more results to return
 
- Return type:
- dict 
- Returns:
- Response Syntax- { 'tokenBalances': [ { '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) } }, ], 'nextToken': 'string' } - Response Structure- (dict) – - tokenBalances (list) – - An array of - TokenBalanceobjects. Each object contains details about the token balance.- (dict) – - The balance of the token. - ownerIdentifier (dict) – - The container for the identifier of the owner. - address (string) – - The contract or wallet address for the owner. 
 
- tokenIdentifier (dict) – - The identifier for the token, including the unique token ID and its blockchain network. - 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 - tokenIdin the 64 character hexadecimal- tokenidformat.
 
- balance (string) – - The container of the token balance. 
- 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 - Timestampof the blockchain instant.- Note- This - timestampwill only be recorded up to the second.
 
- lastUpdatedTime (dict) – - The - Timestampof the last transaction at which the balance for the token in the wallet was updated.- time (datetime) – - The container of the - Timestampof the blockchain instant.- Note- This - timestampwill only be recorded up to the second.
 
 
 
- nextToken (string) – - The pagination token that indicates the next set of results to retrieve. 
 
 
 - Exceptions- ManagedBlockchainQuery.Client.exceptions.ThrottlingException
- ManagedBlockchainQuery.Client.exceptions.ValidationException
- ManagedBlockchainQuery.Client.exceptions.AccessDeniedException
- ManagedBlockchainQuery.Client.exceptions.InternalServerException
- ManagedBlockchainQuery.Client.exceptions.ServiceQuotaExceededException