mirror of
https://github.com/sparrowwallet/sparrow.git
synced 2024-12-24 12:46:45 +00:00
add menu items to copy psbt to clipboard in hex or base64
This commit is contained in:
parent
2caee79df4
commit
74b4f51640
2 changed files with 29 additions and 2 deletions
|
@ -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<WalletTabData> getOpenWalletTabData() {
|
||||
List<WalletTabData> openWalletTabData = new ArrayList<>();
|
||||
|
||||
|
|
|
@ -31,8 +31,14 @@
|
|||
<Menu fx:id="savePSBT" mnemonicParsing="false" text="Save PSBT">
|
||||
<MenuItem fx:id="savePSBTBinary" text="As Binary..." onAction="#savePSBTBinary" accelerator="Shortcut+S"/>
|
||||
<MenuItem text="As Base64..." onAction="#savePSBTText"/>
|
||||
<MenuItem text="As Binary (No Xpubs)..." onAction="#savePSBTBinaryNoXpubs"/>
|
||||
<MenuItem text="As Base64 (No Xpubs)..." onAction="#savePSBTTextNoXpubs"/>
|
||||
<Menu text="To Clipboard">
|
||||
<MenuItem text="As Hex" onAction="#copyPSBTHex"/>
|
||||
<MenuItem text="As Base64" onAction="#copyPSBTBase64"/>
|
||||
</Menu>
|
||||
<Menu text="Without Xpubs">
|
||||
<MenuItem text="As Binary..." onAction="#savePSBTBinaryNoXpubs"/>
|
||||
<MenuItem text="As Base64..." onAction="#savePSBTTextNoXpubs"/>
|
||||
</Menu>
|
||||
</Menu>
|
||||
<SeparatorMenuItem />
|
||||
<MenuItem mnemonicParsing="false" text="Import Wallet..." onAction="#importWallet"/>
|
||||
|
|
Loading…
Reference in a new issue