mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-10-26 06:08:40 +01:00
feat: show Bitcoin master fingerprint in wallet keys (#3489)
* feat: show Bitcoin master fingerprint in wallet keys Add the BIP-32 master fingerprint (XFP) to the Bitcoin wallet keys shown under Settings > Seed & Keys > Keys, labeled "Master fingerprint". * fix: keep xPub in Keys tab by splitting silent payment keys into a dedicated list The Keys tab / Silent Payments tab split relied on a hardcoded item index (`items.sublist(0, 4)` / `sublist(4)`) that assumed the first four items were always WIF/private key/public key/xPub. Adding the master fingerprint as the first item pushed xPub into the Silent Payments tab. Route Bitcoin silent payment keys into their own `silentPaymentItems` list instead, and render each tab from its list.
This commit is contained in:
@@ -30,6 +30,7 @@ abstract class WalletKeysViewModelBase with Store {
|
||||
_restoreHeight = _appStore.wallet!.walletInfo.restoreHeight,
|
||||
_restoreHeightByTransactions = 0,
|
||||
items = ObservableList<StandartListItem>(),
|
||||
silentPaymentItems = ObservableList<StandartListItem>(),
|
||||
_title = _getInitialTitle(_appStore.wallet!) {
|
||||
_populateKeysItems();
|
||||
|
||||
@@ -87,6 +88,7 @@ abstract class WalletKeysViewModelBase with Store {
|
||||
// this is incomplete, needs legacy seed toggle for XMR
|
||||
bool get shouldShowHeightBox => [WalletType.bitcoin, WalletType.zcash].contains(_wallet.type);
|
||||
final ObservableList<StandartListItem> items;
|
||||
final ObservableList<StandartListItem> silentPaymentItems;
|
||||
|
||||
@observable
|
||||
String _title;
|
||||
@@ -150,6 +152,7 @@ abstract class WalletKeysViewModelBase with Store {
|
||||
|
||||
void _populateKeysItems() {
|
||||
items.clear();
|
||||
silentPaymentItems.clear();
|
||||
|
||||
Map<String, String>? keys;
|
||||
|
||||
@@ -217,6 +220,11 @@ abstract class WalletKeysViewModelBase with Store {
|
||||
final electrumKeys = bitcoin!.getWalletKeys(_appStore.wallet!);
|
||||
|
||||
items.addAll([
|
||||
if ((electrumKeys['masterFingerprint'] ?? '').isNotEmpty)
|
||||
StandartListItem(
|
||||
title: "Master fingerprint",
|
||||
value: electrumKeys['masterFingerprint']!,
|
||||
),
|
||||
if ((electrumKeys['wif'] ?? '').isNotEmpty)
|
||||
StandartListItem(title: "WIF", value: electrumKeys['wif']!),
|
||||
if ((electrumKeys['privateKey'] ?? '').isNotEmpty)
|
||||
@@ -233,7 +241,8 @@ abstract class WalletKeysViewModelBase with Store {
|
||||
}
|
||||
|
||||
if (keys != null) {
|
||||
items.addAll([
|
||||
final keysList = _wallet.type == WalletType.bitcoin ? silentPaymentItems : items;
|
||||
keysList.addAll([
|
||||
if ((keys['primaryAddress'] ?? '').isNotEmpty)
|
||||
StandartListItem(
|
||||
key: ValueKey('${_walletName}_wallet_primary_address_item_key'),
|
||||
|
||||
Reference in New Issue
Block a user