locklift
Version:
Node JS framework for working with Ever contracts. Inspired by Truffle and Hardhat. Helps you to build, test, run and maintain your smart contracts.
25 lines (24 loc) • 908 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Keys = void 0;
const everscale_crypto_1 = require("everscale-crypto");
class Keys {
/**
* Derives specific amount of keys from the specified mnemonic phrase and HD path.
* Phrase, amount and path should be specified in the keys config section
* @returns {Promise<KeyPair[]>}
*/
static async generate(config) {
return [...Array(config.amount).keys()].map(i => {
const path = config.path.replace("INDEX", `${i}`);
try {
return (0, everscale_crypto_1.deriveBip39Phrase)(config.phrase, path);
// eslint-disable-next-line @typescript-eslint/no-unused-vars
}
catch (e) {
return (0, everscale_crypto_1.deriveTonMnemonic)(config.phrase, path);
}
});
}
}
exports.Keys = Keys;