notify ui of tx changes and force refresh on rescan

This commit is contained in:
julian 2023-01-19 10:29:00 -06:00
parent 5badeab621
commit db205b40e2
10 changed files with 120 additions and 0 deletions

View file

@ -2116,6 +2116,17 @@ class BitcoinWallet extends CoinServiceAPI with WalletCache, WalletDB {
txnsData.add(data);
}
await addNewTransactionData(txnsData, walletId);
// quick hack to notify manager to call notifyListeners if
// transactions changed
if (txnsData.isNotEmpty) {
GlobalEventBus.instance.fire(
UpdatedInBackgroundEvent(
"Transactions updated/added for: $walletId $walletName ",
walletId,
),
);
}
}
int estimateTxFee({required int vSize, required int feeRatePerKB}) {
@ -2788,6 +2799,7 @@ class BitcoinWallet extends CoinServiceAPI with WalletCache, WalletDB {
);
longMutex = false;
await refresh();
Logging.instance.log("Full rescan complete!", level: LogLevel.Info);
GlobalEventBus.instance.fire(
WalletSyncStatusChangedEvent(

View file

@ -2194,6 +2194,17 @@ class BitcoinCashWallet extends CoinServiceAPI with WalletCache, WalletDB {
}
await addNewTransactionData(txns, walletId);
// quick hack to notify manager to call notifyListeners if
// transactions changed
if (txns.isNotEmpty) {
GlobalEventBus.instance.fire(
UpdatedInBackgroundEvent(
"Transactions updated/added for: $walletId $walletName ",
walletId,
),
);
}
}
int estimateTxFee({required int vSize, required int feeRatePerKB}) {
@ -2857,6 +2868,7 @@ class BitcoinCashWallet extends CoinServiceAPI with WalletCache, WalletDB {
);
longMutex = false;
await refresh();
Logging.instance.log("Full rescan complete!", level: LogLevel.Info);
GlobalEventBus.instance.fire(
WalletSyncStatusChangedEvent(

View file

@ -1936,6 +1936,17 @@ class DogecoinWallet extends CoinServiceAPI with WalletCache, WalletDB {
}
await addNewTransactionData(txns, walletId);
// quick hack to notify manager to call notifyListeners if
// transactions changed
if (txns.isNotEmpty) {
GlobalEventBus.instance.fire(
UpdatedInBackgroundEvent(
"Transactions updated/added for: $walletId $walletName ",
walletId,
),
);
}
}
int estimateTxFee({required int vSize, required int feeRatePerKB}) {
@ -2484,6 +2495,7 @@ class DogecoinWallet extends CoinServiceAPI with WalletCache, WalletDB {
);
longMutex = false;
await refresh();
Logging.instance.log("Full rescan complete!", level: LogLevel.Info);
GlobalEventBus.instance.fire(
WalletSyncStatusChangedEvent(

View file

@ -947,6 +947,7 @@ class EpicCashWallet extends CoinServiceAPI
);
return;
}
await refresh();
GlobalEventBus.instance.fire(
WalletSyncStatusChangedEvent(
WalletSyncStatus.synced,
@ -2114,6 +2115,17 @@ class EpicCashWallet extends CoinServiceAPI
await addNewTransactionData(txnsData, walletId);
// quick hack to notify manager to call notifyListeners if
// transactions changed
if (txnsData.isNotEmpty) {
GlobalEventBus.instance.fire(
UpdatedInBackgroundEvent(
"Transactions updated/added for: $walletId $walletName ",
walletId,
),
);
}
// midSortedArray
// .sort((a, b) => (b["timestamp"] as int) - (a["timestamp"] as int));
//

View file

@ -3567,6 +3567,17 @@ class FiroWallet extends CoinServiceAPI with WalletCache, WalletDB, FiroHive {
}
await addNewTransactionData(txnsData, walletId);
// quick hack to notify manager to call notifyListeners if
// transactions changed
if (txnsData.isNotEmpty) {
GlobalEventBus.instance.fire(
UpdatedInBackgroundEvent(
"Transactions updated/added for: $walletId $walletName ",
walletId,
),
);
}
}
Future<void> _refreshUTXOs() async {
@ -3886,6 +3897,7 @@ class FiroWallet extends CoinServiceAPI with WalletCache, WalletDB, FiroHive {
await _recoverWalletFromBIP32SeedPhrase(mnemonic!, maxUnusedAddressGap);
longMutex = false;
await refresh();
Logging.instance.log("Full rescan complete!", level: LogLevel.Info);
GlobalEventBus.instance.fire(
WalletSyncStatusChangedEvent(

View file

@ -2196,6 +2196,17 @@ class LitecoinWallet extends CoinServiceAPI with WalletCache, WalletDB {
txnsData.add(data);
}
await addNewTransactionData(txnsData, walletId);
// quick hack to notify manager to call notifyListeners if
// transactions changed
if (txnsData.isNotEmpty) {
GlobalEventBus.instance.fire(
UpdatedInBackgroundEvent(
"Transactions updated/added for: $walletId $walletName ",
walletId,
),
);
}
}
int estimateTxFee({required int vSize, required int feeRatePerKB}) {
@ -2873,6 +2884,7 @@ class LitecoinWallet extends CoinServiceAPI with WalletCache, WalletDB {
);
longMutex = false;
await refresh();
Logging.instance.log("Full rescan complete!", level: LogLevel.Info);
GlobalEventBus.instance.fire(
WalletSyncStatusChangedEvent(

View file

@ -221,6 +221,7 @@ class MoneroWallet extends CoinServiceAPI with WalletCache, WalletDB {
var restoreHeight = walletBase?.walletInfo.restoreHeight;
highestPercentCached = 0;
await walletBase?.rescan(height: restoreHeight);
await refresh();
}
@override
@ -908,6 +909,17 @@ class MoneroWallet extends CoinServiceAPI with WalletCache, WalletDB {
}
await addNewTransactionData(txnsData, walletId);
// quick hack to notify manager to call notifyListeners if
// transactions changed
if (txnsData.isNotEmpty) {
GlobalEventBus.instance.fire(
UpdatedInBackgroundEvent(
"Transactions updated/added for: $walletId $walletName ",
walletId,
),
);
}
}
Future<String> _pathForWalletDir({

View file

@ -2182,6 +2182,17 @@ class NamecoinWallet extends CoinServiceAPI with WalletCache, WalletDB {
txnsData.add(data);
}
await addNewTransactionData(txnsData, walletId);
// quick hack to notify manager to call notifyListeners if
// transactions changed
if (txnsData.isNotEmpty) {
GlobalEventBus.instance.fire(
UpdatedInBackgroundEvent(
"Transactions updated/added for: $walletId $walletName ",
walletId,
),
);
}
}
int estimateTxFee({required int vSize, required int feeRatePerKB}) {
@ -2862,6 +2873,7 @@ class NamecoinWallet extends CoinServiceAPI with WalletCache, WalletDB {
);
longMutex = false;
await refresh();
Logging.instance.log("Full rescan complete!", level: LogLevel.Info);
GlobalEventBus.instance.fire(
WalletSyncStatusChangedEvent(

View file

@ -2349,6 +2349,17 @@ class ParticlWallet extends CoinServiceAPI with WalletCache, WalletDB {
}
await addNewTransactionData(txns, walletId);
// quick hack to notify manager to call notifyListeners if
// transactions changed
if (txns.isNotEmpty) {
GlobalEventBus.instance.fire(
UpdatedInBackgroundEvent(
"Transactions updated/added for: $walletId $walletName ",
walletId,
),
);
}
}
int estimateTxFee({required int vSize, required int feeRatePerKB}) {
@ -2961,6 +2972,7 @@ class ParticlWallet extends CoinServiceAPI with WalletCache, WalletDB {
);
longMutex = false;
await refresh();
Logging.instance.log("Full rescan complete!", level: LogLevel.Info);
GlobalEventBus.instance.fire(
WalletSyncStatusChangedEvent(

View file

@ -244,6 +244,7 @@ class WowneroWallet extends CoinServiceAPI with WalletCache, WalletDB {
var restoreHeight = walletBase?.walletInfo.restoreHeight;
highestPercentCached = 0;
await walletBase?.rescan(height: restoreHeight);
await refresh();
}
@override
@ -977,6 +978,17 @@ class WowneroWallet extends CoinServiceAPI with WalletCache, WalletDB {
}
await addNewTransactionData(txnsData, walletId);
// quick hack to notify manager to call notifyListeners if
// transactions changed
if (txnsData.isNotEmpty) {
GlobalEventBus.instance.fire(
UpdatedInBackgroundEvent(
"Transactions updated/added for: $walletId $walletName ",
walletId,
),
);
}
}
Future<String> _pathForWalletDir({