@agoric/deploy-script-support 0.10.4-u18.5 → 0.10.4-u19.0

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,6 +1,6 @@
1
1
  {
2
2
  "name": "@agoric/deploy-script-support",
3
- "version": "0.10.4-u18.5",
3
+ "version": "0.10.4-u19.0",
4
4
  "description": "Helpers and other support for writing deploy scripts",
5
5
  "type": "module",
6
6
  "main": "src/helpers.js",
@@ -34,27 +34,27 @@
34
34
  },
35
35
  "homepage": "https://github.com/Agoric/agoric-sdk#readme",
36
36
  "dependencies": {
37
- "@agoric/ertp": "^0.16.3-u18.1",
38
- "@agoric/import-manager": "^0.3.12-u18.1",
39
- "@agoric/internal": "^0.4.0-u18.1",
40
- "@agoric/notifier": "^0.7.0-u18.1",
41
- "@agoric/store": "^0.9.3-u18.1",
42
- "@agoric/time": "^0.3.3-u18.1",
43
- "@agoric/zoe": "^0.26.3-u18.1",
37
+ "@agoric/ertp": "^0.16.3-u19.0",
38
+ "@agoric/import-manager": "^0.3.12-u19.0",
39
+ "@agoric/internal": "^0.4.0-u19.0",
40
+ "@agoric/notifier": "^0.7.0-u19.0",
41
+ "@agoric/store": "^0.9.3-u19.0",
42
+ "@agoric/time": "^0.3.3-u19.0",
43
+ "@agoric/zoe": "^0.27.0-u19.0",
44
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",
45
+ "@endo/bundle-source": "^3.5.1",
46
+ "@endo/errors": "^1.2.9",
47
+ "@endo/far": "^1.1.10",
48
+ "@endo/marshal": "^1.6.3",
49
+ "@endo/nat": "^5.0.14",
50
+ "@endo/promise-kit": "^1.1.9",
51
51
  "@endo/zip": "^1.0.9"
52
52
  },
53
53
  "devDependencies": {
54
- "@agoric/vats": "^0.16.0-u18.5",
55
- "@endo/init": "^1.1.7",
54
+ "@agoric/vats": "^0.16.0-u19.0",
55
+ "@endo/init": "^1.1.8",
56
56
  "ava": "^5.3.0",
57
- "import-meta-resolve": "^2.2.1"
57
+ "import-meta-resolve": "^4.1.0"
58
58
  },
59
59
  "files": [
60
60
  "src",
@@ -74,5 +74,5 @@
74
74
  "typeCoverage": {
75
75
  "atLeast": 83.71
76
76
  },
77
- "gitHead": "f8c45b8a2e29a51522a81a6692af25b2d7f6b50f"
77
+ "gitHead": "29e9704c375a06bb617027093b30d2d25faa6471"
78
78
  }
package/src/helpers.js CHANGED
@@ -20,6 +20,7 @@ import { installInPieces } from './installInPieces.js';
20
20
  import { makeWriteCoreEval } from './writeCoreEvalParts.js';
21
21
 
22
22
  export * from '@agoric/internal/src/node/createBundles.js';
23
+ export { parseScriptArgs } from './parseCoreEvalArgs.js';
23
24
 
24
25
  // These are also hard-coded in lib-wallet.js.
25
26
  // TODO: Add methods to the wallet to access these without hard-coding
@@ -0,0 +1,36 @@
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 {import('./externalTypes.js').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
+ console.log(`${name}`, variantOrConfig);
16
+
17
+ const Usage = `agoric run ${name}.js ${[...knownVariants, '<json-config>'].join(' | ')}`;
18
+ const opts = {};
19
+
20
+ if (typeof variantOrConfig === 'string') {
21
+ if (variantOrConfig[0] === '{') {
22
+ try {
23
+ opts.config = JSON.parse(variantOrConfig);
24
+ } catch (err) {
25
+ throw Error(`Failed to parse config argument ${variantOrConfig}`);
26
+ }
27
+ } else {
28
+ opts.variant = variantOrConfig;
29
+ }
30
+ } else {
31
+ console.error(Usage);
32
+ throw Error(Usage);
33
+ }
34
+
35
+ return opts;
36
+ };