getWithdrawFee method

  1. @override
Future<Fee> getWithdrawFee(
  1. CreateWithdraw withdraw
)
override

Get estimated withdraw fee, composed of blockchain fee and processing fee.

Throw UnauthorizedException when the secret key is invalid. Throw NotFoundException when the asset was not found. It throws exception TelePayException with any other error.

Implementation

@override
Future<Fee> getWithdrawFee(CreateWithdraw withdraw) async {
  try {
    final response = await _dio.post<Map<String, dynamic>>(
      'getWithdrawFee',
      data: withdraw.toJson(),
      options: Options(headers: _headers),
    );
    if (response.statusCode == 200 && response.data != null) {
      return Fee.fromJson(response.data!);
    }
  } on DioError catch (e) {
    _handlerError(e, 'get withdraw fee');
  }
  throw const TelePayException('Failed to get withdraw fee.');
}