mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2024-11-17 01:37:40 +00:00
CWA-169 | removed xmr-btc pair, fixed fetchLimits and findTradeById methods in MorphTokenExchangeProvider class
This commit is contained in:
parent
22cf5ca08b
commit
b8887daff4
1 changed files with 8 additions and 11 deletions
|
@ -18,7 +18,6 @@ class MorphTokenExchangeProvider extends ExchangeProvider {
|
||||||
MorphTokenExchangeProvider()
|
MorphTokenExchangeProvider()
|
||||||
: super(
|
: super(
|
||||||
pairList: [
|
pairList: [
|
||||||
ExchangePair(from: CryptoCurrency.xmr, to: CryptoCurrency.btc),
|
|
||||||
ExchangePair(from: CryptoCurrency.xmr, to: CryptoCurrency.eth),
|
ExchangePair(from: CryptoCurrency.xmr, to: CryptoCurrency.eth),
|
||||||
ExchangePair(from: CryptoCurrency.xmr, to: CryptoCurrency.bch),
|
ExchangePair(from: CryptoCurrency.xmr, to: CryptoCurrency.bch),
|
||||||
ExchangePair(from: CryptoCurrency.xmr, to: CryptoCurrency.ltc),
|
ExchangePair(from: CryptoCurrency.xmr, to: CryptoCurrency.ltc),
|
||||||
|
@ -51,8 +50,7 @@ class MorphTokenExchangeProvider extends ExchangeProvider {
|
||||||
ExchangePair(from: CryptoCurrency.btc, to: CryptoCurrency.eth),
|
ExchangePair(from: CryptoCurrency.btc, to: CryptoCurrency.eth),
|
||||||
ExchangePair(from: CryptoCurrency.btc, to: CryptoCurrency.bch),
|
ExchangePair(from: CryptoCurrency.btc, to: CryptoCurrency.bch),
|
||||||
ExchangePair(from: CryptoCurrency.btc, to: CryptoCurrency.ltc),
|
ExchangePair(from: CryptoCurrency.btc, to: CryptoCurrency.ltc),
|
||||||
ExchangePair(from: CryptoCurrency.btc, to: CryptoCurrency.dash),
|
ExchangePair(from: CryptoCurrency.btc, to: CryptoCurrency.dash)
|
||||||
ExchangePair(from: CryptoCurrency.btc, to: CryptoCurrency.xmr),
|
|
||||||
]);
|
]);
|
||||||
|
|
||||||
final trades = Hive.box<Trade>(Trade.boxName);
|
final trades = Hive.box<Trade>(Trade.boxName);
|
||||||
|
@ -84,13 +82,13 @@ class MorphTokenExchangeProvider extends ExchangeProvider {
|
||||||
"weight": weight
|
"weight": weight
|
||||||
}]});
|
}]});
|
||||||
final response =
|
final response =
|
||||||
await post(url.toString(), headers: headers, body: json.encode(body));
|
await post(url, headers: headers, body: body);
|
||||||
final responseJSON = json.decode(response.body) as Map<String, dynamic>;
|
final responseJSON = json.decode(response.body) as Map<String, dynamic>;
|
||||||
|
|
||||||
final min = responseJSON['input']['limits']['min'] as double;
|
final min = responseJSON['input']['limits']['min'] as int;
|
||||||
final max = responseJSON['input']['limits']['max'] as double;
|
final max = responseJSON['input']['limits']['max'] as int;
|
||||||
|
|
||||||
return Limits(min: min, max: max);
|
return Limits(min: min.toDouble(), max: max.toDouble());
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -155,9 +153,9 @@ class MorphTokenExchangeProvider extends ExchangeProvider {
|
||||||
|
|
||||||
final responseJSON = json.decode(response.body) as Map<String, dynamic>;
|
final responseJSON = json.decode(response.body) as Map<String, dynamic>;
|
||||||
final fromCurrency = responseJSON['input']['asset'] as String;
|
final fromCurrency = responseJSON['input']['asset'] as String;
|
||||||
final from = CryptoCurrency.fromString(fromCurrency);
|
final from = CryptoCurrency.fromString(fromCurrency.toLowerCase());
|
||||||
final toCurrency = responseJSON['output']['asset'] as String;
|
final toCurrency = responseJSON['output']['asset'] as String;
|
||||||
final to = CryptoCurrency.fromString(toCurrency);
|
final to = CryptoCurrency.fromString(toCurrency.toLowerCase());
|
||||||
final inputAddress = responseJSON['input']['refund_address'] as String;
|
final inputAddress = responseJSON['input']['refund_address'] as String;
|
||||||
final status = responseJSON['state'] as String;
|
final status = responseJSON['state'] as String;
|
||||||
final state = TradeState.deserialize(raw: status.toLowerCase());
|
final state = TradeState.deserialize(raw: status.toLowerCase());
|
||||||
|
@ -177,8 +175,7 @@ class MorphTokenExchangeProvider extends ExchangeProvider {
|
||||||
provider: description,
|
provider: description,
|
||||||
inputAddress: inputAddress,
|
inputAddress: inputAddress,
|
||||||
amount: amount,
|
amount: amount,
|
||||||
state: state,
|
state: state);
|
||||||
outputTransaction: null);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|
Loading…
Reference in a new issue