mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-10-24 06:48:38 +02:00
User token swap improvements (#2470)
* Handle null currency in trade * Improve trade network handling and error reporting * update Polygon network tag * Update exchange_trade_view_model.dart * handle nullable network fields * Update lib/exchange/provider/letsexchange_exchange_provider.dart --------- Co-authored-by: Omar Hatem <omarh.ismail1@gmail.com>
This commit is contained in:
@@ -128,7 +128,15 @@ abstract class ExchangeTradeViewModelBase with Store {
|
||||
@action
|
||||
Future<void> confirmSending() async {
|
||||
if (!isSendable) return;
|
||||
sendViewModel.selectedCryptoCurrency = trade.from;
|
||||
|
||||
final selected = trade.from ?? trade.userCurrencyFrom;
|
||||
if (selected == null) {
|
||||
printV('No selectable currency for trade ${trade.id}');
|
||||
return;
|
||||
}
|
||||
|
||||
sendViewModel.selectedCryptoCurrency = selected;
|
||||
|
||||
final pendingTransaction = await sendViewModel.createTransaction(provider: _provider);
|
||||
if (_provider is ThorChainExchangeProvider) {
|
||||
trade.id = pendingTransaction?.id ?? '';
|
||||
@@ -251,7 +259,7 @@ abstract class ExchangeTradeViewModelBase with Store {
|
||||
|
||||
bool _isEthToken() =>
|
||||
wallet.currency == CryptoCurrency.eth &&
|
||||
tradesStore.trade!.from.tag == CryptoCurrency.eth.title;
|
||||
tradeFrom?.tag == CryptoCurrency.eth.title;
|
||||
|
||||
bool _isPolygonToken() =>
|
||||
wallet.currency == CryptoCurrency.maticpoly &&
|
||||
|
||||
Reference in New Issue
Block a user