CW-411 Update sideshift api (#959)

* Update sideshift api

* Fix sideShift api v2 rate

* Fix rate calculation on sideshift

* Additional fixes

* Minor: Add additional unsupported
* Add network to quote
* Add amount and affiliateID to quote
* Refactor tag/network assigning

* Fix syntax errors with rate qpi

* Add network for fetching rate

* Remove amount from rate endpoint

* Fix transaction depositAmount

* Fix issues from code review

* Fix issues from code review

* Remove affiliate ID

---------

Co-authored-by: Justin Ehrenhofer <justin.ehrenhofer@gmail.com>
This commit is contained in:
Godwin Asuquo
2023-06-09 14:46:00 +03:00
committed by GitHub
co-authored by Justin Ehrenhofer
parent e8446f0c98
commit a4c279b538
5 changed files with 118 additions and 89 deletions
@@ -47,7 +47,7 @@ abstract class ExchangeTradeViewModelBase with Store {
case ExchangeProviderDescription.simpleSwap:
_provider = SimpleSwapExchangeProvider();
break;
case ExchangeProviderDescription.trocador:
case ExchangeProviderDescription.trocador:
_provider = TrocadorExchangeProvider();
break;
}
@@ -114,6 +114,10 @@ abstract class ExchangeTradeViewModelBase with Store {
updatedTrade.createdAt = trade.createdAt;
}
if (updatedTrade.amount.isEmpty) {
updatedTrade.amount = trade.amount;
}
trade = updatedTrade;
_updateItems();
@@ -123,7 +127,8 @@ abstract class ExchangeTradeViewModelBase with Store {
}
void _updateItems() {
final tagFrom = tradesStore.trade!.from.tag != null ? '${tradesStore.trade!.from.tag}' + ' ' : '';
final tagFrom =
tradesStore.trade!.from.tag != null ? '${tradesStore.trade!.from.tag}' + ' ' : '';
final tagTo = tradesStore.trade!.to.tag != null ? '${tradesStore.trade!.to.tag}' + ' ' : '';
items.clear();
items.add(ExchangeTradeItem(
@@ -443,7 +443,9 @@ abstract class ExchangeViewModelBase with Store {
request = SideShiftRequest(
depositMethod: depositCurrency,
settleMethod: receiveCurrency,
depositAmount: depositAmount.replaceAll(',', '.'),
depositAmount: isFixedRateMode
? receiveAmount.replaceAll(',', '.')
: depositAmount.replaceAll(',', '.'),
settleAddress: receiveAddress,
refundAddress: depositAddress,
);