mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2025-01-18 16:55:58 +00:00
experiment with view model code
This commit is contained in:
parent
eb52baff41
commit
8597ab7652
1 changed files with 13 additions and 0 deletions
|
@ -1,3 +1,4 @@
|
|||
import 'package:cake_wallet/di.dart';
|
||||
import 'package:cake_wallet/entities/contact.dart';
|
||||
import 'package:cake_wallet/entities/priority_for_wallet_type.dart';
|
||||
import 'package:cake_wallet/entities/transaction_description.dart';
|
||||
|
@ -16,6 +17,7 @@ import 'package:cake_wallet/tron/tron.dart';
|
|||
import 'package:cake_wallet/view_model/contact_list/contact_list_view_model.dart';
|
||||
import 'package:cake_wallet/view_model/dashboard/balance_view_model.dart';
|
||||
import 'package:cake_wallet/view_model/hardware_wallet/ledger_view_model.dart';
|
||||
import 'package:cake_wallet/view_model/unspent_coins/unspent_coins_list_view_model.dart';
|
||||
import 'package:cake_wallet/wownero/wownero.dart';
|
||||
import 'package:cw_core/exceptions.dart';
|
||||
import 'package:cw_core/transaction_info.dart';
|
||||
|
@ -501,6 +503,17 @@ abstract class SendViewModelBase extends WalletChangeListenerViewModel with Stor
|
|||
throw Exception('Priority is null for wallet type: ${wallet.type}');
|
||||
}
|
||||
|
||||
if (hasCoinControl) {
|
||||
final vm = getIt.get<UnspentCoinsListViewModel>(param1: coinTypeToSpendFrom);
|
||||
bool isCoinSelected = false;
|
||||
for (var coin in vm.items) {
|
||||
isCoinSelected = isCoinSelected || (coin.isSending && !coin.isFrozen);
|
||||
}
|
||||
if (!isCoinSelected) {
|
||||
throw Exception("No coin selected in coin control, you need to select a coin in order to spend");
|
||||
}
|
||||
}
|
||||
|
||||
switch (wallet.type) {
|
||||
case WalletType.bitcoin:
|
||||
case WalletType.litecoin:
|
||||
|
|
Loading…
Reference in a new issue