ManagedBlockchainQuery / Client / batch_get_token_balance

batch_get_token_balance#

ManagedBlockchainQuery.Client.batch_get_token_balance(**kwargs)#

Gets the token balance for a batch of tokens by using the BatchGetTokenBalance action for every token in the request.

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.batch_get_token_balance(
    getTokenBalanceInputs=[
        {
            '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:

getTokenBalanceInputs (list) –

An array of BatchGetTokenBalanceInputItem objects whose balance is being requested.

  • (dict) –

    The container for the input for getting a token balance.

    • tokenIdentifier (dict) – [REQUIRED]

      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) – [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 hexadecimal tokenid format.

    • ownerIdentifier (dict) – [REQUIRED]

      The container for the owner identifier.

      • address (string) – [REQUIRED]

        The contract or wallet address for the owner.

    • 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.

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)
            }
        },
    ],
    'errors': [
        {
            'tokenIdentifier': {
                'network': 'ETHEREUM_MAINNET'|'ETHEREUM_SEPOLIA_TESTNET'|'BITCOIN_MAINNET'|'BITCOIN_TESTNET',
                'contractAddress': 'string',
                'tokenId': 'string'
            },
            'ownerIdentifier': {
                'address': 'string'
            },
            'atBlockchainInstant': {
                'time': datetime(2015, 1, 1)
            },
            'errorCode': 'string',
            'errorMessage': 'string',
            'errorType': 'VALIDATION_EXCEPTION'|'RESOURCE_NOT_FOUND_EXCEPTION'
        },
    ]
}

Response Structure

  • (dict) –

    • tokenBalances (list) –

      An array of BatchGetTokenBalanceOutputItem objects returned by the response.

      • (dict) –

        The container for the properties of a token balance output.

        • ownerIdentifier (dict) –

          The container for the owner identifier.

          • 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 hexadecimal tokenid 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.

    • errors (list) –

      An array of BatchGetTokenBalanceErrorItem objects returned from the request.

      • (dict) –

        Error generated from a failed BatchGetTokenBalance request.

        • 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 hexadecimal tokenid format.

        • ownerIdentifier (dict) –

          The container for the owner identifier.

          • address (string) –

            The contract or wallet address for the owner.

        • 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.

        • errorCode (string) –

          The error code associated with the error.

        • errorMessage (string) –

          The message associated with the error.

        • errorType (string) –

          The type of error.

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