diff --git a/src/main/java/com/sparrowwallet/sparrow/AppController.java b/src/main/java/com/sparrowwallet/sparrow/AppController.java index 4033919b..a7df3be4 100644 --- a/src/main/java/com/sparrowwallet/sparrow/AppController.java +++ b/src/main/java/com/sparrowwallet/sparrow/AppController.java @@ -619,6 +619,27 @@ public class AppController implements Initializable { } } + public void copyPSBTHex(ActionEvent event) { + copyPSBT(false); + } + + public void copyPSBTBase64(ActionEvent event) { + copyPSBT(true); + } + + public void copyPSBT(boolean asBase64) { + Tab selectedTab = tabs.getSelectionModel().getSelectedItem(); + TabData tabData = (TabData)selectedTab.getUserData(); + if(tabData.getType() == TabData.TabType.TRANSACTION) { + TransactionTabData transactionTabData = (TransactionTabData)tabData; + String data = asBase64 ? transactionTabData.getPsbt().toBase64String() : transactionTabData.getPsbt().toString(); + + ClipboardContent content = new ClipboardContent(); + content.putString(data); + Clipboard.getSystemClipboard().setContent(content); + } + } + public List getOpenWalletTabData() { List openWalletTabData = new ArrayList<>(); diff --git a/src/main/resources/com/sparrowwallet/sparrow/app.fxml b/src/main/resources/com/sparrowwallet/sparrow/app.fxml index 65337cd3..4e066a8a 100644 --- a/src/main/resources/com/sparrowwallet/sparrow/app.fxml +++ b/src/main/resources/com/sparrowwallet/sparrow/app.fxml @@ -31,8 +31,14 @@ - - + + + + + + + +