UNPKG

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.

23 lines (20 loc) 781 B
import { deriveBip39Phrase, KeyPair, deriveTonMnemonic } from "everscale-crypto"; import { KeysConfig } from "../config"; export 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[]>} */ public static async generate(config: Required<KeysConfig>): Promise<KeyPair[]> { return [...Array(config.amount).keys()].map(i => { const path = config.path.replace("INDEX", `${i}`); try { return deriveBip39Phrase(config.phrase, path); // eslint-disable-next-line @typescript-eslint/no-unused-vars } catch (e) { return deriveTonMnemonic(config.phrase, path); } }); } }