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 GetTokenBalance action for every token in the request.

Note

Only the native tokens BTC,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'|'BITCOIN_MAINNET',
                'contractAddress': 'string',
                'tokenId': 'string'
            },
            'ownerIdentifier': {
                'address': 'string'
            },
            'atBlockchainInstant': {
                'time': datetime(2015, 1, 1)
            }
        },
    ]
)
Parameters:

getTokenBalanceInputs (list) –

An array of GetTokenBalanceInput 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,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.

    • ownerIdentifier (dict) – [REQUIRED]

      The container for the identifier of the owner.

      • 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'|'BITCOIN_MAINNET',
                'contractAddress': 'string',
                'tokenId': 'string'
            },
            'balance': 'string',
            'atBlockchainInstant': {
                'time': datetime(2015, 1, 1)
            },
            'lastUpdatedTime': {
                'time': datetime(2015, 1, 1)
            }
        },
    ],
    'errors': [
        {
            'tokenIdentifier': {
                'network': 'ETHEREUM_MAINNET'|'BITCOIN_MAINNET',
                '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 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,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.

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

        • ownerIdentifier (dict) –

          The container for the identifier of the owner.

          • 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