@agoric/builders 0.1.1-dev-754698c.0.754698c → 0.1.1-dev-1d67c2a.0.1d67c2a

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-754698c.0.754698c",
3
+ "version": "0.1.1-dev-1d67c2a.0.1d67c2a",
4
4
  "description": "Build scripts for proposals to an Agoric chain",
5
5
  "type": "module",
6
6
  "main": "./index.js",
@@ -20,14 +20,14 @@
20
20
  "author": "Agoric",
21
21
  "license": "Apache-2.0",
22
22
  "dependencies": {
23
- "@agoric/client-utils": "0.1.1-dev-754698c.0.754698c",
24
- "@agoric/ertp": "0.16.3-dev-754698c.0.754698c",
25
- "@agoric/internal": "0.3.3-dev-754698c.0.754698c",
26
- "@agoric/notifier": "0.6.3-dev-754698c.0.754698c",
27
- "@agoric/smart-wallet": "0.5.4-dev-754698c.0.754698c",
28
- "@agoric/vat-data": "0.5.3-dev-754698c.0.754698c",
29
- "@agoric/vats": "0.15.2-dev-754698c.0.754698c",
30
- "@agoric/zoe": "0.26.3-dev-754698c.0.754698c",
23
+ "@agoric/client-utils": "0.1.1-dev-1d67c2a.0.1d67c2a",
24
+ "@agoric/ertp": "0.16.3-dev-1d67c2a.0.1d67c2a",
25
+ "@agoric/internal": "0.3.3-dev-1d67c2a.0.1d67c2a",
26
+ "@agoric/notifier": "0.6.3-dev-1d67c2a.0.1d67c2a",
27
+ "@agoric/smart-wallet": "0.5.4-dev-1d67c2a.0.1d67c2a",
28
+ "@agoric/vat-data": "0.5.3-dev-1d67c2a.0.1d67c2a",
29
+ "@agoric/vats": "0.15.2-dev-1d67c2a.0.1d67c2a",
30
+ "@agoric/zoe": "0.26.3-dev-1d67c2a.0.1d67c2a",
31
31
  "@endo/bundle-source": "^4.1.2",
32
32
  "@endo/captp": "^4.4.8",
33
33
  "@endo/eventual-send": "^1.3.4",
@@ -41,14 +41,15 @@
41
41
  "import-meta-resolve": "^4.1.0"
42
42
  },
43
43
  "devDependencies": {
44
- "@agoric/deploy-script-support": "0.10.4-dev-754698c.0.754698c",
45
- "@agoric/governance": "0.10.4-dev-754698c.0.754698c",
46
- "@agoric/inter-protocol": "0.16.2-dev-754698c.0.754698c",
47
- "@agoric/orchestration": "0.1.1-dev-754698c.0.754698c",
48
- "@agoric/store": "0.9.3-dev-754698c.0.754698c",
49
- "@agoric/swing-store": "0.9.2-dev-754698c.0.754698c",
50
- "@agoric/swingset-liveslots": "0.10.3-dev-754698c.0.754698c",
51
- "@agoric/time": "0.3.3-dev-754698c.0.754698c",
44
+ "@agoric/deploy-script-support": "0.10.4-dev-1d67c2a.0.1d67c2a",
45
+ "@agoric/governance": "0.10.4-dev-1d67c2a.0.1d67c2a",
46
+ "@agoric/inter-protocol": "0.16.2-dev-1d67c2a.0.1d67c2a",
47
+ "@agoric/orchestration": "0.1.1-dev-1d67c2a.0.1d67c2a",
48
+ "@agoric/store": "0.9.3-dev-1d67c2a.0.1d67c2a",
49
+ "@agoric/swing-store": "0.9.2-dev-1d67c2a.0.1d67c2a",
50
+ "@agoric/swingset-liveslots": "0.10.3-dev-1d67c2a.0.1d67c2a",
51
+ "@agoric/swingset-vat": "0.32.3-dev-1d67c2a.0.1d67c2a",
52
+ "@agoric/time": "0.3.3-dev-1d67c2a.0.1d67c2a",
52
53
  "@endo/errors": "^1.2.13",
53
54
  "ava": "^6.4.1",
54
55
  "c8": "^10.1.3"
@@ -78,5 +79,5 @@
78
79
  "typeCoverage": {
79
80
  "atLeast": 89.7
80
81
  },
81
- "gitHead": "754698ceecae0bf068be0022082e672ff4bc71cb"
82
+ "gitHead": "1d67c2a384e8486c7638ab8e424f46e15f4b321d"
82
83
  }
@@ -1,9 +1,12 @@
1
1
  /* eslint-env node */
2
2
  import { makeHelpers } from '@agoric/deploy-script-support';
