listTokenBalances method
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.
May throw AccessDeniedException.
May throw InternalServerException.
May throw ServiceQuotaExceededException.
May throw ThrottlingException.
May throw ValidationException.
Parameter tokenFilter :
The contract address or a token identifier on the blockchain network by
which to filter the request. You must specify the
contractAddress property of this container when listing
tokens minted by a contract.
Parameter maxResults :
The maximum number of token balances to return.
Default: 100
To retrieve the next set of results, make another request with the
returned nextToken value. The value of nextToken
is null when there are no more results to return
Parameter nextToken :
The pagination token that indicates the next set of results to retrieve.
Parameter ownerFilter :
The contract or wallet address on the blockchain network by which to
filter the request. You must specify the address property of
the ownerFilter when listing balances of tokens owned by the
address.
Implementation
Future<ListTokenBalancesOutput> listTokenBalances({
required TokenFilter tokenFilter,
int? maxResults,
String? nextToken,
OwnerFilter? ownerFilter,
}) async {
final $payload = <String, dynamic>{
'tokenFilter': tokenFilter,
if (maxResults != null) 'maxResults': maxResults,
if (nextToken != null) 'nextToken': nextToken,
if (ownerFilter != null) 'ownerFilter': ownerFilter,
};
final response = await _protocol.send(
payload: $payload,
method: 'POST',
requestUri: '/list-token-balances',
exceptionFnMap: _exceptionFns,
);
return ListTokenBalancesOutput.fromJson(response);
}