This commit is contained in:
Marcos Rodriguez 2020-01-02 14:54:34 -06:00
parent 447d0e3042
commit d11a9456d6
3 changed files with 9 additions and 5 deletions

View file

@ -759,7 +759,7 @@ export class AbstractHDElectrumWallet extends AbstractHDWallet {
let pubkey = this._getPubkeyByAddress(input.address);
let masterFingerprintBuffer;
if (masterFingerprint) {
const hexBuffer = Buffer.from(Number(masterFingerprint).toString(16), 'hex');
const hexBuffer = masterFingerprint;
masterFingerprintBuffer = Buffer.from(reverse(hexBuffer));
} else {
masterFingerprintBuffer = Buffer.from([0x00, 0x00, 0x00, 0x00]);
@ -799,9 +799,9 @@ export class AbstractHDElectrumWallet extends AbstractHDWallet {
let masterFingerprintBuffer;
if (masterFingerprint) {
const hexBuffer = Buffer.from(Number(masterFingerprint).toString(16), 'hex')
const hexBuffer = Buffer.from(masterFingerprint);
masterFingerprintBuffer = Buffer.from(reverse(hexBuffer));
} else {
} else {
masterFingerprintBuffer = Buffer.from([0x00, 0x00, 0x00, 0x00]);
}

View file

@ -51,7 +51,7 @@ export class WatchOnlyWallet extends LegacyWallet {
let masterFingerprint = false;
if (parsedSecret.keystore.ckcc_xfp) {
// It is a ColdCard Hardware Wallet
masterFingerprint = parsedSecret.keystore.ckcc_xfp;
masterFingerprint = Buffer.from(Number(parsedSecret.keystore.ckcc_xfp).toString(16), 'hex').toString('hex');
}
this.setSecret(parsedSecret.keystore.xpub);
this.masterFingerprint = masterFingerprint;

View file

@ -46,7 +46,11 @@ const ScanQRCode = ({
const file = await RNFS.readFile(res.uri);
const fileParsed = JSON.parse(file);
if (fileParsed.keystore.xpub) {
onBarCodeRead({ data: fileParsed.keystore.xpub, additionalProperties: { masterFingerprint: fileParsed.keystore.ckcc_xfp } });
let masterFingerprint;
if (fileParsed.keystore.ckcc_xfp) {
masterFingerprint = Buffer.from(Number(fileParsed.keystore.ckcc_xfp).toString(16), 'hex').toString('hex');
}
onBarCodeRead({ data: fileParsed.keystore.xpub, additionalProperties: { masterFingerprint } });
} else {
throw new Error();
}