agoric 0.21.2-dev-b2a7540.0 → 0.21.2-dev-be80150.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agoric",
3
- "version": "0.21.2-dev-b2a7540.0+b2a7540",
3
+ "version": "0.21.2-dev-be80150.0+be80150",
4
4
  "description": "Manage the Agoric Javascript smart contract platform",
5
5
  "type": "module",
6
6
  "main": "src/main.js",
@@ -29,29 +29,29 @@
29
29
  "lint:eslint": "eslint ."
30
30
  },
31
31
  "devDependencies": {
32
- "@agoric/cosmic-swingset": "0.41.4-dev-b2a7540.0+b2a7540",
33
- "@agoric/deploy-script-support": "0.10.4-dev-b2a7540.0+b2a7540",
32
+ "@agoric/cosmic-swingset": "0.41.4-dev-be80150.0+be80150",
33
+ "@agoric/deploy-script-support": "0.10.4-dev-be80150.0+be80150",
34
34
  "ava": "^5.3.0",
35
35
  "c8": "^9.1.0",
36
36
  "dd-trace": "^4.11.1"
37
37
  },
38
38
  "dependencies": {
39
- "@agoric/access-token": "0.4.22-dev-b2a7540.0+b2a7540",
40
- "@agoric/cache": "0.3.3-dev-b2a7540.0+b2a7540",
41
- "@agoric/casting": "0.4.3-dev-b2a7540.0+b2a7540",
42
- "@agoric/client-utils": "0.1.1-dev-b2a7540.0+b2a7540",
43
- "@agoric/cosmic-proto": "0.4.1-dev-b2a7540.0+b2a7540",
44
- "@agoric/ertp": "0.16.3-dev-b2a7540.0+b2a7540",
45
- "@agoric/governance": "0.10.4-dev-b2a7540.0+b2a7540",
46
- "@agoric/inter-protocol": "0.16.2-dev-b2a7540.0+b2a7540",
47
- "@agoric/internal": "0.3.3-dev-b2a7540.0+b2a7540",
48
- "@agoric/network": "0.1.1-dev-b2a7540.0+b2a7540",
49
- "@agoric/smart-wallet": "0.5.4-dev-b2a7540.0+b2a7540",
50
- "@agoric/store": "0.9.3-dev-b2a7540.0+b2a7540",
51
- "@agoric/swingset-vat": "0.32.3-dev-b2a7540.0+b2a7540",
52
- "@agoric/vats": "0.15.2-dev-b2a7540.0+b2a7540",
53
- "@agoric/zoe": "0.26.3-dev-b2a7540.0+b2a7540",
54
- "@agoric/zone": "0.2.3-dev-b2a7540.0+b2a7540",
39
+ "@agoric/access-token": "0.4.22-dev-be80150.0+be80150",
40
+ "@agoric/cache": "0.3.3-dev-be80150.0+be80150",
41
+ "@agoric/casting": "0.4.3-dev-be80150.0+be80150",
42
+ "@agoric/client-utils": "0.1.1-dev-be80150.0+be80150",
43
+ "@agoric/cosmic-proto": "0.4.1-dev-be80150.0+be80150",
44
+ "@agoric/ertp": "0.16.3-dev-be80150.0+be80150",
45
+ "@agoric/governance": "0.10.4-dev-be80150.0+be80150",
46
+ "@agoric/inter-protocol": "0.16.2-dev-be80150.0+be80150",
47
+ "@agoric/internal": "0.3.3-dev-be80150.0+be80150",
48
+ "@agoric/network": "0.1.1-dev-be80150.0+be80150",
49
+ "@agoric/smart-wallet": "0.5.4-dev-be80150.0+be80150",
50
+ "@agoric/store": "0.9.3-dev-be80150.0+be80150",
51
+ "@agoric/swingset-vat": "0.32.3-dev-be80150.0+be80150",
52
+ "@agoric/vats": "0.15.2-dev-be80150.0+be80150",
53
+ "@agoric/zoe": "0.26.3-dev-be80150.0+be80150",
54
+ "@agoric/zone": "0.2.3-dev-be80150.0+be80150",
55
55
  "@confio/relayer": "^0.11.3",
56
56
  "@cosmjs/crypto": "^0.32.3",
57
57
  "@cosmjs/encoding": "^0.32.3",
@@ -102,5 +102,5 @@
102
102
  "typeCoverage": {
103
103
  "atLeast": 77.54
104
104
  },
105
- "gitHead": "b2a754093f7e01728e43ba8842c3e44f8fdd20bd"
105
+ "gitHead": "be80150703656129f98a892d4704270b60c78ad2"
106
106
  }
