@agoric/builders 0.1.1-dev-e37a322.0 → 0.1.1-dev-9b8cad2.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/builders",
3
- "version": "0.1.1-dev-e37a322.0+e37a322",
3
+ "version": "0.1.1-dev-9b8cad2.0+9b8cad2",
4
4
  "description": "Build scripts for proposals to an Agoric chain",
5
5
  "type": "module",
6
6
  "main": "./index.js",
@@ -23,14 +23,14 @@
23
23
  "author": "Agoric",
24
24
  "license": "Apache-2.0",
25
25
  "dependencies": {
26
- "@agoric/ertp": "0.16.3-dev-e37a322.0+e37a322",
27
- "@agoric/fast-usdc": "0.1.1-dev-e37a322.0+e37a322",
28
- "@agoric/internal": "0.3.3-dev-e37a322.0+e37a322",
29
- "@agoric/notifier": "0.6.3-dev-e37a322.0+e37a322",
30
- "@agoric/smart-wallet": "0.5.4-dev-e37a322.0+e37a322",
31
- "@agoric/vat-data": "0.5.3-dev-e37a322.0+e37a322",
32
- "@agoric/vats": "0.15.2-dev-e37a322.0+e37a322",
33
- "@agoric/zoe": "0.26.3-dev-e37a322.0+e37a322",
26
+ "@agoric/ertp": "0.16.3-dev-9b8cad2.0+9b8cad2",
27
+ "@agoric/fast-usdc": "0.1.1-dev-9b8cad2.0+9b8cad2",
28
+ "@agoric/internal": "0.3.3-dev-9b8cad2.0+9b8cad2",
29
+ "@agoric/notifier": "0.6.3-dev-9b8cad2.0+9b8cad2",
30
+ "@agoric/smart-wallet": "0.5.4-dev-9b8cad2.0+9b8cad2",
31
+ "@agoric/vat-data": "0.5.3-dev-9b8cad2.0+9b8cad2",
32
+ "@agoric/vats": "0.15.2-dev-9b8cad2.0+9b8cad2",
33
+ "@agoric/zoe": "0.26.3-dev-9b8cad2.0+9b8cad2",
34
34
  "@endo/bundle-source": "^3.5.0",
35
35
  "@endo/captp": "^4.4.3",
36
36
  "@endo/eventual-send": "^1.2.8",
@@ -43,14 +43,14 @@
43
43
  "import-meta-resolve": "^2.2.1"
44
44
  },
45
45
  "devDependencies": {
46
- "@agoric/deploy-script-support": "0.10.4-dev-e37a322.0+e37a322",
47
- "@agoric/governance": "0.10.4-dev-e37a322.0+e37a322",
48
- "@agoric/inter-protocol": "0.16.2-dev-e37a322.0+e37a322",
49
- "@agoric/orchestration": "0.1.1-dev-e37a322.0+e37a322",
50
- "@agoric/store": "0.9.3-dev-e37a322.0+e37a322",
51
- "@agoric/swing-store": "0.9.2-dev-e37a322.0+e37a322",
52
- "@agoric/swingset-liveslots": "0.10.3-dev-e37a322.0+e37a322",
53
- "@agoric/time": "0.3.3-dev-e37a322.0+e37a322",
46
+ "@agoric/deploy-script-support": "0.10.4-dev-9b8cad2.0+9b8cad2",
47
+ "@agoric/governance": "0.10.4-dev-9b8cad2.0+9b8cad2",
48
+ "@agoric/inter-protocol": "0.16.2-dev-9b8cad2.0+9b8cad2",
49
+ "@agoric/orchestration": "0.1.1-dev-9b8cad2.0+9b8cad2",
50
+ "@agoric/store": "0.9.3-dev-9b8cad2.0+9b8cad2",
51
+ "@agoric/swing-store": "0.9.2-dev-9b8cad2.0+9b8cad2",
52
+ "@agoric/swingset-liveslots": "0.10.3-dev-9b8cad2.0+9b8cad2",
53
+ "@agoric/time": "0.3.3-dev-9b8cad2.0+9b8cad2",
54
54
  "@endo/errors": "^1.2.8",
55
55
  "ava": "^5.3.0",
56
56
  "c8": "^10.1.2"
@@ -83,5 +83,5 @@
83
83
  "typeCoverage": {
84
84
  "atLeast": 89.69
85
85
  },
86
- "gitHead": "e37a3220b45d5b749a1114af1330960752f990f4"
86
+ "gitHead": "9b8cad23e2e69b417d9ea63513cc77af293c4780"
87
87
  }
