Skip to content

Commit

Permalink
feat: writeCoreEval returns plan
Browse files Browse the repository at this point in the history
  • Loading branch information
turadg committed Jun 17, 2024
1 parent 68af59c commit a0115ed
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion packages/deploy-script-support/src/writeCoreEvalParts.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,21 @@ import {
* @import {CoreEvalDescriptor} from './externalTypes.js';
*/

/**
* @typedef CoreEvalPlan
* @property {string} name
* @property {string} permit
* @property {string} script
* @property {{entrypoint: string, bundleID: string, fileName: string}[]} bundles
*/

/**
* @callback WriteCoreEval write to disk the files needed for a CoreEval (js code to`${filePrefix}.js`, permits to `${filePrefix}-permit.json`, an overall
* summary to `${filePrefix}-plan.json), plus whatever bundles bundles the code loads)
* see CoreEval in {@link '/golang/cosmos/x/swingset/types/swingset.pb.go'}
* @param {string} filePrefix name on disk
* @param {import('./externalTypes.js').CoreEvalBuilder} builder
* @returns {Promise<void>}
* @returns {Promise<CoreEvalPlan>}
*/

/**
Expand Down Expand Up @@ -189,6 +197,7 @@ behavior;
log(`creating ${codeFile}`);
await writeFile(codeFile, trimmed);

/** @type {CoreEvalPlan} */
const plan = {
name: filePrefix,
script: codeFile,
Expand All @@ -209,6 +218,7 @@ You can now run a governance submission command like:
Remember to install bundles before submitting the proposal:
${cmds.join('\n ')}
`);
return plan;
};

return writeCoreEval;
Expand Down

0 comments on commit a0115ed

Please sign in to comment.