getAllowance method

Future<BasicAllowance> getAllowance(
  1. String walletGrantee,
  2. String walletGranter
)

Implementation

Future<BasicAllowance> getAllowance(
    String walletGrantee, String walletGranter) async {
  String root =
      "${TerraClientConfiguration.blockchainResourcePath}${CosmosBaseConstants.COSMOS_FEEGRANT_ALLOWANCE}/$walletGranter/$walletGrantee";

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

    return BasicAllowance.fromData(BasicAllowanceDataArgs()
      ..spend_Limit = [
        CoinDataArgs()
          ..denom = CoinDenoms.ULUNA
          ..amount = double.parse(allowance[0].allowance!.value!)
      ]);
  }

  throw Exception("");
}