zkverifyjs
Version:
Submit proofs to zkVerify and query proof state with ease using our npm package.
29 lines (28 loc) • 1.01 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.setupAccount = void 0;
const api_1 = require("@polkadot/api");
const config_1 = require("../../config");
/**
* Sets up the account using the provided secret seed phrase.
*
* @param {string} secretSeedPhrase - The secret seed phrase used to create the account.
* @returns {KeyringPair} The initialized account.
* @throws Will throw an error if the seed phrase is invalid.
*/
const setupAccount = (secretSeedPhrase) => {
try {
const keyring = new api_1.Keyring({ type: 'sr25519' });
keyring.setSS58Format(config_1.CHAIN_SS58_PREFIX);
return keyring.addFromUri(secretSeedPhrase);
}
catch (error) {
if (error instanceof Error) {
throw new Error(`Invalid seed phrase provided: ${error.message}`);
}
else {
throw new Error('An unknown error occurred while setting up the account.');
}
}
};
exports.setupAccount = setupAccount;