3
3
 
4
+ import { interProtocolBundleSpecs } from '@agoric/inter-protocol/source-spec-registry.js';
4
5
  import { getManifestForAddAssetToVault } from '@agoric/inter-protocol/src/proposals/addAssetToVault.js';
5
6
  import { getManifestForPsm } from '@agoric/inter-protocol/src/proposals/startPSM.js';
6
7
  import { makeInstallCache } from '@agoric/inter-protocol/src/proposals/utils.js';
8
+ import { vatsSourceSpecRegistry } from '@agoric/vats/source-spec-registry.js';
9
+ import { buildBundlePath } from '../lib/build-bundle.js';
7
10
 
8
11
  /**
9
12
  * @import {CoreEvalBuilder} from '@agoric/deploy-script-support/src/externalTypes.js';
@@ -38,6 +41,11 @@ export const defaultProposalBuilder = async (
38
41
  }
39
42
 
40
43
  const install = wrapInstall ? wrapInstall(install0) : install0;
44
+ const scaledPriceAuthorityPath = await buildBundlePath(
45
+ import.meta.url,
46
+ '@agoric/zoe/src/contracts/scaledPriceAuthority.js',
47
+ 'scaledPriceAuthority',
48
+ );
41
49
 
42
50
  return harden({
43
51
  sourceSpec: '@agoric/inter-protocol/src/proposals/addAssetToVault.js',
@@ -59,7 +67,7 @@ export const defaultProposalBuilder = async (
59
67
  scaledPriceAuthorityRef: publishRef(
60
68
  install(
61
69
  '@agoric/zoe/src/contracts/scaledPriceAuthority.js',
62
- '../bundles/bundle-scaledPriceAuthority.js',
70
+ scaledPriceAuthorityPath,
63
71
  { persist: true },
64
72
  ),
65
73
  ),
@@ -79,6 +87,10 @@ export const psmProposalBuilder = async (
79
87
  assert(denom, 'ANCHOR_DENOM is required');
80
88
 
81
89
  const install = wrapInstall ? wrapInstall(install0) : install0;
90
+ const psm = interProtocolBundleSpecs.psm;
91
+ const mintHolder = vatsSourceSpecRegistry.mintHolder;
92
+ const psmPath = await buildBundlePath(import.meta.url, psm);
93
+ const mintHolderPath = await buildBundlePath(import.meta.url, mintHolder);
82
94
 
83
95
  return harden({
84
96
  sourceSpec: '@agoric/inter-protocol/src/proposals/startPSM.js',
@@ -91,17 +103,9 @@ export const psmProposalBuilder = async (
91
103
  decimalPlaces,
92
104
  },
93
105
  installKeys: {
94
- psm: publishRef(
95
- install(
96
- '@agoric/inter-protocol/src/psm/psm.js',
97
- '../bundles/bundle-psm.js',
98
- ),
99
- ),
106
+ psm: publishRef(install(psm.packagePath, psmPath)),
100
107
  mintHolder: publishRef(
101
- install(
102
- '@agoric/vats/src/mintHolder.js',
103
- '../../vats/bundles/bundle-mintHolder.js',
104
- ),
108
+ install(mintHolder.packagePath, mintHolderPath),
105
109
  ),
106
110
  },
107
111
  },
@@ -5,7 +5,8 @@
5
5
  * governance votes (n/a on sim-chain).
6
6
  */
7
7
  import { makeHelpers } from '@agoric/deploy-script-support';
8
- import { objectMap } from '@agoric/internal';
8
+ import { governanceSourceSpecRegistry } from '@agoric/governance/source-spec-registry.js';
9
+ import { interProtocolBundleSpecs } from '@agoric/inter-protocol/source-spec-registry.js';
9
10
 
