mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-12-01 12:04:21 +01:00
sp improvements (#2418)
* feat: show sp keys * fix: merge fixes * feat: show sp receive address on tx details page * feat(keys): show silent payment keys tab & keys tab * Update lib/src/screens/wallet_keys/wallet_keys_page.dart --------- Co-authored-by: Omar Hatem <omarh.ismail1@gmail.com>
This commit is contained in:
@@ -90,7 +90,7 @@ abstract class TransactionDetailsViewModelBase with Store {
|
||||
break;
|
||||
case WalletType.none:
|
||||
case WalletType.banano:
|
||||
break;
|
||||
break;
|
||||
}
|
||||
|
||||
final descriptionKey = '${transactionInfo.txHash}_${wallet.walletAddresses.primaryAddress}';
|
||||
@@ -235,9 +235,8 @@ abstract class TransactionDetailsViewModelBase with Store {
|
||||
void _addMoneroListItems(TransactionInfo tx, DateFormat dateFormat) {
|
||||
final descriptionKey = '${transactionInfo.txHash}_${wallet.walletAddresses.primaryAddress}';
|
||||
final description = transactionDescriptionBox.values.firstWhere(
|
||||
(val) => val.id == descriptionKey || val.id == transactionInfo.txHash,
|
||||
orElse: () => TransactionDescription(id: descriptionKey));
|
||||
|
||||
(val) => val.id == descriptionKey || val.id == transactionInfo.txHash,
|
||||
orElse: () => TransactionDescription(id: descriptionKey));
|
||||
|
||||
final key = tx.additionalInfo['key'] as String? ?? description.transactionKey;
|
||||
final accountIndex = tx.additionalInfo['accountIndex'] as int;
|
||||
@@ -344,6 +343,25 @@ abstract class TransactionDetailsViewModelBase with Store {
|
||||
),
|
||||
];
|
||||
|
||||
if (wallet.type == WalletType.bitcoin && tx.direction == TransactionDirection.incoming) {
|
||||
try {
|
||||
final address = bitcoin!.getTransactionAddress(wallet, tx);
|
||||
|
||||
if (address != null) {
|
||||
isRecipientAddressShown = true;
|
||||
_items.add(
|
||||
StandartListItem(
|
||||
title: S.current.transaction_details_recipient_address,
|
||||
value: address,
|
||||
key: ValueKey('standard_list_item_transaction_details_recipient_address_key'),
|
||||
),
|
||||
);
|
||||
}
|
||||
} catch (e) {
|
||||
printV(e.toString());
|
||||
}
|
||||
}
|
||||
|
||||
items.addAll(_items);
|
||||
}
|
||||
|
||||
|
||||
@@ -49,6 +49,8 @@ abstract class WalletKeysViewModelBase with Store {
|
||||
}
|
||||
}
|
||||
|
||||
bool get isBitcoin => _wallet.type == WalletType.bitcoin;
|
||||
|
||||
final ObservableList<StandartListItem> items;
|
||||
|
||||
final String title;
|
||||
@@ -66,8 +68,7 @@ abstract class WalletKeysViewModelBase with Store {
|
||||
bool get isLegacySeedOnly =>
|
||||
[WalletType.monero, WalletType.wownero].contains(_wallet.type) &&
|
||||
_wallet.seed != null &&
|
||||
!(Polyseed.isValidSeed(_wallet.seed!) ||
|
||||
_wallet.seed!.split(' ').length == 12);
|
||||
!(Polyseed.isValidSeed(_wallet.seed!) || _wallet.seed!.split(' ').length == 12);
|
||||
|
||||
String get legacySeed {
|
||||
if ((_wallet.type == WalletType.monero || _wallet.type == WalletType.wownero) &&
|
||||
@@ -163,18 +164,22 @@ abstract class WalletKeysViewModelBase with Store {
|
||||
case WalletType.bitcoin:
|
||||
case WalletType.litecoin:
|
||||
case WalletType.bitcoinCash:
|
||||
final keys = bitcoin!.getWalletKeys(_appStore.wallet!);
|
||||
|
||||
items.addAll([
|
||||
if ((keys['wif']??'').isNotEmpty)
|
||||
StandartListItem(title: "WIF", value: keys['wif']!),
|
||||
if ((keys['privateKey']??'').isNotEmpty)
|
||||
StandartListItem(title: S.current.private_key, value: keys['privateKey']!),
|
||||
if (keys['publicKey'] != null)
|
||||
StandartListItem(title: S.current.public_key, value: keys['publicKey']!),
|
||||
if (keys['xpub'] != null)
|
||||
StandartListItem(title: "xPub", value: keys['xpub']!),
|
||||
]);
|
||||
if (_wallet.type == WalletType.bitcoin) {
|
||||
keys = bitcoin!.getSilentPaymentKeys(_appStore.wallet!);
|
||||
}
|
||||
|
||||
final electrumKeys = bitcoin!.getWalletKeys(_appStore.wallet!);
|
||||
|
||||
items.addAll([
|
||||
if ((electrumKeys['wif'] ?? '').isNotEmpty)
|
||||
StandartListItem(title: "WIF", value: electrumKeys['wif']!),
|
||||
if ((electrumKeys['privateKey'] ?? '').isNotEmpty)
|
||||
StandartListItem(title: S.current.private_key, value: electrumKeys['privateKey']!),
|
||||
if (electrumKeys['publicKey'] != null)
|
||||
StandartListItem(title: S.current.public_key, value: electrumKeys['publicKey']!),
|
||||
if (electrumKeys['xpub'] != null)
|
||||
StandartListItem(title: "xPub", value: electrumKeys['xpub']!),
|
||||
]);
|
||||
break;
|
||||
case WalletType.none:
|
||||
case WalletType.haven:
|
||||
|
||||
Reference in New Issue
Block a user