mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2025-01-09 12:29:31 +00:00
parent
ed1dc75a3d
commit
95ecf4ef56
1 changed files with 6 additions and 4 deletions
|
@ -35,7 +35,7 @@ class SimpleSwapExchangeProvider extends ExchangeProvider {
|
|||
@override
|
||||
ExchangeProviderDescription get description =>
|
||||
ExchangeProviderDescription.simpleSwap;
|
||||
|
||||
|
||||
@override
|
||||
Future<double> calculateAmount(
|
||||
{required CryptoCurrency from,
|
||||
|
@ -61,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;
|
||||
|
@ -79,7 +78,7 @@ class SimpleSwapExchangeProvider extends ExchangeProvider {
|
|||
@override
|
||||
Future<Trade> createTrade({required TradeRequest request, required bool isFixedRateMode}) async {
|
||||
final _request = request as SimpleSwapRequest;
|
||||
final headers = {
|
||||
final headers = {
|
||||
'Content-Type': 'application/json'};
|
||||
final params = <String, String>{
|
||||
'api_key': apiKey,
|
||||
|
@ -111,7 +110,7 @@ class SimpleSwapExchangeProvider extends ExchangeProvider {
|
|||
final id = responseJSON['id'] as String;
|
||||
final inputAddress = responseJSON['address_from'] as String;
|
||||
final settleAddress = responseJSON['user_refund_address'] as String;
|
||||
|
||||
final extraId = responseJSON['extra_id_from'] as String?;
|
||||
return Trade(
|
||||
id: id,
|
||||
provider: description,
|
||||
|
@ -119,6 +118,7 @@ class SimpleSwapExchangeProvider extends ExchangeProvider {
|
|||
to: _request.to,
|
||||
inputAddress: inputAddress,
|
||||
refundAddress: settleAddress,
|
||||
extraId: extraId,
|
||||
state: TradeState.created,
|
||||
amount: _request.amount,
|
||||
createdAt: DateTime.now(),
|
||||
|
@ -188,6 +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 status = responseJSON['status'] as String;
|
||||
final state = TradeState.deserialize(raw: status);
|
||||
|
||||
|
@ -195,6 +196,7 @@ class SimpleSwapExchangeProvider extends ExchangeProvider {
|
|||
id: id,
|
||||
from: from,
|
||||
to: to,
|
||||
extraId: extraId,
|
||||
provider: description,
|
||||
inputAddress: inputAddress,
|
||||
amount: expectedSendAmount,
|
||||
|
|
Loading…
Reference in a new issue