10
11
  import {
11
12
  getManifestForInterProtocol,
@@ -13,6 +14,7 @@ import {
13
14
  getManifestForMain,
14
15
  } from '@agoric/inter-protocol/src/proposals/core-proposal.js';
15
16
  import { makeInstallCache } from '@agoric/inter-protocol/src/proposals/utils.js';
17
+ import { buildBundlePath } from '../lib/build-bundle.js';
16
18
 
17
19
  /**
18
20
  * @import {CoreEvalBuilder} from '@agoric/deploy-script-support/src/externalTypes.js';
@@ -21,38 +23,58 @@ import { makeInstallCache } from '@agoric/inter-protocol/src/proposals/utils.js'
21
23
 
22
24
  // TODO end inter-package filesystem references https://github.com/Agoric/agoric-sdk/issues/8178
23
25
 
24
- /** @type {Record<string, Record<string, [string, string]>>} */
26
+ /**
27
+ * @typedef {{
28
+ * sourceSpec?: string;
29
+ * packagePath?: string;
30
+ * bundleName?: string;
31
+ * }} BundleRegistryEntry
32
+ */
33
+
34
+ /** @type {Record<string, Record<string, BundleRegistryEntry>>} */
25
35
  const installKeyGroups = {
26
36
  econCommittee: {
27
- contractGovernor: [
28
- '@agoric/governance/src/contractGovernor.js',
29
- '../../governance/bundles/bundle-contractGovernor.js',
30
- ],
31
- committee: [
32
- '@agoric/governance/src/committee.js',
33
- '../../governance/bundles/bundle-committee.js',
34
- ],
35
- binaryVoteCounter: [
36
- '@agoric/governance/src/binaryVoteCounter.js',
37
- '../../governance/bundles/bundle-binaryVoteCounter.js',
38
- ],
37
+ contractGovernor: governanceSourceSpecRegistry.contractGovernor,
38
+ committee: governanceSourceSpecRegistry.committee,
39
+ binaryVoteCounter: governanceSourceSpecRegistry.binaryVoteCounter,
39
40
  },
40
41
  main: {
41
- vaultFactory: [
42
- '@agoric/inter-protocol/src/vaultFactory/vaultFactory.js',
43
- '../../inter-protocol/bundles/bundle-vaultFactory.js',
44
- ],
45
- feeDistributor: [
46
- '@agoric/inter-protocol/src/feeDistributor.js',
47
- '../../inter-protocol/bundles/bundle-feeDistributor.js',
48
- ],
49
- reserve: [
50
- '@agoric/inter-protocol/src/reserve/assetReserve.js',
51
- '../../inter-protocol/bundles/bundle-reserve.js',
52
- ],
42
+ vaultFactory: interProtocolBundleSpecs.vaultFactory,
43
+ feeDistributor: interProtocolBundleSpecs.feeDistributor,
44
+ reserve: interProtocolBundleSpecs.reserve,
53
45
  },
54
46
  };
55
47
 
48
+ /**
49
+ * @template I
50
+ * @template R
51
+ * @param {object} opts
52
+ * @param {(i: I) => R} opts.publishRef
53
+ * @param {(m: string, b: string, opts?: any) => I} opts.install
54
+ * @param {Record<string, BundleRegistryEntry>} opts.group
55
+ * @param {boolean} [opts.persist]
56
+ */
57
+ const publishInstallGroup = async ({ publishRef, install, group, persist }) =>
58
+ Object.fromEntries(
59
+ // eslint-disable-next-line @jessie.js/safe-await-separator
60
+ await Promise.all(
61
+ Object.entries(group).map(async ([key, entry]) => {
62
+ const bundlePath = await buildBundlePath(import.meta.url, entry);
63
+ assert(entry.packagePath, `${key} missing packagePath`);
64
+ return [
65
+ key,
66
+ publishRef(
67
+ install(
68
+ entry.packagePath,
69
+ bundlePath,
70
+ persist === undefined ? undefined : { persist },
71
+ ),
72
+ ),
73
+ ];
74
+ }),
75
+ ),
76
+ );
77
+
56
78
  /**
57
79
  * @template I
58
80
  * @template R
@@ -68,12 +90,12 @@ export const committeeProposalBuilder = async (
68
90
  { econCommitteeOptions } = {},
69
91
  ) => {
70
92
  const install = wrapInstall ? wrapInstall(install0) : install0;
71
-
72
- /** @param {Record<string, [string, string]>} group */
73
- const publishGroup = group =>
74
- objectMap(group, ([mod, bundle]) =>
75
- publishRef(install(mod, bundle, { persist: true })),
76
- );
93
+ const econCommitteeInstallKeys = await publishInstallGroup({
94
+ publishRef,
95
+ install,
96
+ group: installKeyGroups.econCommittee,
97
+ persist: true,
98
+ });
77
99
  return harden({
78
100
  sourceSpec: '@agoric/inter-protocol/src/proposals/core-proposal.js',
79
101
  getManifestCall: [
@@ -81,7 +103,7 @@ export const committeeProposalBuilder = async (
81
103
  {
82
104
  econCommitteeOptions,
83
105
  installKeys: {
84
- ...publishGroup(installKeyGroups.econCommittee),
106
+ ...econCommitteeInstallKeys,
85
107
  },
86
108
  },
87
109
  ],
@@ -104,13 +126,12 @@ export const mainProposalBuilder = async ({
104
126
  const { VAULT_FACTORY_CONTROLLER_ADDR } = process.env;
105
127
 
106
128
  const install = wrapInstall ? wrapInstall(install0) : install0;
107
-
108
- const persist = true;
109
- /** @param {Record<string, [string, string]>} group */
110
- const publishGroup = group =>
111
- objectMap(group, ([mod, bundle]) =>
112
- publishRef(install(mod, bundle, { persist })),
113
- );
129
+ const mainInstallKeys = await publishInstallGroup({
130
+ publishRef,
131
+ install,
132
+ group: installKeyGroups.main,
133
+ persist: true,
134
+ });
114
135
  return harden({
115
136
  sourceSpec: '@agoric/inter-protocol/src/proposals/core-proposal.js',
116
137
  getManifestCall: [
@@ -118,7 +139,7 @@ export const mainProposalBuilder = async ({
118
139
  {
119
140
  vaultFactoryControllerAddress: VAULT_FACTORY_CONTROLLER_ADDR,
120
141
  installKeys: {
121
- ...publishGroup(installKeyGroups.main),
142
+ ...mainInstallKeys,
122
143
  },
123
144
  },
124
145
  ],
@@ -150,10 +171,6 @@ export const defaultProposalBuilder = async (
150
171
  } = {},
151
172
  } = options;
152
173
 
153
- /** @param {Record<string, [string, string]>} group */
154
- const publishGroup = group =>
155
- objectMap(group, ([mod, bundle]) => publishRef(install(mod, bundle)));
156
-
157
174
  const anchorOptions = anchorDenom && {
158
175
  denom: anchorDenom,
159
176
  decimalPlaces: parseInt(anchorDecimalPlaces, 10),
@@ -165,6 +182,16 @@ export const defaultProposalBuilder = async (
165
182
  const econCommitteeOptions = {
166
183
  committeeSize: parseInt(econCommitteeSize, 10),
167
184
  };
185
+ const econCommitteeInstallKeys = await publishInstallGroup({
186
+ publishRef,
187
+ install,
188
+ group: installKeyGroups.econCommittee,
189
+ });
190
+ const mainInstallKeys = await publishInstallGroup({
191
+ publishRef,
192
+ install,
193
+ group: installKeyGroups.main,
194
+ });
168
195
 
169
196
  return harden({
170
197
  sourceSpec: '@agoric/inter-protocol/src/proposals/core-proposal.js',
@@ -177,8 +204,8 @@ export const defaultProposalBuilder = async (
177
204
  anchorOptions,
178
205
  econCommitteeOptions,
179
206
  installKeys: {
180
- ...publishGroup(installKeyGroups.econCommittee),
181
- ...publishGroup(installKeyGroups.main),
207
+ ...econCommitteeInstallKeys,
208
+ ...mainInstallKeys,
182
209
  },
183
210
  },
184
211
  ],
@@ -2,6 +2,8 @@
2
2
  import { makeHelpers } from '@agoric/deploy-script-support';
3
3
 
4
4
  import { getManifestForInviteCommittee } from '@agoric/inter-protocol/src/proposals/committee-proposal.js';
5
+ import { interProtocolBundleSpecs } from '@agoric/inter-protocol/source-spec-registry.js';
6
+ import { buildBundlePath } from '../lib/build-bundle.js';
5
7
 
6
8
  /**
7
9
  * @import {CoreEvalBuilder} from '@agoric/deploy-script-support/src/externalTypes.js';
@@ -21,6 +23,12 @@ export const defaultProposalBuilder = async (
21
23
 
22
24
  assert(voterAddresses, 'ECON_COMMITTEE_ADDRESSES is required');
23
25
 
26
+ const econCommitteeCharter = interProtocolBundleSpecs.econCommitteeCharter;
27
+ const econCommitteeCharterPath = await buildBundlePath(
28
+ import.meta.url,
29
+ econCommitteeCharter,
30
+ );
31
+
24
32
  return harden({
25
33
  sourceSpec: '@agoric/inter-protocol/src/proposals/committee-proposal.js',
26
34
  getManifestCall: [
@@ -28,13 +36,9 @@ export const defaultProposalBuilder = async (
28
36
  {
29
37
  voterAddresses,
30
38
  econCommitteeCharterRef: publishRef(
31
- install(
32
- '@agoric/inter-protocol/src/econCommitteeCharter.js',
33
- '../bundles/bundle-econCommitteeCharter.js',
34
- {
35
- persist: true,
36
- },
37
- ),
39
+ install(econCommitteeCharter.packagePath, econCommitteeCharterPath, {
40
+ persist: true,
41
+ }),
38
42
  ),
39
43
  },
40
44
  ],
@@ -1,5 +1,7 @@
1
1
  /* eslint-env node */
2
2
  import { makeHelpers } from '@agoric/deploy-script-support';
3
+ import { interProtocolBundleSpecs } from '@agoric/inter-protocol/source-spec-registry.js';
4
+ import { buildBundlePath } from '../lib/build-bundle.js';
3
5
 
4
6
  /**
5
7
  * @import {CoreEvalBuilder} from '@agoric/deploy-script-support/src/externalTypes.js';
@@ -45,6 +47,12 @@ export const defaultProposalBuilder = async (
45
47
  assert(OUT_BRAND_NAME);
46
48
  }
47
49
 
50
+ const priceAggregator = interProtocolBundleSpecs.priceAggregator;
51
+ const priceAggregatorPath = await buildBundlePath(
52
+ import.meta.url,
53
+ priceAggregator,
54
+ );
55
+
48
56
  return harden({
49
57
  sourceSpec: '@agoric/inter-protocol/src/proposals/price-feed-proposal.js',
50
58
  getManifestCall: [
@@ -61,10 +69,7 @@ export const defaultProposalBuilder = async (
61
69
  brandInRef: brandIn && publishRef(brandIn),
62
70
  brandOutRef: brandOut && publishRef(brandOut),
63
71
  priceAggregatorRef: publishRef(
64
- install(
65
- '@agoric/inter-protocol/src/price/fluxAggregatorContract.js',
66
- '../bundles/bundle-fluxAggregatorKit.js',
67
- ),
72
+ install(priceAggregator.packagePath, priceAggregatorPath),
68
73
  ),
69
74
  },
70
75
  ],
@@ -14,7 +14,9 @@
14
14
  * agoric run replace-electorate-core.js MAINNET
15
15
  */
16
16
  import { makeHelpers } from '@agoric/deploy-script-support';
17
+ import { governanceSourceSpecRegistry } from '@agoric/governance/source-spec-registry.js';
17
18
  import { getManifestForReplaceAllElectorates } from '@agoric/inter-protocol/src/proposals/replaceElectorate.js';
19
+ import { buildBundlePath } from '../lib/build-bundle.js';
18
20
 
19
21
  /**
20
22
  * @import {replaceAllElectorates} from '@agoric/inter-protocol/src/proposals/replaceElectorate.js';
@@ -108,6 +110,11 @@ export const defaultProposalBuilder = async ({ publishRef, install }, opts) => {
108
110
  throw Error(error);
109
111
  }
110
112
  const { committeeName, voterAddresses, highPrioritySendersConfig } = config;
113
+ const committee = governanceSourceSpecRegistry.committee;
114
+ const economicCommitteePath = await buildBundlePath(
115
+ import.meta.url,
116
+ committee,
117
+ );
111
118
  console.log(
112
119
  'Generating replace committee proposal with config',
113
120
  JSON.stringify({
@@ -125,10 +132,7 @@ export const defaultProposalBuilder = async ({ publishRef, install }, opts) => {
125
132
  voterAddresses,
126
133
  highPrioritySendersConfig,
127
134
  economicCommitteeRef: publishRef(
128
- install(
129
- '@agoric/governance/src/committee.js',
130
- '../bundles/bundle-committee.js',
131
- ),
135
+ install(committee.packagePath, economicCommitteePath),
132
136
  ),
133
137
  },
134
138
  ],
@@ -1,5 +1,7 @@
1
1
  import { makeHelpers } from '@agoric/deploy-script-support';
2
+ import { interProtocolBundleSpecs } from '@agoric/inter-protocol/source-spec-registry.js';
2
3
  import { getManifestForPriceFeeds } from '@agoric/inter-protocol/src/proposals/deploy-price-feeds.js';
4
+ import { buildBundlePath } from '../lib/build-bundle.js';
3
5
 
4
6
  /**
5
7
  * @import {PriceFeedConfig} from '@agoric/inter-protocol/src/proposals/deploy-price-feeds.js';
@@ -69,6 +71,16 @@ export const defaultProposalBuilder = async ({ publishRef, install }, opts) => {
69
71
  throw Error(error);
70
72
  }
71
73
  const { oracleAddresses, inBrandNames, contractTerms } = config;
74
+ const priceAggregator = interProtocolBundleSpecs.priceAggregator;
75
+ const priceAggregatorPath = await buildBundlePath(
76
+ import.meta.url,
77
+ priceAggregator,
78
+ );
79
+ const scaledPriceAuthorityPath = await buildBundlePath(
80
+ import.meta.url,
81
+ '@agoric/zoe/src/contracts/scaledPriceAuthority.js',
82
+ 'scaledPriceAuthority',
83
+ );
72
84
  console.log(
73
85
  'Generating price feeds update proposal with config',
74
86
  JSON.stringify({ oracleAddresses, inBrandNames, contractTerms }),
@@ -82,15 +94,12 @@ export const defaultProposalBuilder = async ({ publishRef, install }, opts) => {
82
94
  inBrandNames,
83
95
  contractTerms,
84
96
  priceAggregatorRef: publishRef(
85
- install(
86
- '@agoric/inter-protocol/src/price/fluxAggregatorContract.js',
87
- '../bundles/bundle-fluxAggregatorKit.js',
88
- ),
97
+ install(priceAggregator.packagePath, priceAggregatorPath),
89
98
  ),
90
99
  scaledPARef: publishRef(
91
100
  install(
92
101
  '@agoric/zoe/src/contracts/scaledPriceAuthority.js',
93
- '../bundles/bundle-scaledPriceAuthority.js',
102
+ scaledPriceAuthorityPath,
94
103
  ),
95
104
  ),
96
105
  },
@@ -0,0 +1,87 @@
1
+ /* eslint-env node */
2
+ import { dirname, resolve as pathResolve } from 'path';
3
+ import { fileURLToPath } from 'url';
4
+
5
+ import { unsafeMakeBundleCache } from '@agoric/swingset-vat/tools/bundleTool.js';
6
+
7
+ /** @type {Map<string, Promise<Awaited<ReturnType<typeof unsafeMakeBundleCache>>>>} */
8
+ const bundleCaches = new Map();
9
+ /** @type {Map<string, Promise<string>>} */
10
+ const bundlePathCache = new Map();
11
+
12
+ /**
13
+ * @typedef {{
14
+ * sourceSpec?: string;
15
+ * packagePath?: string;
16
+ * bundleName?: string;
17
+ * }} BundleRegistryEntry
18
+ */
19
+
20
+ /**
21
+ * Build (or validate) a cached bundle and return the absolute pathname.
22
+ *
23
+ * @param {string} fromMetaUrl
24
+ * @param {string | BundleRegistryEntry} moduleSpecifierOrEntry
25
+ * @param {string} [bundleName]
26
+ * @param {{ bundleDirRel?: string }} [options]
27
+ */
28
+ export const buildBundlePath = async (
29
+ fromMetaUrl,
30
+ moduleSpecifierOrEntry,
31
+ bundleName = undefined,
32
+ options = {},
33
+ ) => {
34
+ const { bundleDirRel = '../bundles' } = options;
35
+ const fromDir = dirname(fileURLToPath(fromMetaUrl));
36
+ /** @type {string | undefined} */
37
+ let sourceSpec;
38
+ /** @type {string | undefined} */
39
+ let resolvedBundleName;
40
+
41
+ if (typeof moduleSpecifierOrEntry === 'string') {
42
+ sourceSpec = fileURLToPath(import.meta.resolve(moduleSpecifierOrEntry));
43
+ if (typeof bundleName !== 'string') {
44
+ throw TypeError('bundleName is required when using a module specifier');
45
+ }
46
+ resolvedBundleName = bundleName;
47
+ } else {
48
+ const {
49
+ sourceSpec: sourceSpec0,
50
+ packagePath,
51
+ bundleName: entryBundleName,
52
+ } = /** @type {BundleRegistryEntry} */ (moduleSpecifierOrEntry);
53
+ sourceSpec =
54
+ sourceSpec0 ||
55
+ (packagePath && fileURLToPath(import.meta.resolve(packagePath)));
56
+ resolvedBundleName = entryBundleName;
57
+ }
58
+ if (!sourceSpec || !resolvedBundleName) {
59
+ throw TypeError(
60
+ 'registry entry must provide sourceSpec/packagePath and bundleName',
61
+ );
62
+ }
63
+
64
+ const bundleDir = pathResolve(fromDir, bundleDirRel);
65
+ // Use '\0' to avoid ambiguity between key components.
66
+ const cacheKey = [bundleDir, sourceSpec, resolvedBundleName].join('\0');
67
+ const cached = bundlePathCache.get(cacheKey);
68
+ if (cached) {
69
+ return cached;
70
+ }
71
+
72
+ const bundlePathP = (async () => {
73
+ if (!bundleCaches.has(bundleDir)) {
74
+ bundleCaches.set(bundleDir, unsafeMakeBundleCache(bundleDir));
75
+ }
76
+ const bundleCacheP = bundleCaches.get(bundleDir);
77
+ assert(bundleCacheP, `missing bundle cache for ${bundleDir}`);
78
+ const bundleCache = await bundleCacheP;
79
+ const { bundleFileName } = await bundleCache.validateOrAdd(
80
+ sourceSpec,
81
+ resolvedBundleName,
82
+ );
83
+ return pathResolve(bundleDir, bundleFileName);
84
+ })();
85
+ bundlePathCache.set(cacheKey, bundlePathP);
86
+ return bundlePathP;
87
+ };
@@ -1,4 +1,5 @@
1
1
  import { makeHelpers } from '@agoric/deploy-script-support';
2
+ import { buildBundlePath } from '../lib/build-bundle.js';
2
3
 
3
4
  /**
4
5
  * @import {CoreEvalBuilder} from '@agoric/deploy-script-support/src/externalTypes.js';
@@ -6,21 +7,24 @@ import { makeHelpers } from '@agoric/deploy-script-support';
6
7
  */
7
8
 
8
9
  /** @type {CoreEvalBuilder} */
9
- export const defaultProposalBuilder = async ({ publishRef, install }) =>
10
- harden({
10
+ export const defaultProposalBuilder = async ({ publishRef, install }) => {
11
+ const pegasusPath = await buildBundlePath(
12
+ import.meta.url,
13
+ '@agoric/pegasus/src/contract.js',
14
+ 'pegasus',
15
+ );
16
+ return harden({
11
17
  sourceSpec: '@agoric/pegasus/src/proposals/core-proposal.js',
12
18
  getManifestCall: [
13
19
  'getManifestForPegasus',
14
20
  {
15
21
  pegasusRef: publishRef(
16
- install(
17
- '@agoric/pegasus/src/contract.js',
18
- '../bundles/bundle-pegasus.js',
19
- ),
22
+ install('@agoric/pegasus/src/contract.js', pegasusPath),
20
23
  ),
21
24
  },
22
25
  ],
23
26
  });
27
+ };
24
28
 
25
29
  /** @type {DeployScriptFunction} */
26
30
  export default async (homeP, endowments) => {
@@ -7,6 +7,7 @@
7
7
 
8
8
  import { makeHelpers } from '@agoric/deploy-script-support';
9
9
  import { getManifestForGame1 } from '@agoric/smart-wallet/test/start-game1-proposal.js';
10
+ import { buildBundlePath } from '../lib/build-bundle.js';
10
11
 
11
12
  /**
12
13
  * @import {CoreEvalBuilder} from '@agoric/deploy-script-support/src/externalTypes.js';
@@ -15,17 +16,20 @@ import { getManifestForGame1 } from '@agoric/smart-wallet/test/start-game1-propo
15
16
 
16
17
  /** @type {CoreEvalBuilder} */
17
18
  const game1ProposalBuilder = async ({ publishRef, install }) => {
19
+ const game1Path = await buildBundlePath(
20
+ import.meta.url,
21
+ '@agoric/smart-wallet/test/gameAssetContract.js',
22
+ 'game1',
23
+ );
18
24
  return harden({
19
25
  sourceSpec: '@agoric/smart-wallet/test/start-game1-proposal.js',
20
26
  getManifestCall: [
21
27
  getManifestForGame1.name,
22
28
  {
23
29
  game1Ref: publishRef(
24
- install(
25
- '@agoric/smart-wallet/test/gameAssetContract.js',
26
- '../bundles/bundle-game1.js',
27
- { persist: true },
28
- ),
30
+ install('@agoric/smart-wallet/test/gameAssetContract.js', game1Path, {
31
+ persist: true,
32
+ }),
29
33
  ),
30
34
  },
31
35
  ],
@@ -6,7 +6,9 @@
6
6
  */
7
7
 
8
8
  import { makeHelpers } from '@agoric/deploy-script-support';
9
+ import { smartWalletSourceSpecRegistry } from '@agoric/smart-wallet/source-spec-registry.js';
9
10
  import { getManifestForUpgrade } from '@agoric/smart-wallet/src/proposals/upgrade-walletFactory-proposal.js';
11
+ import { buildBundlePath } from '../lib/build-bundle.js';
10
12
 
11
13
  /**
12
14
  * @import {CoreEvalBuilder} from '@agoric/deploy-script-support/src/externalTypes.js';
@@ -15,6 +17,11 @@ import { getManifestForUpgrade } from '@agoric/smart-wallet/src/proposals/upgrad
15
17
 
16
18
  /** @type {CoreEvalBuilder} */
17
19
  export const defaultProposalBuilder = async ({ publishRef, install }) => {
20
+ const walletFactory = smartWalletSourceSpecRegistry.walletFactory;
21
+ const walletFactoryPath = await buildBundlePath(
22
+ import.meta.url,
23
+ walletFactory,
24
+ );
18
25
  return harden({
19
26
  sourceSpec:
20
27
  '@agoric/smart-wallet/src/proposals/upgrade-walletFactory-proposal.js',
@@ -22,11 +29,9 @@ export const defaultProposalBuilder = async ({ publishRef, install }) => {
22
29
  getManifestForUpgrade.name,
23
30
  {
24
31
  walletFactoryRef: publishRef(
25
- install(
26
- '@agoric/smart-wallet/src/walletFactory.js',
27
- '../bundles/bundle-walletFactory.js',
28
- { persist: true },
29
- ),
32
+ install(walletFactory.packagePath, walletFactoryPath, {
33
+ persist: true,
34
+ }),
30
35
  ),
31
36
  },
32
37
  ],
@@ -1,4 +1,7 @@
1
1
  import { makeHelpers } from '@agoric/deploy-script-support';
2
+ import { interProtocolBundleSpecs } from '@agoric/inter-protocol/source-spec-registry.js';
3
+ import { smartWalletSourceSpecRegistry } from '@agoric/smart-wallet/source-spec-registry.js';
4
+ import { buildBundlePath } from '../lib/build-bundle.js';
2
5
 
3
6
  /**
4
7
  * @import {CoreEvalBuilder} from '@agoric/deploy-script-support/src/externalTypes.js';
@@ -6,29 +9,35 @@ import { makeHelpers } from '@agoric/deploy-script-support';
6
9
  */
7
10
 
8
11
  /** @type {CoreEvalBuilder} */
9
- export const defaultProposalBuilder = async ({ publishRef, install }) =>
10
- harden({
12
+ export const defaultProposalBuilder = async ({ publishRef, install }) => {
13
+ const provisionPool = interProtocolBundleSpecs.provisionPool;
14
+ const walletFactory = smartWalletSourceSpecRegistry.walletFactory;
15
+ const provisionPoolPath = await buildBundlePath(
16
+ import.meta.url,
17
+ provisionPool,
18
+ );
19
+ const walletFactoryPath = await buildBundlePath(
20
+ import.meta.url,
21
+ walletFactory,
22
+ );
23
+
24
+ return harden({
11
25
  sourceSpec: '@agoric/vats/src/core/startWalletFactory.js',
12
26
  getManifestCall: [
13
27
  'getManifestForWalletFactory',
14
28
  {
15
29
  installKeys: {
16
30
  provisionPool: publishRef(
17
- install(
18
- '@agoric/inter-protocol/src/provisionPool.js',
19
- '../bundles/bundle-provisionPool.js',
20
- ),
31
+ install(provisionPool.packagePath, provisionPoolPath),
21
32
  ),
22
33
  walletFactory: publishRef(
23
- install(
24
- '@agoric/smart-wallet/src/walletFactory.js',
25
- '../../smart-wallet/bundles/bundle-walletFactory.js',
26
- ),
34
+ install(walletFactory.packagePath, walletFactoryPath),
27
35
  ),
28
36
  },
29
37
  },
30
38
  ],
31
39
  });
40
+ };
32
41
 
33
42
  /** @type {DeployScriptFunction} */
34
43
  export default async (homeP, endowments) => {
@@ -1,6 +1,8 @@
1
1
  /* global process */
2
2
 
3
+ import { interProtocolBundleSpecs } from '@agoric/inter-protocol/source-spec-registry.js';
3
4
  import { DEFAULT_CONTRACT_TERMS } from '../inter-protocol/price-feed-core.js';
5
+ import { buildBundlePath } from '../lib/build-bundle.js';
4
6
 
5
7
  /**
6
8
  * @import {CoreEvalBuilder} from '@agoric/deploy-script-support/src/externalTypes.js';
@@ -34,6 +36,12 @@ export const strictPriceFeedProposalBuilder = async (
34
36
  Array.isArray(IN_BRAND_LOOKUP) ||
35
37
  Fail`IN_BRAND_NAME array is required; got ${IN_BRAND_LOOKUP}`;
36
38
 
39
+ const priceAggregator = interProtocolBundleSpecs.priceAggregator;
40
+ const priceAggregatorPath = await buildBundlePath(
41
+ import.meta.url,
42
+ priceAggregator,
43
+ );
44
+
37
45
  return harden({
38
46
  sourceSpec: '@agoric/inter-protocol/src/proposals/price-feed-proposal.js',
39
47
  getManifestCall: [
@@ -47,10 +55,7 @@ export const strictPriceFeedProposalBuilder = async (
47
55
  OUT_BRAND_DECIMALS: 4,
48
56
  OUT_BRAND_NAME: 'USD',
49
57
  priceAggregatorRef: publishRef(
50
- install(
51
- '@agoric/inter-protocol/src/price/fluxAggregatorContract.js',
52
- '../bundles/bundle-fluxAggregatorKit.js',
53
- ),
58
+ install(priceAggregator.packagePath, priceAggregatorPath),
54
59
  ),
55
60
  },
56
61
  ],