Disable mweb coins for exchanges (#1919)

* Disable mweb coins for exchanges

* Take into consideration to not use non-mweb coins in ALL calculations
This commit is contained in:
Omar Hatem
2025-01-03 08:53:15 +02:00
committed by GitHub
parent 0ebfd671f9
commit 5ea443235d
4 changed files with 40 additions and 23 deletions
+10 -3
View File
@@ -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!