minor fix [skip ci]
OmarHatem committed
Apr 11, 2025 at 04:41 UTC
079480e3c9ab881f5ddb614241eeb68ca3874ff2
1 file changed
+21
-23
lib/view_model/send/send_view_model.dart
+21
-23
@@ -223,7 +223,8 @@ abstract class SendViewModelBase extends WalletChangeListenerViewModel with Stor
223
String get balance {
224
if (walletType == WalletType.litecoin && coinTypeToSpendFrom == UnspentCoinType.mweb) {
225
return balanceViewModel.balances.values.first.secondAvailableBalance;
226
- } else if (walletType == WalletType.litecoin && coinTypeToSpendFrom == UnspentCoinType.nonMweb) {
226
+ } else if (walletType == WalletType.litecoin &&
227
+ coinTypeToSpendFrom == UnspentCoinType.nonMweb) {
228
return balanceViewModel.balances.values.first.availableBalance;
229
}
230
return wallet.balance[selectedCryptoCurrency]!.formattedFullAvailableBalance;
@@ -414,8 +415,7 @@ abstract class SendViewModelBase extends WalletChangeListenerViewModel with Stor
415
state = IsExecutingState();
416
417
try {
417
- final originalOCPRequest =
418
- await _ocpService.getOpenCryptoPayInvoice(uri.toString());
418
+ final originalOCPRequest = await _ocpService.getOpenCryptoPayInvoice(uri.toString());
419
final paymentUri = await _ocpService.getOpenCryptoPayAddress(
420
originalOCPRequest,
421
selectedCryptoCurrency,
@@ -427,8 +427,8 @@ abstract class SendViewModelBase extends WalletChangeListenerViewModel with Stor
427
clearOutputs();
428
429
outputs.first.address = paymentRequest.address;
430
- outputs.first.parsedAddress = ParsedAddress(
431
- addresses: [paymentRequest.address], name: ocpRequest!.receiverName);
430
+ outputs.first.parsedAddress =
431
+ ParsedAddress(addresses: [paymentRequest.address], name: ocpRequest!.receiverName);
432
outputs.first.setCryptoAmount(paymentRequest.amount);
433
outputs.first.note = ocpRequest!.receiverName;
434
@@ -441,15 +441,13 @@ abstract class SendViewModelBase extends WalletChangeListenerViewModel with Stor
441
}
442
443
@action
444
- Future<PendingTransaction?> createTransaction(
445
- {ExchangeProvider? provider}) async {
444
+ Future<PendingTransaction?> createTransaction({ExchangeProvider? provider}) async {
445
try {
446
if (!(state is IsExecutingState)) state = IsExecutingState();
447
448
if (wallet.isHardwareWallet) state = IsAwaitingDeviceResponseState();
449
451
- pendingTransaction =
452
- await wallet.createTransaction(_credentials(provider));
450
+ pendingTransaction = await wallet.createTransaction(_credentials(provider));
451
452
if (provider is ThorChainExchangeProvider) {
453
final outputCount = pendingTransaction?.outputCount ?? 0;
@@ -463,8 +461,7 @@ abstract class SendViewModelBase extends WalletChangeListenerViewModel with Stor
461
}
462
463
if (wallet.type == WalletType.bitcoin) {
466
- final updatedOutputs =
467
- bitcoin!.updateOutputs(pendingTransaction!, outputs);
464
+ final updatedOutputs = bitcoin!.updateOutputs(pendingTransaction!, outputs);
465
466
if (outputs.length == updatedOutputs.length) {
467
outputs.replaceRange(0, outputs.length, updatedOutputs);
@@ -525,8 +522,7 @@ abstract class SendViewModelBase extends WalletChangeListenerViewModel with Stor
522
@action
523
Future<void> commitTransaction(BuildContext context) async {
524
if (pendingTransaction == null) {
528
- throw Exception(
529
- "Pending transaction doesn't exist. It should not be happened.");
525
+ throw Exception("Pending transaction doesn't exist. It should not be happened.");
526
}
527
528
if (ocpRequest != null) {
@@ -564,8 +560,8 @@ abstract class SendViewModelBase extends WalletChangeListenerViewModel with Stor
560
561
if (pendingTransaction!.shouldCommitUR()) {
562
final urstr = await pendingTransaction!.commitUR();
567
- final result = await Navigator.of(context)
568
- .pushNamed(Routes.urqrAnimatedPage, arguments: urstr);
563
+ final result =
564
+ await Navigator.of(context).pushNamed(Routes.urqrAnimatedPage, arguments: urstr);
565
if (result == null) {
566
state = FailureState("Canceled by user");
567
return;
@@ -579,8 +575,7 @@ abstract class SendViewModelBase extends WalletChangeListenerViewModel with Stor
575
}
576
577
if (pendingTransaction!.id.isNotEmpty) {
582
- final descriptionKey =
583
- '${pendingTransaction!.id}_${wallet.walletAddresses.primaryAddress}';
578
+ final descriptionKey = '${pendingTransaction!.id}_${wallet.walletAddresses.primaryAddress}';
579
_settingsStore.shouldSaveRecipientAddress
580
? await transactionDescriptionBox.add(TransactionDescription(
581
id: descriptionKey,
@@ -629,10 +624,12 @@ abstract class SendViewModelBase extends WalletChangeListenerViewModel with Stor
624
);
625
626
case WalletType.monero:
632
- return monero!.createMoneroTransactionCreationCredentials(outputs: outputs, priority: priority!);
627
+ return monero!
628
+ .createMoneroTransactionCreationCredentials(outputs: outputs, priority: priority!);
629
630
case WalletType.wownero:
635
- return wownero!.createWowneroTransactionCreationCredentials(outputs: outputs, priority: priority!);
631
+ return wownero!
632
+ .createWowneroTransactionCreationCredentials(outputs: outputs, priority: priority!);
633
634
case WalletType.ethereum:
635
return ethereum!.createEthereumTransactionCredentials(outputs,
@@ -643,7 +640,8 @@ abstract class SendViewModelBase extends WalletChangeListenerViewModel with Stor
640
return polygon!.createPolygonTransactionCredentials(outputs,
641
priority: priority!, currency: selectedCryptoCurrency);
642
case WalletType.solana:
646
- return solana!.createSolanaTransactionCredentials(outputs, currency: selectedCryptoCurrency);
643
+ return solana!
644
+ .createSolanaTransactionCredentials(outputs, currency: selectedCryptoCurrency);
645
case WalletType.tron:
646
return tron!.createTronTransactionCredentials(outputs, currency: selectedCryptoCurrency);
647
case WalletType.zano:
@@ -677,8 +675,8 @@ abstract class SendViewModelBase extends WalletChangeListenerViewModel with Stor
675
676
ContactRecord? newContactAddress() {
677
final Set<String> contactAddresses =
680
- Set.from(contactListViewModel.contacts.map((contact) => contact.address))
681
- ..addAll(contactListViewModel.walletContacts.map((contact) => contact.address));
678
+ Set.from(contactListViewModel.contacts.map((contact) => contact.address))
679
+ ..addAll(contactListViewModel.walletContacts.map((contact) => contact.address));
680
681
for (var output in outputs) {
682
String address;
@@ -768,7 +766,7 @@ abstract class SendViewModelBase extends WalletChangeListenerViewModel with Stor
766
final parsedErrorMessageResult =
767
EVMTransactionErrorFeesHandler.parseEthereumFeesErrorMessage(
768
errorMessage,
771
- _fiatConversationStore.prices[currency]!,
769
+ _fiatConversationStore.prices[currency] ?? 0.0,
770
);
771
772
if (parsedErrorMessageResult.error != null) {