mirror of
https://github.com/sparrowwallet/sparrow.git
synced 2024-11-05 05:46:44 +00:00
read name from ur:crypto-hdkey and set keystore label if present
This commit is contained in:
parent
961fd94dd6
commit
4bec71e7c4
2 changed files with 17 additions and 3 deletions
|
@ -260,7 +260,7 @@ public class QRScanDialog extends Dialog<QRScanDialog.Result> {
|
|||
DeterministicSeed seed;
|
||||
try {
|
||||
extendedKey = ExtendedKey.fromDescriptor(qrtext);
|
||||
result = new Result(extendedKey);
|
||||
result = new Result(extendedKey, null);
|
||||
return;
|
||||
} catch(Exception e) {
|
||||
//Ignore, not a valid xpub
|
||||
|
@ -409,7 +409,7 @@ public class QRScanDialog extends Dialog<QRScanDialog.Result> {
|
|||
} else if(urRegistryType.equals(RegistryType.CRYPTO_HDKEY)) {
|
||||
CryptoHDKey cryptoHDKey = (CryptoHDKey)ur.decodeFromRegistry();
|
||||
ExtendedKey extendedKey = getExtendedKey(cryptoHDKey);
|
||||
return new Result(extendedKey);
|
||||
return new Result(extendedKey, cryptoHDKey.getName());
|
||||
} else if(urRegistryType.equals(RegistryType.CRYPTO_OUTPUT)) {
|
||||
CryptoOutput cryptoOutput = (CryptoOutput)ur.decodeFromRegistry();
|
||||
OutputDescriptor outputDescriptor = getOutputDescriptor(cryptoOutput);
|
||||
|
@ -662,6 +662,7 @@ public class QRScanDialog extends Dialog<QRScanDialog.Result> {
|
|||
public final PSBT psbt;
|
||||
public final BitcoinURI uri;
|
||||
public final ExtendedKey extendedKey;
|
||||
public final String extendedKeyName;
|
||||
public final OutputDescriptor outputDescriptor;
|
||||
public final List<Wallet> wallets;
|
||||
public final DeterministicSeed seed;
|
||||
|
@ -673,6 +674,7 @@ public class QRScanDialog extends Dialog<QRScanDialog.Result> {
|
|||
this.psbt = null;
|
||||
this.uri = null;
|
||||
this.extendedKey = null;
|
||||
this.extendedKeyName = null;
|
||||
this.outputDescriptor = null;
|
||||
this.wallets = null;
|
||||
this.seed = null;
|
||||
|
@ -685,6 +687,7 @@ public class QRScanDialog extends Dialog<QRScanDialog.Result> {
|
|||
this.psbt = psbt;
|
||||
this.uri = null;
|
||||
this.extendedKey = null;
|
||||
this.extendedKeyName = null;
|
||||
this.outputDescriptor = null;
|
||||
this.wallets = null;
|
||||
this.seed = null;
|
||||
|
@ -697,6 +700,7 @@ public class QRScanDialog extends Dialog<QRScanDialog.Result> {
|
|||
this.psbt = null;
|
||||
this.uri = uri;
|
||||
this.extendedKey = null;
|
||||
this.extendedKeyName = null;
|
||||
this.outputDescriptor = null;
|
||||
this.wallets = null;
|
||||
this.seed = null;
|
||||
|
@ -709,6 +713,7 @@ public class QRScanDialog extends Dialog<QRScanDialog.Result> {
|
|||
this.psbt = null;
|
||||
this.uri = BitcoinURI.fromAddress(address);
|
||||
this.extendedKey = null;
|
||||
this.extendedKeyName = null;
|
||||
this.outputDescriptor = null;
|
||||
this.wallets = null;
|
||||
this.seed = null;
|
||||
|
@ -716,11 +721,12 @@ public class QRScanDialog extends Dialog<QRScanDialog.Result> {
|
|||
this.exception = null;
|
||||
}
|
||||
|
||||
public Result(ExtendedKey extendedKey) {
|
||||
public Result(ExtendedKey extendedKey, String name) {
|
||||
this.transaction = null;
|
||||
this.psbt = null;
|
||||
this.uri = null;
|
||||
this.extendedKey = extendedKey;
|
||||
this.extendedKeyName = name;
|
||||
this.outputDescriptor = null;
|
||||
this.wallets = null;
|
||||
this.seed = null;
|
||||
|
@ -733,6 +739,7 @@ public class QRScanDialog extends Dialog<QRScanDialog.Result> {
|
|||
this.psbt = null;
|
||||
this.uri = null;
|
||||
this.extendedKey = null;
|
||||
this.extendedKeyName = null;
|
||||
this.outputDescriptor = outputDescriptor;
|
||||
this.wallets = null;
|
||||
this.seed = null;
|
||||
|
@ -745,6 +752,7 @@ public class QRScanDialog extends Dialog<QRScanDialog.Result> {
|
|||
this.psbt = null;
|
||||
this.uri = null;
|
||||
this.extendedKey = null;
|
||||
this.extendedKeyName = null;
|
||||
this.outputDescriptor = null;
|
||||
this.wallets = wallets;
|
||||
this.seed = null;
|
||||
|
@ -757,6 +765,7 @@ public class QRScanDialog extends Dialog<QRScanDialog.Result> {
|
|||
this.psbt = null;
|
||||
this.uri = null;
|
||||
this.extendedKey = null;
|
||||
this.extendedKeyName = null;
|
||||
this.outputDescriptor = null;
|
||||
this.wallets = null;
|
||||
this.seed = seed;
|
||||
|
@ -769,6 +778,7 @@ public class QRScanDialog extends Dialog<QRScanDialog.Result> {
|
|||
this.psbt = null;
|
||||
this.uri = null;
|
||||
this.extendedKey = null;
|
||||
this.extendedKeyName = null;
|
||||
this.outputDescriptor = null;
|
||||
this.wallets = null;
|
||||
this.seed = null;
|
||||
|
@ -781,6 +791,7 @@ public class QRScanDialog extends Dialog<QRScanDialog.Result> {
|
|||
this.psbt = null;
|
||||
this.uri = null;
|
||||
this.extendedKey = null;
|
||||
this.extendedKeyName = null;
|
||||
this.outputDescriptor = null;
|
||||
this.wallets = null;
|
||||
this.seed = null;
|
||||
|
|
|
@ -517,6 +517,9 @@ public class KeystoreController extends WalletFormController implements Initiali
|
|||
QRScanDialog.Result result = optionalResult.get();
|
||||
if(result.extendedKey != null && result.extendedKey.getKey().isPubKeyOnly()) {
|
||||
xpub.setText(result.extendedKey.getExtendedKey());
|
||||
if(result.extendedKeyName != null) {
|
||||
label.setText(result.extendedKeyName);
|
||||
}
|
||||
} else if(result.outputDescriptor != null && !result.outputDescriptor.getExtendedPublicKeys().isEmpty()) {
|
||||
ExtendedKey extendedKey = result.outputDescriptor.getExtendedPublicKeys().iterator().next();
|
||||
KeyDerivation keyDerivation = result.outputDescriptor.getKeyDerivation(extendedKey);
|
||||
|
|
Loading…
Reference in a new issue