mirror of
https://github.com/sparrowwallet/sparrow.git
synced 2024-12-24 12:46:45 +00:00
pass desired account number to keystore import description
This commit is contained in:
parent
37a8a0a7f9
commit
e565786bbc
15 changed files with 32 additions and 18 deletions
|
@ -16,7 +16,7 @@ public class FileKeystoreImportPane extends FileImportPane {
|
|||
private final KeyDerivation requiredDerivation;
|
||||
|
||||
public FileKeystoreImportPane(Wallet wallet, KeystoreFileImport importer, KeyDerivation requiredDerivation) {
|
||||
super(importer, importer.getName(), "Keystore import", importer.getKeystoreImportDescription(), "image/" + importer.getWalletModel().getType() + ".png", importer.isKeystoreImportScannable(), importer.isFileFormatAvailable());
|
||||
super(importer, importer.getName(), "Keystore import", importer.getKeystoreImportDescription(getAccount(wallet, requiredDerivation)), "image/" + importer.getWalletModel().getType() + ".png", importer.isKeystoreImportScannable(), importer.isFileFormatAvailable());
|
||||
this.wallet = wallet;
|
||||
this.importer = importer;
|
||||
this.requiredDerivation = requiredDerivation;
|
||||
|
@ -34,4 +34,17 @@ public class FileKeystoreImportPane extends FileImportPane {
|
|||
EventManager.get().post(new KeystoreImportEvent(keystore));
|
||||
}
|
||||
}
|
||||
|
||||
private static int getAccount(Wallet wallet, KeyDerivation requiredDerivation) {
|
||||
if(wallet == null || requiredDerivation == null) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int account = wallet.getScriptType().getAccount(requiredDerivation.getDerivationPath());
|
||||
if(account < 0) {
|
||||
account = 0;
|
||||
}
|
||||
|
||||
return account;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@ public class CoboVaultMultisig extends ColdcardMultisig {
|
|||
}
|
||||
|
||||
@Override
|
||||
public String getKeystoreImportDescription() {
|
||||
public String getKeystoreImportDescription(int account) {
|
||||
return "Import file or QR created by using the Multisig Wallet > ... > Show/Export XPUB feature on your Cobo Vault.";
|
||||
}
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ public class CoboVaultSinglesig implements KeystoreFileImport, WalletImport {
|
|||
}
|
||||
|
||||
@Override
|
||||
public String getKeystoreImportDescription() {
|
||||
public String getKeystoreImportDescription(int account) {
|
||||
return "Import file or QR created by using the My Cobo Vault > ... > Export Wallet feature on your Cobo Vault.";
|
||||
}
|
||||
|
||||
|
|
|
@ -84,8 +84,8 @@ public class ColdcardMultisig implements WalletImport, KeystoreFileImport, Walle
|
|||
}
|
||||
|
||||
@Override
|
||||
public String getKeystoreImportDescription() {
|
||||
return "Import file created by using the Settings > Multisig Wallets > Export XPUB > 0 feature on your Coldcard.";
|
||||
public String getKeystoreImportDescription(int account) {
|
||||
return "Import file created by using the Settings > Multisig Wallets > Export XPUB > " + account + " feature on your Coldcard.";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -28,8 +28,8 @@ public class ColdcardSinglesig implements KeystoreFileImport, WalletImport {
|
|||
}
|
||||
|
||||
@Override
|
||||
public String getKeystoreImportDescription() {
|
||||
return "Import file created by using the Advanced > MicroSD > Export Wallet > Generic JSON > 0 feature on your Coldcard. Note this requires firmware version 3.1.3 or later.";
|
||||
public String getKeystoreImportDescription(int account) {
|
||||
return "Import file created by using the Advanced > MicroSD > Export Wallet > Generic JSON > " + account + " feature on your Coldcard. Note this requires firmware version 3.1.3 or later.";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -35,7 +35,7 @@ public class Electrum implements KeystoreFileImport, WalletImport, WalletExport
|
|||
}
|
||||
|
||||
@Override
|
||||
public String getKeystoreImportDescription() {
|
||||
public String getKeystoreImportDescription(int account) {
|
||||
return "Import a single keystore from an Electrum wallet (use File > Import > Electrum to import a multisig wallet).";
|
||||
}
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ public class GordianSeedTool implements KeystoreFileImport {
|
|||
}
|
||||
|
||||
@Override
|
||||
public String getKeystoreImportDescription() {
|
||||
public String getKeystoreImportDescription(int account) {
|
||||
return "Select your seed and scan the QR code created by Authenticate > Derive Key > Other Key Derivations > " + Network.get().toDisplayString() + " > Master Key > Account Descriptor. Click the share icon at the bottom.";
|
||||
}
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ public class KeystoneMultisig extends ColdcardMultisig {
|
|||
}
|
||||
|
||||
@Override
|
||||
public String getKeystoreImportDescription() {
|
||||
public String getKeystoreImportDescription(int account) {
|
||||
return "Import file or QR created by using the Multisig Wallet > ... > Show/Export XPUB feature on your Keystone.";
|
||||
}
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ public class KeystoneSinglesig implements KeystoreFileImport, WalletImport {
|
|||
}
|
||||
|
||||
@Override
|
||||
public String getKeystoreImportDescription() {
|
||||
public String getKeystoreImportDescription(int account) {
|
||||
return "Import file or QR created by using the My Keystone > ... > Export Wallet feature on your Keystone. Make sure to set the Watch-only Wallet to Sparrow in the Settings first.";
|
||||
}
|
||||
|
||||
|
|
|
@ -7,6 +7,10 @@ import java.io.InputStream;
|
|||
|
||||
public interface KeystoreFileImport extends KeystoreImport, FileImport {
|
||||
Keystore getKeystore(ScriptType scriptType, InputStream inputStream, String password) throws ImportException;
|
||||
String getKeystoreImportDescription(int account);
|
||||
default String getKeystoreImportDescription() {
|
||||
return getKeystoreImportDescription(0);
|
||||
}
|
||||
boolean isKeystoreImportScannable();
|
||||
default boolean isFileFormatAvailable() {
|
||||
return true;
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
package com.sparrowwallet.sparrow.io;
|
||||
|
||||
import com.sparrowwallet.drongo.policy.PolicyType;
|
||||
import com.sparrowwallet.drongo.wallet.WalletModel;
|
||||
|
||||
public interface KeystoreImport extends Import {
|
||||
String getKeystoreImportDescription();
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ public class PassportMultisig extends ColdcardMultisig {
|
|||
}
|
||||
|
||||
@Override
|
||||
public String getKeystoreImportDescription() {
|
||||
public String getKeystoreImportDescription(int account) {
|
||||
return "Import file or QR created from New Account > Sparrow > Multisig > QR Code/microSD on your Passport. For existing accounts, use Manage Account > Export by QR/microSD.";
|
||||
}
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ public class PassportSinglesig extends ColdcardSinglesig {
|
|||
}
|
||||
|
||||
@Override
|
||||
public String getKeystoreImportDescription() {
|
||||
public String getKeystoreImportDescription(int account) {
|
||||
return "Import file or QR created from New Account > Sparrow > Standard > QR Code/microSD on your Passport. For existing accounts, use Manage Account > Export by QR/microSD.";
|
||||
}
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ public class SeedSigner extends SpecterDIY {
|
|||
}
|
||||
|
||||
@Override
|
||||
public String getKeystoreImportDescription() {
|
||||
public String getKeystoreImportDescription(int account) {
|
||||
return "Import QR created on your SeedSigner by selecting xPub from Seed in the Seed Tools menu once you have entered your seed.";
|
||||
}
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@ public class SpecterDIY implements KeystoreFileImport, WalletExport {
|
|||
}
|
||||
|
||||
@Override
|
||||
public String getKeystoreImportDescription() {
|
||||
public String getKeystoreImportDescription(int account) {
|
||||
return "Import file or QR created by using the Master Public Keys feature on your Specter DIY device. Note the default is P2WPKH for Single Signature, and P2WSH for Multi Signature.";
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue