CWA-169 | removed xmr-btc pair, fixed fetchLimits and findTradeById methods in MorphTokenExchangeProvider class
Oleksandr Sobol committed
Feb 5, 2020 at 19:30 UTC
b8887daff4599ddd114de1bc54ad3e5e3bb74000
1 file changed
+8
-11
lib/src/domain/exchange/morphtoken/morphtoken_exchange_provider.dart
+8
-11
@@ -18,7 +18,6 @@ class MorphTokenExchangeProvider extends ExchangeProvider {
18
MorphTokenExchangeProvider()
19
: super(
20
pairList: [
21
- ExchangePair(from: CryptoCurrency.xmr, to: CryptoCurrency.btc),
21
ExchangePair(from: CryptoCurrency.xmr, to: CryptoCurrency.eth),
22
ExchangePair(from: CryptoCurrency.xmr, to: CryptoCurrency.bch),
23
ExchangePair(from: CryptoCurrency.xmr, to: CryptoCurrency.ltc),
@@ -51,8 +50,7 @@ class MorphTokenExchangeProvider extends ExchangeProvider {
50
ExchangePair(from: CryptoCurrency.btc, to: CryptoCurrency.eth),
51
ExchangePair(from: CryptoCurrency.btc, to: CryptoCurrency.bch),
52
ExchangePair(from: CryptoCurrency.btc, to: CryptoCurrency.ltc),
54
- ExchangePair(from: CryptoCurrency.btc, to: CryptoCurrency.dash),
55
- ExchangePair(from: CryptoCurrency.btc, to: CryptoCurrency.xmr),
53
+ ExchangePair(from: CryptoCurrency.btc, to: CryptoCurrency.dash)
54
]);
55
56
final trades = Hive.box<Trade>(Trade.boxName);
@@ -84,13 +82,13 @@ class MorphTokenExchangeProvider extends ExchangeProvider {
82
"weight": weight
83
}]});
84
final response =
87
- await post(url.toString(), headers: headers, body: json.encode(body));
85
+ await post(url, headers: headers, body: body);
86
final responseJSON = json.decode(response.body) as Map<String, dynamic>;
87
90
- final min = responseJSON['input']['limits']['min'] as double;
91
- final max = responseJSON['input']['limits']['max'] as double;
88
+ final min = responseJSON['input']['limits']['min'] as int;
89
+ final max = responseJSON['input']['limits']['max'] as int;
90
93
- return Limits(min: min, max: max);
91
+ return Limits(min: min.toDouble(), max: max.toDouble());
92
}
93
94
@override
@@ -155,9 +153,9 @@ class MorphTokenExchangeProvider extends ExchangeProvider {
153
154
final responseJSON = json.decode(response.body) as Map<String, dynamic>;
155
final fromCurrency = responseJSON['input']['asset'] as String;
158
- final from = CryptoCurrency.fromString(fromCurrency);
156
+ final from = CryptoCurrency.fromString(fromCurrency.toLowerCase());
157
final toCurrency = responseJSON['output']['asset'] as String;
160
- final to = CryptoCurrency.fromString(toCurrency);
158
+ final to = CryptoCurrency.fromString(toCurrency.toLowerCase());
159
final inputAddress = responseJSON['input']['refund_address'] as String;
160
final status = responseJSON['state'] as String;
161
final state = TradeState.deserialize(raw: status.toLowerCase());
@@ -177,8 +175,7 @@ class MorphTokenExchangeProvider extends ExchangeProvider {
175
provider: description,
176
inputAddress: inputAddress,
177
amount: amount,
180
- state: state,
181
- outputTransaction: null);
178
+ state: state);
179
}
180
181
@override