Update electrum-mnemonic to 2.0.0

This commit is contained in:
junderw 2020-05-04 12:53:14 +09:00
parent a73701c5dc
commit e1ed2b9a6e
No known key found for this signature in database
GPG Key ID: A9273B5AD3E47B45
3 changed files with 7 additions and 15 deletions

View File

@ -4,11 +4,9 @@ const bitcoin = require('bitcoinjs-lib');
const mn = require('electrum-mnemonic'); const mn = require('electrum-mnemonic');
const HDNode = require('bip32'); const HDNode = require('bip32');
// This type of wallet should only accept a valid standard prefix const PREFIX = mn.PREFIXES.standard;
const MNEMONIC_TO_SEED_OPTS = { const MNEMONIC_TO_SEED_OPTS = {
validPrefixes: [ prefix: PREFIX,
mn.PREFIXES.standard,
],
}; };
/** /**
@ -22,13 +20,7 @@ export class HDLegacyElectrumSeedP2PKHWallet extends HDLegacyP2PKHWallet {
static typeReadable = 'HD Legacy Electrum (BIP32 P2PKH)'; static typeReadable = 'HD Legacy Electrum (BIP32 P2PKH)';
validateMnemonic() { validateMnemonic() {
try { return mn.validateMnemonic(this.secret, PREFIX);
// This type of wallet should only accept a valid standard prefix
mn.mnemonicToSeedSync(this.secret, MNEMONIC_TO_SEED_OPTS);
return true;
} catch (_) {
return false;
}
} }
async generate() { async generate() {

6
package-lock.json generated
View File

@ -4683,9 +4683,9 @@
"from": "git+https://github.com/BlueWallet/rn-electrum-client.git#2a5bb11dd9a8d89f328049d9ed59bce49d88a15d" "from": "git+https://github.com/BlueWallet/rn-electrum-client.git#2a5bb11dd9a8d89f328049d9ed59bce49d88a15d"
}, },
"electrum-mnemonic": { "electrum-mnemonic": {
"version": "1.0.7", "version": "2.0.0",
"resolved": "https://registry.npmjs.org/electrum-mnemonic/-/electrum-mnemonic-1.0.7.tgz", "resolved": "https://registry.npmjs.org/electrum-mnemonic/-/electrum-mnemonic-2.0.0.tgz",
"integrity": "sha512-qi53UYOr+yxCBDVYzKm6a6yzomhHiZR43EuH2I3+teqizj2fapMDh0AyixB3id7ZnFCsiGnOxFqN4TzuzQy5dQ==", "integrity": "sha512-egooI/RRX31y1LUbvv2OJf0eptrJjc5/lFv6txgDZx91g6JdZrQeQp+5AqlcfDUdsl2aDkeHk1a79J6bt3v8SA==",
"requires": { "requires": {
"create-hmac": "^1.1.7", "create-hmac": "^1.1.7",
"pbkdf2": "^3.0.17", "pbkdf2": "^3.0.17",

View File

@ -81,7 +81,7 @@
"dayjs": "1.8.23", "dayjs": "1.8.23",
"ecurve": "1.0.6", "ecurve": "1.0.6",
"electrum-client": "git+https://github.com/BlueWallet/rn-electrum-client.git#2a5bb11dd9a8d89f328049d9ed59bce49d88a15d", "electrum-client": "git+https://github.com/BlueWallet/rn-electrum-client.git#2a5bb11dd9a8d89f328049d9ed59bce49d88a15d",
"electrum-mnemonic": "1.0.7", "electrum-mnemonic": "2.0.0",
"eslint-config-prettier": "6.10.0", "eslint-config-prettier": "6.10.0",
"eslint-config-standard": "12.0.0", "eslint-config-standard": "12.0.0",
"eslint-config-standard-react": "7.0.2", "eslint-config-standard-react": "7.0.2",