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.
14 lines (12 loc) • 596 B
text/typescript
import { GiverConfig } from "../config";
import { deriveBip39Phrase, KeyPair, makeBip39Path } from "everscale-crypto";
import { getKeyPairFromSecret } from "../../utils";
export const getGiverKeyPair = (giverSettings: GiverConfig): KeyPair => {
if ("key" in giverSettings) {
return getKeyPairFromSecret(giverSettings.key);
}
if ("phrase" in giverSettings && "accountId" in giverSettings) {
return deriveBip39Phrase(giverSettings.phrase, makeBip39Path(giverSettings.accountId));
}
throw new Error("You should provide secret key or phrase(with accountId) in giver settings");
};