mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-10-26 06:08:40 +01:00
Merge branch 'dev' of https://github.com/cake-tech/cake_wallet into CW-1529-Improved-Seed-UI
This commit is contained in:
@@ -90,11 +90,25 @@ abstract class NFTSendViewModelBase with Store {
|
||||
}
|
||||
}
|
||||
|
||||
@action
|
||||
void markSendStarted() => state = IsExecutingState();
|
||||
/// Re-entrancy latch for the send button, held only while the tap handler is
|
||||
/// inside [AuthService.authenticateAction].
|
||||
///
|
||||
/// Deliberately not [state]: the auth sheet is pushed closable, and closing it
|
||||
/// pops the route without ever invoking onAuthenticationFinished, so a flag
|
||||
/// that waits on the auth result would never be cleared. The caller clears
|
||||
/// this in a finally instead. Once auth succeeds, createTransaction takes over
|
||||
/// the guard by setting IsExecutingState synchronously.
|
||||
bool _isStartingSend = false;
|
||||
|
||||
bool get isStartingSend => _isStartingSend;
|
||||
|
||||
void markSendStarted() => _isStartingSend = true;
|
||||
|
||||
void markSendSettled() => _isStartingSend = false;
|
||||
|
||||
@action
|
||||
void reset() {
|
||||
_isStartingSend = false;
|
||||
pendingTransaction = null;
|
||||
state = InitialExecutionState();
|
||||
}
|
||||
|
||||
@@ -907,9 +907,11 @@ abstract class SendViewModelBase extends WalletChangeListenerViewModel with Stor
|
||||
final isSendAll = outputs.any((output) => output.sendAll);
|
||||
|
||||
if (!isSendAll) {
|
||||
final estimateTxAmountDouble = outputs.fold<double>(
|
||||
0, (acc, output) => acc + (double.tryParse(output.cryptoAmount) ?? 0));
|
||||
if (estimateTxAmountDouble <= 0) throw Exception('Amount must be greater than 0');
|
||||
final estimateTxAmount = outputs.fold<BigInt>(
|
||||
BigInt.zero, (acc, output) => acc + output.cryptoAmountMoney.amount);
|
||||
if (estimateTxAmount <= BigInt.zero) {
|
||||
throw Exception('Amount must be greater than 0');
|
||||
}
|
||||
}
|
||||
|
||||
pendingTransaction = await wallet.createTransaction(_credentials(provider));
|
||||
|
||||
Reference in New Issue
Block a user