agoric 0.21.2-other-dev-8f8782b.0 → 0.21.2-other-dev-fbe72e7.0.fbe72e7

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.
Files changed (44) hide show
  1. package/README.md +0 -73
  2. package/package.json +60 -43
  3. package/src/anylogger-agoric.js +31 -16
  4. package/src/bin-agops.js +8 -12
  5. package/src/chain-config.js +42 -16
  6. package/src/commands/auction.js +22 -19
  7. package/src/commands/gov.js +475 -0
  8. package/src/commands/inter.js +44 -62
  9. package/src/commands/oracle.js +144 -87
  10. package/src/commands/perf.js +20 -16
  11. package/src/commands/psm.js +29 -26
  12. package/src/commands/reserve.js +13 -6
  13. package/src/commands/test-upgrade.js +15 -8
  14. package/src/commands/vaults.js +31 -18
  15. package/src/commands/wallet.js +121 -48
  16. package/src/cosmos.js +3 -3
  17. package/src/deploy.js +10 -5
  18. package/src/entrypoint.js +2 -5
  19. package/src/follow.js +14 -10
  20. package/src/helpers.js +10 -5
  21. package/src/init.js +2 -9
  22. package/src/install.js +18 -25
  23. package/src/lib/bundles.js +102 -0
  24. package/src/lib/chain.js +71 -35
  25. package/src/lib/format.js +28 -34
  26. package/src/lib/index.js +7 -0
  27. package/src/lib/packageManager.js +24 -0
  28. package/src/lib/wallet.js +44 -144
  29. package/src/main-publish.js +2 -3
  30. package/src/main.js +95 -125
  31. package/src/open.js +8 -10
  32. package/src/publish.js +4 -9
  33. package/src/scripts.js +14 -32
  34. package/src/sdk-package-names.js +22 -9
  35. package/src/set-defaults.js +2 -1
  36. package/src/start.js +59 -68
  37. package/tools/getting-started.js +272 -0
  38. package/tools/resm-plugin/deploy.js +18 -0
  39. package/tools/resm-plugin/package.json +12 -0
  40. package/tools/resm-plugin/src/output.js +1 -0
  41. package/tools/resm-plugin/src/plugin.js +17 -0
  42. package/CHANGELOG.md +0 -1069
  43. package/src/commands/ec.js +0 -314
  44. package/src/lib/rpc.js +0 -272
package/README.md CHANGED
@@ -2,79 +2,6 @@
2
2
 
