diff --git a/src/main/java/com/sparrowwallet/sparrow/control/FileWalletImportPane.java b/src/main/java/com/sparrowwallet/sparrow/control/FileWalletImportPane.java index a4abf902..2a581e3d 100644 --- a/src/main/java/com/sparrowwallet/sparrow/control/FileWalletImportPane.java +++ b/src/main/java/com/sparrowwallet/sparrow/control/FileWalletImportPane.java @@ -12,7 +12,7 @@ public class FileWalletImportPane extends FileImportPane { private final WalletImport importer; public FileWalletImportPane(WalletImport importer) { - super(importer, importer.getName(), "Wallet import", importer.getWalletImportDescription(), "image/" + importer.getWalletModel().getType() + ".png", importer.isWalletImportScannable(), true); + super(importer, importer.getName(), "Wallet import", importer.getWalletImportDescription(), "image/" + importer.getWalletModel().getType() + ".png", importer.isWalletImportScannable(), importer.isWalletImportFileFormatAvailable()); this.importer = importer; } diff --git a/src/main/java/com/sparrowwallet/sparrow/control/WalletImportDialog.java b/src/main/java/com/sparrowwallet/sparrow/control/WalletImportDialog.java index ba213cd2..c5719cab 100644 --- a/src/main/java/com/sparrowwallet/sparrow/control/WalletImportDialog.java +++ b/src/main/java/com/sparrowwallet/sparrow/control/WalletImportDialog.java @@ -59,7 +59,7 @@ public class WalletImportDialog extends Dialog { } } - List walletImporters = new ArrayList<>(List.of(new Bip129(), new CaravanMultisig(), new ColdcardMultisig(), new CoboVaultMultisig(), new Electrum(), new KeystoneMultisig(), new Descriptor(), new SpecterDesktop(), new BlueWalletMultisig(), new Sparrow())); + List walletImporters = new ArrayList<>(List.of(new Bip129(), new CaravanMultisig(), new ColdcardMultisig(), new CoboVaultMultisig(), new Electrum(), new KeystoneMultisig(), new Descriptor(), new SpecterDesktop(), new BlueWalletMultisig(), new Sparrow(), new JadeMultisig())); if(!selectedWalletForms.isEmpty()) { walletImporters.add(new WalletLabels(selectedWalletForms)); } diff --git a/src/main/java/com/sparrowwallet/sparrow/io/JadeMultisig.java b/src/main/java/com/sparrowwallet/sparrow/io/JadeMultisig.java index b0c0d3a2..0f6ce703 100644 --- a/src/main/java/com/sparrowwallet/sparrow/io/JadeMultisig.java +++ b/src/main/java/com/sparrowwallet/sparrow/io/JadeMultisig.java @@ -1,8 +1,11 @@ package com.sparrowwallet.sparrow.io; +import com.sparrowwallet.drongo.wallet.Keystore; import com.sparrowwallet.drongo.wallet.Wallet; import com.sparrowwallet.drongo.wallet.WalletModel; +import java.io.InputStream; + public class JadeMultisig extends ColdcardMultisig { @Override public String getName() { @@ -38,4 +41,30 @@ public class JadeMultisig extends ColdcardMultisig { public boolean walletExportRequiresDecryption() { return false; } + + @Override + public String getWalletImportDescription() { + return "Import the QR created using Options > Wallet > Registered Wallets on your Jade."; + } + + @Override + public boolean isWalletImportScannable() { + return true; + } + + @Override + public boolean isWalletImportFileFormatAvailable() { + return false; + } + + @Override + public Wallet importWallet(InputStream inputStream, String password) throws ImportException { + Wallet wallet = super.importWallet(inputStream, password); + for(Keystore keystore : wallet.getKeystores()) { + keystore.setLabel(keystore.getLabel().replace("Coldcard", "Jade")); + keystore.setWalletModel(WalletModel.JADE); + } + + return wallet; + } } diff --git a/src/main/java/com/sparrowwallet/sparrow/io/WalletImport.java b/src/main/java/com/sparrowwallet/sparrow/io/WalletImport.java index ee206761..1fbf36ba 100644 --- a/src/main/java/com/sparrowwallet/sparrow/io/WalletImport.java +++ b/src/main/java/com/sparrowwallet/sparrow/io/WalletImport.java @@ -8,4 +8,7 @@ public interface WalletImport extends FileImport { String getWalletImportDescription(); Wallet importWallet(InputStream inputStream, String password) throws ImportException; boolean isWalletImportScannable(); + default boolean isWalletImportFileFormatAvailable() { + return true; + } }