GetTokenBalance - Amazon Managed Blockchain

GetTokenBalance

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.

Request Syntax

POST /get-token-balance HTTP/1.1 Content-type: application/json { "atBlockchainInstant": { "time": number }, "ownerIdentifier": { "address": "string" }, "tokenIdentifier": { "contractAddress": "string", "network": "string", "tokenId": "string" } }

URI Request Parameters

The request does not use any URI parameters.

Request Body

The request accepts the following data in JSON format.

atBlockchainInstant

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.

Type: BlockchainInstant object

Required: No

ownerIdentifier

The container for the identifier for the owner.

Type: OwnerIdentifier object

Required: Yes

tokenIdentifier

The container for the identifier for the token, including the unique token ID and its blockchain network.

Type: TokenIdentifier object

Required: Yes

Response Syntax

HTTP/1.1 200 Content-type: application/json { "atBlockchainInstant": { "time": number }, "balance": "string", "lastUpdatedTime": { "time": number }, "ownerIdentifier": { "address": "string" }, "tokenIdentifier": { "contractAddress": "string", "network": "string", "tokenId": "string" } }

Response Elements

If the action is successful, the service sends back an HTTP 200 response.

The following data is returned in JSON format by the service.

atBlockchainInstant

The container for time.

Type: BlockchainInstant object

balance

The container for the token balance.

Type: String

lastUpdatedTime

The container for time.

Type: BlockchainInstant object

ownerIdentifier

The container for the owner identifier.

Type: OwnerIdentifier object

tokenIdentifier

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.

Type: TokenIdentifier object

Errors

For information about the errors that are common to all actions, see Common Errors.

AccessDeniedException

The AWS account doesn’t have access to this resource.

HTTP Status Code: 403

InternalServerException

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

HTTP Status Code: 500

ResourceNotFoundException

The resource was not found.

HTTP Status Code: 404

ServiceQuotaExceededException

The service quota has been exceeded for this resource.

HTTP Status Code: 402

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.

HTTP Status Code: 429

ValidationException

The resource passed is invalid.

HTTP Status Code: 400

See Also

For more information about using this API in one of the language-specific AWS SDKs, see the following: