getSwapRate method

Future<Coin> getSwapRate(
  1. Coin offerCoin,
  2. String askDenom
)

Implementation

Future<Coin> getSwapRate(Coin offerCoin, String askDenom) async {
  var rootPath =
      "${TerraClientConfiguration.blockchainResourcePath}${CosmosBaseConstants.COSMOS_MARKET_SWAP}?offer_coin=${offerCoin.amount}${offerCoin.denom}&ask_denom=${askDenom}";

  var response = await apiRequester.getAsync<MarketingSwaps>(rootPath);
  if (response.successful!) {
    var result = MarketingSwaps.fromJson(response.result!);
    return Coin.fromJSON(result.return_coin);
  }

  throw Exception("");
}