@@ -1,8 +1,22 @@
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
14
 
4
15
  /** @type {import('@agoric/deploy-script-support/src/externalTypes.js').CoreEvalBuilder} */
5
- export const defaultProposalBuilder = async ({ publishRef, install }) => {
16
+ export const defaultProposalBuilder = async (
17
+ { publishRef, install },
18
+ options,
19
+ ) => {
6
20
  return harden({
7
21
  sourceSpec: '@agoric/orchestration/src/proposals/start-basic-flows.js',
8
22
  getManifestCall: [
@@ -15,6 +29,7 @@ export const defaultProposalBuilder = async ({ publishRef, install }) => {
15
29
  ),
16
30
  ),
17
31
  },
32
+ options,
18
33
  },
19
34
  ],
20
35
  });
@@ -22,6 +37,31 @@ export const defaultProposalBuilder = async ({ publishRef, install }) => {
22
37
 
23
38
  /** @type {import('@agoric/deploy-script-support/src/externalTypes.js').DeployScriptFunction} */
24
39
  export default async (homeP, endowments) => {
40
+ 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
+
25
62
  const { writeCoreEval } = await makeHelpers(homeP, endowments);
26
- await writeCoreEval(startBasicFlows.name, defaultProposalBuilder);
63
+
64
+ await writeCoreEval(startBasicFlows.name, utils =>
65
+ defaultProposalBuilder(utils, opts),
66
+ );
27
67
  };
@@ -0,0 +1,73 @@
1
+ /**
2
+ * @file A proposal to start the auto-stake-it contract.
3
+ *
4
+ * AutoStakeIt allows users to to create an auto-forwarding address that
5
+ * transfers and stakes tokens on a remote chain when received.
6
+ */
7
+ import { makeHelpers } from '@agoric/deploy-script-support';
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
+ };
20
+
21
+ /** @type {import('@agoric/deploy-script-support/src/externalTypes.js').CoreEvalBuilder} */
22
+ export const defaultProposalBuilder = async (
23
+ { publishRef, install },
24
+ options,
25
+ ) => {
26
+ return harden({
27
+ sourceSpec: '@agoric/orchestration/src/proposals/start-auto-stake-it.js',
28
+ getManifestCall: [
29
+ 'getManifest',
30
+ {
31
+ installKeys: {
32
+ autoAutoStakeIt: publishRef(
33
+ install(
34
+ '@agoric/orchestration/src/examples/auto-stake-it.contract.js',
35
+ ),
36
+ ),
37
+ },
38
+ options,
39
+ },
40
+ ],
41
+ });
42
+ };
43
+
44
+ /** @type {import('@agoric/deploy-script-support/src/externalTypes.js').DeployScriptFunction} */
45
+ export default async (homeP, endowments) => {
46
+ 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
+
68
+ const { writeCoreEval } = await makeHelpers(homeP, endowments);
69
+
70
+ await writeCoreEval(startAutoStakeIt.name, utils =>
71
+ defaultProposalBuilder(utils, opts),
72
+ );
73
+ };
@@ -7,14 +7,14 @@ import {
7
7
  makeTracer,
8
8
  NonNullish,
9
9
  } from '@agoric/internal';
10
- import { E, Far } from '@endo/far';
10
+ import { E } from '@endo/far';
11
11
 
12
12
  /// <reference types="@agoric/vats/src/core/types-ambient"/>
13
13
  /**
14
14
  * @import {Installation, Instance} from '@agoric/zoe/src/zoeService/utils.js';
15
15
  */
16
16
 
17
- const trace = makeTracer('FixBuggySA', true);
17
+ const trace = makeTracer('UpgradeSA', true);
18
18
 
19
19
  /**
20
20
  * @import {start as StartFn} from '@agoric/orchestration/src/examples/send-anywhere.contract.js';
@@ -30,7 +30,7 @@ const trace = makeTracer('FixBuggySA', true);
30
30
  * }} powers
31
31
  * @param {...any} rest
32
32
  */
