Skip to content

Commit

Permalink
Add deposit data saving to CLI
Browse files Browse the repository at this point in the history
  • Loading branch information
mllnd committed Nov 13, 2023
1 parent e4832b6 commit 10048eb
Showing 1 changed file with 23 additions and 3 deletions.
26 changes: 23 additions & 3 deletions cli/subcommands/create_validators/command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,14 @@ import { Command, ValidationError } from "cliffy/command/mod.ts";
import { ALLOWED_NETWORKS, getOverviewTable, promptConfirm, promptMnemonic, promptPassword } from "./mod.ts";
import { ALLOWED_LANGUAGES } from "../mnemonic/mod.ts";

import { createKeystores, generateCredentials, saveSigningKeystores, verifySigningKeystores } from "../../../keygen/mod.ts";
import {
createKeystores,
generateCredentials,
saveDepositData,
saveSigningKeystores,
verifyDepositData,
verifySigningKeystores,
} from "../../../keygen/mod.ts";
import { error, info } from "../../utils/mod.ts";

export const command = new Command()
Expand Down Expand Up @@ -42,12 +49,25 @@ export const command = new Command()
getOverviewTable(keygenOptions).then(promptConfirm).then(() => {
info("Generating validator credentials...");
return generateCredentials(keygenOptions);
}).then((credentials) => {
}).then(async (credentials) => {
info(`${credentials.length} credentials successfully generated!`);

info("Creating deposit data...");
const { depositData, fileName } = await saveDepositData(credentials, keygenOptions.storagePath);

verifyDepositData(keygenOptions.storagePath, fileName, depositData).then((verified) => {
if (!verified) {
error("Deposit data verification failed!");
return;
}
info("Deposit data successfully verified! 🎉");
});
return credentials;
}).then((credentials) => {
info("Creating keystores...");
return createKeystores(credentials, keygenOptions.password);
}).then(async (keystores) => {
info("Creating keystores...");
info("Saving keystores...");
await saveSigningKeystores(keystores, keygenOptions.storagePath);
info("Keystores saved successfully!");

Expand Down

0 comments on commit 10048eb

Please sign in to comment.