mirror of
https://github.com/sparrowwallet/drongo.git
synced 2024-12-25 09:36:44 +00:00
set bip47 wallet label before creating addresses
This commit is contained in:
parent
6401761530
commit
fe57ad3e7a
1 changed files with 4 additions and 3 deletions
|
@ -170,8 +170,8 @@ public class Wallet extends Persistable implements Comparable<Wallet> {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Wallet addChildWallet(PaymentCode externalPaymentCode, ScriptType childScriptType, BlockTransactionHashIndex notificationOutput, BlockTransaction notificationTransaction) {
|
public Wallet addChildWallet(PaymentCode externalPaymentCode, ScriptType childScriptType, BlockTransactionHashIndex notificationOutput, BlockTransaction notificationTransaction, String label) {
|
||||||
Wallet bip47Wallet = addChildWallet(externalPaymentCode, childScriptType);
|
Wallet bip47Wallet = addChildWallet(externalPaymentCode, childScriptType, label);
|
||||||
WalletNode notificationNode = bip47Wallet.getNode(KeyPurpose.NOTIFICATION);
|
WalletNode notificationNode = bip47Wallet.getNode(KeyPurpose.NOTIFICATION);
|
||||||
notificationNode.getTransactionOutputs().add(notificationOutput);
|
notificationNode.getTransactionOutputs().add(notificationOutput);
|
||||||
bip47Wallet.updateTransactions(Map.of(notificationTransaction.getHash(), notificationTransaction));
|
bip47Wallet.updateTransactions(Map.of(notificationTransaction.getHash(), notificationTransaction));
|
||||||
|
@ -179,7 +179,7 @@ public class Wallet extends Persistable implements Comparable<Wallet> {
|
||||||
return bip47Wallet;
|
return bip47Wallet;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Wallet addChildWallet(PaymentCode externalPaymentCode, ScriptType childScriptType) {
|
public Wallet addChildWallet(PaymentCode externalPaymentCode, ScriptType childScriptType, String label) {
|
||||||
if(policyType != PolicyType.SINGLE) {
|
if(policyType != PolicyType.SINGLE) {
|
||||||
throw new IllegalStateException("Cannot add payment code wallet to " + policyType.getName() + " wallet");
|
throw new IllegalStateException("Cannot add payment code wallet to " + policyType.getName() + " wallet");
|
||||||
}
|
}
|
||||||
|
@ -194,6 +194,7 @@ public class Wallet extends Persistable implements Comparable<Wallet> {
|
||||||
}
|
}
|
||||||
|
|
||||||
Wallet childWallet = new Wallet(childScriptType + "-" + externalPaymentCode.toString());
|
Wallet childWallet = new Wallet(childScriptType + "-" + externalPaymentCode.toString());
|
||||||
|
childWallet.setLabel(label);
|
||||||
childWallet.setPolicyType(PolicyType.SINGLE);
|
childWallet.setPolicyType(PolicyType.SINGLE);
|
||||||
childWallet.setScriptType(childScriptType);
|
childWallet.setScriptType(childScriptType);
|
||||||
childWallet.setGapLimit(5);
|
childWallet.setGapLimit(5);
|
||||||
|
|
Loading…
Reference in a new issue