add passport multisig to wallet import menu

This commit is contained in:
Craig Raw 2024-09-02 12:40:54 +02:00
parent 65f1fa7cf8
commit c2b5b24702
2 changed files with 23 additions and 1 deletions

View file

@ -61,7 +61,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(), new JadeMultisig()));
new KeystoneMultisig(), new Descriptor(), new SpecterDesktop(), new BlueWalletMultisig(), new Sparrow(), new JadeMultisig(), new PassportMultisig()));
if(!selectedWalletForms.isEmpty()) {
walletImporters.add(new WalletLabels(selectedWalletForms));
}

View file

@ -2,6 +2,7 @@ package com.sparrowwallet.sparrow.io;
import com.sparrowwallet.drongo.protocol.ScriptType;
import com.sparrowwallet.drongo.wallet.Keystore;
import com.sparrowwallet.drongo.wallet.Wallet;
import com.sparrowwallet.drongo.wallet.WalletModel;
import java.io.InputStream;
@ -45,4 +46,25 @@ public class PassportMultisig extends ColdcardMultisig {
public boolean isWalletExportScannable() {
return true;
}
@Override
public boolean isWalletImportScannable() {
return true;
}
@Override
public String getWalletImportDescription() {
return "Import file or QR created by using Settings > Bitcoin > Multisig > [Wallet Detail] > Export via QR/microSD on your Passport.";
}
@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", "Passport"));
keystore.setWalletModel(WalletModel.PASSPORT);
}
return wallet;
}
}