mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2025-06-28 12:29:51 +00:00
CW-687 Coin control fixes (#2058)
* fix coin control * don't reselect frozen coins
This commit is contained in:
parent
de40b2f9aa
commit
0c14c0b1f4
2 changed files with 19 additions and 9 deletions
|
@ -102,7 +102,9 @@ abstract class SendViewModelBase extends WalletChangeListenerViewModel with Stor
|
|||
outputs
|
||||
.add(Output(wallet, _settingsStore, _fiatConversationStore, () => selectedCryptoCurrency));
|
||||
|
||||
unspentCoinsListViewModel.initialSetup();
|
||||
unspentCoinsListViewModel.initialSetup().then((_) {
|
||||
unspentCoinsListViewModel.resetUnspentCoinsInfoSelections();
|
||||
});
|
||||
}
|
||||
|
||||
@observable
|
||||
|
@ -728,8 +730,7 @@ abstract class SendViewModelBase extends WalletChangeListenerViewModel with Stor
|
|||
return S.current.insufficient_funds_for_tx;
|
||||
}
|
||||
|
||||
return
|
||||
'''${S.current.insufficient_funds_for_tx} \n\n'''
|
||||
return '''${S.current.insufficient_funds_for_tx} \n\n'''
|
||||
'''${S.current.balance}: ${parsedErrorMessageResult.balanceEth} ${walletType == WalletType.polygon ? "POL" : "ETH"} (${parsedErrorMessageResult.balanceUsd} ${fiatFromSettings.name})\n\n'''
|
||||
'''${S.current.transaction_cost}: ${parsedErrorMessageResult.txCostEth} ${walletType == WalletType.polygon ? "POL" : "ETH"} (${parsedErrorMessageResult.txCostUsd} ${fiatFromSettings.name})\n\n'''
|
||||
'''${S.current.overshot}: ${parsedErrorMessageResult.overshotEth} ${walletType == WalletType.polygon ? "POL" : "ETH"} (${parsedErrorMessageResult.overshotUsd} ${fiatFromSettings.name})''';
|
||||
|
|
|
@ -68,7 +68,6 @@ abstract class UnspentCoinsListViewModelBase with Store {
|
|||
|
||||
bool get hasAdjustableFieldChanged => items.any(_hasAdjustableFieldChanged);
|
||||
|
||||
|
||||
Future<void> saveUnspentCoinInfo(UnspentCoinsItem item) async {
|
||||
try {
|
||||
final existingInfo = _unspentCoinsInfo.values
|
||||
|
@ -79,7 +78,6 @@ abstract class UnspentCoinsListViewModelBase with Store {
|
|||
existingInfo.isSending = item.isSending;
|
||||
existingInfo.note = item.note;
|
||||
|
||||
|
||||
await existingInfo.save();
|
||||
_updateUnspentCoinsInfo();
|
||||
} catch (e) {
|
||||
|
@ -167,6 +165,17 @@ abstract class UnspentCoinsListViewModelBase with Store {
|
|||
items.addAll(unspents);
|
||||
}
|
||||
|
||||
@action
|
||||
void resetUnspentCoinsInfoSelections() {
|
||||
// reset all unspent coins selections to true except frozen ones
|
||||
for (final item in items) {
|
||||
if (!item.isFrozen) {
|
||||
item.isSending = true;
|
||||
saveUnspentCoinInfo(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@action
|
||||
void toggleSelectAll(bool value) {
|
||||
for (final item in items) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue