CW-1157-Use-correct-derivation-paths-for-other-address-types (#2825)

* feat: use bitcoin standard derivation paths per address type

* add support for Electrum derivation type in wallet

* fix merge conflict

* Use segwit HD for key export and simplify _hdFor

* skip derivation chooser for standard scan paths

* add legacy and P2SH derivation paths
This commit is contained in:
Serhii
2026-03-26 22:46:08 +01:00
committed by GitHub
parent d0851df2c6
commit 6378e929b6
18 changed files with 432 additions and 146 deletions
@@ -13,6 +13,7 @@ class WalletAddressListItem extends ListItem {
this.isOneTimeReceiveAddress = false,
this.isHidden = false,
this.isManual = false,
this.isLegacyDerivation = false,
}) : super();
final int? id;
@@ -24,6 +25,7 @@ class WalletAddressListItem extends ListItem {
final bool isChange;
bool isHidden;
bool isManual;
bool isLegacyDerivation;
final bool? isOneTimeReceiveAddress;
@override
@@ -290,7 +290,8 @@ abstract class WalletAddressListViewModelBase extends WalletChangeListenerViewMo
txCount: subaddress.txCount,
balance: _appStore.amountParsingProxy
.getDisplayCryptoString(subaddress.balance, walletTypeToCryptoCurrency(type)),
isChange: subaddress.isChange);
isChange: subaddress.isChange,
isLegacyDerivation: subaddress.isLegacyDerivation);
});
// don't show all 1000+ mweb addresses:
@@ -352,8 +353,9 @@ abstract class WalletAddressListViewModelBase extends WalletChangeListenerViewMo
for (var i = 0; i < addressList.length; i++) {
if (!(addressList[i] is WalletAddressListItem)) continue;
(addressList[i] as WalletAddressListItem).isHidden = wallet.walletAddresses.hiddenAddresses
.contains((addressList[i] as WalletAddressListItem).address);
final item = addressList[i] as WalletAddressListItem;
item.isHidden = wallet.walletAddresses.hiddenAddresses.contains(item.address) ||
(isElectrumWallet && item.isLegacyDerivation);
}
for (var i = 0; i < addressList.length; i++) {