From ed42dba9cc6eda3745898cd969b9fc74a032c75e Mon Sep 17 00:00:00 2001 From: likho Date: Fri, 8 Mar 2024 19:31:34 +0200 Subject: [PATCH] Update address to match epicbox config --- lib/wallets/wallet/impl/epiccash_wallet.dart | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/wallets/wallet/impl/epiccash_wallet.dart b/lib/wallets/wallet/impl/epiccash_wallet.dart index 8228ab7c8..015faa00c 100644 --- a/lib/wallets/wallet/impl/epiccash_wallet.dart +++ b/lib/wallets/wallet/impl/epiccash_wallet.dart @@ -317,6 +317,7 @@ class EpiccashWallet extends Bip39Wallet { Future
_generateAndStoreReceivingAddressForIndex( int index, ) async { + Address? address = await getCurrentReceivingAddress(); EpicBoxConfigModel epicboxConfig = await getEpicBoxConfig(); @@ -325,6 +326,7 @@ class EpiccashWallet extends Bip39Wallet { //Check if the address is the same as the current epicbox domain //Since we're only using one epicbpox now this doesn't apply but will be // useful in the future + final encodedConfig = jsonEncode(epicboxConfig); if (splitted[1] != epicboxConfig.host) { //Update the address address = await thisWalletAddress(index, epicboxConfig); @@ -332,6 +334,13 @@ class EpiccashWallet extends Bip39Wallet { } else { address = await thisWalletAddress(index, epicboxConfig); } + + if (info.cachedReceivingAddress != address.value) { + await info.updateReceivingAddress( + newAddress: address.value, + isar: mainDB.isar, + ); + } return address; } @@ -360,7 +369,6 @@ class EpiccashWallet extends Bip39Wallet { subType: AddressSubType.receiving, publicKey: [], // ?? ); - await mainDB.updateOrPutAddresses([address]); return address; }