show wallet output descriptors with multipath indexes as per bitcoin core pr #22838

This commit is contained in:
Craig Raw 2021-11-13 15:05:45 +02:00
parent cb41a1ed66
commit dc65313313
4 changed files with 7 additions and 5 deletions

2
drongo

@ -1 +1 @@
Subproject commit ebf7128ae5737c3ae4f9b54ad0df72b9bfa63594 Subproject commit 8e4924783224fc894b45855cdbd866981413db3b

View file

@ -1,5 +1,6 @@
package com.sparrowwallet.sparrow.control; package com.sparrowwallet.sparrow.control;
import com.sparrowwallet.drongo.KeyPurpose;
import com.sparrowwallet.drongo.OutputDescriptor; import com.sparrowwallet.drongo.OutputDescriptor;
import com.sparrowwallet.drongo.policy.PolicyType; import com.sparrowwallet.drongo.policy.PolicyType;
import com.sparrowwallet.drongo.protocol.ScriptType; import com.sparrowwallet.drongo.protocol.ScriptType;
@ -79,7 +80,7 @@ public class DescriptorArea extends CodeArea {
copyOutputDescriptor.setOnAction(AE -> { copyOutputDescriptor.setOnAction(AE -> {
hide(); hide();
ClipboardContent content = new ClipboardContent(); ClipboardContent content = new ClipboardContent();
content.putString(OutputDescriptor.getOutputDescriptor(wallet).toString(true)); content.putString(OutputDescriptor.getOutputDescriptor(wallet, KeyPurpose.DEFAULT_PURPOSES, null).toString(true));
Clipboard.getSystemClipboard().setContent(content); Clipboard.getSystemClipboard().setContent(content);
}); });
getItems().add(copyOutputDescriptor); getItems().add(copyOutputDescriptor);

View file

@ -1,5 +1,6 @@
package com.sparrowwallet.sparrow.io; package com.sparrowwallet.sparrow.io;
import com.sparrowwallet.drongo.KeyPurpose;
import com.sparrowwallet.drongo.OutputDescriptor; import com.sparrowwallet.drongo.OutputDescriptor;
import com.sparrowwallet.drongo.wallet.Wallet; import com.sparrowwallet.drongo.wallet.Wallet;
import com.sparrowwallet.drongo.wallet.WalletModel; import com.sparrowwallet.drongo.wallet.WalletModel;
@ -23,7 +24,7 @@ public class Descriptor implements WalletImport, WalletExport {
@Override @Override
public void exportWallet(Wallet wallet, OutputStream outputStream) throws ExportException { public void exportWallet(Wallet wallet, OutputStream outputStream) throws ExportException {
try { try {
OutputDescriptor outputDescriptor = OutputDescriptor.getOutputDescriptor(wallet); OutputDescriptor outputDescriptor = OutputDescriptor.getOutputDescriptor(wallet, KeyPurpose.DEFAULT_PURPOSES, null);
String outputDescriptorString = outputDescriptor.toString(true); String outputDescriptorString = outputDescriptor.toString(true);
outputStream.write(outputDescriptorString.getBytes(StandardCharsets.UTF_8)); outputStream.write(outputDescriptorString.getBytes(StandardCharsets.UTF_8));
outputStream.flush(); outputStream.flush();

View file

@ -376,7 +376,7 @@ public class SettingsController extends WalletFormController implements Initiali
} }
public void editDescriptor(ActionEvent event) { public void editDescriptor(ActionEvent event) {
OutputDescriptor outputDescriptor = OutputDescriptor.getOutputDescriptor(walletForm.getWallet()); OutputDescriptor outputDescriptor = OutputDescriptor.getOutputDescriptor(walletForm.getWallet(), KeyPurpose.DEFAULT_PURPOSES, null);
String outputDescriptorString = outputDescriptor.toString(walletForm.getWallet().isValid()); String outputDescriptorString = outputDescriptor.toString(walletForm.getWallet().isValid());
TextAreaDialog dialog = new TextAreaDialog(outputDescriptorString); TextAreaDialog dialog = new TextAreaDialog(outputDescriptorString);
@ -408,7 +408,7 @@ public class SettingsController extends WalletFormController implements Initiali
} }
public void showDescriptor(ActionEvent event) { public void showDescriptor(ActionEvent event) {
OutputDescriptor outputDescriptor = OutputDescriptor.getOutputDescriptor(walletForm.getWallet()); OutputDescriptor outputDescriptor = OutputDescriptor.getOutputDescriptor(walletForm.getWallet(), KeyPurpose.DEFAULT_PURPOSES, null);
String outputDescriptorString = outputDescriptor.toString(walletForm.getWallet().isValid()); String outputDescriptorString = outputDescriptor.toString(walletForm.getWallet().isValid());
TextAreaDialog dialog = new TextAreaDialog(outputDescriptorString, false); TextAreaDialog dialog = new TextAreaDialog(outputDescriptorString, false);