getBalance method

Future<List<Coin>> getBalance(
  1. String walletAddress
)

Implementation

Future<List<Coin>> getBalance(String walletAddress) async {
  String root =
      "${TerraClientConfiguration.blockchainResourcePath}${CosmosBaseConstants.COSMOS_BANK_BALANCES}/$walletAddress";

  var response = await apiRequester.getAsync<BankInfoApiJson>(root);
  if (response.successful!) {
    var result = BankInfoApiJson.fromJson(response.result!);

    return CoinsExtensions.fromJSON(result.balances!);
  }

  throw Exception(
      "Could not successfully fetch the account information for wallet address: $walletAddress");
}