@agoric/builders 0.2.0-u20.0 → 0.2.0-u21.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/CHANGELOG.md CHANGED
@@ -3,7 +3,7 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
- ## 0.2.0-u20.0 (2025-04-16)
6
+ ## 0.2.0-u21.0 (2025-06-19)
7
7
 
8
8
 
9
9
  ### ⚠ BREAKING CHANGES
@@ -17,9 +17,11 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
17
17
  * smartWallet verstion 2 with watchedPromises ([5ed5107](https://github.com/Agoric/agoric-sdk/commit/5ed51078d39e643d91b572d9c50fad4a276d7ded))
18
18
  * `ForwardOpts` accepts `intermediateRecipient` ([eb975f1](https://github.com/Agoric/agoric-sdk/commit/eb975f1df1587bc9307b27c20b7b236cc7fe386e))
19
19
  * `ForwardOptsShape` ([50b1717](https://github.com/Agoric/agoric-sdk/commit/50b1717c1e40ed67a5e69810961ad8d0144c5f9e))
20
+ * `IcaAccountKit` accepts `relativeTimeoutNs` opt for outgoing tx packets ([57b4bde](https://github.com/Agoric/agoric-sdk/commit/57b4bdea6b22202d4e58b82b1ca6f94de660682a))
20
21
  * `update-fee-config` proposal ([5d8775c](https://github.com/Agoric/agoric-sdk/commit/5d8775c409896369a931e6d78ae1d7958ad9d901))
21
22
  * a proposal to upgrade scaledPriceAuthorities ([e5ed0ff](https://github.com/Agoric/agoric-sdk/commit/e5ed0ff6abcb83f52b32d49125e21e6e41923ed0))
22
23
  * add `bech32Prefix?: string` to `CosmosChainInfo` ([cb9e1ee](https://github.com/Agoric/agoric-sdk/commit/cb9e1eeab9295b44ec009b82d73c457299e8d6f4))
24
+ * add axelar gmp core-eval and bootstrap tests ([e0d7ef8](https://github.com/Agoric/agoric-sdk/commit/e0d7ef82f1fc4ea42c6fc8ae7faaf5c74de8e36e))
23
25
  * add priceFeed for StkAtom ([6a861df](https://github.com/Agoric/agoric-sdk/commit/6a861dfa14f42b4547a24ba31175a3b1a74c97c1))
24
26
  * Add terminate-governed-instance.js proposal ([c2cb517](https://github.com/Agoric/agoric-sdk/commit/c2cb51779039ef2a5921efcc35b3b365a7b6159f)), closes [#10725](https://github.com/Agoric/agoric-sdk/issues/10725) [#10861](https://github.com/Agoric/agoric-sdk/issues/10861)
25
27
  * add transfer method to CosmosOrchestrationAccount ([b1fdde1](https://github.com/Agoric/agoric-sdk/commit/b1fdde18b33237d1a2ea6f02938d998f55ce4d01))
@@ -39,6 +41,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
39
41
  * chain-capabilities.js constants ([52ff70a](https://github.com/Agoric/agoric-sdk/commit/52ff70a187df1fadc89ccc506228bc6d0ca48da6))
40
42
  * **chainHub:** register and retrieve non-cosmos chains ([bd11be2](https://github.com/Agoric/agoric-sdk/commit/bd11be25656ad0dd9ea4ad18c85f74a11ef2e520))
41
43
  * coreEval to update priceFeeds, auction, and vaultManager ([fd91f78](https://github.com/Agoric/agoric-sdk/commit/fd91f781ad721033d67485d1732272af0c689ae7))
44
+ * **cosmos:** add Reserve withdrawal upgrade ([9e97cbd](https://github.com/Agoric/agoric-sdk/commit/9e97cbd7438e3df5aec96091d18ecdcde720978b))
42
45
  * **cosmos:** upgrade IBC vat for next release ([c994490](https://github.com/Agoric/agoric-sdk/commit/c99449081560480e7e2dd6fc069b12dbcc630370))
43
46
  * examples/auto-stake-it.contract.js ([b87ecba](https://github.com/Agoric/agoric-sdk/commit/b87ecba0ea41f1397dbd513d8e4c541f1299fd3f)), closes [#9042](https://github.com/Agoric/agoric-sdk/issues/9042)
44
47
  * export `DenomDetailShape` ([2dfddb3](https://github.com/Agoric/agoric-sdk/commit/2dfddb3fb2018d769b1acc1b32f4ff3b4c7f67b7))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agoric/builders",
3
- "version": "0.2.0-u20.0",
3
+ "version": "0.2.0-u21.0",
4
4
  "description": "Build scripts for proposals to an Agoric chain",
5
5
  "type": "module",
6
6
  "main": "./index.js",
@@ -10,26 +10,26 @@
10
10
  "build:add-STARS-proposal": "echo This command has been deprecated. Please run this instead: agoric run scripts/inter-protocol/add-STARS.js",
11
11
  "build:restart-vats-proposal": "echo This command has been deprecated. Please run this instead: agoric run scripts/vats/restart-vats.js",
12
12
  "build:zcf-proposal": "echo This command has been deprecated. Please run this instead: agoric run scripts/vats/replace-zoe.js",
13
- "prepack": "tsc --build tsconfig.build.json",
13
+ "prepack": "yarn run -T tsc --build tsconfig.build.json",
14
14
  "postpack": "git clean -f '*.d.ts*' '*.tsbuildinfo'",
15
15
  "test": "ava",
16
16
  "test:xs": "exit 0",
17
17
  "lint-fix": "yarn lint:eslint --fix",
18
- "lint": "run-s --continue-on-error lint:*",
19
- "lint:types": "tsc",
20
- "lint:eslint": "eslint ."
18
+ "lint": "yarn run -T run-s --continue-on-error 'lint:*'",
19
+ "lint:types": "yarn run -T tsc",
20
+ "lint:eslint": "yarn run -T eslint ."
21
21
  },
22
22
  "keywords": [],
23
23
  "author": "Agoric",
24
24
  "license": "Apache-2.0",
25
25
  "dependencies": {
26
- "@agoric/ertp": "^0.16.3-u20.0",
27
- "@agoric/internal": "^0.4.0-u20.0",
28
- "@agoric/notifier": "^0.7.0-u20.0",
29
- "@agoric/smart-wallet": "^0.5.4-u20.0",
30
- "@agoric/vat-data": "^0.5.3-u20.0",
31
- "@agoric/vats": "^0.16.0-u20.0",
32
- "@agoric/zoe": "^0.27.0-u20.0",
26
+ "@agoric/ertp": "workspace:*",
27
+ "@agoric/internal": "workspace:*",
28
+ "@agoric/notifier": "workspace:*",
29
+ "@agoric/smart-wallet": "workspace:*",
30
+ "@agoric/vat-data": "workspace:*",
31
+ "@agoric/vats": "workspace:*",
32
+ "@agoric/zoe": "workspace:*",
33
33
  "@endo/bundle-source": "^4.0.0",
34
34
  "@endo/captp": "^4.4.5",
35
35
  "@endo/eventual-send": "^1.3.1",
@@ -42,17 +42,17 @@
42
42
  "import-meta-resolve": "^4.1.0"
43
43
  },
44
44
  "devDependencies": {
45
- "@agoric/deploy-script-support": "^0.10.4-u20.0",
46
- "@agoric/governance": "^0.10.4-u20.0",
47
- "@agoric/inter-protocol": "^0.17.0-u20.0",
48
- "@agoric/orchestration": "^0.2.0-u20.0",
49
- "@agoric/store": "^0.9.3-u20.0",
50
- "@agoric/swing-store": "^0.10.0-u20.0",
51
- "@agoric/swingset-liveslots": "^0.10.3-u20.0",
52
- "@agoric/time": "^0.3.3-u20.0",
45
+ "@agoric/deploy-script-support": "workspace:*",
46
+ "@agoric/governance": "workspace:*",
47
+ "@agoric/inter-protocol": "workspace:*",
48
+ "@agoric/orchestration": "workspace:*",
49
+ "@agoric/store": "workspace:*",
50
+ "@agoric/swing-store": "workspace:*",
51
+ "@agoric/swingset-liveslots": "workspace:*",
52
+ "@agoric/time": "workspace:*",
53
53
  "@endo/errors": "^1.2.10",
54
54
  "ava": "^5.3.0",
55
- "c8": "^10.1.2"
55
+ "c8": "^10.1.3"
56
56
  },
57
57
  "files": [
58
58
  "CHANGELOG.md",
@@ -67,7 +67,7 @@
67
67
  "access": "public"
68
68
  },
69
69
  "engines": {
70
- "node": "^18.12 || ^20.9"
70
+ "node": "^20.9 || ^22.11"
71
71
  },
72
72
  "ava": {
73
73
  "files": [
@@ -80,7 +80,7 @@
80
80
  "workerThreads": false
81
81
  },
82
82
  "typeCoverage": {
83
- "atLeast": 91.55
83
+ "atLeast": 90.62
84
84
  },
85
- "gitHead": "8e4207fa19dabf76c1f91f8779b5b5b93570ecea"
85
+ "gitHead": "e4dd46857133403d584bcf822a81817b355532f9"
86
86
  }
@@ -0,0 +1,74 @@
1
+ import { execFileSync } from 'node:child_process';
2
+ import { makeHelpers } from '@agoric/deploy-script-support';
3
+ import { parseArgs } from 'node:util';
4
+ import {
5
+ getManifest,
6
+ startAxelarGmp,
7
+ } from '@agoric/orchestration/src/proposals/start-axelar-gmp.js';
8
+ import { assetInfo } from '@agoric/orchestration/src/utils/axelar-static-config.js';
9
+ import { getChainConfig } from './get-chain-config.js';
10
+
11
+ /** @typedef {{ net?: string, peer?: string[] }} PeerChainOpts */
12
+
13
+ /**
14
+ * @import {CoreEvalBuilder} from '@agoric/deploy-script-support/src/externalTypes.js';
15
+ */
16
+
17
+ /** @type {CoreEvalBuilder} */
18
+ export const defaultProposalBuilder = async (
19
+ { publishRef, install },
20
+ options,
21
+ ) =>
22
+ harden({
23
+ sourceSpec: '@agoric/orchestration/src/proposals/start-axelar-gmp.js',
24
+ getManifestCall: [
25
+ getManifest.name,
26
+ {
27
+ installationRef: publishRef(
28
+ install('@agoric/orchestration/dist/axelar-gmp.contract.bundle.js'),
29
+ ),
30
+ options,
31
+ },
32
+ ],
33
+ });
34
+
35
+ /** @type {import('@agoric/deploy-script-support/src/externalTypes.js').DeployScriptFunction} */
36
+ export default async (homeP, endowments) => {
37
+ const { scriptArgs } = endowments;
38
+
39
+ /** @type {import('node:util').ParseArgsConfig['options']} */
40
+ const options = {
41
+ net: {
42
+ type: 'string',
43
+ },
44
+ peer: { type: 'string', multiple: true },
45
+ };
46
+
47
+ /** @type {{ values: PeerChainOpts }} */
48
+ const { values: flags } = parseArgs({ args: scriptArgs, options });
49
+
50
+ const parseAssetInfo = () => {
51
+ if (typeof assetInfo !== 'string') return undefined;
52
+ return JSON.parse(assetInfo);
53
+ };
54
+
55
+ if (!flags.net) throw Error('--net required');
56
+ if (!flags.peer) throw Error('--peer required');
57
+
58
+ const chainDetails = await getChainConfig({
59
+ net: flags.net,
60
+ peers: flags.peer,
61
+ execFileSync,
62
+ });
63
+
64
+ const opts = harden({
65
+ chainInfo: chainDetails,
66
+ assetInfo: parseAssetInfo(),
67
+ });
68
+
69
+ const { writeCoreEval } = await makeHelpers(homeP, endowments);
70
+
71
+ await writeCoreEval(startAxelarGmp.name, utils =>
72
+ defaultProposalBuilder(utils, opts),
73
+ );
74
+ };
@@ -0,0 +1,117 @@
1
+ import { IBCConnectionInfoShape } from '@agoric/orchestration/src/typeGuards.js';
2
+ import { mustMatch } from '@endo/patterns';
3
+ import { makeAgd } from '@agoric/orchestration/src/utils/agd-lib.js';
4
+ import { networkConfigs } from '@agoric/orchestration/src/utils/gmp.js';
5
+ import * as childProcess from 'node:child_process';
6
+ import fetchedChainInfo from '@agoric/orchestration/src/fetched-chain-info.js';
7
+
8
+ /**
9
+ * @import {IBCChannelID, IBCConnectionID} from '@agoric/vats';
10
+ * @import {CosmosChainInfo, IBCConnectionInfo} from '@agoric/orchestration'
11
+ */
12
+
13
+ /** @param {string[]} strs */
14
+ const parsePeers = strs => {
15
+ /** @type {[name: string, conn: IBCConnectionID, chan: IBCChannelID, denom:string][]} */
16
+ // @ts-expect-error XXX ID syntax should be dynamically checked
17
+ const peerParts = strs.map(s => s.split(':'));
18
+ const badPeers = peerParts.filter(d => d.length !== 4);
19
+ if (badPeers.length) {
20
+ throw Error(
21
+ `peers must be name:connection-X:channel-Y:denom, not ${badPeers.join(', ')}`,
22
+ );
23
+ }
24
+ return peerParts;
25
+ };
26
+
27
+ /**
28
+ * Get the IBC chain configuration based on the provided network and peer inputs.
29
+ *
30
+ * @param {object} args - The arguments object.
31
+ * @param {string} args.net - The network name (e.g., 'emerynet').
32
+ * @param {string[]} args.peers - The peers to connect .
33
+ * @param {childProcess.execFileSync} [args.execFileSync] - Optional execFileSync function.
34
+ * @returns {Promise<Record<string, CosmosChainInfo>>} A promise that resolves to the chain configuration details keyed by chain name.
35
+ */
36
+
37
+ export const getChainConfig = async ({
38
+ net,
39
+ peers,
40
+ execFileSync = childProcess.execFileSync,
41
+ }) => {
42
+ await null;
43
+
44
+ if (net === 'bootstrap') {
45
+ return {
46
+ agoric: fetchedChainInfo.agoric,
47
+ axelar: fetchedChainInfo.axelar,
48
+ };
49
+ }
50
+
51
+ /** @type {Record<string, CosmosChainInfo>} */
52
+ const chainDetails = {};
53
+
54
+ /** @type {Record<string, IBCConnectionInfo>} */
55
+ const connections = {};
56
+ const portId = 'transfer';
57
+
58
+ const { chainId, rpc } = networkConfigs[net];
59
+ const agd = makeAgd({ execFileSync }).withOpts({ rpcAddrs: [rpc] });
60
+
61
+ for (const [peerName, myConn, myChan, denom] of parsePeers(peers)) {
62
+ console.debug(peerName, { denom });
63
+ const connInfo = await agd
64
+ .query(['ibc', 'connection', 'end', myConn])
65
+ .then(x => x.connection);
66
+ const { client_id: clientId } = connInfo;
67
+ const clientState = await agd
68
+ .query(['ibc', 'client', 'state', clientId])
69
+ .then(x => x.client_state);
70
+ const { chain_id: peerId } = clientState;
71
+ console.debug(peerName, { chainId: peerId, denom });
72
+ chainDetails[peerName] = {
73
+ namespace: 'cosmos',
74
+ reference: peerId,
75
+ chainId: peerId,
76
+ stakingTokens: [{ denom }],
77
+ bech32Prefix: peerName,
78
+ };
79
+
80
+ const chan = await agd
81
+ .query(['ibc', 'channel', 'end', portId, myChan])
82
+ .then(r => r.channel);
83
+
84
+ /** @type {IBCConnectionInfo} */
85
+ const info = harden({
86
+ client_id: clientId,
87
+ counterparty: {
88
+ client_id: connInfo.counterparty.client_id,
89
+ connection_id: connInfo.counterparty.connection_id,
90
+ },
91
+ id: myConn,
92
+ state: connInfo.state,
93
+ transferChannel: {
94
+ channelId: myChan,
95
+ counterPartyChannelId: chan.counterparty.channel_id,
96
+ counterPartyPortId: chan.counterparty.port_id,
97
+ ordering: chan.ordering,
98
+ portId,
99
+ state: chan.state,
100
+ version: chan.version,
101
+ },
102
+ });
103
+ mustMatch(info, IBCConnectionInfoShape);
104
+ connections[peerId] = info;
105
+ }
106
+
107
+ chainDetails.agoric = {
108
+ namespace: 'cosmos',
109
+ reference: chainId,
110
+ chainId,
111
+ stakingTokens: [{ denom: 'ubld' }],
112
+ connections,
113
+ bech32Prefix: 'agoric',
114
+ };
115
+
116
+ return chainDetails;
117
+ };
@@ -0,0 +1,46 @@
1
+ /**
2
+ * @import {DeployScriptEndownments} from '@agoric/deploy-script-support/src/externalTypes.js';
3
+ * @import {CosmosChainInfo, Denom, DenomDetail} from '@agoric/orchestration';
4
+ * @import {ParseArgsConfig} from 'node:util'
5
+ */
6
+
7
+ /**
8
+ * Parse `chainInfo` and `assetInfo` into builder opts
9
+ *
10
+ * NOTE: Ambient authority via `node:util`
11
+ *
12
+ * @param {DeployScriptEndownments['scriptArgs']} scriptArgs
13
+ * @returns {Promise<{
14
+ * chainInfo: Record<string, CosmosChainInfo>;
15
+ * assetInfo: [Denom, DenomDetail & { brandKey?: string }][];
16
+ * }>}
17
+ */
18
+ export const parseChainHubOpts = async scriptArgs => {
19
+ // import dynamically so the modules can work in CoreEval environment
20
+ const { parseArgs } = await import('node:util');
21
+
22
+ /** @type {ParseArgsConfig['options']} */
23
+ const parserOpts = {
24
+ chainInfo: { type: 'string' },
25
+ assetInfo: { type: 'string' },
26
+ };
27
+ const {
28
+ values: { chainInfo, assetInfo },
29
+ } = parseArgs({
30
+ args: scriptArgs,
31
+ options: parserOpts,
32
+ });
33
+
34
+ const parseChainInfo = () => {
35
+ if (typeof chainInfo !== 'string') return undefined;
36
+ return JSON.parse(chainInfo);
37
+ };
38
+ const parseAssetInfo = () => {
39
+ if (typeof assetInfo !== 'string') return undefined;
40
+ return JSON.parse(assetInfo);
41
+ };
42
+ return harden({
43
+ chainInfo: parseChainInfo(),
44
+ assetInfo: parseAssetInfo(),
45
+ });
46
+ };
@@ -1,16 +1,6 @@
1
1
  import { makeHelpers } from '@agoric/deploy-script-support';
2
2
  import { startBasicFlows } from '@agoric/orchestration/src/proposals/start-basic-flows.js';
3
- import { parseArgs } from 'node:util';
4
-
5
- /**
6
- * @import {ParseArgsConfig} from 'node:util'
7
- */
8
-
9
- /** @type {ParseArgsConfig['options']} */
10
- const parserOpts = {
11
- chainInfo: { type: 'string' },
12
- assetInfo: { type: 'string' },
13
- };
3
+ import { parseChainHubOpts } from './helpers.js';
14
4
 
15
5
  /** @type {import('@agoric/deploy-script-support/src/externalTypes.js').CoreEvalBuilder} */
16
6
  export const defaultProposalBuilder = async (
@@ -38,29 +28,8 @@ export const defaultProposalBuilder = async (
38
28
  /** @type {import('@agoric/deploy-script-support/src/externalTypes.js').DeployScriptFunction} */
39
29
  export default async (homeP, endowments) => {
40
30
  const { scriptArgs } = endowments;
41
-
42
- const {
43
- values: { chainInfo, assetInfo },
44
- } = parseArgs({
45
- args: scriptArgs,
46
- options: parserOpts,
47
- });
48
-
49
- const parseChainInfo = () => {
50
- if (typeof chainInfo !== 'string') return undefined;
51
- return JSON.parse(chainInfo);
52
- };
53
- const parseAssetInfo = () => {
54
- if (typeof assetInfo !== 'string') return undefined;
55
- return JSON.parse(assetInfo);
56
- };
57
- const opts = harden({
58
- chainInfo: parseChainInfo(),
59
- assetInfo: parseAssetInfo(),
60
- });
61
-
31
+ const opts = parseChainHubOpts(scriptArgs);
62
32
  const { writeCoreEval } = await makeHelpers(homeP, endowments);
63
-
64
33
  await writeCoreEval(startBasicFlows.name, utils =>
65
34
  defaultProposalBuilder(utils, opts),
66
35
  );
@@ -1,7 +1,11 @@
1
1
  import { makeHelpers } from '@agoric/deploy-script-support';
2
+ import { parseChainHubOpts } from './helpers.js';
2
3
 
3
4
  /** @type {import('@agoric/deploy-script-support/src/externalTypes.js').CoreEvalBuilder} */
4
- export const defaultProposalBuilder = async ({ publishRef, install }) => {
5
+ export const defaultProposalBuilder = async (
6
+ { publishRef, install },
7
+ options,
8
+ ) => {
5
9
  return harden({
6
10
  sourceSpec: '@agoric/orchestration/src/proposals/start-stakeAtom.js',
7
11
  getManifestCall: [
@@ -12,6 +16,7 @@ export const defaultProposalBuilder = async ({ publishRef, install }) => {
12
16
  install('@agoric/orchestration/src/examples/stake-ica.contract.js'),
13
17
  ),
14
18
  },
19
+ options,
15
20
  },
16
21
  ],
17
22
  });
@@ -19,6 +24,10 @@ export const defaultProposalBuilder = async ({ publishRef, install }) => {
19
24
 
20
25
  /** @type {import('@agoric/deploy-script-support/src/externalTypes.js').DeployScriptFunction} */
21
26
  export default async (homeP, endowments) => {
27
+ const { scriptArgs } = endowments;
28
+ const opts = parseChainHubOpts(scriptArgs);
22
29
  const { writeCoreEval } = await makeHelpers(homeP, endowments);
23
- await writeCoreEval('start-stakeAtom', defaultProposalBuilder);
30
+ await writeCoreEval('start-stakeAtom', utils =>
31
+ defaultProposalBuilder(utils, opts),
32
+ );
24
33
  };
@@ -1,7 +1,11 @@
1
1
  import { makeHelpers } from '@agoric/deploy-script-support';
2
+ import { parseChainHubOpts } from './helpers.js';
2
3
 
3
4
  /** @type {import('@agoric/deploy-script-support/src/externalTypes.js').CoreEvalBuilder} */
4
- export const defaultProposalBuilder = async ({ publishRef, install }) => {
5
+ export const defaultProposalBuilder = async (
6
+ { publishRef, install },
7
+ options,
8
+ ) => {
5
9
  return harden({
6
10
  sourceSpec: '@agoric/orchestration/src/proposals/start-stakeOsmo.js',
7
11
  getManifestCall: [
@@ -12,6 +16,7 @@ export const defaultProposalBuilder = async ({ publishRef, install }) => {
12
16
  install('@agoric/orchestration/src/examples/stake-ica.contract.js'),
13
17
  ),
14
18
  },
19
+ options,
15
20
  },
16
21
  ],
17
22
  });
@@ -19,6 +24,10 @@ export const defaultProposalBuilder = async ({ publishRef, install }) => {
19
24
 
20
25
  /** @type {import('@agoric/deploy-script-support/src/externalTypes.js').DeployScriptFunction} */
21
26
  export default async (homeP, endowments) => {
27
+ const { scriptArgs } = endowments;
28
+ const opts = parseChainHubOpts(scriptArgs);
22
29
  const { writeCoreEval } = await makeHelpers(homeP, endowments);
23
- await writeCoreEval('start-stakeOsmo', defaultProposalBuilder);
30
+ await writeCoreEval('start-stakeOsmo', utils =>
31
+ defaultProposalBuilder(utils, opts),
32
+ );
24
33
  };
@@ -6,17 +6,7 @@
6
6
  */
7
7
  import { makeHelpers } from '@agoric/deploy-script-support';
8
8
  import { startAutoStakeIt } from '@agoric/orchestration/src/proposals/start-auto-stake-it.js';
9
- import { parseArgs } from 'node:util';
10
-
11
- /**
12
- * @import {ParseArgsConfig} from 'node:util'
13
- */
14
-
15
- /** @type {ParseArgsConfig['options']} */
16
- const parserOpts = {
17
- chainInfo: { type: 'string' },
18
- assetInfo: { type: 'string' },
19
- };
9
+ import { parseChainHubOpts } from '../orchestration/helpers.js';
20
10
 
21
11
  /** @type {import('@agoric/deploy-script-support/src/externalTypes.js').CoreEvalBuilder} */
22
12
  export const defaultProposalBuilder = async (
@@ -44,29 +34,8 @@ export const defaultProposalBuilder = async (
44
34
  /** @type {import('@agoric/deploy-script-support/src/externalTypes.js').DeployScriptFunction} */
45
35
  export default async (homeP, endowments) => {
46
36
  const { scriptArgs } = endowments;
47
-
48
- const {
49
- values: { chainInfo, assetInfo },
50
- } = parseArgs({
51
- args: scriptArgs,
52
- options: parserOpts,
53
- });
54
-
55
- const parseChainInfo = () => {
56
- if (typeof chainInfo !== 'string') return undefined;
57
- return JSON.parse(chainInfo);
58
- };
59
- const parseAssetInfo = () => {
60
- if (typeof assetInfo !== 'string') return undefined;
61
- return JSON.parse(assetInfo);
62
- };
63
- const opts = harden({
64
- chainInfo: parseChainInfo(),
65
- assetInfo: parseAssetInfo(),
66
- });
67
-
37
+ const opts = parseChainHubOpts(scriptArgs);
68
38
  const { writeCoreEval } = await makeHelpers(homeP, endowments);
69
-
70
39
  await writeCoreEval(startAutoStakeIt.name, utils =>
71
40
  defaultProposalBuilder(utils, opts),
72
41
  );
@@ -3,17 +3,7 @@ import {
3
3
  getManifest,
4
4
  startSendAnywhere,
5
5
  } from '@agoric/orchestration/src/proposals/start-send-anywhere.js';
6
- import { parseArgs } from 'node:util';
7
-
8
- /**
9
- * @import {ParseArgsConfig} from 'node:util'
10
- */
11
-
12
- /** @type {ParseArgsConfig['options']} */
13
- const parserOpts = {
14
- chainInfo: { type: 'string' },
15
- assetInfo: { type: 'string' },
16
- };
6
+ import { parseChainHubOpts } from '../orchestration/helpers.js';
17
7
 
18
8
  /** @type {import('@agoric/deploy-script-support/src/externalTypes.js').CoreEvalBuilder} */
19
9
  export const defaultProposalBuilder = async (
@@ -38,29 +28,8 @@ export const defaultProposalBuilder = async (
38
28
  /** @type {import('@agoric/deploy-script-support/src/externalTypes.js').DeployScriptFunction} */
39
29
  export default async (homeP, endowments) => {
40
30
  const { scriptArgs } = endowments;
41
-
42
- const {
43
- values: { chainInfo, assetInfo },
44
- } = parseArgs({
45
- args: scriptArgs,
46
- options: parserOpts,
47
- });
48
-
49
- const parseChainInfo = () => {
50
- if (typeof chainInfo !== 'string') return undefined;
51
- return JSON.parse(chainInfo);
52
- };
53
- const parseAssetInfo = () => {
54
- if (typeof assetInfo !== 'string') return undefined;
55
- return JSON.parse(assetInfo);
56
- };
57
- const opts = harden({
58
- chainInfo: parseChainInfo(),
59
- assetInfo: parseAssetInfo(),
60
- });
61
-
31
+ const opts = parseChainHubOpts(scriptArgs);
62
32
  const { writeCoreEval } = await makeHelpers(homeP, endowments);
63
-
64
33
  await writeCoreEval(startSendAnywhere.name, utils =>
65
34
  defaultProposalBuilder(utils, opts),
66
35
  );
@@ -0,0 +1,36 @@
1
+ import { makeHelpers } from '@agoric/deploy-script-support';
2
+ import {
3
+ getManifest,
4
+ startSwapAnything,
5
+ } from '@agoric/orchestration/src/proposals/start-swap-anything.js';
6
+ import { parseChainHubOpts } from '../orchestration/helpers.js';
7
+
8
+ /** @type {import('@agoric/deploy-script-support/src/externalTypes.js').CoreEvalBuilder} */
9
+ export const defaultProposalBuilder = async (
10
+ { publishRef, install },
11
+ options,
12
+ ) =>
13
+ harden({
14
+ sourceSpec: '@agoric/orchestration/src/proposals/start-swap-anything.js',
15
+ getManifestCall: [
16
+ getManifest.name,
17
+ {
18
+ installationRef: publishRef(
19
+ install(
20
+ '@agoric/orchestration/src/examples/swap-anything.contract.js',
21
+ ),
22
+ ),
23
+ options,
24
+ },
25
+ ],
26
+ });
27
+
28
+ /** @type {import('@agoric/deploy-script-support/src/externalTypes.js').DeployScriptFunction} */
29
+ export default async (homeP, endowments) => {
30
+ const { scriptArgs } = endowments;
31
+ const opts = parseChainHubOpts(scriptArgs);
32
+ const { writeCoreEval } = await makeHelpers(homeP, endowments);
33
+ await writeCoreEval(startSwapAnything.name, utils =>
34
+ defaultProposalBuilder(utils, opts),
35
+ );
36
+ };
@@ -0,0 +1,94 @@
1
+ /**
2
+ * @file This is for use in tests in a3p-integration
3
+ * Unlike most builder scripts, this one includes the proposal exports as well.
4
+ */
5
+ import {
6
+ deeplyFulfilledObject,
7
+ makeTracer,
8
+ NonNullish,
9
+ } from '@agoric/internal';
10
+ import { E } from '@endo/far';
11
+
12
+ /// <reference types="@agoric/vats/src/core/types-ambient"/>
13
+
14
+ const trace = makeTracer('StartAxelarGmp', true);
15
+
16
+ /**
17
+ * @import {start as StartFn} from '@agoric/orchestration/src/examples/axelar-gmp.contract.js';
18
+ */
19
+
20
+ /**
21
+ * @param {BootstrapPowers} powers
22
+ */
23
+ export const restartAxelarGmp = async ({
24
+ consume: {
25
+ agoricNames,
26
+ board,
27
+ chainStorage,
28
+ chainTimerService,
29
+ cosmosInterchainService,
30
+ localchain,
31
+ contractKits,
32
+ },
33
+ instance: instances,
34
+ }) => {
35
+ trace(restartAxelarGmp.name);
36
+
37
+ const marshaller = await E(board).getReadonlyMarshaller();
38
+ const privateArgs = await deeplyFulfilledObject(
39
+ harden({
40
+ agoricNames,
41
+ localchain,
42
+ marshaller,
43
+ orchestrationService: cosmosInterchainService,
44
+ storageNode: E(NonNullish(await chainStorage)).makeChildNode('axelarGmp'),
45
+ timerService: chainTimerService,
46
+ }),
47
+ );
48
+
49
+ // @ts-expect-error unknown instance
50
+ const instance = await instances.consume.axelarGmp;
51
+ trace('instance', instance);
52
+ /** @type {StartedInstanceKit<StartFn>} */
53
+ const kit = /** @type {any} */ (await E(contractKits).get(instance));
54
+
55
+ await E(kit.adminFacet).restartContract(privateArgs);
56
+ trace('done');
57
+ };
58
+ harden(restartAxelarGmp);
59
+
60
+ export const getManifest = () => {
61
+ return {
62
+ manifest: {
63
+ [restartAxelarGmp.name]: {
64
+ consume: {
65
+ agoricNames: true,
66
+ board: true,
67
+ chainTimerService: true,
68
+ chainStorage: true,
69
+ cosmosInterchainService: true,
70
+ localchain: true,
71
+ contractKits: true,
72
+ },
73
+ instance: {
74
+ consume: { axelarGmp: true },
75
+ },
76
+ },
77
+ },
78
+ };
79
+ };
80
+
81
+ /** @type {import('@agoric/deploy-script-support/src/externalTypes.js').CoreEvalBuilder} */
82
+ export const defaultProposalBuilder = async () =>
83
+ harden({
84
+ sourceSpec: '@agoric/builders/scripts/testing/restart-axelar-gmp.js',
85
+ getManifestCall: [getManifest.name],
86
+ });
87
+
88
+ /** @type {import('@agoric/deploy-script-support/src/externalTypes.js').DeployScriptFunction} */
89
+ export default async (homeP, endowments) => {
90
+ const dspModule = await import('@agoric/deploy-script-support');
91
+ const { makeHelpers } = dspModule;
92
+ const { writeCoreEval } = await makeHelpers(homeP, endowments);
93
+ await writeCoreEval(restartAxelarGmp.name, defaultProposalBuilder);
94
+ };
@@ -7,8 +7,10 @@
7
7
  import { deeplyFulfilledObject, makeTracer } from '@agoric/internal';
8
8
  import { makeStorageNodeChild } from '@agoric/internal/src/lib-chainStorage.js';
9
9
  import { E } from '@endo/far';
10
+ import { parseChainHubOpts } from '../orchestration/helpers.js';
10
11
 
11
12
  /**
13
+ * @import {CosmosChainInfo, Denom, DenomDetail} from '@agoric/orchestration';
12
14
  * @import {QueryFlowsSF as StartFn} from '@agoric/orchestration/src/fixtures/query-flows.contract.js';
13
15
  */
14
16
 
@@ -28,25 +30,34 @@ const trace = makeTracer(contractName, true);
28
30
  * };
29
31
  * };
30
32
  * }} powers
33
+ * @param {{
34
+ * options: {
35
+ * chainInfo: Record<string, CosmosChainInfo>;
36
+ * assetInfo: [Denom, DenomDetail & { brandKey?: string }][];
37
+ * };
38
+ * }} config
31
39
  */
32
- export const startQueryFlows = async ({
33
- consume: {
34
- agoricNames,
35
- board,
36
- chainStorage,
37
- chainTimerService,
38
- cosmosInterchainService,
39
- localchain,
40
- startUpgradable,
41
- },
42
- installation: {
43
- consume: { [contractName]: installation },
44
- },
45
- instance: {
46
- // @ts-expect-error unknown instance
47
- produce: { [contractName]: produceInstance },
40
+ export const startQueryFlows = async (
41
+ {
42
+ consume: {
43
+ agoricNames,
44
+ board,
45
+ chainStorage,
46
+ chainTimerService,
47
+ cosmosInterchainService,
48
+ localchain,
49
+ startUpgradable,
50
+ },
51
+ installation: {
52
+ consume: { [contractName]: installation },
53
+ },
54
+ instance: {
55
+ // @ts-expect-error unknown instance
56
+ produce: { [contractName]: produceInstance },
57
+ },
48
58
  },
49
- }) => {
59
+ { options: { chainInfo, assetInfo } },
60
+ ) => {
50
61
  trace(`start ${contractName}`);
51
62
 
52
63
  const storageNode = await makeStorageNodeChild(chainStorage, contractName);
@@ -60,6 +71,8 @@ export const startQueryFlows = async ({
60
71
  privateArgs: await deeplyFulfilledObject(
61
72
  harden({
62
73
  agoricNames,
74
+ assetInfo,
75
+ chainInfo,
63
76
  orchestrationService: cosmosInterchainService,
64
77
  localchain,
65
78
  storageNode,
@@ -76,7 +89,7 @@ harden(startQueryFlows);
76
89
 
77
90
  export const getManifestForContract = (
78
91
  { restoreRef },
79
- { installKeys, ...options },
92
+ { installKeys, options },
80
93
  ) => {
81
94
  return {
82
95
  manifest: {
@@ -106,7 +119,10 @@ export const getManifestForContract = (
106
119
  };
107
120
 
108
121
  /** @type {import('@agoric/deploy-script-support/src/externalTypes.js').CoreEvalBuilder} */
109
- export const defaultProposalBuilder = async ({ publishRef, install }) => {
122
+ export const defaultProposalBuilder = async (
123
+ { publishRef, install },
124
+ options,
125
+ ) => {
110
126
  return harden({
111
127
  // Somewhat unorthodox, source the exports from this builder module
112
128
  sourceSpec: '@agoric/builders/scripts/testing/start-query-flows.js',
@@ -120,6 +136,7 @@ export const defaultProposalBuilder = async ({ publishRef, install }) => {
120
136
  ),
121
137
  ),
122
138
  },
139
+ options,
123
140
  },
124
141
  ],
125
142
  });
@@ -127,9 +144,12 @@ export const defaultProposalBuilder = async ({ publishRef, install }) => {
127
144
 
128
145
  /** @type {import('@agoric/deploy-script-support/src/externalTypes.js').DeployScriptFunction} */
129
146
  export default async (homeP, endowments) => {
130
- // import dynamically so the module can work in CoreEval environment
131
- const dspModule = await import('@agoric/deploy-script-support');
132
- const { makeHelpers } = dspModule;
147
+ // import dynamically so the modules can work in CoreEval environment
148
+ const { makeHelpers } = await import('@agoric/deploy-script-support');
149
+ const { scriptArgs } = endowments;
150
+ const opts = parseChainHubOpts(scriptArgs);
133
151
  const { writeCoreEval } = await makeHelpers(homeP, endowments);
134
- await writeCoreEval(startQueryFlows.name, defaultProposalBuilder);
152
+ await writeCoreEval(startQueryFlows.name, utils =>
153
+ defaultProposalBuilder(utils, opts),
154
+ );
135
155
  };
@@ -0,0 +1,25 @@
1
+ import { makeHelpers } from '@agoric/deploy-script-support';
2
+
3
+ /** @type {import('@agoric/deploy-script-support/src/externalTypes.js').CoreEvalBuilder} */
4
+ export const defaultProposalBuilder = async ({ publishRef, install }) =>
5
+ harden({
6
+ sourceSpec:
7
+ '@agoric/vats/src/proposals/upgrade-provisionPool-to-BLD-proposal.js',
8
+ getManifestCall: [
9
+ 'getManifestForUpgradingProvisionPool',
10
+ {
11
+ provisionPoolRef: publishRef(
12
+ install('@agoric/inter-protocol/src/provisionPool.js'),
13
+ ),
14
+ },
15
+ ],
16
+ });
17
+
18
+ /** @type {import('@agoric/deploy-script-support/src/externalTypes.js').DeployScriptFunction} */
19
+ export default async (homeP, endowments) => {
20
+ const { writeCoreProposal } = await makeHelpers(homeP, endowments);
21
+ await writeCoreProposal(
22
+ 'upgrade-provision-pool-to-BLD',
23
+ defaultProposalBuilder,
24
+ );
25
+ };
@@ -1,10 +1,10 @@
1
1
  /** @type {import('@agoric/deploy-script-support/src/externalTypes.js').CoreEvalBuilder} */
2
2
  export const upgradeVatsProposalBuilder = async (
3
3
  { publishRef, install },
4
- bundleRecord,
4
+ vatNameToEntrypoint,
5
5
  ) => {
6
- if (!bundleRecord) {
7
- throw Error('Missing bundleRecord');
6
+ if (!vatNameToEntrypoint) {
7
+ throw Error('Missing vatNameToEntrypoint');
8
8
  }
9
9
  return harden({
10
10
  sourceSpec: '@agoric/vats/src/proposals/upgrade-vats-generic-proposal.js',
@@ -12,7 +12,7 @@ export const upgradeVatsProposalBuilder = async (
12
12
  'getManifestForUpgradingVats',
13
13
  {
14
14
  bundleRefs: Object.fromEntries(
15
- Object.entries(bundleRecord).map(
15
+ Object.entries(vatNameToEntrypoint).map(
16
16
  ([name, entrypoint]) =>
17
17
  /** @type {const} */ ([name, publishRef(install(entrypoint))]),
18
18
  ),
@@ -21,3 +21,29 @@ export const upgradeVatsProposalBuilder = async (
21
21
  ],
22
22
  });
23
23
  };
24
+
25
+ /** @type {import('@agoric/deploy-script-support/src/externalTypes.js').CoreEvalBuilder} */
26
+ export const upgradeZoeContractsProposalBuilder = async (
27
+ { publishRef, install },
28
+ contractKitSpecs,
29
+ ) => {
30
+ if (!contractKitSpecs) {
31
+ throw Error('Missing contractKitSpecs');
32
+ }
33
+ return harden({
34
+ sourceSpec: '@agoric/vats/src/proposals/upgrade-vats-generic-proposal.js',
35
+ getManifestCall: [
36
+ 'getManifestForUpgradingZoeContractKits',
37
+ {
38
+ contractKitSpecs,
39
+ /** @type {{ [bundleName: string]: VatSourceRef }} */
40
+ installationBundleRefs: Object.fromEntries(
41
+ contractKitSpecs.map(({ bundleName, entrypoint }) => [
42
+ bundleName,
43
+ publishRef(install(entrypoint)),
44
+ ]),
45
+ ),
46
+ },
47
+ ],
48
+ });
49
+ };