mirror of
https://github.com/sparrowwallet/sparrow.git
synced 2024-12-25 05:06:45 +00:00
handle new coldcard firmware p2sh_p2wsh import name change
This commit is contained in:
parent
d847da9d61
commit
c6689228d0
2 changed files with 5 additions and 3 deletions
|
@ -48,8 +48,8 @@ public class ColdcardMultisig implements WalletImport, KeystoreFileImport, Walle
|
||||||
keystore.setKeyDerivation(new KeyDerivation(cck.xfp, cck.p2sh_deriv));
|
keystore.setKeyDerivation(new KeyDerivation(cck.xfp, cck.p2sh_deriv));
|
||||||
keystore.setExtendedPublicKey(ExtendedKey.fromDescriptor(cck.p2sh));
|
keystore.setExtendedPublicKey(ExtendedKey.fromDescriptor(cck.p2sh));
|
||||||
} else if(scriptType.equals(ScriptType.P2SH_P2WSH)) {
|
} else if(scriptType.equals(ScriptType.P2SH_P2WSH)) {
|
||||||
keystore.setKeyDerivation(new KeyDerivation(cck.xfp, cck.p2wsh_p2sh_deriv));
|
keystore.setKeyDerivation(new KeyDerivation(cck.xfp, cck.p2wsh_p2sh_deriv != null ? cck.p2wsh_p2sh_deriv : cck.p2sh_p2wsh_deriv));
|
||||||
keystore.setExtendedPublicKey(ExtendedKey.fromDescriptor(cck.p2wsh_p2sh));
|
keystore.setExtendedPublicKey(ExtendedKey.fromDescriptor(cck.p2wsh_p2sh != null ? cck.p2wsh_p2sh : cck.p2sh_p2wsh));
|
||||||
} else if(scriptType.equals(ScriptType.P2WSH)) {
|
} else if(scriptType.equals(ScriptType.P2WSH)) {
|
||||||
keystore.setKeyDerivation(new KeyDerivation(cck.xfp, cck.p2wsh_deriv));
|
keystore.setKeyDerivation(new KeyDerivation(cck.xfp, cck.p2wsh_deriv));
|
||||||
keystore.setExtendedPublicKey(ExtendedKey.fromDescriptor(cck.p2wsh));
|
keystore.setExtendedPublicKey(ExtendedKey.fromDescriptor(cck.p2wsh));
|
||||||
|
@ -65,6 +65,8 @@ public class ColdcardMultisig implements WalletImport, KeystoreFileImport, Walle
|
||||||
public String p2sh;
|
public String p2sh;
|
||||||
public String p2wsh_p2sh_deriv;
|
public String p2wsh_p2sh_deriv;
|
||||||
public String p2wsh_p2sh;
|
public String p2wsh_p2sh;
|
||||||
|
public String p2sh_p2wsh_deriv;
|
||||||
|
public String p2sh_p2wsh;
|
||||||
public String p2wsh_deriv;
|
public String p2wsh_deriv;
|
||||||
public String p2wsh;
|
public String p2wsh;
|
||||||
public String xpub;
|
public String xpub;
|
||||||
|
|
|
@ -66,7 +66,7 @@ public class ColdcardSinglesig implements KeystoreFileImport, WalletImport {
|
||||||
ColdcardKeystore ck = gson.fromJson(map.get(key), ColdcardKeystore.class);
|
ColdcardKeystore ck = gson.fromJson(map.get(key), ColdcardKeystore.class);
|
||||||
|
|
||||||
if(ck.name != null) {
|
if(ck.name != null) {
|
||||||
ScriptType ckScriptType = ScriptType.valueOf(ck.name.replace("p2wpkh-p2sh", "p2sh_p2wpkh").toUpperCase());
|
ScriptType ckScriptType = ScriptType.valueOf(ck.name.replace("p2wpkh-p2sh", "p2sh_p2wpkh").replace("p2sh-p2wpkh", "p2sh_p2wpkh").toUpperCase());
|
||||||
if(ckScriptType.equals(scriptType)) {
|
if(ckScriptType.equals(scriptType)) {
|
||||||
Keystore keystore = new Keystore();
|
Keystore keystore = new Keystore();
|
||||||
keystore.setLabel(getName());
|
keystore.setLabel(getName());
|
||||||
|
|
Loading…
Reference in a new issue