Skip to content

batch_get_token_balance async

batch_get_token_balance(
    *,
    config_overrides: Optional[AsyncManagedBlockchainQueryClientConfig] = None,
    get_token_balance_inputs: Optional[GetTokenBalanceInputList] = None,
) -> BatchGetTokenBalanceOutput

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

Only the native tokens BTC and ETH, and the ERC-20, ERC-721, and ERC 1155 token standards are supported.

Parameters:

  • get_token_balance_inputs (Optional[GetTokenBalanceInputList], default: None ) –

    An array of BatchGetTokenBalanceInputItem objects whose balance is being requested.

Raises:

  • AccessDeniedException –

    The Amazon Web Services account doesn’t have access to this resource.

  • InternalServerException –

    The request processing has failed because of an internal error in the service.

  • ResourceNotFoundException –

    The resource was not found.

  • ServiceQuotaExceededException –

    The service quota has been exceeded for this resource.

  • ThrottlingException –

    The request or operation couldn't be performed because a service is throttling requests. The most common source of throttling errors is when you create resources that exceed your service limit for this resource type. Request a limit increase or delete unused resources, if possible.

  • ValidationException –

    The resource passed is invalid.

  • UnknownServiceError –

    The service returned an error code this client does not model.

Source code in docs_src/capo_managedblockchain_query/_services/async_managed_blockchain_query.py
async def batch_get_token_balance(
    self,
    *,
    config_overrides: Optional[AsyncManagedBlockchainQueryClientConfig] = None,
    get_token_balance_inputs: Optional[
        "capo_managedblockchain_query.types.get_token_balance_input_list.GetTokenBalanceInputList"
    ] = None,
) -> "capo_managedblockchain_query.types.batch_get_token_balance_output.BatchGetTokenBalanceOutput":
    """<p>Gets the token balance for a batch of tokens by using the <code>BatchGetTokenBalance</code> action for every token in the request.</p> <note> <p>Only the native tokens BTC and ETH, and the ERC-20, ERC-721, and ERC 1155 token standards are supported.</p> </note>

    Args:
        get_token_balance_inputs: <p>An array of <code>BatchGetTokenBalanceInputItem</code> objects whose balance is being requested.</p>

    Raises:
        capo_managedblockchain_query.errors.access_denied_exception.AccessDeniedException: <p>The Amazon Web Services account doesn’t have access to this resource. </p>
        capo_managedblockchain_query.errors.internal_server_exception.InternalServerException: <p>The request processing has failed because of an internal error in the service.</p>
        capo_managedblockchain_query.errors.resource_not_found_exception.ResourceNotFoundException: <p>The resource was not found.</p>
        capo_managedblockchain_query.errors.service_quota_exceeded_exception.ServiceQuotaExceededException: <p>The service quota has been exceeded for this resource.</p>
        capo_managedblockchain_query.errors.throttling_exception.ThrottlingException: <p>The request or operation couldn't be performed because a service is throttling requests. The most common source of throttling errors is when you create resources that exceed your service limit for this resource type. Request a limit increase or delete unused resources, if possible.</p>
        capo_managedblockchain_query.errors.validation_exception.ValidationException: <p>The resource passed is invalid.</p>
        capo_managedblockchain_query.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_managedblockchain_query.types.batch_get_token_balance_input.BatchGetTokenBalanceInput]",
    ) -> AsyncOperationResponse[
        "capo_managedblockchain_query.types.batch_get_token_balance_output.BatchGetTokenBalanceOutput"
    ]:
        import capo_managedblockchain_query._operations.tieton_chain_query_service.batch_get_token_balance

        (
            output,
            http_response,
        ) = await capo_managedblockchain_query._operations.tieton_chain_query_service.batch_get_token_balance.async_batch_get_token_balance(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("BatchGetTokenBalance")
    )
    input_: capo_managedblockchain_query.types.batch_get_token_balance_input.BatchGetTokenBalanceInput = {}
    if get_token_balance_inputs is not None:
        input_["get_token_balance_inputs"] = get_token_balance_inputs

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output