mirror of
https://github.com/BlueWallet/BlueWallet.git
synced 2024-11-19 09:50:15 +01:00
Merge pull request #2577 from BlueWallet/jsonim
ADD: Standard wallet type Electrum JSON import
This commit is contained in:
commit
0b859a10b4
@ -164,12 +164,25 @@ export class AbstractWallet {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const parsedSecret = JSON.parse(this.secret);
|
let parsedSecret;
|
||||||
|
// regex might've matched invalid data. if so, parse newSecret.
|
||||||
|
if (this.secret.trim().length > 0) {
|
||||||
|
try {
|
||||||
|
parsedSecret = JSON.parse(this.secret);
|
||||||
|
} catch (e) {
|
||||||
|
console.log(e);
|
||||||
|
parsedSecret = JSON.parse(newSecret);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
parsedSecret = JSON.parse(newSecret);
|
||||||
|
}
|
||||||
if (parsedSecret && parsedSecret.keystore && parsedSecret.keystore.xpub) {
|
if (parsedSecret && parsedSecret.keystore && parsedSecret.keystore.xpub) {
|
||||||
let masterFingerprint = false;
|
let masterFingerprint = false;
|
||||||
if (parsedSecret.keystore.ckcc_xfp) {
|
if (parsedSecret.keystore.ckcc_xfp) {
|
||||||
// It is a ColdCard Hardware Wallet
|
// It is a ColdCard Hardware Wallet
|
||||||
masterFingerprint = Number(parsedSecret.keystore.ckcc_xfp);
|
masterFingerprint = Number(parsedSecret.keystore.ckcc_xfp);
|
||||||
|
} else if (parsedSecret.keystore.root_fingerprint) {
|
||||||
|
masterFingerprint = Number(parsedSecret.keystore.root_fingerprint);
|
||||||
}
|
}
|
||||||
if (parsedSecret.keystore.label) {
|
if (parsedSecret.keystore.label) {
|
||||||
this.setLabel(parsedSecret.keystore.label);
|
this.setLabel(parsedSecret.keystore.label);
|
||||||
|
@ -480,7 +480,7 @@ export class MultisigHDWallet extends AbstractHDElectrumWallet {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// is it electrum json?
|
// is it electrum json?
|
||||||
if (json && json.wallet_type) {
|
if (json && json.wallet_type && json.wallet_type !== 'standard') {
|
||||||
const mofn = json.wallet_type.split('of');
|
const mofn = json.wallet_type.split('of');
|
||||||
this.setM(parseInt(mofn[0].trim()));
|
this.setM(parseInt(mofn[0].trim()));
|
||||||
const n = parseInt(mofn[1].trim());
|
const n = parseInt(mofn[1].trim());
|
||||||
|
@ -141,7 +141,6 @@ const WalletsImport = () => {
|
|||||||
<BlueDoneAndDismissKeyboardInputAccessory
|
<BlueDoneAndDismissKeyboardInputAccessory
|
||||||
onClearTapped={() => {
|
onClearTapped={() => {
|
||||||
setImportText('');
|
setImportText('');
|
||||||
Keyboard.dismiss();
|
|
||||||
}}
|
}}
|
||||||
onPasteTapped={text => {
|
onPasteTapped={text => {
|
||||||
setImportText(text);
|
setImportText(text);
|
||||||
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user