diff --git a/lib/wallets/wallet/intermediate/bip39_hd_wallet.dart b/lib/wallets/wallet/intermediate/bip39_hd_wallet.dart index a176f4d9e..eb01d996e 100644 --- a/lib/wallets/wallet/intermediate/bip39_hd_wallet.dart +++ b/lib/wallets/wallet/intermediate/bip39_hd_wallet.dart @@ -27,7 +27,7 @@ abstract class Bip39HDWallet extends Bip39Wallet @override Future generateNewReceivingAddress() async { final current = await getCurrentReceivingAddress(); - final index = current?.derivationIndex ?? 0; + final index = current == null ? 0 : current.derivationIndex + 1; const chain = 0; // receiving address final address = await _generateAddress( @@ -49,7 +49,7 @@ abstract class Bip39HDWallet extends Bip39Wallet @override Future generateNewChangeAddress() async { final current = await getCurrentChangeAddress(); - final index = current?.derivationIndex ?? 0; + final index = current == null ? 0 : current.derivationIndex + 1; const chain = 1; // change address final address = await _generateAddress(