@@ -28,8 +28,8 @@ const selectedCode = anylogger.levels[selectedLevel];
28
28
  const globalCode = selectedCode === undefined ? -Infinity : selectedCode;
29
29
 
30
30
  const oldExt = anylogger.ext;
31
- anylogger.ext = (l, o) => {
32
- l = oldExt(l, o);
31
+ anylogger.ext = (l, ...rest) => {
32
+ l = oldExt(l, ...rest);
33
33
  l.enabledFor = lvl => globalCode >= anylogger.levels[lvl];
34
34
 
35
35
  const prefix = l.name.replace(/:/g, ': ');
@@ -81,7 +81,12 @@ export const DEFAULT_RPC_PORT = 26657;
81
81
  export const DEFAULT_PROM_PORT = 26660;
82
82
  export const DEFAULT_API_PORT = 1317;
83
83
 
84
- // Rewrite the app.toml.
84
+ /**
85
+ * Rewrite the app.toml.
86
+ *
87
+ * @param {{ appToml: string, enableCors?: boolean, exportMetrics?: boolean, portNum?: string, chainId?: string, enableRosetta?: boolean, rosettaPort?: string }} input
88
+ * @returns {string} toml
89
+ */
85
90
  export function finishCosmosApp({
86
91
  appToml,
87
92
  enableCors,
@@ -92,6 +97,8 @@ export function finishCosmosApp({
92
97
  rosettaPort = `${DEFAULT_ROSETTA_PORT}`,
93
98
  }) {
94
99
  const rpcPort = Number(portNum);
100
+ // TODO: Use an accurate narrow type.
101
+ /** @type {Record<string, any>} */
95
102
  const app = TOML.parse(appToml);
96
103
 
97
104
  if (enableCors) {
@@ -138,7 +145,12 @@ export function finishCosmosApp({
138
145
  return TOML.stringify(app);
139
146
  }
140
147
 
141
- // Rewrite the config.toml.
148
+ /**
149
+ * Rewrite the config.toml.
150
+ *
151
+ * @param {{ configToml: string, enableCors?: boolean, exportMetrics?: boolean, portNum?: string, persistentPeers?: string, seeds?: string, unconditionalPeerIds?: string }} input
152
+ * @returns {string} toml
153
+ */
142
154
  export function finishTendermintConfig({
143
155
  configToml,
144
156
  enableCors,
@@ -151,6 +163,8 @@ export function finishTendermintConfig({
151
163
  const rpcPort = Number(portNum);
152
164
 
153
165
  // Adjust the config.toml.
166
+ // TODO: Use an accurate narrow type.
167
+ /** @type {Record<string, any>} */
154
168
  const config = TOML.parse(configToml);
155
169
 
156
170
  config.proxy_app = 'kvstore';
@@ -189,7 +203,12 @@ export function finishTendermintConfig({
189
203
  return TOML.stringify(config);
190
204
  }
191
205
 
192
- // Rewrite/import the genesis.json.
206
+ /**
207
+ * Rewrite/import the genesis.json.
208
+ *
209
+ * @param {{ genesisJson: string, exportedGenesisJson?: string }} input
210
+ * @returns {string} json
211
+ */
193
212
  export function finishCosmosGenesis({ genesisJson, exportedGenesisJson }) {
194
213
  const genesis = JSON.parse(genesisJson);
195
214
  const exported = exportedGenesisJson ? JSON.parse(exportedGenesisJson) : {};
@@ -175,7 +175,9 @@ export const makeWalletCommand = async command => {
175
175
  keyring: { home, backend },
176
176
  from,
177
177
  gas:
178
- gas === 'auto' ? ['auto', parseFiniteNumber(gasAdjustment)] : gas,
178
+ gas === 'auto'
179
+ ? ['auto', parseFiniteNumber(gasAdjustment)]
180
+ : parseFiniteNumber(gas),
179
181
  dryRun,
180
182
  verbose,
181
183
  },
package/src/cosmos.js CHANGED
@@ -50,7 +50,7 @@ export default async function cosmosMain(progname, rawArgs, powers, opts) {
50
50
  },
51
51
  );
52
52
  // Ensure the build doesn't mess up stdout.
53
- ps.childProcess.stdout.pipe(process.stderr);
53
+ ps.childProcess.stdout?.pipe(process.stderr);
54
54
  return ps;
55
55
  }
56
56
  throw e;
package/src/helpers.js CHANGED
@@ -42,12 +42,12 @@ export const makePspawn = ({
42
42
  *
43
43
  * @param {string} cmd command name to run
44
44
  * @param {Array<string>} cargs arguments to the command
45
- * @param {object} param2
46
- * @param {string} [param2.cwd]
47
- * @param {string | [string, string, string]} [param2.stdio] standard IO
45
+ * @param {object} [opts]
46
+ * @param {string} [opts.cwd]
47
+ * @param {string | [string, string, string]} [opts.stdio] standard IO
48
48
  * specification
49
- * @param {Record<string, string | undefined>} [param2.env] environment
50
- * @param {boolean} [param2.detached] whether the child process should be detached
49
+ * @param {Record<string, string | undefined>} [opts.env] environment
50
+ * @param {boolean} [opts.detached] whether the child process should be detached
51
51
  * @returns {Promise<number> & { childProcess: ChildProcess }}} promise for
52
52
  * exit status. The return result has a `childProcess` property to obtain
53
53
  * control over the running process
package/src/install.js CHANGED
@@ -37,7 +37,7 @@ export default async function installMain(progname, rawArgs, powers, opts) {
37
37
  stdio: ['inherit', 'pipe', 'inherit'],
38
38
  });
39
39
  const stdout = [];
40
- p.childProcess.stdout.on('data', out => stdout.push(out));
40
+ p.childProcess.stdout?.on('data', out => stdout.push(out));
41
41
  await p;
42
42
  const d = JSON.parse(Buffer.concat(stdout).toString('utf-8'));
43
43
  for (const [name, { location }] of Object.entries(d)) {
@@ -49,7 +49,7 @@ export default async function installMain(progname, rawArgs, powers, opts) {
49
49
  let subdirs;
50
50
  const workTrees = ['.'];
51
51
  let sdkWorktree;
52
- /** @type {Map<string, string>} */
52
+ /** @type {Map<string, string | null>} */
53
53
  const sdkPackageToPath = new Map();
54
54
  const linkFolder = path.resolve(`_agstate/yarn-links`);
55
55
  const linkFlags = [];
@@ -170,7 +170,7 @@ export default async function installMain(progname, rawArgs, powers, opts) {
170
170
  .then(results => {
171
171
  // After all have settled, throw any errors.
172
172
  const failures = results.filter(
173
- ({ status }) => status !== 'fulfilled',
173
+ result => result.status !== 'fulfilled',
174
174
  );
175
175
  if (failures.length) {
176
176
  throw AggregateError(
@@ -284,6 +284,10 @@ export default async function installMain(progname, rawArgs, powers, opts) {
284
284
  // Create symlinks to the SDK packages.
285
285
  await Promise.all(
286
286
  [...sdkPackageToPath.entries()].map(async ([pjName, dir]) => {
287
+ if (typeof dir !== 'string') {
288
+ throw Error(`unexpected incomplete package mapping: ${pjName}`);
289
+ }
290
+
287
291
  const SUBOPTIMAL = false;
288
292
  await null;
289
293
  if (SUBOPTIMAL) {
@@ -301,7 +305,7 @@ export default async function installMain(progname, rawArgs, powers, opts) {
301
305
  log('linking', linkName);
302
306
  return fs
303
307
  .mkdir(linkDir, { recursive: true })
304
- .then(_ => fs.symlink(path.relative(linkDir, dir), linkName));
308
+ .then(() => fs.symlink(path.relative(linkDir, dir), linkName));
305
309
  }),
306
310
  );
307
311
 
@@ -1,5 +1,9 @@
1
1
  import { NonNullish } from '@agoric/internal';
2
2
 
3
+ /**
4
+ * @import {MinimalNetworkConfig} from '@agoric/client-utils';
5
+ */
6
+
3
7
  export const networkConfigUrl = agoricNetSubdomain =>
4
8
  `https://${agoricNetSubdomain}.agoric.net/network-config`;
5
9
  export const rpcUrl = agoricNetSubdomain =>
package/src/main.js CHANGED
@@ -66,7 +66,9 @@ const main = async (progname, rawArgs, powers) => {
66
66
  'verbosity that can be increased',
67
67
  (_value, _previous) => (cmdOpts.verbose += 1),
68
68
  );
69
- const baseCmd = (...args) => addCmdOpts(program.command(...args));
69
+ /** @type {typeof program.command} */
70
+ const baseCmd = (nameAndParams, ...rest) =>
71
+ addCmdOpts(program.command(nameAndParams, ...rest));
70
72
 
71
73
  addCmdOpts(
72
74
  program
package/src/scripts.js CHANGED
@@ -56,7 +56,7 @@ export const makeLookup =
56
56
 
57
57
  /**
58
58
  * @param {string[]} scripts
59
- * @param {{ allowUnsafePlugins: boolean, progname: string, rawArgs: string[], endowments?: Record<string, any> }} opts
59
+ * @param {{ allowUnsafePlugins?: boolean, progname: string, rawArgs: string[], endowments?: Record<string, any> }} opts
60
60
  * @param {{ fs: import('fs/promises'), console: Console }} powers
61
61
  */
62
62
  export const makeScriptLoader =
package/src/start.js CHANGED
@@ -276,13 +276,13 @@ export default async function startMain(progname, rawArgs, powers, opts) {
276
276
  await rmVerbose(serverDir);
277
277
  }
278
278
 
279
+ /** @type {(args: string[], spawnOpts?: Parameters<typeof pspawn>[2], dockerArgs?: string[]) => ReturnType<pspawn>} */
279
280
  let chainSpawn;
280
281
  if (!popts.dockerTag) {
281
- chainSpawn = (args, spawnOpts = undefined) => {
282
- return pspawn(cosmosChain, [...args, `--home=${serverDir}`], spawnOpts);
283
- };
282
+ chainSpawn = (args, spawnOpts) =>
283
+ pspawn(cosmosChain, [...args, `--home=${serverDir}`], spawnOpts);
284
284
  } else {
285
- chainSpawn = (args, spawnOpts = undefined, dockerArgs = []) =>
285
+ chainSpawn = (args, spawnOpts, dockerArgs = []) =>
286
286
  pspawn(
287
287
  'docker',
288
288
  [
@@ -482,12 +482,12 @@ export default async function startMain(progname, rawArgs, powers, opts) {
482
482
  await rmVerbose(serverDir);
483
483
  }
484
484
 
485
+ /** @type {(args: string[], spawnOpts?: Parameters<typeof pspawn>[2], dockerArgs?: string[]) => ReturnType<pspawn>} */
485
486
  let soloSpawn;
486
487
  if (!popts.dockerTag) {
487
- soloSpawn = (args, spawnOpts = undefined) =>
488
- pspawn(agSolo, args, spawnOpts);
488
+ soloSpawn = (args, spawnOpts) => pspawn(agSolo, args, spawnOpts);
489
489
  } else {
490
- soloSpawn = (args, spawnOpts = undefined, dockerArgs = []) =>
490
+ soloSpawn = (args, spawnOpts, dockerArgs = []) =>
491
491
  pspawn(
492
492
  'docker',
493
493
  [