getERC20TokenMarketPrice method

  1. @override
Future<TokenPriceResponse> getERC20TokenMarketPrice(
  1. EthereumAddress tokenAddress
)
override

Retrieves the market price of an ERC-20 token.

Given the tokenAddress, this method returns a TokenPriceResponse containing information about the market price of the token.

Implementation

@override
Future<TokenPriceResponse> getERC20TokenMarketPrice(
    EthereumAddress tokenAddress) async {
  return TokenPriceResponse.fromJson(await _restClient
      .get<Map<String, dynamic>>('/token/price', queryParameters: {
    'contract_address': tokenAddress.hex,
    'chain_id': _chain.chainId
  }));
}