33
- export const fixSendAnywhere = async (
33
+ export const upgradeSendAnywhere = async (
34
34
  {
35
35
  consume: {
36
36
  agoricNames,
@@ -45,7 +45,7 @@ export const fixSendAnywhere = async (
45
45
  },
46
46
  { options: { sendAnywhereRef } },
47
47
  ) => {
48
- trace(fixSendAnywhere.name);
48
+ trace(upgradeSendAnywhere.name);
49
49
 
50
50
  const saInstance = await instances.consume.sendAnywhere;
51
51
  trace('saInstance', saInstance);
@@ -53,28 +53,24 @@ export const fixSendAnywhere = async (
53
53
 
54
54
  const marshaller = await E(board).getReadonlyMarshaller();
55
55
 
56
- // This apparently pointless wrapper is to maintain structural parity
57
- // with the buggy core-eval's wrapper to make lookup() hang.
58
- const agoricNamesResolves = Far('agoricNames that resolves', {
59
- lookup: async (...args) => {
60
- return E(agoricNames).lookup(...args);
61
- },
62
- });
63
-
64
56
  const privateArgs = await deeplyFulfilledObject(
65
57
  harden({
66
- agoricNames: agoricNamesResolves,
58
+ agoricNames,
67
59
  localchain,
68
60
  marshaller,
69
61
  orchestrationService: cosmosInterchainService,
70
62
  storageNode: E(NonNullish(await chainStorage)).makeChildNode(
71
- 'sendAnywhere',
63
+ 'send-anywhere',
72
64
  ),
73
65
  timerService: chainTimerService,
66
+ // undefined so `registerKnownChainsAndAssets` does not run again
67
+ chainInfo: undefined,
68
+ assetInfo: undefined,
74
69
  }),
75
70
  );
76
71
 
77
72
  trace('upgrading...');
73
+ trace('ref', sendAnywhereRef);
78
74
  await E(saKit.adminFacet).upgradeContract(
79
75
  sendAnywhereRef.bundleID,
80
76
  privateArgs,
@@ -82,13 +78,13 @@ export const fixSendAnywhere = async (
82
78
 
83
79
  trace('done');
84
80
  };
85
- harden(fixSendAnywhere);
81
+ harden(upgradeSendAnywhere);
86
82
 
87
83
  export const getManifestForValueVow = ({ restoreRef }, { sendAnywhereRef }) => {
88
84
  console.log('sendAnywhereRef', sendAnywhereRef);
89
85
  return {
90
86
  manifest: {
91
- [fixSendAnywhere.name]: {
87
+ [upgradeSendAnywhere.name]: {
92
88
  consume: {
93
89
  agoricNames: true,
94
90
  board: true,
@@ -120,7 +116,7 @@ export const getManifestForValueVow = ({ restoreRef }, { sendAnywhereRef }) => {
120
116
  export const defaultProposalBuilder = async ({ publishRef, install }) =>
121
117
  harden({
122
118
  // Somewhat unorthodox, source the exports from this builder module
123
- sourceSpec: '@agoric/builders/scripts/testing/fix-buggy-sendAnywhere.js',
119
+ sourceSpec: '@agoric/builders/scripts/testing/upgrade-send-anywhere.js',
124
120
  getManifestCall: [
125
121
  'getManifestForValueVow',
126
122
  {
@@ -139,5 +135,5 @@ export default async (homeP, endowments) => {
139
135
  const dspModule = await import('@agoric/deploy-script-support');
140
136
  const { makeHelpers } = dspModule;
141
137
  const { writeCoreEval } = await makeHelpers(homeP, endowments);
142
- await writeCoreEval(fixSendAnywhere.name, defaultProposalBuilder);
138
+ await writeCoreEval(upgradeSendAnywhere.name, defaultProposalBuilder);
143
139
  };
@@ -1,128 +0,0 @@
1
- /**
2
- * @file A proposal to start the auto-stake-it contract.
3
- *
4
- * AutoStakeIt allows users to to create an auto-forwarding address that
5
- * transfers and stakes tokens on a remote chain when received.
6
- */
7
- import { makeTracer } from '@agoric/internal';
8
- import { makeStorageNodeChild } from '@agoric/internal/src/lib-chainStorage.js';
9
- import { E } from '@endo/far';
10
- import { deeplyFulfilled } from '@endo/marshal';
11
-
12
- /**
13
- * @import {AutoStakeItSF} from '@agoric/orchestration/src/examples/auto-stake-it.contract.js';
14
- */
15
-
16
- const contractName = 'autoAutoStakeIt';
17
- const trace = makeTracer(contractName, true);
18
-
19
- /**
20
- * @param {BootstrapPowers} powers
21
- */
22
- export const startAutoStakeIt = async ({
23
- consume: {
24
- agoricNames,
25
- board,
26
- chainStorage,
27
- chainTimerService,
28
- cosmosInterchainService,
29
- localchain,
30
- startUpgradable,
31
- },
32
- installation: {
33
- // @ts-expect-error not a WellKnownName
34
- consume: { [contractName]: installation },
35
- },
36
- instance: {
37
- // @ts-expect-error not a WellKnownName
38
- produce: { [contractName]: produceInstance },
39
- },
40
- }) => {
41
- trace(`start ${contractName}`);
42
- await null;
43
-
44
- const storageNode = await makeStorageNodeChild(chainStorage, contractName);
45
- const marshaller = await E(board).getPublishingMarshaller();
46
-
47
- /** @type {StartUpgradableOpts<AutoStakeItSF>} */
48
- const startOpts = {
49
- label: 'autoAutoStakeIt',
50
- installation,
51
- terms: undefined,
52
- privateArgs: await deeplyFulfilled(
53
- // @ts-expect-error
54
- harden({
55
- agoricNames,
56
- orchestrationService: cosmosInterchainService,
57
- localchain,
58
- storageNode,
59
- marshaller,
60
- timerService: chainTimerService,
61
- }),
62
- ),
63
- };
64
-
65
- const { instance } = await E(startUpgradable)(startOpts);
66
- produceInstance.resolve(instance);
67
- };
68
- harden(startAutoStakeIt);
69
-
70
- export const getManifestForContract = (
71
- { restoreRef },
72
- { installKeys, ...options },
73
- ) => {
74
- return {
75
- manifest: {
76
- [startAutoStakeIt.name]: {
77
- consume: {
78
- agoricNames: true,
79
- board: true,
80
- chainStorage: true,
81
- chainTimerService: true,
82
- cosmosInterchainService: true,
83
- localchain: true,
84
- startUpgradable: true,
85
- },
86
- installation: {
87
- consume: { [contractName]: true },
88
- },
89
- instance: {
90
- produce: { [contractName]: true },
91
- },
92
- },
93
- },
94
- installations: {
95
- [contractName]: restoreRef(installKeys[contractName]),
96
- },
97
- options,
98
- };
99
- };
100
-
101
- /** @type {import('@agoric/deploy-script-support/src/externalTypes.js').CoreEvalBuilder} */
102
- export const defaultProposalBuilder = async ({ publishRef, install }) => {
103
- return harden({
104
- // Somewhat unorthodox, source the exports from this builder module
105
- sourceSpec: '@agoric/builders/scripts/testing/start-auto-stake-it.js',
106
- getManifestCall: [
107
- 'getManifestForContract',
108
- {
109
- installKeys: {
110
- autoAutoStakeIt: publishRef(
111
- install(
112
- '@agoric/orchestration/src/examples/auto-stake-it.contract.js',
113
- ),
114
- ),
115
- },
116
- },
117
- ],
118
- });
119
- };
120
-
121
- /** @type {import('@agoric/deploy-script-support/src/externalTypes.js').DeployScriptFunction} */
122
- export default async (homeP, endowments) => {
123
- // import dynamically so the module can work in CoreEval environment
124
- const dspModule = await import('@agoric/deploy-script-support');
125
- const { makeHelpers } = dspModule;
126
- const { writeCoreEval } = await makeHelpers(homeP, endowments);
127
- await writeCoreEval(startAutoStakeIt.name, defaultProposalBuilder);
128
- };
@@ -1,143 +0,0 @@
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, Far } from '@endo/far';
11
-
12
- /// <reference types="@agoric/vats/src/core/types-ambient"/>
13
- /**
14
- * @import {Installation} from '@agoric/zoe/src/zoeService/utils.js';
15
- */
16
-
17
- const trace = makeTracer('StartBuggySA', true);
18
-
19
- /**
20
- * @import {start as StartFn} from '@agoric/orchestration/src/examples/send-anywhere.contract.js';
21
- */
22
-
23
- /**
24
- * @param {BootstrapPowers & {
25
- * installation: {
26
- * consume: {
27
- * sendAnywhere: Installation<StartFn>;
28
- * };
29
- * };
30
- * }} powers
31
- */
32
- export const startSendAnywhere = async ({
33
- consume: {
34
- agoricNames,
35
- board,
36
- chainStorage,
37
- chainTimerService,
38
- cosmosInterchainService,
39
- localchain,
40
- startUpgradable,
41
- },
42
- installation: {
43
- consume: { sendAnywhere },
44
- },
45
- instance: {
46
- // @ts-expect-error unknown instance
47
- produce: { sendAnywhere: produceInstance },
48
- },
49
- }) => {
50
- trace(startSendAnywhere.name);
51
-
52
- const marshaller = await E(board).getReadonlyMarshaller();
53
-
54
- const privateArgs = await deeplyFulfilledObject(
55
- harden({
56
- agoricNames,
57
- localchain,
58
- marshaller,
59
- orchestrationService: cosmosInterchainService,
60
- storageNode: E(NonNullish(await chainStorage)).makeChildNode(
61
- 'sendAnywhere',
62
- ),
63
- timerService: chainTimerService,
64
- }),
65
- );
66
-
67
- /** @type {import('@agoric/vats').NameHub} */
68
- // @ts-expect-error intentional fake
69
- const agoricNamesHangs = Far('agoricNames that hangs', {
70
- lookup: async () => {
71
- trace('agoricNames.lookup being called that will never resolve');
72
- // BUG: this never resolves
73
- return new Promise(() => {});
74
- },
75
- });
76
-
77
- const { instance } = await E(startUpgradable)({
78
- label: 'sendAnywhere',
79
- installation: sendAnywhere,
80
- privateArgs: {
81
- ...privateArgs,
82
- agoricNames: agoricNamesHangs,
83
- },
84
- });
85
- produceInstance.resolve(instance);
86
- trace('done');
87
- };
88
- harden(startSendAnywhere);
89
-
90
- export const getManifestForValueVow = ({ restoreRef }, { sendAnywhereRef }) => {
91
- trace('sendAnywhereRef', sendAnywhereRef);
92
- return {
93
- manifest: {
94
- [startSendAnywhere.name]: {
95
- consume: {
96
- agoricNames: true,
97
- board: true,
98
- chainStorage: true,
99
- chainTimerService: true,
100
- cosmosInterchainService: true,
101
- localchain: true,
102
-
103
- startUpgradable: true,
104
- },
105
- installation: {
106
- consume: { sendAnywhere: true },
107
- },
108
- instance: {
109
- produce: { sendAnywhere: true },
110
- },
111
- },
112
- },
113
- installations: {
114
- sendAnywhere: restoreRef(sendAnywhereRef),
115
- },
116
- };
117
- };
118
-
119
- /** @type {import('@agoric/deploy-script-support/src/externalTypes.js').CoreEvalBuilder} */
120
- export const defaultProposalBuilder = async ({ publishRef, install }) =>
121
- harden({
122
- // Somewhat unorthodox, source the exports from this builder module
123
- sourceSpec: '@agoric/builders/scripts/testing/start-buggy-sendAnywhere.js',
124
- getManifestCall: [
125
- 'getManifestForValueVow',
126
- {
127
- sendAnywhereRef: publishRef(
128
- install(
129
- '@agoric/orchestration/src/examples/send-anywhere.contract.js',
130
- ),
131
- ),
132
- },
133
- ],
134
- });
135
-
136
- /** @type {import('@agoric/deploy-script-support/src/externalTypes.js').DeployScriptFunction} */
137
- export default async (homeP, endowments) => {
138
- // import dynamically so the module can work in CoreEval environment
139
- const dspModule = await import('@agoric/deploy-script-support');
140
- const { makeHelpers } = dspModule;
141
- const { writeCoreEval } = await makeHelpers(homeP, endowments);
142
- await writeCoreEval(startSendAnywhere.name, defaultProposalBuilder);
143
- };