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.
31 lines (30 loc) • 1.42 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.getGiverKeyPair = void 0;
const everscale_crypto_1 = require("everscale-crypto");
const utils_1 = require("../../utils");
const getGiverKeyPair = (giverSettings) => {
if ("key" in giverSettings) {
return (0, utils_1.getKeyPairFromSecret)(giverSettings.key);
}
if ("phrase" in giverSettings && "accountId" in giverSettings) {
try {
return (0, everscale_crypto_1.deriveBip39Phrase)(giverSettings.phrase, (0, everscale_crypto_1.makeBip39Path)(giverSettings.accountId));
// eslint-disable-next-line @typescript-eslint/no-unused-vars
}
catch (e) {
return (0, everscale_crypto_1.deriveTonMnemonic)(giverSettings.phrase, (0, everscale_crypto_1.makeBip39Path)(giverSettings.accountId));
}
}
if ("phrase" in giverSettings && "path" in giverSettings) {
try {
return (0, everscale_crypto_1.deriveBip39Phrase)(giverSettings.phrase, giverSettings.path);
// eslint-disable-next-line @typescript-eslint/no-unused-vars
}
catch (e) {
return (0, everscale_crypto_1.deriveTonMnemonic)(giverSettings.phrase, giverSettings.path);
}
}
throw new Error("You should provide secret key or phrase(with accountId or path) in giver settings");
};
exports.getGiverKeyPair = getGiverKeyPair;