From 27bfd85ba504f7a0be6cb05467da6e83aa3a81b9 Mon Sep 17 00:00:00 2001 From: Serhii Date: Tue, 1 Apr 2025 16:33:49 +0300 Subject: [PATCH] fix XOSwap pair id (#2143) --- lib/exchange/provider/xoswap_exchange_provider.dart | 11 ++++++++++- .../screens/exchange_trade/exchange_confirm_page.dart | 2 +- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/lib/exchange/provider/xoswap_exchange_provider.dart b/lib/exchange/provider/xoswap_exchange_provider.dart index 0b3826aa9..5611d6855 100644 --- a/lib/exchange/provider/xoswap_exchange_provider.dart +++ b/lib/exchange/provider/xoswap_exchange_provider.dart @@ -188,12 +188,21 @@ class XOSwapExchangeProvider extends ExchangeProvider { try { final uri = Uri.https(_apiAuthority, '$_apiPath$_orders'); + final curFrom = await _getAssets(request.fromCurrency); + final curTo = await _getAssets(request.toCurrency); + + if (curFrom == null || curTo == null) { + throw TradeNotCreatedException(description); + } + + final pairId = curFrom + '_' + curTo; + final payload = { 'fromAmount': request.fromAmount, 'fromAddress': request.refundAddress, 'toAmount': request.toAmount, 'toAddress': request.toAddress, - 'pairId': '${request.fromCurrency.title}_${request.toCurrency.title}', + 'pairId': pairId, }; final response = await http.post(uri, headers: _headers, body: json.encode(payload)); diff --git a/lib/src/screens/exchange_trade/exchange_confirm_page.dart b/lib/src/screens/exchange_trade/exchange_confirm_page.dart index 60b534c6e..4b7e27294 100644 --- a/lib/src/screens/exchange_trade/exchange_confirm_page.dart +++ b/lib/src/screens/exchange_trade/exchange_confirm_page.dart @@ -118,7 +118,7 @@ class ExchangeConfirmPage extends BasePage { mainAxisAlignment: MainAxisAlignment.center, children: [ (trade.provider.image?.isNotEmpty ?? false) - ? Image.asset(trade.provider.image, height: 50) + ? ImageUtil.getImageFromPath(imagePath: trade.provider.image, height: 50, width: 50) : const SizedBox(), if (!trade.provider.horizontalLogo) Padding(