getFeeEstimateForCryptoWithdrawal method

Future<double> getFeeEstimateForCryptoWithdrawal({
  1. String? currency,
  2. String? cryptoAddress,
})

Get fee estimate for crypto withdrawal

Gets the fee estimate for the crypto withdrawal to crypto address

https://docs.cloud.coinbase.com/exchange/reference/exchangerestapi_getwithdrawfeeestimate

Implementation

Future<double> getFeeEstimateForCryptoWithdrawal({
  String? currency,
  String? cryptoAddress,
}) async {
  var response = await _transfersRestClient.getFeeEstimateForCryptoWithdrawal(
    currency: currency,
    cryptoAddress: cryptoAddress,
  );

  if (response.statusCode != 200) throw response;

  var decodedResponse = json.decode(response.body);
  return double.tryParse(decodedResponse['fee'])!;
}