mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-10-17 05:41:29 +02:00
payjoin address getter fix (#3191)
* payjoin address getter fix * fix payjoin getter address type * Update cw_bitcoin/lib/electrum_wallet_addresses.dart --------- Co-authored-by: Omar Hatem <omarh.ismail1@gmail.com>
This commit is contained in:
@@ -74,7 +74,7 @@ abstract class BitcoinWalletAddressesBase extends ElectrumWalletAddresses with S
|
||||
Future<void> initPayjoin() async {
|
||||
try {
|
||||
await payjoinManager.initPayjoin();
|
||||
currentPayjoinReceiver = await payjoinManager.getUnusedReceiver(primaryAddress);
|
||||
currentPayjoinReceiver = await payjoinManager.getUnusedReceiver(payjoinCompatibleAddress);
|
||||
payjoinEndpoint = (await currentPayjoinReceiver?.pjUri())?.pjEndpoint();
|
||||
|
||||
payjoinManager.resumeSessions();
|
||||
@@ -88,7 +88,7 @@ abstract class BitcoinWalletAddressesBase extends ElectrumWalletAddresses with S
|
||||
@action
|
||||
Future<void> newPayjoinReceiver() async {
|
||||
try {
|
||||
currentPayjoinReceiver = await payjoinManager.getUnusedReceiver(primaryAddress);
|
||||
currentPayjoinReceiver = await payjoinManager.getUnusedReceiver(payjoinCompatibleAddress);
|
||||
payjoinEndpoint = (await currentPayjoinReceiver?.pjUri())?.pjEndpoint();
|
||||
|
||||
payjoinManager.spawnReceiver(receiver: currentPayjoinReceiver!);
|
||||
|
||||
@@ -290,6 +290,16 @@ abstract class ElectrumWalletAddressesBase extends WalletAddresses with Store {
|
||||
return getAddress(index: 0, hd: mainHd, addressType: addressPageType);
|
||||
}
|
||||
|
||||
String get payjoinCompatibleAddress {
|
||||
final addrType = (addressPageType == SilentPaymentsAddresType.p2sp ||
|
||||
addressPageType == LightningAddressType.p2l)
|
||||
? SegwitAddresType.p2wpkh
|
||||
: addressPageType;
|
||||
|
||||
final mainHd = mainHdByType[addrType] ?? mainHdByType.values.first;
|
||||
return getAddress(index: 0, hd: mainHd, addressType: addrType);
|
||||
}
|
||||
|
||||
Map<String, int> currentReceiveAddressIndexByType;
|
||||
|
||||
int get currentReceiveAddressIndex =>
|
||||
|
||||
Reference in New Issue
Block a user