@nomiclabs/buidler
Version:
Buidler is an extensible developer tool that helps smart contract developers increase productivity by reliably bringing together the tools they want.
12 lines • 593 B
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
const bip39_1 = require("ethereum-cryptography/bip39");
const hdkey_1 = require("ethereum-cryptography/hdkey");
function deriveKeyFromMnemonicAndPath(mnemonic, hdPath) {
const seed = bip39_1.mnemonicToSeedSync(mnemonic);
const masterKey = hdkey_1.HDKey.fromMasterSeed(seed);
const derived = masterKey.derive(hdPath);
return derived.privateKey === null ? undefined : derived.privateKey;
}
exports.deriveKeyFromMnemonicAndPath = deriveKeyFromMnemonicAndPath;
//# sourceMappingURL=keys-derivation.js.map
;