From 7590d786b535eb12a34b23f5603c276cbc28eb79 Mon Sep 17 00:00:00 2001 From: Craig Raw Date: Fri, 3 Feb 2023 13:57:29 +0200 Subject: [PATCH] fix copy address output script bytes to return entire scriptpubkey --- .../sparrow/control/EntryCell.java | 22 +++++++++++-------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/src/main/java/com/sparrowwallet/sparrow/control/EntryCell.java b/src/main/java/com/sparrowwallet/sparrow/control/EntryCell.java index 54b58daf..f25a2c01 100644 --- a/src/main/java/com/sparrowwallet/sparrow/control/EntryCell.java +++ b/src/main/java/com/sparrowwallet/sparrow/control/EntryCell.java @@ -654,14 +654,6 @@ public class EntryCell extends TreeTableCell implements Confirmati Clipboard.getSystemClipboard().setContent(content); }); - MenuItem copyHex = new MenuItem("Copy Script Output Bytes"); - copyHex.setOnAction(AE -> { - hide(); - ClipboardContent content = new ClipboardContent(); - content.putString(Utils.bytesToHex(address.getOutputScriptData())); - Clipboard.getSystemClipboard().setContent(content); - }); - MenuItem copyOutputDescriptor = new MenuItem("Copy Output Descriptor"); copyOutputDescriptor.setOnAction(AE -> { hide(); @@ -670,7 +662,19 @@ public class EntryCell extends TreeTableCell implements Confirmati Clipboard.getSystemClipboard().setContent(content); }); - getItems().addAll(copyAddress, copyHex, copyOutputDescriptor); + getItems().addAll(copyAddress, copyOutputDescriptor); + + if(nodeEntry != null) { + MenuItem copyHex = new MenuItem("Copy Script Output Bytes"); + copyHex.setOnAction(AE -> { + hide(); + Script outputScript = nodeEntry.getWallet().getOutputScript(nodeEntry.getNode()); + ClipboardContent content = new ClipboardContent(); + content.putString(Utils.bytesToHex(outputScript.getProgram())); + Clipboard.getSystemClipboard().setContent(content); + }); + getItems().add(copyHex); + } } }