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:
@@ -73,6 +73,19 @@ class CWBitcoin extends Bitcoin {
|
||||
return bitcoinWallet.keys.toJson();
|
||||
}
|
||||
|
||||
@override
|
||||
Map<String, String> getSilentPaymentKeys(Object wallet) {
|
||||
final bitcoinWallet = wallet as ElectrumWallet;
|
||||
final keysOwner = bitcoinWallet.walletAddresses.silentAddress!;
|
||||
|
||||
return <String, String>{
|
||||
'privateSpendKey': keysOwner.b_spend.toHex(),
|
||||
'publicSpendKey': keysOwner.B_spend.toHex(),
|
||||
'privateViewKey': keysOwner.b_scan.toHex(),
|
||||
'publicViewKey': keysOwner.B_scan.toHex(),
|
||||
};
|
||||
}
|
||||
|
||||
@override
|
||||
List<TransactionPriority> getTransactionPriorities() => BitcoinTransactionPriority.all;
|
||||
|
||||
@@ -116,9 +129,7 @@ class CWBitcoin extends Bitcoin {
|
||||
String? payjoinUri,
|
||||
}) {
|
||||
final bitcoinFeeRate =
|
||||
priority == BitcoinTransactionPriority.custom && feeRate != null
|
||||
? feeRate
|
||||
: null;
|
||||
priority == BitcoinTransactionPriority.custom && feeRate != null ? feeRate : null;
|
||||
return BitcoinTransactionCredentials(
|
||||
outputs
|
||||
.map((out) => OutputInfo(
|
||||
@@ -237,12 +248,12 @@ class CWBitcoin extends Bitcoin {
|
||||
Box<UnspentCoinsInfo> unspentCoinSource,
|
||||
Box<PayjoinSession> payjoinSessionSource,
|
||||
bool isDirect) {
|
||||
return BitcoinWalletService(walletInfoSource, unspentCoinSource,
|
||||
payjoinSessionSource, isDirect);
|
||||
return BitcoinWalletService(
|
||||
walletInfoSource, unspentCoinSource, payjoinSessionSource, isDirect);
|
||||
}
|
||||
|
||||
WalletService createLitecoinWalletService(Box<WalletInfo> walletInfoSource,
|
||||
Box<UnspentCoinsInfo> unspentCoinSource, bool isDirect) {
|
||||
WalletService createLitecoinWalletService(
|
||||
Box<WalletInfo> walletInfoSource, Box<UnspentCoinsInfo> unspentCoinSource, bool isDirect) {
|
||||
return LitecoinWalletService(walletInfoSource, unspentCoinSource, isDirect);
|
||||
}
|
||||
|
||||
@@ -775,4 +786,20 @@ class CWBitcoin extends Bitcoin {
|
||||
(_wallet.walletAddresses as BitcoinWalletAddresses).currentPayjoinReceiver = null;
|
||||
(_wallet.walletAddresses as BitcoinWalletAddresses).payjoinEndpoint = null;
|
||||
}
|
||||
|
||||
@override
|
||||
String? getTransactionAddress(Object wallet, TransactionInfo tx) {
|
||||
final bitcoinWallet = wallet as BitcoinWallet;
|
||||
final bitcoinTx = tx as ElectrumTransactionInfo;
|
||||
|
||||
if (bitcoinTx.unspents == null || bitcoinTx.unspents!.isEmpty) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// final bitcoinSPAddrs =
|
||||
// bitcoinTx.unspents!.first.bitcoinAddressRecord as BitcoinSilentPaymentAddressRecord;
|
||||
final bitcoinSPAddrs = wallet.walletAddresses as BitcoinWalletAddresses;
|
||||
final bitcoinSPAddr = bitcoinSPAddrs.silentAddresses.first;
|
||||
return bitcoinSPAddr.address;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user