fetchBalanceForToken method

Future<Amount> fetchBalanceForToken(
  1. String address,
  2. CoinEntity token
)

Fetch the Balance of a token given for a given address

Implementation

Future<Amount> fetchBalanceForToken(
  String address,
  CoinEntity token,
) async =>
    switch (token) {
      ERC20Entity erc20 => fetchTokenBalance(
          address: address,
          contractAddress: erc20.contractAddress,
        ).then((balance) => Amount(value: balance, decimals: erc20.decimals)),
      CoinEntity coin => fetchBalance(
          address: address,
        ).then((balance) => Amount(value: balance, decimals: coin.decimals)),
    };