getWithdrawMinimum method

  1. @override
Future<double> getWithdrawMinimum(
  1. String asset,
  2. String blockchain, [
  3. String? network
])
override

Obtains minimum amount required to withdraw funds on a given asset.

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<double> getWithdrawMinimum(
  String asset,
  String blockchain, [
  String? network,
]) async {
  try {
    final response = await _dio.post<Map<String, dynamic>>(
      'getWithdrawMinimum',
      data: <String, dynamic>{
        'asset': asset,
        'blockchain': blockchain,
        'network': network,
      },
      options: Options(headers: _headers),
    );

    if (response.statusCode == 200 && response.data != null) {
      return response.data!['withdraw_minimum'] as double;
    }
  } on DioError catch (e) {
    _handlerError(e, 'get withdraw minimum');
  }
  throw const TelePayException('Failed to get withdraw minimum.');
}