From b09b3d0e1f7aec3354a3f01fe922b2407386f54a Mon Sep 17 00:00:00 2001 From: julian Date: Fri, 27 Jan 2023 14:43:38 -0600 Subject: [PATCH] restore all paynym history function --- lib/services/coins/dogecoin/dogecoin_wallet.dart | 6 ++++++ lib/services/mixins/paynym_wallet_interface.dart | 14 ++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/lib/services/coins/dogecoin/dogecoin_wallet.dart b/lib/services/coins/dogecoin/dogecoin_wallet.dart index 073d050c9..2db5ee516 100644 --- a/lib/services/coins/dogecoin/dogecoin_wallet.dart +++ b/lib/services/coins/dogecoin/dogecoin_wallet.dart @@ -545,6 +545,12 @@ class DogecoinWallet extends CoinServiceAPI // refresh transactions to pick up any received notification transactions await _refreshTransactions(); + // restore paynym transactions + await restoreAllHistory( + maxUnusedAddressGap: maxUnusedAddressGap, + maxNumberOfIndexesToCheck: maxNumberOfIndexesToCheck, + ); + await _updateUTXOs(); await Future.wait([ diff --git a/lib/services/mixins/paynym_wallet_interface.dart b/lib/services/mixins/paynym_wallet_interface.dart index 16d65c6cf..ee86b3e79 100644 --- a/lib/services/mixins/paynym_wallet_interface.dart +++ b/lib/services/mixins/paynym_wallet_interface.dart @@ -724,6 +724,20 @@ mixin PaynymWalletInterface { return unBlindedList; } + Future restoreAllHistory({ + required int maxUnusedAddressGap, + required int maxNumberOfIndexesToCheck, + }) async { + final codes = await getAllPaymentCodesFromNotificationTransactions(); + final List> futures = []; + for (final code in codes) { + futures.add(restoreHistoryWith( + code, maxUnusedAddressGap, maxNumberOfIndexesToCheck)); + } + + await Future.wait(futures); + } + Future restoreHistoryWith( PaymentCode other, int maxUnusedAddressGap,