mirror of
https://github.com/BlueWallet/BlueWallet.git
synced 2025-03-13 11:09:20 +01:00
FIX: multisig vault create crash
This commit is contained in:
parent
9028818f09
commit
e7633e4b1a
4 changed files with 13 additions and 9 deletions
|
@ -1102,7 +1102,7 @@ export class AbstractHDElectrumWallet extends AbstractHDWallet {
|
|||
|
||||
/**
|
||||
* @param seed {Buffer} Buffer object with seed
|
||||
* @returns {string} Hex string of fingerprint derived from mnemonics. Always has lenght of 8 chars and correct leading zeroes
|
||||
* @returns {string} Hex string of fingerprint derived from mnemonics. Always has lenght of 8 chars and correct leading zeroes. All caps
|
||||
*/
|
||||
static seedToFingerprint(seed) {
|
||||
const root = bitcoin.bip32.fromSeed(seed);
|
||||
|
@ -1111,6 +1111,15 @@ export class AbstractHDElectrumWallet extends AbstractHDWallet {
|
|||
return hex.toUpperCase();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mnemonic {string} Mnemonic phrase (12 or 24 words)
|
||||
* @returns {string} Hex fingerprint
|
||||
*/
|
||||
static mnemonicToFingerprint(mnemonic) {
|
||||
const seed = bip39.mnemonicToSeed(mnemonic);
|
||||
return AbstractHDElectrumWallet.seedToFingerprint(seed);
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns {string} Hex string of fingerprint derived from wallet mnemonics. Always has lenght of 8 chars and correct leading zeroes
|
||||
*/
|
||||
|
|
|
@ -1103,9 +1103,4 @@ export class MultisigHDWallet extends AbstractHDElectrumWallet {
|
|||
static isXpubForMultisig(xpub) {
|
||||
return ['xpub', 'Ypub', 'Zpub'].includes(xpub.substring(0, 4));
|
||||
}
|
||||
|
||||
static mnemonicToFingerprint(mnemonic) {
|
||||
const seed = bip39.mnemonicToSeed(mnemonic);
|
||||
return MultisigHDWallet.seedToFingerprint(seed);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -285,7 +285,7 @@ const WalletsAddMultisigStep2 = () => {
|
|||
};
|
||||
|
||||
const setFpCacheForMnemonics = seed => {
|
||||
staticCache[seed] = MultisigHDWallet.seedToFingerprint(seed);
|
||||
staticCache[seed] = MultisigHDWallet.mnemonicToFingerprint(seed);
|
||||
return staticCache[seed];
|
||||
};
|
||||
|
||||
|
|
|
@ -441,7 +441,7 @@ const ViewEditMultisigCosigners = () => {
|
|||
hd.setSecret(mnemonic);
|
||||
if (!hd.validateMnemonic()) return alert(loc.multisig.invalid_mnemonics);
|
||||
|
||||
const newFp = MultisigHDWallet.seedToFingerprint(hd.getSecret());
|
||||
const newFp = MultisigHDWallet.mnemonicToFingerprint(hd.getSecret());
|
||||
if (newFp !== wallet.getFingerprint(currentlyEditingCosignerNum)) return alert(loc.multisig.invalid_fingerprint);
|
||||
|
||||
wallet.deleteCosigner(newFp);
|
||||
|
@ -457,7 +457,7 @@ const ViewEditMultisigCosigners = () => {
|
|||
InteractionManager.runAfterInteractions(() => {
|
||||
try {
|
||||
const mnemonics = wallet.getCosigner(index);
|
||||
const newFp = MultisigHDWallet.seedToFingerprint(mnemonics);
|
||||
const newFp = MultisigHDWallet.mnemonicToFingerprint(mnemonics);
|
||||
const path = wallet.getCustomDerivationPathForCosigner(index);
|
||||
const xpub = wallet.convertXpubToMultisignatureXpub(MultisigHDWallet.seedToXpub(mnemonics, path));
|
||||
wallet.deleteCosigner(newFp);
|
||||
|
|
Loading…
Add table
Reference in a new issue