mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2025-03-06 08:44:35 +00:00
fix issues from code review
This commit is contained in:
parent
a97bcc12f6
commit
8606d2bcd5
1 changed files with 5 additions and 4 deletions
|
@ -33,7 +33,8 @@ class SimpleSwapExchangeProvider extends ExchangeProvider {
|
||||||
static const apiKey = secrets.simpleSwapApiKey;
|
static const apiKey = secrets.simpleSwapApiKey;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
ExchangeProviderDescription get description => ExchangeProviderDescription.simpleSwap;
|
ExchangeProviderDescription get description =>
|
||||||
|
ExchangeProviderDescription.simpleSwap;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<double> calculateAmount(
|
Future<double> calculateAmount(
|
||||||
|
@ -60,7 +61,6 @@ class SimpleSwapExchangeProvider extends ExchangeProvider {
|
||||||
|
|
||||||
if (response.body == null || response.body == "null") return 0.00;
|
if (response.body == null || response.body == "null") return 0.00;
|
||||||
final data = json.decode(response.body) as String;
|
final data = json.decode(response.body) as String;
|
||||||
|
|
||||||
return double.parse(data);
|
return double.parse(data);
|
||||||
} catch (_) {
|
} catch (_) {
|
||||||
return 0.00;
|
return 0.00;
|
||||||
|
@ -78,7 +78,8 @@ class SimpleSwapExchangeProvider extends ExchangeProvider {
|
||||||
@override
|
@override
|
||||||
Future<Trade> createTrade({required TradeRequest request, required bool isFixedRateMode}) async {
|
Future<Trade> createTrade({required TradeRequest request, required bool isFixedRateMode}) async {
|
||||||
final _request = request as SimpleSwapRequest;
|
final _request = request as SimpleSwapRequest;
|
||||||
final headers = {'Content-Type': 'application/json'};
|
final headers = {
|
||||||
|
'Content-Type': 'application/json'};
|
||||||
final params = <String, String>{
|
final params = <String, String>{
|
||||||
'api_key': apiKey,
|
'api_key': apiKey,
|
||||||
};
|
};
|
||||||
|
@ -187,7 +188,7 @@ class SimpleSwapExchangeProvider extends ExchangeProvider {
|
||||||
final to = CryptoCurrency.fromString(toCurrency);
|
final to = CryptoCurrency.fromString(toCurrency);
|
||||||
final inputAddress = responseJSON['address_from'] as String;
|
final inputAddress = responseJSON['address_from'] as String;
|
||||||
final expectedSendAmount = responseJSON['expected_amount'].toString();
|
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 status = responseJSON['status'] as String;
|
||||||
final state = TradeState.deserialize(raw: status);
|
final state = TradeState.deserialize(raw: status);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue