From 1ddf94613056cf1464cd0d5a227e5c1ba90965ac Mon Sep 17 00:00:00 2001 From: OmarHatem Date: Tue, 31 Dec 2024 08:04:49 +0200 Subject: [PATCH] Disable mweb coins for exchanges --- lib/view_model/send/send_view_model.dart | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/lib/view_model/send/send_view_model.dart b/lib/view_model/send/send_view_model.dart index 78bc867db..cafe89cb1 100644 --- a/lib/view_model/send/send_view_model.dart +++ b/lib/view_model/send/send_view_model.dart @@ -394,7 +394,7 @@ abstract class SendViewModelBase extends WalletChangeListenerViewModel with Stor if (wallet.isHardwareWallet) state = IsAwaitingDeviceResponseState(); - pendingTransaction = await wallet.createTransaction(_credentials()); + pendingTransaction = await wallet.createTransaction(_credentials(provider)); if (provider is ThorChainExchangeProvider) { final outputCount = pendingTransaction?.outputCount ?? 0; @@ -522,7 +522,7 @@ abstract class SendViewModelBase extends WalletChangeListenerViewModel with Stor void setTransactionPriority(TransactionPriority priority) => _settingsStore.priority[wallet.type] = priority; - Object _credentials() { + Object _credentials([ExchangeProvider? provider]) { final priority = _settingsStore.priority[wallet.type]; if (priority == null && @@ -535,7 +535,6 @@ abstract class SendViewModelBase extends WalletChangeListenerViewModel with Stor switch (wallet.type) { case WalletType.bitcoin: - case WalletType.litecoin: case WalletType.bitcoinCash: return bitcoin!.createBitcoinTransactionCredentials( outputs, @@ -543,6 +542,14 @@ abstract class SendViewModelBase extends WalletChangeListenerViewModel with Stor feeRate: customBitcoinFeeRate, coinTypeToSpendFrom: coinTypeToSpendFrom, ); + case WalletType.litecoin: + return bitcoin!.createBitcoinTransactionCredentials( + outputs, + priority: priority!, + feeRate: customBitcoinFeeRate, + // if it's an exchange flow then disable sending from mweb coins + coinTypeToSpendFrom: provider != null ? UnspentCoinType.nonMweb : coinTypeToSpendFrom, + ); case WalletType.monero: return monero!