3
3
  If you just want to use the Agoric CLI for your own smart contract, please see the [Getting Started website](https://agoric.com/documentation/getting-started/) for information.
4
4
 
5
- ## Relaying via IBC
6
-
7
- The CLI integrates support for the [Confio
8
- ts-relayer](https://github.com/confio/ts-relayer#quick-start) via the
9
- `agoric ibc-setup` and `agoric ibc-relayer` commands.
10
-
11
- Run `agoric start --reset -v local-chain` in a project directory. In the
12
- meantime, you can configure the relayer (note that `--registry-from .` means to use `./registry.yaml`):
13
-
14
- ```console
15
- $ agoric ibc-setup init --registry-from . --src local --dest ollinet
16
- ...
17
- $ agoric ibc-setup keys list
18
- ollinet: agoric1fwk40de0xu7gtlk8z858q2f5lfcqv33ml8qdg4
19
- local: agoric1rvyry6jqmcrrm4ay9tu23rer7que8kdj4206zk
20
- $
21
- ```
22
-
23
- Once your chain has booted, send some `uist` tokens to your `local` relayer
24
- account printed above:
25
-
26
- ```console
27
- $ agd --home=_agstate/keys tx --keyring-backend=test bank send provision agoric1rvyry6jqmcrrm4ay9tu23rer7que8kdj4206zk 20000000uist --from=provision --chain-id=agoriclocal --yes
28
- ...
29
- $
30
- ```
31
-
32
- Go to https://ollinet.faucet.agoric.net and fund your `ollinet` relayer account
33
- printed above with BLD/IBC toy tokens.
34
-
35
- Check your relayer balances. Both `local` and `ollinet` relayer accounts should
36
- show `ubld` and `uist`:
37
-
38
- ```console
39
- $ agoric ibc-setup balances
40
- CHAIN AMOUNT
41
- ollinet 74972124ubld
42
- local 20000000uist
43
- $
44
- ```
45
-
46
- Create an ICS-20 fungible token transfer channel:
47
-
48
- ```console
49
- $ agoric ibc-setup ics20 -v
50
- ...
51
- Created channel:
52
- agoriclocal: transfer/channel-0 (connection-0)
53
- agoricollinet-55: transfer/channel-33 (connection-12)
54
- $
55
- ```
56
-
57
- Now that the channel exists, you can relay packets along it just by using:
58
-
59
- ```console
60
- $ agoric ibc-relayer start -v --poll 15
61
- ```
62
-
63
- Leave this running in the background, and use the above `transfer/channel-0` or
64
- `transfer/channel-33` to send tokens back and forth. The following
65
- example uses the `tx ibc-transfer transfer` command, and then
66
- `transfer channel-0` to indicate the `transfer/channel-0` portID/channelID. It really wants you to know this is about token *transfer*.
67
-
68
- ```console
69
- $ agd --home=_agstate/keys tx ibc-transfer transfer --keyring-backend=test \
70
- transfer channel-0 \
71
- agoric1fwk40de0xu7gtlk8z858q2f5lfcqv33ml8qdg4 200uist \
72
- --from=provision --chain-id=agoriclocal --yes
73
- ...
74
- # Watch the ibc-relayer send a packet and its acknowledgement, then...
75
- $ agd query bank balances agoric1rvyry6jqmcrrm4ay9tu23rer7que8kdj4206zk
76
- ```
77
-
78
5
  ## Developing Agoric CLI
79
6
 
80
7
  **NOTE: these steps are only for modifying the Agoric CLI. See the above for using it to create your own smart contracts.**
package/package.json CHANGED
@@ -1,69 +1,80 @@
1
1
  {
2
2
  "name": "agoric",
3
- "version": "0.21.2-other-dev-8f8782b.0+8f8782b",
3
+ "version": "0.21.2-other-dev-fbe72e7.0.fbe72e7",
4
4
  "description": "Manage the Agoric Javascript smart contract platform",
5
5
  "type": "module",
6
6
  "main": "src/main.js",
7
7
  "bin": {
8
- "agoric": "src/entrypoint.js",
9
- "agops": "src/bin-agops.js"
8
+ "agops": "src/bin-agops.js",
9
+ "agoric": "src/entrypoint.js"
10
+ },
11
+ "exports": {
12
+ "./src/entrypoint.js": "./src/entrypoint.js",
13
+ "./src/helpers.js": "./src/helpers.js",
14
+ "./src/lib/index.js": "./src/lib/index.js"
10
15
  },
11
16
  "files": [
12
17
  "src",
18
+ "tools",
13
19
  "exported.js"
14
20
  ],
15
21
  "scripts": {
16
22
  "build": "node ./scripts/get-sdk-package-names.js > src/sdk-package-names.js",
17
23
  "test": "ava",
18
- "test:c8": "c8 $C8_OPTIONS ava --config=ava-nesm.config.js",
24
+ "test:c8": "c8 --all ${C8_OPTIONS:-} ava",
19
25
  "test:xs": "exit 0",
20
26
  "integration-test": "ava --config .ava-integration-test.config.js",
21
27
  "lint-fix": "yarn lint:eslint --fix",
22
- "lint": "run-s --continue-on-error lint:*",
23
- "lint:types": "tsc -p jsconfig.json",
24
- "lint:eslint": "eslint ."
28
+ "lint": "yarn run -T run-s --continue-on-error 'lint:*'",
29
+ "lint:types": "yarn run -T tsc",
30
+ "lint:eslint": "yarn run -T eslint ."
25
31
  },
26
32
  "devDependencies": {
27
- "@agoric/deploy-script-support": "0.10.4-other-dev-8f8782b.0+8f8782b",
28
- "ava": "^5.2.0",
29
- "c8": "^7.13.0",
30
- "dd-trace": "^3.3.0"
33
+ "@agoric/cosmic-swingset": "0.41.4-other-dev-fbe72e7.0.fbe72e7",
34
+ "@agoric/deploy-script-support": "0.10.4-other-dev-fbe72e7.0.fbe72e7",
35
+ "ava": "^5.3.0",
36
+ "c8": "^10.1.2"
31
37
  },
32
38
  "dependencies": {
33
- "@agoric/access-token": "0.4.22-other-dev-8f8782b.0+8f8782b",
34
- "@agoric/assert": "0.6.1-other-dev-8f8782b.0+8f8782b",
35
- "@agoric/cache": "0.3.3-other-dev-8f8782b.0+8f8782b",
36
- "@agoric/casting": "0.4.3-other-dev-8f8782b.0+8f8782b",
37
- "@agoric/cosmic-proto": "0.3.1-other-dev-8f8782b.0+8f8782b",
38
- "@agoric/ertp": "0.16.3-other-dev-8f8782b.0+8f8782b",
39
- "@agoric/inter-protocol": "0.16.2-other-dev-8f8782b.0+8f8782b",
40
- "@agoric/internal": "0.3.3-other-dev-8f8782b.0+8f8782b",
41
- "@agoric/smart-wallet": "0.5.4-other-dev-8f8782b.0+8f8782b",
42
- "@agoric/store": "0.9.3-other-dev-8f8782b.0+8f8782b",
43
- "@agoric/swingset-vat": "0.32.3-other-dev-8f8782b.0+8f8782b",
44
- "@agoric/vats": "0.15.2-other-dev-8f8782b.0+8f8782b",
45
- "@agoric/zoe": "0.26.3-other-dev-8f8782b.0+8f8782b",
46
- "@agoric/zone": "0.2.3-other-dev-8f8782b.0+8f8782b",
47
- "@confio/relayer": "^0.9.0",
48
- "@cosmjs/crypto": "^0.30.1",
49
- "@cosmjs/encoding": "^0.30.1",
50
- "@cosmjs/math": "^0.30.1",
51
- "@cosmjs/proto-signing": "^0.30.1",
52
- "@cosmjs/stargate": "^0.30.1",
53
- "@endo/bundle-source": "2.5.2-upstream-rollup",
54
- "@endo/captp": "3.1.1",
55
- "@endo/compartment-mapper": "0.8.4",
56
- "@endo/far": "0.2.18",
57
- "@endo/init": "0.5.56",
58
- "@endo/marshal": "0.8.5",
59
- "@endo/nat": "4.1.27",
60
- "@endo/promise-kit": "0.2.56",
39
+ "@agoric/access-token": "0.4.22-other-dev-fbe72e7.0.fbe72e7",
40
+ "@agoric/cache": "0.3.3-other-dev-fbe72e7.0.fbe72e7",
41
+ "@agoric/casting": "0.4.3-other-dev-fbe72e7.0.fbe72e7",
42
+ "@agoric/client-utils": "0.1.1-other-dev-fbe72e7.0.fbe72e7",
43
+ "@agoric/cosmic-proto": "0.4.1-other-dev-fbe72e7.0.fbe72e7",
44
+ "@agoric/ertp": "0.16.3-other-dev-fbe72e7.0.fbe72e7",
45
+ "@agoric/governance": "0.10.4-other-dev-fbe72e7.0.fbe72e7",
46
+ "@agoric/inter-protocol": "0.16.2-other-dev-fbe72e7.0.fbe72e7",
47
+ "@agoric/internal": "0.3.3-other-dev-fbe72e7.0.fbe72e7",
48
+ "@agoric/network": "0.1.1-other-dev-fbe72e7.0.fbe72e7",
49
+ "@agoric/smart-wallet": "0.5.4-other-dev-fbe72e7.0.fbe72e7",
50
+ "@agoric/store": "0.9.3-other-dev-fbe72e7.0.fbe72e7",
51
+ "@agoric/swingset-vat": "0.32.3-other-dev-fbe72e7.0.fbe72e7",
52
+ "@agoric/vats": "0.15.2-other-dev-fbe72e7.0.fbe72e7",
53
+ "@agoric/zoe": "0.26.3-other-dev-fbe72e7.0.fbe72e7",
54
+ "@agoric/zone": "0.2.3-other-dev-fbe72e7.0.fbe72e7",
55
+ "@cosmjs/crypto": "^0.36.0",
56
+ "@cosmjs/encoding": "^0.36.0",
57
+ "@cosmjs/math": "^0.36.0",
58
+ "@cosmjs/proto-signing": "^0.36.0",
59
+ "@cosmjs/stargate": "^0.36.0",
60
+ "@endo/base64": "^1.0.12",
61
+ "@endo/bundle-source": "^4.1.2",
62
+ "@endo/captp": "^4.4.8",
63
+ "@endo/compartment-mapper": "^1.6.3",
64
+ "@endo/env-options": "^1.1.11",
65
+ "@endo/errors": "^1.2.13",
66
+ "@endo/far": "^1.1.14",
67
+ "@endo/init": "^1.1.12",
68
+ "@endo/marshal": "^1.8.0",
69
+ "@endo/nat": "^5.1.3",
70
+ "@endo/patterns": "^1.7.0",
71
+ "@endo/promise-kit": "^1.1.13",
72
+ "@endo/zip": "^1.0.11",
61
73
  "@iarna/toml": "^2.2.3",
62
74
  "anylogger": "^0.21.0",
63
75
  "chalk": "^5.2.0",
64
- "commander": "^10.0.0",
76
+ "commander": "^12.1.0",
65
77
  "deterministic-json": "^1.0.5",
66
- "esm": "agoric-labs/esm#Agoric-built",
67
78
  "inquirer": "^8.2.2",
68
79
  "opener": "^1.5.2",
69
80
  "tmp": "^0.2.1",
@@ -82,10 +93,16 @@
82
93
  "homepage": "https://github.com/Agoric/agoric-sdk#readme",
83
94
  "ava": {
84
95
  "files": [
85
- "test/**/test-*.js"
96
+ "test/**/*.test.*"
86
97
  ],
87
98
  "timeout": "2m",
88
99
  "workerThreads": false
89
100
  },
90
- "gitHead": "8f8782bc52393e9d4fc82523ecf31cab429b11b3"
101
+ "typeCoverage": {
102
+ "atLeast": 79.88
103
+ },
104
+ "engines": {
105
+ "node": "^20.9 || ^22.11"
106
+ },
107
+ "gitHead": "fbe72e72107f9997f788674e668c660d92ec4492"
91
108
  }
@@ -1,31 +1,46 @@
1
- /* global process */
1
+ /* eslint-env node */
2
+ import {
3
+ getEnvironmentOption,
4
+ getEnvironmentOptionsList,
5
+ } from '@endo/env-options';
2
6
  import anylogger from 'anylogger';
3
7
  import chalk from 'chalk';
4
8
 
5
- // Turn on debugging output with DEBUG=agoric
6
- const { DEBUG } = process.env;
7
- let selectedLevel = 'info';
8
- if (DEBUG === undefined) {
9
- selectedLevel = 'log';
10
- } else if (DEBUG.includes('agoric')) {
11
- selectedLevel = 'debug';
9
+ const DEBUG_LIST = getEnvironmentOptionsList('DEBUG');
10
+
11
+ // Turn on debugging output with DEBUG=agoric or DEBUG=agoric:${level}
12
+ let selectedLevel =
13
+ DEBUG_LIST.length || getEnvironmentOption('DEBUG', 'unset') === 'unset'
14
+ ? 'log'
15
+ : 'info';
16
+ for (const level of DEBUG_LIST) {
17
+ const parts = level.split(':');
18
+ if (parts[0] !== 'agoric') {
19
+ continue;
20
+ }
21
+ if (parts.length > 1) {
22
+ selectedLevel = parts[1];
23
+ } else {
24
+ selectedLevel = 'debug';
25
+ }
12
26
  }
13
- const defaultLevel = anylogger.levels[selectedLevel];
27
+ const selectedCode = anylogger.levels[selectedLevel];
28
+ const globalCode = selectedCode === undefined ? -Infinity : selectedCode;
14
29
 
15
30
  const oldExt = anylogger.ext;
16
- anylogger.ext = (l, o) => {
17
- l = oldExt(l, o);
18
- l.enabledFor = lvl => defaultLevel >= anylogger.levels[lvl];
31
+ anylogger.ext = (l, ...rest) => {
32
+ l = oldExt(l, ...rest);
33
+ l.enabledFor = lvl => globalCode >= anylogger.levels[lvl];
19
34
 
20
35
  const prefix = l.name.replace(/:/g, ': ');
21
36
  for (const [level, code] of Object.entries(anylogger.levels)) {
22
- if (code > defaultLevel) {
23
- // Disable printing.
24
- l[level] = () => {};
25
- } else {
37
+ if (globalCode >= code) {
26
38
  // Enable the printing with a prefix.
27
39
  const doLog = l[level] || (() => {});
28
40
  l[level] = (...args) => doLog(chalk.bold.blue(`${prefix}:`), ...args);
41
+ } else {
42
+ // Disable printing.
43
+ l[level] = () => {};
29
44
  }
30
45
  }
31
46
  return l;
package/src/bin-agops.js CHANGED
@@ -1,13 +1,11 @@
1
1
  #!/usr/bin/env node
2
+ /* eslint-env node */
2
3
  // @ts-check
3
4
  // @jessie-check
4
5
 
5
- /* eslint-disable @jessie.js/no-nested-await */
6
- /* global fetch, setTimeout */
7
-
8
- import '@agoric/casting/node-fetch-shim.js';
9
6
  import '@endo/init';
10
- import '@endo/init/pre.js';
7
+
8
+ import { E } from '@endo/far';
11
9
 
12
10
  import { execFileSync } from 'child_process';
13
11
  import path from 'path';
@@ -15,7 +13,7 @@ import process from 'process';
15
13
  import anylogger from 'anylogger';
16
14
  import { Command, CommanderError, createCommand } from 'commander';
17
15
  import { makeOracleCommand } from './commands/oracle.js';
18
- import { makeEconomicCommiteeCommand } from './commands/ec.js';
16
+ import { makeGovCommand } from './commands/gov.js';
19
17
  import { makePsmCommand } from './commands/psm.js';
20
18
  import { makeReserveCommand } from './commands/reserve.js';
21
19
  import { makeVaultsCommand } from './commands/vaults.js';
@@ -30,8 +28,7 @@ const progname = path.basename(process.argv[1]);
30
28
  const program = new Command();
31
29
  program.name(progname).version('unversioned');
32
30
 
33
- program.addCommand(makeOracleCommand(logger));
34
- program.addCommand(makeEconomicCommiteeCommand(logger));
31
+ program.addCommand(makeGovCommand(logger));
35
32
  program.addCommand(makePerfCommand(logger));
36
33
  program.addCommand(makePsmCommand(logger));
37
34
  program.addCommand(makeVaultsCommand(logger));
@@ -69,18 +66,17 @@ const procIO = {
69
66
  setTimeout,
70
67
  };
71
68
 
69
+ program.addCommand(makeOracleCommand(procIO, logger));
72
70
  program.addCommand(makeReserveCommand(logger, procIO));
73
71
  program.addCommand(makeAuctionCommand(logger, { ...procIO, fetch }));
74
72
  program.addCommand(makeInterCommand(procIO, { fetch }));
75
73
  program.addCommand(makeTestCommand(procIO, { fetch }));
76
74
 
77
- try {
78
- await program.parseAsync(process.argv);
79
- } catch (err) {
75
+ void E.when(program.parseAsync(process.argv), undefined, err => {
80
76
  if (err instanceof CommanderError) {
81
77
  console.error(err.message);
82
78
  } else {
83
79
  console.error(err); // CRASH! show stack trace
84
80
  }
85
81
  process.exit(1);
86
- }
82
+ });
@@ -1,5 +1,6 @@
1
1
  import djson from 'deterministic-json';
2
2
  import TOML from '@iarna/toml';
3
+ import * as Tokens from '@agoric/internal/src/tokens.js';
3
4
 
4
5
  export const STAKING_MAX_VALIDATORS = 150;
5
6
  // Required for IBC connections not to time out.
@@ -13,38 +14,38 @@ export const ICA_HOST_ALLOW_MESSAGES = [
13
14
  ];
14
15
 
15
16
  const Stake = /** @type {const} */ ({
16
- name: 'Agoric Staking Token',
17
+ name: Tokens.Stake.proposedName,
17
18
  description: 'The token used by delegates to stake on the Agoric chain',
18
19
  denom_units: [
19
20
  {
20
- denom: 'ubld',
21
+ denom: Tokens.Stake.denom,
21
22
  exponent: 0,
22
23
  },
23
24
  {
24
25
  denom: 'bld',
25
- exponent: 6,
26
+ exponent: Tokens.Stake.displayInfo.decimalPlaces,
26
27
  },
27
28
  ],
28
- base: 'ubld',
29
+ base: Tokens.Stake.denom,
29
30
  display: 'bld',
30
- symbol: 'BLD',
31
+ symbol: Tokens.Stake.symbol,
31
32
  });
32
33
  const Stable = /** @type {const} */ ({
33
- name: 'Agoric stable token',
34
+ name: Tokens.Stable.proposedName,
34
35
  description: 'The stable token used by the Agoric chain',
35
36
  denom_units: [
36
37
  {
37
- denom: 'uist',
38
+ denom: Tokens.Stable.denom,
38
39
  exponent: 0,
39
40
  },
40
41
  {
41
42
  denom: 'ist',
42
- exponent: 6,
43
+ exponent: Tokens.Stable.displayInfo.decimalPlaces,
43
44
  },
44
45
  ],
45
- base: 'uist',
46
+ base: Tokens.Stable.denom,
46
47
  display: 'ist',
47
- symbol: 'IST',
48
+ symbol: Tokens.Stable.symbol,
48
49
  });
49
50
  export const DENOM_METADATA = /** @type {const} */ ([Stake, Stable]);
50
51
 
@@ -80,7 +81,12 @@ export const DEFAULT_RPC_PORT = 26657;
80
81
  export const DEFAULT_PROM_PORT = 26660;
81
82
  export const DEFAULT_API_PORT = 1317;
82
83
 
83
- // 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
+ */
84
90
  export function finishCosmosApp({
85
91
  appToml,
86
92
  enableCors,
@@ -91,6 +97,8 @@ export function finishCosmosApp({
91
97
  rosettaPort = `${DEFAULT_ROSETTA_PORT}`,
92
98
  }) {
93
99
  const rpcPort = Number(portNum);
100
+ // TODO: Use an accurate narrow type.
101
+ /** @type {Record<string, any>} */
94
102
  const app = TOML.parse(appToml);
95
103
 
96
104
  if (enableCors) {
@@ -124,6 +132,7 @@ export function finishCosmosApp({
124
132
 
125
133
  // Optionally enable the rosetta service
126
134
  if (enableRosetta) {
135
+ app.rosetta ||= {};
127
136
  app.rosetta.enable = enableRosetta;
128
137
  app.rosetta.network = chainId;
129
138
  app.rosetta.retries = 30;
@@ -137,7 +146,12 @@ export function finishCosmosApp({
137
146
  return TOML.stringify(app);
138
147
  }
139
148
 
140
- // Rewrite the config.toml.
149
+ /**
150
+ * Rewrite the config.toml.
151
+ *
152
+ * @param {{ configToml: string, enableCors?: boolean, exportMetrics?: boolean, portNum?: string, persistentPeers?: string, seeds?: string, unconditionalPeerIds?: string }} input
153
+ * @returns {string} toml
154
+ */
141
155
  export function finishTendermintConfig({
142
156
  configToml,
143
157
  enableCors,
@@ -150,6 +164,8 @@ export function finishTendermintConfig({
150
164
  const rpcPort = Number(portNum);
151
165
 
152
166
  // Adjust the config.toml.
167
+ // TODO: Use an accurate narrow type.
168
+ /** @type {Record<string, any>} */
153
169
  const config = TOML.parse(configToml);
154
170
 
155
171
  config.proxy_app = 'kvstore';
@@ -188,7 +204,12 @@ export function finishTendermintConfig({
188
204
  return TOML.stringify(config);
189
205
  }
190
206
 
191
- // Rewrite/import the genesis.json.
207
+ /**
208
+ * Rewrite/import the genesis.json.
209
+ *
210
+ * @param {{ genesisJson: string, exportedGenesisJson?: string }} input
211
+ * @returns {string} json
212
+ */
192
213
  export function finishCosmosGenesis({ genesisJson, exportedGenesisJson }) {
193
214
  const genesis = JSON.parse(genesisJson);
194
215
  const exported = exportedGenesisJson ? JSON.parse(exportedGenesisJson) : {};
@@ -235,9 +256,14 @@ export function finishCosmosGenesis({ genesisJson, exportedGenesisJson }) {
235
256
 
236
257
  // Set the denomination for different modules.
237
258
  genesis.app_state.mint.params.mint_denom = MINT_DENOM;
238
- genesis.app_state.crisis.constant_fee.denom = MINT_DENOM;
239
- genesis.app_state.gov.deposit_params.min_deposit = GOV_DEPOSIT_COINS;
240
- genesis.app_state.gov.voting_params.voting_period = GOV_VOTING_PERIOD;
259
+
260
+ {
261
+ const gov = genesis.app_state.gov;
262
+ const depositParams = gov.params ?? gov.deposit_params;
263
+ const votingParams = gov.params ?? gov.voting_params;
264
+ depositParams.min_deposit = GOV_DEPOSIT_COINS;
265
+ votingParams.voting_period = GOV_VOTING_PERIOD;
266
+ }
241
267
 
242
268
  // Reduce the cost of a transaction.
243
269
  genesis.app_state.auth.params.tx_size_cost_per_byte = '1';
@@ -1,14 +1,21 @@
1
- /* eslint-disable @jessie.js/no-nested-await */
2
1
  // @ts-check
3
- /* eslint-disable func-names */
2
+ /* eslint-env node */
3
+ import {
4
+ fetchEnvNetworkConfig,
5
+ makeAgoricNames,
6
+ makeVstorageKit,
7
+ } from '@agoric/client-utils';
8
+ import { Fail } from '@endo/errors';
4
9
  import { InvalidArgumentError } from 'commander';
5
- import { makeRpcUtils } from '../lib/rpc.js';
6
10
  import { outputActionAndHint } from '../lib/wallet.js';
7
11
 
8
- const { Fail } = assert;
12
+ /**
13
+ * @import {ParamTypesMap, ParamTypesMapFromRecord} from '@agoric/governance/src/contractGovernance/typedParamManager.js'
14
+ * @import {AuctionParamRecord} from '@agoric/inter-protocol/src/auction/params.js';
15
+ * @import {ParamValueForType} from '@agoric/governance/src/types.js'
16
+ */
9
17
 
10
- /** @typedef {import('@agoric/governance/src/contractGovernance/typedParamManager.js').ParamTypesMap} ParamTypesMap */
11
- /** @template M @typedef {import('@agoric/governance/src/contractGovernance/typedParamManager.js').ParamTypesMapFromRecord<M>} ParamTypesMapFromRecord */
18
+ const networkConfig = await fetchEnvNetworkConfig({ env: process.env, fetch });
12
19
 
13
20
  /**
14
21
  * @template {ParamTypesMap} M
@@ -17,7 +24,6 @@ const { Fail } = assert;
17
24
  * }} ParamValues
18
25
  */
19
26
 
20
- /** @typedef {ReturnType<import('@agoric/inter-protocol/src/auction/params.js').makeAuctioneerParams>} AuctionParamRecord */
21
27
  /** @typedef {ParamValues<ParamTypesMapFromRecord<AuctionParamRecord>>} AuctionParams */
22
28
 
23
29
  /**
@@ -59,11 +65,6 @@ export const makeAuctionCommand = (
59
65
  'descending clock step size',
60
66
  BigInt,
61
67
  )
62
- .option(
63
- '--discount-step <integer>',
64
- 'proposed value (basis points)',
65
- BigInt,
66
- )
67
68
  .requiredOption(
68
69
  '--charterAcceptOfferId <string>',
69
70
  'offer that had continuing invitation result',
@@ -91,13 +92,13 @@ export const makeAuctionCommand = (
91
92
  * }} opts
92
93
  */
93
94
  async opts => {
94
- const { agoricNames, readLatestHead } = await makeRpcUtils({ fetch });
95
-
96
- /** @type {{ current: AuctionParamRecord }} */
97
- // @ts-expect-error XXX should runtime check?
98
- const { current } = await readLatestHead(
99
- `published.auction.governance`,
95
+ const { readPublished, ...vsk } = makeVstorageKit(
96
+ { fetch },
97
+ networkConfig,
100
98
  );
99
+ const agoricNames = await makeAgoricNames(vsk.fromBoard, vsk.vstorage);
100
+
101
+ const { current } = await readPublished(`auction.governance`);
101
102
 
102
103
  const {
103
104
  AuctionStartDelay: {
@@ -111,7 +112,7 @@ export const makeAuctionCommand = (
111
112
  * but TimeMath.toRel prodocues a RelativeTime (which may be a bare bigint).
112
113
  *
113
114
  * @param {bigint} relValue
114
- * @returns {import('@agoric/time/src/types').RelativeTimeRecord}
115
+ * @returns {import('@agoric/time').RelativeTimeRecord}
115
116
  */
116
117
  const toRel = relValue => ({ timerBrand, relValue });
117
118
 
@@ -130,6 +131,8 @@ export const makeAuctionCommand = (
130
131
  };
131
132
 
132
133
  if (Object.keys(params).length === 0) {
134
+ // InvalidArgumentError is a class constructor, and so
135
+ // must be invoked with `new`.
133
136
  throw new InvalidArgumentError(`no parameters given`);
134
137
  }
135
138