Sp fixes (#1471)

* feat: missing desktop setting menu * fix: sp utxo pending

Rafael committed May 31, 2024 at 08:55 UTC 5545137047f0d0a9cebdabec5c4d8e97a1baf568
3 files changed +21 -3
cw_bitcoin/lib/electrum_wallet.dart
+18 -1
@@ -1465,7 +1465,7 @@ abstract class ElectrumWalletBase
1465
1466 time = status["block_time"] as int?;
1467 final height = status["block_height"] as int? ?? 0;
1468 - final tip = await getCurrentChainTip();
1468 + final tip = await getUpdatedChainTip();
1469 if (tip > 0) confirmations = height > 0 ? tip - height + 1 : 0;
1470 } else {
1471 final verboseTransaction = await electrumClient.getTransactionRaw(hash: hash);
@@ -1519,6 +1519,23 @@ abstract class ElectrumWalletBase
1519 await fetchTransactionsForAddressType(historiesWithDetails, SegwitAddresType.p2wpkh);
1520 }
1521
1522 + transactionHistory.transactions.values.forEach((tx) async {
1523 + final isPendingSilentPaymentUtxo =
1524 + (tx.isPending || tx.confirmations == 0) && historiesWithDetails[tx.id] == null;
1525 +
1526 + if (isPendingSilentPaymentUtxo) {
1527 + final info =
1528 + await fetchTransactionInfo(hash: tx.id, height: tx.height, retryOnFailure: true);
1529 +
1530 + if (info != null) {
1531 + tx.confirmations = info.confirmations;
1532 + tx.isPending = tx.confirmations == 0;
1533 + transactionHistory.addOne(tx);
1534 + await transactionHistory.save();
1535 + }
1536 + }
1537 + });
1538 +
1539 return historiesWithDetails;
1540 } catch (e) {
1541 print(e.toString());
cw_bitcoin/pubspec.lock
+2 -2
@@ -793,8 +793,8 @@ packages:
793 dependency: "direct main"
794 description:
795 path: "."
796 - ref: "sp_v1.0.0"
797 - resolved-ref: a9a4c6d051f37a15a3a52cc2a0094f24c68b62c5
796 + ref: "sp_v2.0.0"
797 + resolved-ref: "62c152b9086cd968019128845371072f7e1168de"
798 url: "https://github.com/cake-tech/sp_scanner"
799 source: git
800 version: "0.0.1"
lib/src/widgets/setting_actions.dart
+1
@@ -29,6 +29,7 @@ class SettingActions {
29 connectionSettingAction,
30 walletSettingAction,
31 addressBookSettingAction,
32 + silentPaymentsSettingAction,
33 securityBackupSettingAction,
34 privacySettingAction,
35 displaySettingAction,