getTokenBalancesForAddress method
- EthereumAddress address,
- {EthereumAddress? tokenAddress,
- int page = 1,
- int pageSize = 20}
override
Retrieves token balances for a specific address.
Given the address
, this method returns a TokenBalancesResponse
with
information about the token balances. Additional parameters like tokenAddress
,
page
, and pageSize
can be specified for more targeted results.
Implementation
@override
Future<TokenBalancesResponse> getTokenBalancesForAddress(
EthereumAddress address,
{EthereumAddress? tokenAddress,
int page = 1,
int pageSize = 20}) async {
return TokenBalancesResponse.fromJson(await _restClient
.get<Map<String, dynamic>>('/account/tokens', queryParameters: {
'address': address.hex,
'chain_id': _chain.chainId,
if (tokenAddress != null) 'contract_address': tokenAddress.hex,
'page': page,
'limit': pageSize,
}));
}