@agoric/deploy-script-support 0.10.4-other-dev-3eb1a1d.0 → 0.10.4-other-dev-d15096d.0.d15096d

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -70,9 +70,11 @@ or an object whose keys identify child properties and whose corresponding values
70
70
  are theirselves (recursive) permits. See `BootstrapManifiest` in
71
71
  [lib-boot.js](../vats/src/core/lib-boot.js).
72
72
 
73
- The object returned from a "getManifestCall" invocation may also include
74
- "installations" to register in `agoricNames`, as is done here with name "game1"
75
- using the reference passed in via the invocation argument:
73
+ The manifest object returned from a "getManifestCall" invocation may also
74
+ include "installations" (they'll be registered with `agoricNames` and in the
75
+ bootstrap promise space) and/or "options" (they'll be provided as the "options"
76
+ property of the second argument for each call of the manifest's functions):
77
+
76
78
  ```js
77
79
  /** @type {import('@agoric/vats/src/core/lib-boot').BootstrapManifest} */
78
80
  const gameManifest = harden({
@@ -87,9 +89,12 @@ const gameManifest = harden({
87
89
  export const getManifestForGame1 = ({ restoreRef }, { game1Ref }) => {
88
90
  return harden({
89
91
  manifest: gameManifest,
92
+ // a reference to the game1 bundle will be published in agoricNames as "game1"
90
93
  installations: {
91
94
  game1: restoreRef(game1Ref),
92
95
  },
96
+ // the second argument of `startGameContract` will be `{ options: ["foo"] }`
97
+ options: ["foo"],
93
98
  });
94
99
  };
95
100
  ```
package/package.json CHANGED
@@ -1,20 +1,20 @@
1
1
  {
2
2
  "name": "@agoric/deploy-script-support",
3
- "version": "0.10.4-other-dev-3eb1a1d.0+3eb1a1d",
3
+ "version": "0.10.4-other-dev-d15096d.0.d15096d",
4
4
  "description": "Helpers and other support for writing deploy scripts",
5
5
  "type": "module",
6
6
  "main": "src/helpers.js",
7
7
  "engines": {
8
- "node": "^18.12 || ^20.9"
8
+ "node": "^20.9 || ^22.11"
9
9
  },
10
10
  "scripts": {
11
11
  "build": "exit 0",
12
12
  "test": "ava",
13
13
  "test:xs": "exit 0",
14
14
  "lint-fix": "yarn lint:eslint --fix",
15
- "lint:eslint": "eslint .",
16
- "lint:types": "tsc",
17
- "lint": "run-s --continue-on-error lint:*"
15
+ "lint:eslint": "yarn run -T eslint .",
16
+ "lint:types": "yarn run -T tsc",
17
+ "lint": "yarn run -T run-s --continue-on-error 'lint:*'"
18
18
  },
19
19
  "repository": {
20
20
  "type": "git",
@@ -34,27 +34,28 @@
34
34
  },
35
35
  "homepage": "https://github.com/Agoric/agoric-sdk#readme",
36
36
  "dependencies": {
37
- "@agoric/ertp": "0.16.3-other-dev-3eb1a1d.0+3eb1a1d",
38
- "@agoric/import-manager": "0.3.12-other-dev-3eb1a1d.0+3eb1a1d",
39
- "@agoric/internal": "0.3.3-other-dev-3eb1a1d.0+3eb1a1d",
40
- "@agoric/notifier": "0.6.3-other-dev-3eb1a1d.0+3eb1a1d",
41
- "@agoric/store": "0.9.3-other-dev-3eb1a1d.0+3eb1a1d",
42
- "@agoric/time": "0.3.3-other-dev-3eb1a1d.0+3eb1a1d",
43
- "@agoric/zoe": "0.26.3-other-dev-3eb1a1d.0+3eb1a1d",
44
- "@endo/base64": "^1.0.9",
45
- "@endo/bundle-source": "^3.5.0",
46
- "@endo/errors": "^1.2.8",
47
- "@endo/far": "^1.1.9",
48
- "@endo/marshal": "^1.6.2",
49
- "@endo/nat": "^5.0.13",
50
- "@endo/promise-kit": "^1.1.8",
51
- "@endo/zip": "^1.0.9"
37
+ "@agoric/ertp": "0.16.3-other-dev-d15096d.0.d15096d",
38
+ "@agoric/import-manager": "0.3.12-other-dev-d15096d.0.d15096d",
39
+ "@agoric/internal": "0.3.3-other-dev-d15096d.0.d15096d",
40
+ "@agoric/notifier": "0.6.3-other-dev-d15096d.0.d15096d",
41
+ "@agoric/pola-io": "0.1.1-other-dev-d15096d.0.d15096d",
42
+ "@agoric/store": "0.9.3-other-dev-d15096d.0.d15096d",
43
+ "@agoric/time": "0.3.3-other-dev-d15096d.0.d15096d",
44
+ "@agoric/zoe": "0.26.3-other-dev-d15096d.0.d15096d",
45
+ "@endo/base64": "^1.0.12",
46
+ "@endo/bundle-source": "^4.1.2",
47
+ "@endo/errors": "^1.2.13",
48
+ "@endo/far": "^1.1.14",
49
+ "@endo/marshal": "^1.8.0",
50
+ "@endo/nat": "^5.1.3",
51
+ "@endo/promise-kit": "^1.1.13",
52
+ "@endo/zip": "^1.0.11"
52
53
  },
53
54
  "devDependencies": {
54
- "@agoric/vats": "0.15.2-other-dev-3eb1a1d.0+3eb1a1d",
55
- "@endo/init": "^1.1.7",
55
+ "@agoric/vats": "0.15.2-other-dev-d15096d.0.d15096d",
56
+ "@endo/init": "^1.1.12",
56
57
  "ava": "^5.3.0",
57
- "import-meta-resolve": "^2.2.1"
58
+ "import-meta-resolve": "^4.1.0"
58
59
  },
59
60
  "files": [
60
61
  "src",
@@ -72,7 +73,7 @@
72
73
  "access": "public"
73
74
  },
74
75
  "typeCoverage": {
75
- "atLeast": 83.71
76
+ "atLeast": 83.14
76
77
  },
77
- "gitHead": "3eb1a1d2d75b2b4a94807cd3bf759bc9fc531f05"
78
+ "gitHead": "d15096dc4ff8b96e9b6cd11954c20d3a9efbb393"
78
79
  }
@@ -2,6 +2,10 @@
2
2
  import { Fail } from '@endo/errors';
3
3
  import { E } from '@endo/far';
4
4
 
5
+ /**
6
+ * @import {InvitationDetails, PaymentPKeywordRecord, Proposal, UserSeat} from '@agoric/zoe';
7
+ */
8
+
5
9
  /**
6
10
  * @param {ERef<UserSeat>} seat
7
11
  * @param {string} expectedOfferResult
@@ -1,13 +1,19 @@
1
1
  import { Fail } from '@endo/errors';
2
2
 
3
+ /**
4
+ * @import {promises} from 'fs';
5
+ * @import {resolve} from 'path';
6
+ * @import {BundleSourceResult} from '@endo/bundle-source';
7
+ */
8
+
3
9
  /**
4
10
  * @param {string} cacheDir
5
- * @param {{ now: typeof Date.now, fs: import('fs').promises, pathResolve: typeof import('path').resolve }} param1
11
+ * @param {{ now: typeof Date.now, fs: promises, pathResolve: typeof resolve }} param1
6
12
  */
7
13
  export const makeCacheAndGetBundleSpec =
8
14
  (cacheDir, { now, fs, pathResolve }) =>
9
15
  /**
10
- * @param {Promise<import('@endo/bundle-source').BundleSourceResult<'endoZipBase64'>>} bundleP
16
+ * @param {Promise<BundleSourceResult<'endoZipBase64'>>} bundleP
11
17
  */
12
18
  async bundleP => {
13
19
  const bundle = await bundleP;
@@ -3,6 +3,8 @@ const t = 'makeCoreProposalBehavior';
3
3
 
4
4
  /**
5
5
  * @import {Installation} from '@agoric/zoe/src/zoeService/utils.js';
6
+ * @import {E} from '@endo/far';
7
+ * @import {ManifestBundleRef} from './externalTypes.js';
6
8
  */
7
9
 
8
10
  /**
@@ -13,7 +15,6 @@ const t = 'makeCoreProposalBehavior';
13
15
  */
14
16
 
15
17
  /**
16
- * @import {ManifestBundleRef} from './externalTypes.js'
17
18
  * @typedef {[methodName: string, ...args: unknown[]]} FlatMethargs
18
19
  * @typedef {Record<string, Record<string, unknown>>} Manifest
19
20
  */
@@ -44,9 +45,9 @@ export const permits = {
44
45
  * @param {ManifestBundleRef} inputs.manifestBundleRef
45
46
  * @param {FlatMethargs} inputs.getManifestCall
46
47
  * @param {Manifest} [inputs.customManifest]
47
- * @param {typeof import('@endo/far').E} inputs.E
48
+ * @param {typeof E} inputs.E
48
49
  * @param {(...args: unknown[]) => void} [inputs.log]
49
- * @param {(ref: import('./externalTypes.js').ManifestBundleRef) => Promise<import('@agoric/zoe/src/zoeService/utils.js').Installation<unknown>>} [inputs.customRestoreRef]
50
+ * @param {(ref: ManifestBundleRef) => Promise<Installation<unknown>>} [inputs.customRestoreRef]
50
51
  * @returns {(vatPowers: unknown) => Promise<unknown>}
51
52
  */
52
53
  export const makeCoreProposalBehavior = ({
@@ -83,7 +84,7 @@ export const makeCoreProposalBehavior = ({
83
84
  };
84
85
 
85
86
  const makeRestoreRef = (vatAdminSvc, zoe) => {
86
- /** @type {(ref: import('./externalTypes.js').ManifestBundleRef) => Promise<Installation<unknown>>} */
87
+ /** @type {(ref: ManifestBundleRef) => Promise<Installation<unknown>>} */
87
88
  const defaultRestoreRef = async bundleRef => {
88
89
  // extract-proposal.js creates these records, and bundleName is
89
90
  // the optional name under which the bundle was installed into
@@ -193,7 +194,7 @@ export const makeCoreProposalBehavior = ({
193
194
  /**
194
195
  * @param {object} inputs
195
196
  * @param {Array<{ ref: ManifestBundleRef, call: FlatMethargs, customManifest?: Manifest }>} inputs.metadataRecords
196
- * @param {typeof import('@endo/far').E} inputs.E
197
+ * @param {typeof E} inputs.E
197
198
  */
198
199
  export const makeEnactCoreProposalsFromBundleRef = ({ metadataRecords, E }) => {
199
200
  /**
@@ -1,6 +1,11 @@
1
1
  // @ts-check
2
2
  import { E } from '@endo/far';
3
3
 
4
+ /**
5
+ * @import {Amount, Brand, Issuer, Payment, Purse} from '@agoric/ertp';
6
+ * @import {InvitationDetails} from '@agoric/zoe';
7
+ */
8
+
4
9
  /**
5
10
  * @param {ERef<Purse>} zoeInvitationPurse
6
11
  */
@@ -1,3 +1,4 @@
1
+ /* eslint-disable @agoric/group-jsdoc-imports */
1
2
  // @ts-check
2
3
  export {};
3
4
 
@@ -70,7 +71,7 @@ export {};
70
71
  * }} CommonHome
71
72
  */
72
73
 
73
- // TODO wallet as import('@agoric/wallet-backend/src/types').WalletAdmin once it's a module
74
+ // TODO wallet as import('@agoric/wallet-backend/src/types.js').WalletAdmin once it's a module
74
75
  /**
75
76
  * @typedef {CommonHome & {
76
77
  * agoricNames: ERef<NameHub>,
@@ -11,6 +11,11 @@ import {
11
11
  makeEnactCoreProposalsFromBundleRef,
12
12
  } from './coreProposalBehavior.js';
13
13
 
14
+ /**
15
+ * @import {CoreEvalBuilder} from './externalTypes.js';
16
+ * @import {PublishBundleRef} from './externalTypes.js';
17
+ */
18
+
14
19
  /**
15
20
  * @typedef {string | {module: string, entrypoint?: string, args?: Array<unknown>}} ConfigProposal
16
21
  */
@@ -155,7 +160,7 @@ export const extractCoreProposalBundles = async (
155
160
  const thisProposalSequence = getSequenceForProposal(key);
156
161
  const initPath = findModule(dirname, module);
157
162
  const initDir = path.dirname(initPath);
158
- /** @type {Record<string, import('./externalTypes.js').CoreEvalBuilder>} */
163
+ /** @type {Record<string, CoreEvalBuilder>} */
159
164
  const ns = await import(initPath);
160
165
  const install = (srcSpec, bundlePath) => {
161
166
  const absoluteSrc = findModule(initDir, srcSpec);
@@ -181,7 +186,7 @@ export const extractCoreProposalBundles = async (
181
186
  );
182
187
  return bundleHandle;
183
188
  };
184
- /** @type {import('./externalTypes.js').PublishBundleRef} */
189
+ /** @type {PublishBundleRef} */
185
190
  const publishRef = async handleP => {
186
191
  const handle = await handleP;
187
192
  bundleHandleToAbsolutePaths.has(handle) ||
@@ -13,7 +13,7 @@
13
13
  import { E } from '@endo/far';
14
14
  import url from 'url';
15
15
 
16
- /** @typedef {ReturnType<import('./endo-pieces-contract.js')['start']>['publicFacet']} BundleMaker */
16
+ /** @typedef {ReturnType<typeof import('./endo-pieces-contract.js').start>['publicFacet']} BundleMaker */
17
17
  /** @typedef {ReturnType<BundleMaker['makeBundler']>} Bundler */
18
18
 
19
19
  export const makeGetBundlerMaker =
package/src/helpers.js CHANGED
@@ -1,6 +1,6 @@
1
1
  // @ts-check
2
2
 
3
- /// <reference path="../../zoe/exported.js" />
3
+ /// <reference types="@agoric/zoe/exported.js" />
4
4
 
5
5
  import { E } from '@endo/far';
6
6
  import bundleSource from '@endo/bundle-source';
@@ -19,7 +19,15 @@ import { assertOfferResult } from './assertOfferResult.js';
19
19
  import { installInPieces } from './installInPieces.js';
20
20
  import { makeWriteCoreEval } from './writeCoreEvalParts.js';
21
21
 
22
+ /**
23
+ * @import {CommonHome} from './externalTypes.js';
24
+ * @import {AgSoloHome} from './externalTypes.js';
25
+ * @import {DeployScriptEndownments} from './externalTypes.js';
26
+ * @import {WriteCoreEval} from './writeCoreEvalParts.js';
27
+ */
28
+
22
29
  export * from '@agoric/internal/src/node/createBundles.js';
30
+ export { parseScriptArgs } from './parseCoreEvalArgs.js';
23
31
 
24
32
  // These are also hard-coded in lib-wallet.js.
25
33
  // TODO: Add methods to the wallet to access these without hard-coding
@@ -53,8 +61,8 @@ const makeLazyObject = sourceObject => {
53
61
  };
54
62
 
55
63
  /**
56
- * @param {Promise<import('./externalTypes.js').CommonHome | import('./externalTypes.js').AgSoloHome>} homePromise
57
- * @param {import('./externalTypes.js').DeployScriptEndownments} endowments
64
+ * @param {Promise<CommonHome | AgSoloHome>} homePromise
65
+ * @param {DeployScriptEndownments} endowments
58
66
  */
59
67
  export const makeHelpers = async (homePromise, endowments) => {
60
68
  // Endowments provided via `agoric run` or `agoric deploy`.
@@ -145,7 +153,7 @@ export const makeHelpers = async (homePromise, endowments) => {
145
153
  get getBundlerMaker() {
146
154
  return makeGetBundlerMaker(homePromise, { bundleSource, lookup });
147
155
  },
148
- /** @returns {import('./writeCoreEvalParts.js').WriteCoreEval} */
156
+ /** @returns {WriteCoreEval} */
149
157
  get writeCoreEval() {
150
158
  return makeWriteCoreEval(homePromise, endowments, {
151
159
  getBundleSpec: deps.cacheAndGetBundleSpec,
package/src/install.js CHANGED
@@ -3,13 +3,16 @@ import './externalTypes.js';
3
3
 
4
4
  import { E } from '@endo/far';
5
5
 
6
- /** @import {Petname} from '@agoric/deploy-script-support/src/externalTypes.js' */
6
+ /**
7
+ * @import {Petname} from '@agoric/deploy-script-support/src/externalTypes.js'
8
+ * @import {InstallationManager} from './startInstance.js';
9
+ */
7
10
 
8
11
  // XXX board is Board but specifying that leads to type errors with imports which aren't worth fixing right now
9
12
  /**
10
13
  * @param {typeof import('@endo/bundle-source')['default']} bundleSource
11
14
  * @param {ERef<ZoeService>} zoe
12
- * @param {ERef<import('./startInstance.js').InstallationManager>} installationManager
15
+ * @param {ERef<InstallationManager>} installationManager
13
16
  * @param {ERef<any>} board
14
17
  * @param {(bundle: any) => any} [publishBundle]
15
18
  * @param {(path: string) => string} [pathResolve]
package/src/offer.js CHANGED
@@ -4,7 +4,11 @@ import { E } from '@endo/far';
4
4
  // Avoid pulling in too many dependencies like notifiers
5
5
  import { AmountMath } from '@agoric/ertp/src/amountMath.js';
6
6
 
7
- /** @import {Petname} from '@agoric/deploy-script-support/src/externalTypes.js' */
7
+ /**
8
+ * @import {Petname} from '@agoric/deploy-script-support/src/externalTypes.js';
9
+ * @import {Amount, Brand, Issuer, Payment, Purse} from '@agoric/ertp';
10
+ * @import {InvitationDetails, Keyword, Proposal} from '@agoric/zoe';
11
+ */
8
12
 
9
13
  /**
10
14
  * @typedef {object} OfferHelperConfig
@@ -0,0 +1,40 @@
1
+ /**
2
+ * To customize proposals for multiple environments, we pass the "variant"
3
+ * identifier in scriptArgs. The variant must match a knownVariant.
4
+ *
5
+ * @param {DeployScriptEndownments} endowments
6
+ * @param {string} name a name to use in error messages or Usage suggestions.
7
+ * @param {string[]} knownVariants
8
+ */
9
+ export const parseScriptArgs = async (endowments, name, knownVariants) => {
10
+ const { scriptArgs } = endowments;
11
+ // const variantOrConfig = scriptArgs?.[0];
12
+ const variantOrConfig =
13
+ scriptArgs && scriptArgs.length > 0 ? scriptArgs : undefined;
14
+
15
+ /**
16
+ * @import {DeployScriptEndownments} from './externalTypes.js';
17
+ */
18
+
19
+ console.log(`${name}`, variantOrConfig);
20
+
21
+ const Usage = `agoric run ${name}.js ${[...knownVariants, '<json-config>'].join(' | ')}`;
22
+ const opts = {};
23
+
24
+ if (typeof variantOrConfig === 'string') {
25
+ if (variantOrConfig[0] === '{') {
26
+ try {
27
+ opts.config = JSON.parse(variantOrConfig);
28
+ } catch (err) {
29
+ throw Error(`Failed to parse config argument ${variantOrConfig}`);
30
+ }
31
+ } else {
32
+ opts.variant = variantOrConfig;
33
+ }
34
+ } else {
35
+ console.error(Usage);
36
+ throw Error(Usage);
37
+ }
38
+
39
+ return opts;
40
+ };
@@ -0,0 +1,168 @@
1
+ /**
2
+ * @file support for Contract Deployment Process
3
+ *
4
+ * 1. `agoric run XYZ.build.js` produces:
5
+ * - `b1-123.json` bundle x 2: contract, aux
6
+ * - `XYZ-permit.json`, `XYZ.js` script
7
+ * 2. Install bundles
8
+ * - permissionless with per-byte fee in IST
9
+ * 3. Submit CoreEval proposal to BLD stakers
10
+ * - `XYZ-permit.json`, `XYZ.js`
11
+ *
12
+ * @see {runBuilder}
13
+ * @see {installBundles}
14
+ * @see {submitCoreEval}
15
+ */
16
+ import { toCLIOptions } from '@agoric/internal/src/cli-utils.js';
17
+
18
+ /**
19
+ * @import {CmdRunner} from '@agoric/pola-io';
20
+ * @import {FileRd} from '@agoric/pola-io';
21
+ */
22
+
23
+ /**
24
+ *
25
+ * TODO: builder should be a FileRd
26
+ * TODO: parameterize dest dir
27
+ *
28
+ * @example
29
+ * to use npx to find `agoric` in node_modules/.bin:
30
+ * const execP = promisify(childProcess.execFile)
31
+ * const agoric = makeCmdRunner('npx', { execFile: execP }).subCommand('agoric');
32
+ *
33
+ * XXX use a different name from execFile since the meaning is different
34
+ *
35
+ * @param {CmdRunner} agoric
36
+ * @param {FileRd} builder
37
+ * @param {string[]} [builderOpts]
38
+ * @param {{cwd?: FileRd}} [io]
39
+ *
40
+ * @returns {Promise<Plan>}
41
+ *
42
+ * @typedef {{
43
+ * name: string,
44
+ * script: string,
45
+ * permit: string,
46
+ * bundles: { entrypoint:string, bundleID:string, fileName:string}[];
47
+ * }} Plan
48
+ */
49
+ export const runBuilder = async (
50
+ agoric,
51
+ builder,
52
+ builderOpts = [],
53
+ { cwd = builder.join('../../') } = {},
54
+ ) => {
55
+ const cmd = agoric.withFlags(...builderOpts);
56
+ const { stdout } = await cmd.exec(['run', String(builder)]);
57
+ const match = stdout?.match(/ (?<name>[-\w]+)-permit.json/);
58
+ if (!(match && match.groups)) {
59
+ throw Error('no permit found');
60
+ }
61
+ /** @type {Plan} */
62
+ const plan = await cwd.join(`${match.groups.name}-plan.json`).readJSON();
63
+ return plan;
64
+ };
65
+
66
+ export const txFlags = ({
67
+ node,
68
+ from,
69
+ chainId,
70
+ keyringBackend = 'test',
71
+ broadcastMode = 'block',
72
+ }) => ({
73
+ node,
74
+ from,
75
+ 'chain-id': chainId,
76
+ 'keyring-backend': keyringBackend,
77
+ 'broadcast-mode': broadcastMode,
78
+ // TODO: parameterize these?
79
+ gas: 'auto',
80
+ 'gas-adjustment': '1.4',
81
+ });
82
+
83
+ /**
84
+ * @param {CmdRunner} agd
85
+ * @param {number} n
86
+ */
87
+ export const waitForBlock = async (agd, n = 1) => {
88
+ const getHeight = async () => {
89
+ const { stdout } = await agd.exec(['status']);
90
+ const status = JSON.parse(stdout);
91
+ const { latest_block_height: height } = status.sync_info || status.SyncInfo;
92
+ return height;
93
+ };
94
+ const initialHeight = await getHeight();
95
+ const SEC = 1000;
96
+ let currentHeight;
97
+ do {
98
+ await new Promise(resolve => setTimeout(resolve, 1 * SEC)); // XXX ambient
99
+ currentHeight = await getHeight();
100
+ } while (currentHeight - initialHeight < n);
101
+ console.log('block height:', initialHeight, currentHeight);
102
+ };
103
+
104
+ /**
105
+ * @param {CmdRunner} agd - agd with --from etc.
106
+ * @param {string[]} txArgs
107
+ */
108
+ export const runTx = async (agd, txArgs) => {
109
+ const { stdout } = await agd.withFlags('-o', 'json').exec(['tx', ...txArgs]);
110
+ const result = JSON.parse(stdout);
111
+ if (result.code !== 0) {
112
+ throw Object.assign(Error(result.raw_log), result);
113
+ }
114
+ return result;
115
+ };
116
+
117
+ /**
118
+ * @param {CmdRunner} agd
119
+ * @param {FileRd} bundle
120
+ */
121
+ export const installBundle = async (agd, bundle) =>
122
+ runTx(agd, ['swingset', 'install-bundle', `@${bundle}`]);
123
+
124
+ export const txAbbr = tx => {
125
+ const { txhash, code, height, gas_used: g } = tx;
126
+
127
+ return { txhash, code, height, gas_used: g };
128
+ };
129
+
130
+ /**
131
+ * @param {CmdRunner} agd
132
+ * @param {Plan['bundles']} bundles
133
+ * @param {FileRd} files
134
+ */
135
+ export const installBundles = (agd, bundles, files) => {
136
+ const ps = bundles.map(b =>
137
+ installBundle(agd, files.join(files.relative(b.fileName))),
138
+ );
139
+ return Promise.all(ps);
140
+ };
141
+
142
+ /**
143
+ * @param {CmdRunner} agd
144
+ * @param {Pick<Plan, 'permit' | 'script'>[]} evals
145
+ * @param {object} [opts]
146
+ * @param {string} [opts.title]
147
+ * @param {string} [opts.description]
148
+ * @param {object} [opts.depositOpts]
149
+ * @param {string} [opts.depositOpts.denom]
150
+ * @param {number} [opts.depositOpts.unit]
151
+ * @param {number} [opts.depositOpts.qty]
152
+ * @param {string} [opts.deposit]
153
+ */
154
+ export const submitCoreEval = async (
155
+ agd,
156
+ evals,
157
+ {
158
+ title = evals[0].script,
159
+ description = title,
160
+ depositOpts: { denom = 'ubld', unit = 1_000_000, qty = 10 } = {},
161
+ deposit = `${qty * unit}${denom}`,
162
+ } = {},
163
+ ) =>
164
+ runTx(agd, [
165
+ ...'gov submit-proposal swingset-core-eval'.split(' '),
166
+ ...evals.map(e => [e.permit, e.script]).flat(),
167
+ ...toCLIOptions({ title, description, deposit }),
168
+ ]);
package/src/saveIssuer.js CHANGED
@@ -1,12 +1,16 @@
1
1
  // @ts-check
2
2
  import { E } from '@endo/far';
3
3
 
4
- /** @import {Petname} from '@agoric/deploy-script-support/src/externalTypes.js' */
4
+ /**
5
+ * @import {Petname} from '@agoric/deploy-script-support/src/externalTypes.js';
6
+ * @import {Amount, Brand, Issuer, Payment} from '@agoric/ertp';
7
+ * @import {IssuerManager} from './startInstance.js';
8
+ */
5
9
 
6
10
  /**
7
11
  * @param {ERef<any>} walletAdmin - an internal type of the
8
12
  * wallet, not defined here
9
- * @param {ERef<import('./startInstance.js').IssuerManager>} issuerManager
13
+ * @param {ERef<IssuerManager>} issuerManager
10
14
  */
11
15
  export const makeSaveIssuer = (walletAdmin, issuerManager) => {
12
16
  /**
@@ -2,7 +2,11 @@
2
2
  import { assert } from '@endo/errors';
3
3
  import { E, passStyleOf } from '@endo/far';
4
4
 
5
- /** @import {Petname} from '@agoric/deploy-script-support/src/externalTypes.js' */
5
+ /**
6
+ * @import {Petname} from '@agoric/deploy-script-support/src/externalTypes.js';
7
+ * @import {Amount, Brand, Issuer, Payment, Purse} from '@agoric/ertp';
8
+ * @import {IssuerKeywordRecord, Keyword} from '@agoric/zoe';
9
+ */
6
10
 
7
11
  /**
8
12
  * @template T
@@ -13,6 +13,8 @@ import {
13
13
  /**
14
14
  * @import {BundleSource, BundleSourceResult} from '@endo/bundle-source';
15
15
  * @import {AgSoloHome, CanonicalHome, CommonHome, CoreEvalBuilder, CoreEvalDescriptor, ManifestBundleRef} from './externalTypes.js';
16
+ * @import {BundleMaker} from './getBundlerMaker.js';
17
+ * @import {Bundler} from './getBundlerMaker.js';
16
18
  */
17
19
 
18
20
  /**
@@ -40,8 +42,8 @@ import {
40
42
  * pathResolve: (path: string) => string,
41
43
  * }} endowments
42
44
  * @param {{
43
- * getBundlerMaker: () => Promise<import('./getBundlerMaker.js').BundleMaker>,
44
- * getBundleSpec: (bundle: Promise<BundleSourceResult<'endoZipBase64'>>, getBundle: () => import('./getBundlerMaker.js').Bundler, opts?: any) => Promise<ManifestBundleRef>,
45
+ * getBundlerMaker: () => Promise<BundleMaker>,
46
+ * getBundleSpec: (bundle: Promise<BundleSourceResult<'endoZipBase64'>>, getBundle: () => Bundler, opts?: any) => Promise<ManifestBundleRef>,
45
47
  * log?: typeof console.log,
46
48
  * writeFile?: typeof fs.promises.writeFile
47
49
  * }} io
@@ -60,7 +62,7 @@ export const makeWriteCoreEval = (
60
62
  const { bundleSource, pathResolve } = endowments;
61
63
 
62
64
  let bundlerCache;
63
- /** @returns {import('./getBundlerMaker.js').Bundler} */
65
+ /** @returns {Bundler} */
64
66
  const getBundler = () => {
65
67
  if (!bundlerCache) {
66
68
  bundlerCache = E(getBundlerMaker()).makeBundler({