From 8606d2bcd5e9e5385bb46e4b26ca6350b64aeb5e Mon Sep 17 00:00:00 2001 From: Godwin Asuquo Date: Mon, 24 Oct 2022 17:57:36 +0300 Subject: [PATCH] fix issues from code review --- .../simpleswap/simpleswap_exchange_provider.dart | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/exchange/simpleswap/simpleswap_exchange_provider.dart b/lib/exchange/simpleswap/simpleswap_exchange_provider.dart index c5fbbdc00..a1b6f87f0 100644 --- a/lib/exchange/simpleswap/simpleswap_exchange_provider.dart +++ b/lib/exchange/simpleswap/simpleswap_exchange_provider.dart @@ -33,7 +33,8 @@ class SimpleSwapExchangeProvider extends ExchangeProvider { static const apiKey = secrets.simpleSwapApiKey; @override - ExchangeProviderDescription get description => ExchangeProviderDescription.simpleSwap; + ExchangeProviderDescription get description => + ExchangeProviderDescription.simpleSwap; @override Future calculateAmount( @@ -60,7 +61,6 @@ class SimpleSwapExchangeProvider extends ExchangeProvider { if (response.body == null || response.body == "null") return 0.00; final data = json.decode(response.body) as String; - return double.parse(data); } catch (_) { return 0.00; @@ -78,7 +78,8 @@ class SimpleSwapExchangeProvider extends ExchangeProvider { @override Future createTrade({required TradeRequest request, required bool isFixedRateMode}) async { final _request = request as SimpleSwapRequest; - final headers = {'Content-Type': 'application/json'}; + final headers = { + 'Content-Type': 'application/json'}; final params = { 'api_key': apiKey, }; @@ -187,7 +188,7 @@ class SimpleSwapExchangeProvider extends ExchangeProvider { final to = CryptoCurrency.fromString(toCurrency); final inputAddress = responseJSON['address_from'] as String; final expectedSendAmount = responseJSON['expected_amount'].toString(); - final extraId = responseJSON['extra_id_from'] as String; + final extraId = responseJSON['extra_id_from'] as String?; final status = responseJSON['status'] as String; final state = TradeState.deserialize(raw: status);