add jade multisig wallet import

This commit is contained in:
Craig Raw 2023-08-31 09:34:15 +02:00
parent 6383b8b46f
commit 90bfa47046
4 changed files with 34 additions and 2 deletions

View file

@ -12,7 +12,7 @@ public class FileWalletImportPane extends FileImportPane {
private final WalletImport importer; private final WalletImport importer;
public FileWalletImportPane(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; this.importer = importer;
} }

View file

@ -59,7 +59,7 @@ public class WalletImportDialog extends Dialog<Wallet> {
} }
} }
List<WalletImport> 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<WalletImport> 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()) { if(!selectedWalletForms.isEmpty()) {
walletImporters.add(new WalletLabels(selectedWalletForms)); walletImporters.add(new WalletLabels(selectedWalletForms));
} }

View file

@ -1,8 +1,11 @@
package com.sparrowwallet.sparrow.io; package com.sparrowwallet.sparrow.io;
import com.sparrowwallet.drongo.wallet.Keystore;
import com.sparrowwallet.drongo.wallet.Wallet; import com.sparrowwallet.drongo.wallet.Wallet;
import com.sparrowwallet.drongo.wallet.WalletModel; import com.sparrowwallet.drongo.wallet.WalletModel;
import java.io.InputStream;
public class JadeMultisig extends ColdcardMultisig { public class JadeMultisig extends ColdcardMultisig {
@Override @Override
public String getName() { public String getName() {
@ -38,4 +41,30 @@ public class JadeMultisig extends ColdcardMultisig {
public boolean walletExportRequiresDecryption() { public boolean walletExportRequiresDecryption() {
return false; 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;
}
} }

View file

@ -8,4 +8,7 @@ public interface WalletImport extends FileImport {
String getWalletImportDescription(); String getWalletImportDescription();
Wallet importWallet(InputStream inputStream, String password) throws ImportException; Wallet importWallet(InputStream inputStream, String password) throws ImportException;
boolean isWalletImportScannable(); boolean isWalletImportScannable();
default boolean isWalletImportFileFormatAvailable() {
return true;
}
} }