getTokenBalance method
Future<GetTokenBalanceOutput>
getTokenBalance({
- required OwnerIdentifier ownerIdentifier,
- required TokenIdentifier tokenIdentifier,
- BlockchainInstant? atBlockchainInstant,
Gets the balance of a specific token, including native tokens, for a given address (wallet or contract) on the blockchain.
May throw AccessDeniedException.
May throw InternalServerException.
May throw ResourceNotFoundException.
May throw ServiceQuotaExceededException.
May throw ThrottlingException.
May throw ValidationException.
Parameter ownerIdentifier :
The container for the identifier for the owner.
Parameter tokenIdentifier :
The container for the identifier for the token, including the unique token
ID and its blockchain network.
Parameter atBlockchainInstant :
The time for when the TokenBalance is requested or the current time if a
time is not provided in the request.
Implementation
Future<GetTokenBalanceOutput> getTokenBalance({
required OwnerIdentifier ownerIdentifier,
required TokenIdentifier tokenIdentifier,
BlockchainInstant? atBlockchainInstant,
}) async {
final $payload = <String, dynamic>{
'ownerIdentifier': ownerIdentifier,
'tokenIdentifier': tokenIdentifier,
if (atBlockchainInstant != null)
'atBlockchainInstant': atBlockchainInstant,
};
final response = await _protocol.send(
payload: $payload,
method: 'POST',
requestUri: '/get-token-balance',
exceptionFnMap: _exceptionFns,
);
return GetTokenBalanceOutput.fromJson(response);
}