diff --git a/src/main/java/com/sparrowwallet/sparrow/control/FileWalletExportPane.java b/src/main/java/com/sparrowwallet/sparrow/control/FileWalletExportPane.java index 467f6e88..9226e555 100644 --- a/src/main/java/com/sparrowwallet/sparrow/control/FileWalletExportPane.java +++ b/src/main/java/com/sparrowwallet/sparrow/control/FileWalletExportPane.java @@ -28,12 +28,14 @@ public class FileWalletExportPane extends TitledDescriptionPane { private final Wallet wallet; private final WalletExport exporter; private final boolean scannable; + private final boolean file; public FileWalletExportPane(Wallet wallet, WalletExport exporter) { - super(exporter.getName(), "Wallet file export", exporter.getWalletExportDescription(), "image/" + exporter.getWalletModel().getType() + ".png"); + super(exporter.getName(), "Wallet export", exporter.getWalletExportDescription(), "image/" + exporter.getWalletModel().getType() + ".png"); this.wallet = wallet; this.exporter = exporter; this.scannable = exporter.isWalletExportScannable(); + this.file = exporter.isWalletExportFile(); buttonBox.getChildren().clear(); buttonBox.getChildren().add(createButton()); @@ -41,7 +43,7 @@ public class FileWalletExportPane extends TitledDescriptionPane { @Override protected Control createButton() { - if(scannable) { + if(scannable && file) { ToggleButton showButton = new ToggleButton("Show..."); Glyph cameraGlyph = new Glyph(FontAwesome5.FONT_NAME, FontAwesome5.Glyph.CAMERA); cameraGlyph.setFontSize(12); @@ -61,6 +63,15 @@ public class FileWalletExportPane extends TitledDescriptionPane { SegmentedButton segmentedButton = new SegmentedButton(); segmentedButton.getButtons().addAll(showButton, fileButton); return segmentedButton; + } else if(scannable) { + Button showButton = new Button("Show..."); + Glyph cameraGlyph = new Glyph(FontAwesome5.FONT_NAME, FontAwesome5.Glyph.CAMERA); + cameraGlyph.setFontSize(12); + showButton.setGraphic(cameraGlyph); + showButton.setOnAction(event -> { + exportQR(); + }); + return showButton; } else { Button exportButton = new Button("Export File..."); exportButton.setAlignment(Pos.CENTER_RIGHT); @@ -137,7 +148,7 @@ public class FileWalletExportPane extends TitledDescriptionPane { QRDisplayDialog qrDisplayDialog; if(exporter instanceof CoboVaultMultisig) { qrDisplayDialog = new QRDisplayDialog(RegistryType.BYTES.toString(), outputStream.toByteArray(), true); - } else if(exporter instanceof PassportMultisig || exporter instanceof KeystoneMultisig) { + } else if(exporter instanceof PassportMultisig || exporter instanceof KeystoneMultisig || exporter instanceof JadeMultisig) { qrDisplayDialog = new QRDisplayDialog(RegistryType.BYTES.toString(), outputStream.toByteArray(), false); } else { qrDisplayDialog = new QRDisplayDialog(outputStream.toString(StandardCharsets.UTF_8)); diff --git a/src/main/java/com/sparrowwallet/sparrow/control/WalletExportDialog.java b/src/main/java/com/sparrowwallet/sparrow/control/WalletExportDialog.java index 73056095..f3e460ff 100644 --- a/src/main/java/com/sparrowwallet/sparrow/control/WalletExportDialog.java +++ b/src/main/java/com/sparrowwallet/sparrow/control/WalletExportDialog.java @@ -44,7 +44,7 @@ public class WalletExportDialog extends Dialog { if(wallet.getPolicyType() == PolicyType.SINGLE) { exporters = List.of(new Electrum(), new ElectrumPersonalServer(), new Descriptor(), new SpecterDesktop(), new Sparrow()); } else if(wallet.getPolicyType() == PolicyType.MULTI) { - exporters = List.of(new CaravanMultisig(), new ColdcardMultisig(), new CoboVaultMultisig(), new Electrum(), new ElectrumPersonalServer(), new KeystoneMultisig(), new Descriptor(), new PassportMultisig(), new SpecterDesktop(), new BlueWalletMultisig(), new SpecterDIY(), new Sparrow()); + exporters = List.of(new CaravanMultisig(), new ColdcardMultisig(), new CoboVaultMultisig(), new Electrum(), new ElectrumPersonalServer(), new KeystoneMultisig(), new Descriptor(), new JadeMultisig(), new PassportMultisig(), new SpecterDesktop(), new BlueWalletMultisig(), new SpecterDIY(), new Sparrow()); } else { throw new UnsupportedOperationException("Cannot export wallet with policy type " + wallet.getPolicyType()); } diff --git a/src/main/java/com/sparrowwallet/sparrow/io/JadeMultisig.java b/src/main/java/com/sparrowwallet/sparrow/io/JadeMultisig.java new file mode 100644 index 00000000..b0c0d3a2 --- /dev/null +++ b/src/main/java/com/sparrowwallet/sparrow/io/JadeMultisig.java @@ -0,0 +1,41 @@ +package com.sparrowwallet.sparrow.io; + +import com.sparrowwallet.drongo.wallet.Wallet; +import com.sparrowwallet.drongo.wallet.WalletModel; + +public class JadeMultisig extends ColdcardMultisig { + @Override + public String getName() { + return "Jade Multisig"; + } + + @Override + public WalletModel getWalletModel() { + return WalletModel.JADE; + } + + @Override + public String getWalletExportDescription() { + return "Export a QR that allows Jade to import a multisig wallet using the Scan feature."; + } + + @Override + public String getExportFileExtension(Wallet wallet) { + return null; + } + + @Override + public boolean isWalletExportScannable() { + return true; + } + + @Override + public boolean isWalletExportFile() { + return false; + } + + @Override + public boolean walletExportRequiresDecryption() { + return false; + } +} diff --git a/src/main/java/com/sparrowwallet/sparrow/io/WalletExport.java b/src/main/java/com/sparrowwallet/sparrow/io/WalletExport.java index 4ce23842..a949a1d6 100644 --- a/src/main/java/com/sparrowwallet/sparrow/io/WalletExport.java +++ b/src/main/java/com/sparrowwallet/sparrow/io/WalletExport.java @@ -10,6 +10,9 @@ public interface WalletExport extends ImportExport { String getExportFileExtension(Wallet wallet); boolean isWalletExportScannable(); boolean walletExportRequiresDecryption(); + default boolean isWalletExportFile() { + return true; + } default boolean exportsAllWallets() { return false; }