@agoric/deploy-script-support 0.10.4-mainnet1B-dev-26244e8.0 → 0.10.4-orchestration-dev-096c4e8.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/exported.js +0 -2
- package/package.json +27 -20
- package/src/coreProposalBehavior.js +117 -64
- package/src/endo-pieces-contract.js +3 -0
- package/src/externalTypes.js +9 -10
- package/src/extract-proposal.js +232 -154
- package/src/getBundlerMaker.js +4 -0
- package/src/helpers.js +4 -1
- package/src/install.js +2 -11
- package/src/offer.js +5 -6
- package/src/saveIssuer.js +2 -2
- package/src/startInstance.js +3 -4
- package/src/writeCoreProposal.js +76 -14
- package/CHANGELOG.md +0 -563
package/src/extract-proposal.js
CHANGED
|
@@ -11,21 +11,47 @@ import {
|
|
|
11
11
|
} from './coreProposalBehavior.js';
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
|
-
* @typedef {string | {
|
|
14
|
+
* @typedef {string | {module: string, entrypoint?: string, args?: Array<unknown>}} ConfigProposal
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
/**
|
|
18
|
+
* @typedef {{steps: ConfigProposal[][]}} SequentialCoreProposals
|
|
19
|
+
* @typedef {ConfigProposal[] | SequentialCoreProposals} CoreProposals
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
const { Fail } = assert;
|
|
18
23
|
|
|
19
24
|
const req = createRequire(import.meta.url);
|
|
20
25
|
|
|
26
|
+
/**
|
|
27
|
+
* @param {...(CoreProposals | undefined | null)} args
|
|
28
|
+
* @returns {SequentialCoreProposals}
|
|
29
|
+
*/
|
|
30
|
+
export const mergeCoreProposals = (...args) => {
|
|
31
|
+
/** @type {ConfigProposal[][]} */
|
|
32
|
+
const steps = [];
|
|
33
|
+
for (const coreProposal of args) {
|
|
34
|
+
if (!coreProposal) {
|
|
35
|
+
continue;
|
|
36
|
+
}
|
|
37
|
+
if ('steps' in coreProposal) {
|
|
38
|
+
steps.push(...coreProposal.steps);
|
|
39
|
+
} else {
|
|
40
|
+
steps.push(coreProposal);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
return harden({ steps });
|
|
44
|
+
};
|
|
45
|
+
harden(mergeCoreProposals);
|
|
46
|
+
|
|
21
47
|
/**
|
|
22
48
|
* @param {(ModuleSpecifier | FilePath)[]} paths
|
|
23
49
|
* @typedef {string} ModuleSpecifier
|
|
24
50
|
* @typedef {string} FilePath
|
|
25
51
|
*/
|
|
26
52
|
const pathResolve = (...paths) => {
|
|
27
|
-
const fileName = paths.pop();
|
|
28
|
-
|
|
53
|
+
const fileName = /** @type {string} */ (paths.pop());
|
|
54
|
+
fileName || Fail`base name required`;
|
|
29
55
|
try {
|
|
30
56
|
return req.resolve(fileName, {
|
|
31
57
|
paths,
|
|
@@ -40,6 +66,19 @@ const findModule = (initDir, srcSpec) =>
|
|
|
40
66
|
? pathResolve(initDir, srcSpec)
|
|
41
67
|
: req.resolve(srcSpec);
|
|
42
68
|
|
|
69
|
+
/**
|
|
70
|
+
* @param {{ bundleID?: string, bundleName?: string }} handle - mutated then hardened
|
|
71
|
+
* @param {string} sourceSpec - the specifier of a module to load
|
|
72
|
+
* @param {string} key - the key of the proposal
|
|
73
|
+
* @param {string} piece - the piece of the proposal
|
|
74
|
+
* @returns {Promise<[string, any]>}
|
|
75
|
+
*/
|
|
76
|
+
const namedHandleToBundleSpec = async (handle, sourceSpec, key, piece) => {
|
|
77
|
+
handle.bundleName = `coreProposal${String(key)}_${piece}`;
|
|
78
|
+
harden(handle);
|
|
79
|
+
return harden([handle.bundleName, { sourceSpec }]);
|
|
80
|
+
};
|
|
81
|
+
|
|
43
82
|
/**
|
|
44
83
|
* Format core proposals to be run at bootstrap:
|
|
45
84
|
* SwingSet `bundles` configuration
|
|
@@ -51,188 +90,227 @@ const findModule = (initDir, srcSpec) =>
|
|
|
51
90
|
* but for sim-chain and such, they can be declared statically in
|
|
52
91
|
* the chain configuration, in which case they are run at bootstrap.
|
|
53
92
|
*
|
|
54
|
-
* @param {
|
|
93
|
+
* @param {CoreProposals} coreProposals - governance
|
|
55
94
|
* proposals to run at chain bootstrap for scenarios such as sim-chain.
|
|
56
95
|
* @param {FilePath} [dirname]
|
|
57
|
-
* @param {
|
|
58
|
-
* @param {
|
|
96
|
+
* @param {object} [opts]
|
|
97
|
+
* @param {typeof makeEnactCoreProposalsFromBundleRef} [opts.makeEnactCoreProposals]
|
|
98
|
+
* @param {(key: PropertyKey) => PropertyKey} [opts.getSequenceForProposal]
|
|
99
|
+
* @param {typeof namedHandleToBundleSpec} [opts.handleToBundleSpec]
|
|
59
100
|
*/
|
|
60
101
|
export const extractCoreProposalBundles = async (
|
|
61
102
|
coreProposals,
|
|
62
103
|
dirname = '.',
|
|
63
|
-
|
|
64
|
-
getSequenceForProposal,
|
|
104
|
+
opts,
|
|
65
105
|
) => {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
getSequenceForProposal =
|
|
69
|
-
|
|
106
|
+
const {
|
|
107
|
+
makeEnactCoreProposals = makeEnactCoreProposalsFromBundleRef,
|
|
108
|
+
getSequenceForProposal = key => key,
|
|
109
|
+
handleToBundleSpec = namedHandleToBundleSpec,
|
|
110
|
+
} = opts || {};
|
|
70
111
|
|
|
71
112
|
dirname = pathResolve(dirname);
|
|
72
113
|
dirname = await fs.promises
|
|
73
114
|
.stat(dirname)
|
|
74
115
|
.then(stbuf => (stbuf.isDirectory() ? dirname : path.dirname(dirname)));
|
|
75
116
|
|
|
76
|
-
/** @type {Map<{ bundleName?: string }, { source: string, bundle?: string }>} */
|
|
117
|
+
/** @type {Map<{ bundleID?: string, bundleName?: string }, { source: string, bundle?: string }>} */
|
|
77
118
|
const bundleHandleToAbsolutePaths = new Map();
|
|
78
119
|
|
|
120
|
+
const proposalSteps =
|
|
121
|
+
'steps' in coreProposals ? coreProposals.steps : [coreProposals];
|
|
79
122
|
const bundleToSource = new Map();
|
|
80
|
-
const
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
typeof module === 'string' ||
|
|
99
|
-
Fail`coreProposal module ${module} must be string`;
|
|
100
|
-
typeof entrypoint === 'string' ||
|
|
101
|
-
Fail`coreProposal entrypoint ${entrypoint} must be string`;
|
|
102
|
-
Array.isArray(args) || Fail`coreProposal args ${args} must be array`;
|
|
103
|
-
|
|
104
|
-
const thisProposalBundleHandles = new Set();
|
|
105
|
-
assert(getSequenceForProposal);
|
|
106
|
-
const thisProposalSequence = getSequenceForProposal(i);
|
|
107
|
-
const initPath = findModule(dirname, module);
|
|
108
|
-
const initDir = path.dirname(initPath);
|
|
109
|
-
/** @type {Record<string, import('./externalTypes.js').ProposalBuilder>} */
|
|
110
|
-
const ns = await import(initPath);
|
|
111
|
-
const install = (srcSpec, bundlePath) => {
|
|
112
|
-
const absoluteSrc = findModule(initDir, srcSpec);
|
|
113
|
-
const bundleHandle = {};
|
|
114
|
-
const absolutePaths = { source: absoluteSrc };
|
|
115
|
-
if (bundlePath) {
|
|
116
|
-
const absoluteBundle = pathResolve(initDir, bundlePath);
|
|
117
|
-
absolutePaths.bundle = absoluteBundle;
|
|
118
|
-
const oldSource = bundleToSource.get(absoluteBundle);
|
|
119
|
-
if (oldSource) {
|
|
120
|
-
assert.equal(
|
|
121
|
-
oldSource,
|
|
122
|
-
absoluteSrc,
|
|
123
|
-
X`${bundlePath} already installed from ${oldSource}, now ${absoluteSrc}`,
|
|
124
|
-
);
|
|
123
|
+
const extractedSteps = await Promise.all(
|
|
124
|
+
proposalSteps.map((proposalStep, i) =>
|
|
125
|
+
Promise.all(
|
|
126
|
+
proposalStep.map(async (coreProposal, j) => {
|
|
127
|
+
const key = `${i}.${j}`;
|
|
128
|
+
// console.debug(`Parsing core proposal:`, coreProposal);
|
|
129
|
+
|
|
130
|
+
/** @type {string} */
|
|
131
|
+
let entrypoint;
|
|
132
|
+
/** @type {unknown[]} */
|
|
133
|
+
let args;
|
|
134
|
+
/** @type {string} */
|
|
135
|
+
let module;
|
|
136
|
+
if (typeof coreProposal === 'string') {
|
|
137
|
+
module = coreProposal;
|
|
138
|
+
entrypoint = 'defaultProposalBuilder';
|
|
139
|
+
args = [];
|
|
125
140
|
} else {
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
thisProposalBundleHandles.add(bundleHandle);
|
|
132
|
-
bundleHandleToAbsolutePaths.set(bundleHandle, harden(absolutePaths));
|
|
133
|
-
return bundleHandle;
|
|
134
|
-
};
|
|
135
|
-
/** @type {import('./externalTypes.js').PublishBundleRef} */
|
|
136
|
-
const publishRef = async handleP => {
|
|
137
|
-
const handle = await handleP;
|
|
138
|
-
bundleHandleToAbsolutePaths.has(handle) ||
|
|
139
|
-
Fail`${handle} not in installed bundles`;
|
|
140
|
-
return handle;
|
|
141
|
-
};
|
|
142
|
-
const proposal = await ns[entrypoint]({ publishRef, install }, ...args);
|
|
143
|
-
|
|
144
|
-
// Add the proposal bundle handles in sorted order.
|
|
145
|
-
const bundleSpecEntries = [...thisProposalBundleHandles.keys()]
|
|
146
|
-
.map(handle => [handle, bundleHandleToAbsolutePaths.get(handle)])
|
|
147
|
-
.sort(([_hnda, { source: a }], [_hndb, { source: b }]) => {
|
|
148
|
-
if (a < b) {
|
|
149
|
-
return -1;
|
|
141
|
+
({
|
|
142
|
+
module,
|
|
143
|
+
entrypoint = 'defaultProposalBuilder',
|
|
144
|
+
args = [],
|
|
145
|
+
} = coreProposal);
|
|
150
146
|
}
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
const
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
147
|
+
|
|
148
|
+
typeof module === 'string' ||
|
|
149
|
+
Fail`coreProposal module ${module} must be string`;
|
|
150
|
+
typeof entrypoint === 'string' ||
|
|
151
|
+
Fail`coreProposal entrypoint ${entrypoint} must be string`;
|
|
152
|
+
Array.isArray(args) || Fail`coreProposal args ${args} must be array`;
|
|
153
|
+
|
|
154
|
+
const thisProposalBundleHandles = new Set();
|
|
155
|
+
assert(getSequenceForProposal);
|
|
156
|
+
const thisProposalSequence = getSequenceForProposal(key);
|
|
157
|
+
const initPath = findModule(dirname, module);
|
|
158
|
+
const initDir = path.dirname(initPath);
|
|
159
|
+
/** @type {Record<string, import('./externalTypes.js').ProposalBuilder>} */
|
|
160
|
+
const ns = await import(initPath);
|
|
161
|
+
const install = (srcSpec, bundlePath) => {
|
|
162
|
+
const absoluteSrc = findModule(initDir, srcSpec);
|
|
163
|
+
const bundleHandle = {};
|
|
164
|
+
const absolutePaths = { source: absoluteSrc };
|
|
165
|
+
if (bundlePath) {
|
|
166
|
+
const absoluteBundle = pathResolve(initDir, bundlePath);
|
|
167
|
+
absolutePaths.bundle = absoluteBundle;
|
|
168
|
+
const oldSource = bundleToSource.get(absoluteBundle);
|
|
169
|
+
if (oldSource) {
|
|
170
|
+
oldSource === absoluteSrc ||
|
|
171
|
+
Fail`${bundlePath} already installed from ${oldSource}, now ${absoluteSrc}`;
|
|
172
|
+
} else {
|
|
173
|
+
bundleToSource.set(absoluteBundle, absoluteSrc);
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
// Don't harden the bundleHandle since we need to set the bundleName on
|
|
177
|
+
// its unique identity later.
|
|
178
|
+
thisProposalBundleHandles.add(bundleHandle);
|
|
179
|
+
bundleHandleToAbsolutePaths.set(
|
|
180
|
+
bundleHandle,
|
|
181
|
+
harden(absolutePaths),
|
|
182
|
+
);
|
|
183
|
+
return bundleHandle;
|
|
184
|
+
};
|
|
185
|
+
/** @type {import('./externalTypes.js').PublishBundleRef} */
|
|
186
|
+
const publishRef = async handleP => {
|
|
187
|
+
const handle = await handleP;
|
|
188
|
+
// eslint-disable-next-line @typescript-eslint/prefer-ts-expect-error -- https://github.com/Agoric/agoric-sdk/issues/4620 */
|
|
189
|
+
// @ts-ignore xxx types
|
|
190
|
+
bundleHandleToAbsolutePaths.has(handle) ||
|
|
191
|
+
Fail`${handle} not in installed bundles`;
|
|
192
|
+
return handle;
|
|
193
|
+
};
|
|
194
|
+
const proposal = await ns[entrypoint](
|
|
195
|
+
{
|
|
196
|
+
publishRef,
|
|
197
|
+
// @ts-expect-error not statically verified to return a full obj
|
|
198
|
+
install,
|
|
199
|
+
},
|
|
200
|
+
...args,
|
|
201
|
+
);
|
|
202
|
+
|
|
203
|
+
// Add the proposal bundle handles in sorted order.
|
|
204
|
+
const bundleSpecEntries = await Promise.all(
|
|
205
|
+
[...thisProposalBundleHandles.keys()]
|
|
206
|
+
.map(handle => [handle, bundleHandleToAbsolutePaths.get(handle)])
|
|
207
|
+
.sort(([_hnda, { source: a }], [_hndb, { source: b }]) => {
|
|
208
|
+
if (a < b) {
|
|
209
|
+
return -1;
|
|
210
|
+
}
|
|
211
|
+
if (a > b) {
|
|
212
|
+
return 1;
|
|
213
|
+
}
|
|
214
|
+
return 0;
|
|
215
|
+
})
|
|
216
|
+
.map(async ([handle, absolutePaths], k) => {
|
|
217
|
+
// Transform the bundle handle identity into a bundleName reference.
|
|
218
|
+
const specEntry = await handleToBundleSpec(
|
|
219
|
+
handle,
|
|
220
|
+
absolutePaths.source,
|
|
221
|
+
thisProposalSequence,
|
|
222
|
+
String(k),
|
|
223
|
+
);
|
|
224
|
+
harden(handle);
|
|
225
|
+
return specEntry;
|
|
226
|
+
}),
|
|
227
|
+
);
|
|
228
|
+
|
|
229
|
+
// Now that we've assigned all the bundleNames and hardened the
|
|
230
|
+
// handles, we can extract the behavior bundle.
|
|
231
|
+
const { sourceSpec, getManifestCall } = await deeplyFulfilledObject(
|
|
232
|
+
harden(proposal),
|
|
233
|
+
);
|
|
234
|
+
|
|
235
|
+
const proposalSource = pathResolve(initDir, sourceSpec);
|
|
236
|
+
const proposalNS = await import(proposalSource);
|
|
237
|
+
const [manifestGetterName, ...manifestGetterArgs] = getManifestCall;
|
|
238
|
+
manifestGetterName in proposalNS ||
|
|
239
|
+
Fail`proposal ${proposalSource} missing export ${manifestGetterName}`;
|
|
240
|
+
const { manifest: customManifest } = await proposalNS[
|
|
241
|
+
manifestGetterName
|
|
242
|
+
](harden({ restoreRef: () => null }), ...manifestGetterArgs);
|
|
243
|
+
|
|
244
|
+
const behaviorBundleHandle = {};
|
|
245
|
+
const specEntry = await handleToBundleSpec(
|
|
246
|
+
behaviorBundleHandle,
|
|
247
|
+
proposalSource,
|
|
248
|
+
thisProposalSequence,
|
|
249
|
+
'proposalNS',
|
|
250
|
+
);
|
|
251
|
+
bundleSpecEntries.unshift(specEntry);
|
|
252
|
+
|
|
253
|
+
bundleHandleToAbsolutePaths.set(
|
|
254
|
+
behaviorBundleHandle,
|
|
255
|
+
harden({
|
|
256
|
+
source: proposalSource,
|
|
257
|
+
}),
|
|
258
|
+
);
|
|
259
|
+
|
|
260
|
+
return /** @type {const} */ ([
|
|
261
|
+
key,
|
|
262
|
+
{
|
|
263
|
+
ref: behaviorBundleHandle,
|
|
264
|
+
call: getManifestCall,
|
|
265
|
+
customManifest,
|
|
266
|
+
bundleSpecs: bundleSpecEntries,
|
|
267
|
+
},
|
|
268
|
+
]);
|
|
269
|
+
}),
|
|
270
|
+
),
|
|
271
|
+
),
|
|
205
272
|
);
|
|
206
273
|
|
|
207
274
|
// Extract all the bundle specs in already-sorted order.
|
|
208
275
|
const bundles = Object.fromEntries(
|
|
209
|
-
|
|
276
|
+
extractedSteps.flatMap(step =>
|
|
277
|
+
step.flatMap(([_key, { bundleSpecs }]) => bundleSpecs),
|
|
278
|
+
),
|
|
210
279
|
);
|
|
211
280
|
harden(bundles);
|
|
212
281
|
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
282
|
+
const codeSteps = extractedSteps.map(extractedStep => {
|
|
283
|
+
// Extract the manifest references and calls.
|
|
284
|
+
const metadataRecords = extractedStep.map(([_key, extractedSpec]) => {
|
|
285
|
+
const { ref, call, customManifest } = extractedSpec;
|
|
286
|
+
return { ref, call, customManifest };
|
|
287
|
+
});
|
|
288
|
+
harden(metadataRecords);
|
|
220
289
|
|
|
221
|
-
|
|
222
|
-
// This is generated by @agoric/
|
|
290
|
+
const code = `\
|
|
291
|
+
// This is generated by @agoric/deploy-script-support/src/extract-proposal.js - DO NOT EDIT
|
|
223
292
|
/* eslint-disable */
|
|
224
293
|
|
|
225
|
-
const
|
|
226
|
-
|
|
227
|
-
const makeCoreProposalBehavior = ${makeCoreProposalBehavior};
|
|
294
|
+
const metadataRecords = harden(${stringify(metadataRecords, true)});
|
|
228
295
|
|
|
229
|
-
|
|
296
|
+
// Make an enactCoreProposals function and "export" it by way of script completion value.
|
|
297
|
+
// It is constructed by an IIFE to ensure the absence of global bindings for
|
|
298
|
+
// makeCoreProposalBehavior and makeEnactCoreProposals (the latter referencing the former),
|
|
299
|
+
// which may not be necessary but preserves behavior pre-dating
|
|
300
|
+
// https://github.com/Agoric/agoric-sdk/pull/8712 .
|
|
301
|
+
const enactCoreProposals = ((
|
|
302
|
+
makeCoreProposalBehavior = ${makeCoreProposalBehavior},
|
|
303
|
+
makeEnactCoreProposals = ${makeEnactCoreProposals},
|
|
304
|
+
) => makeEnactCoreProposals({ metadataRecords, E }))();
|
|
305
|
+
enactCoreProposals;
|
|
230
306
|
`;
|
|
307
|
+
return defangAndTrim(code);
|
|
308
|
+
});
|
|
231
309
|
|
|
232
310
|
// console.debug('created bundles from proposals:', coreProposals, bundles);
|
|
233
|
-
return {
|
|
311
|
+
return harden({
|
|
234
312
|
bundles,
|
|
235
|
-
|
|
313
|
+
codeSteps,
|
|
236
314
|
bundleHandleToAbsolutePaths,
|
|
237
|
-
};
|
|
315
|
+
});
|
|
238
316
|
};
|
package/src/getBundlerMaker.js
CHANGED
|
@@ -13,6 +13,9 @@
|
|
|
13
13
|
import { E } from '@endo/far';
|
|
14
14
|
import url from 'url';
|
|
15
15
|
|
|
16
|
+
/** @typedef {ReturnType<import('./endo-pieces-contract.js')['start']>['publicFacet']} BundleMaker */
|
|
17
|
+
/** @typedef {ReturnType<BundleMaker['makeBundler']>} Bundler */
|
|
18
|
+
|
|
16
19
|
export const makeGetBundlerMaker =
|
|
17
20
|
(homeP, { lookup, bundleSource }) =>
|
|
18
21
|
async ({
|
|
@@ -20,6 +23,7 @@ export const makeGetBundlerMaker =
|
|
|
20
23
|
log = console.log,
|
|
21
24
|
} = {}) => {
|
|
22
25
|
const { board: optionalBoard, zoe, scratch } = await homeP;
|
|
26
|
+
/** @type {() => Promise<BundleMaker>} */
|
|
23
27
|
const lookupOrCreate = async () => {
|
|
24
28
|
// Locate the bundler maker if any already exists at the given path.
|
|
25
29
|
let bundlerMaker = await lookup(JSON.parse(BUNDLER_MAKER_LOOKUP));
|
package/src/helpers.js
CHANGED
package/src/install.js
CHANGED
|
@@ -3,20 +3,11 @@ import './externalTypes.js';
|
|
|
3
3
|
|
|
4
4
|
import { E } from '@endo/far';
|
|
5
5
|
|
|
6
|
-
/** @typedef {import('@agoric/deploy-script-support/src/externalTypes').Petname} Petname */
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* @callback BundleSource
|
|
10
|
-
* @param {string} startFilename - the filepath to start the bundling from
|
|
11
|
-
* @param {ModuleFormat | BundleOptions} [moduleFormat]
|
|
12
|
-
* @param {object} [powers]
|
|
13
|
-
* @param {ReadFn} [powers.read]
|
|
14
|
-
* @param {CanonicalFn} [powers.canonical]
|
|
15
|
-
*/
|
|
6
|
+
/** @typedef {import('@agoric/deploy-script-support/src/externalTypes.js').Petname} Petname */
|
|
16
7
|
|
|
17
8
|
// XXX board is Board but specifying that leads to type errors with imports which aren't worth fixing right now
|
|
18
9
|
/**
|
|
19
|
-
* @param {
|
|
10
|
+
* @param {typeof import('@endo/bundle-source')['default']} bundleSource
|
|
20
11
|
* @param {ERef<ZoeService>} zoe
|
|
21
12
|
* @param {ERef<import('./startInstance.js').InstallationManager>} installationManager
|
|
22
13
|
* @param {ERef<any>} board
|
package/src/offer.js
CHANGED
|
@@ -4,7 +4,7 @@ import { assert } from '@agoric/assert';
|
|
|
4
4
|
// Avoid pulling in too many dependencies like notifiers
|
|
5
5
|
import { AmountMath } from '@agoric/ertp/src/amountMath.js';
|
|
6
6
|
|
|
7
|
-
/** @typedef {import('@agoric/deploy-script-support/src/externalTypes').Petname} Petname */
|
|
7
|
+
/** @typedef {import('@agoric/deploy-script-support/src/externalTypes.js').Petname} Petname */
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* @typedef {object} OfferHelperConfig
|
|
@@ -19,7 +19,7 @@ import { AmountMath } from '@agoric/ertp/src/amountMath.js';
|
|
|
19
19
|
* @param {ERef<any>} walletAdmin - an internal type of the
|
|
20
20
|
* wallet, not defined here
|
|
21
21
|
* @param {ERef<ZoeService>} zoe
|
|
22
|
-
* @param {ERef<Purse
|
|
22
|
+
* @param {ERef<Purse<'set'>>} zoeInvitationPurse
|
|
23
23
|
*/
|
|
24
24
|
export const makeOfferAndFindInvitationAmount = (
|
|
25
25
|
walletAdmin,
|
|
@@ -28,7 +28,7 @@ export const makeOfferAndFindInvitationAmount = (
|
|
|
28
28
|
) => {
|
|
29
29
|
/**
|
|
30
30
|
* @param {Record<string, any>} invitationDetailsCriteria
|
|
31
|
-
* @returns {Promise<Amount
|
|
31
|
+
* @returns {Promise<Amount<'set'>>} invitationAmount
|
|
32
32
|
*/
|
|
33
33
|
const findInvitationAmount = async invitationDetailsCriteria => {
|
|
34
34
|
const invitationAmount = await E(zoeInvitationPurse).getCurrentAmount();
|
|
@@ -114,9 +114,8 @@ export const makeOfferAndFindInvitationAmount = (
|
|
|
114
114
|
} = config;
|
|
115
115
|
|
|
116
116
|
const invitationToUse = getInvitation(invitation, partialInvitationDetails);
|
|
117
|
-
const invitationDetails =
|
|
118
|
-
invitationToUse
|
|
119
|
-
);
|
|
117
|
+
const invitationDetails =
|
|
118
|
+
await E(zoe).getInvitationDetails(invitationToUse);
|
|
120
119
|
const payments = withdrawPayments(proposal, paymentsWithPursePetnames);
|
|
121
120
|
|
|
122
121
|
const seat = E(zoe).offer(invitationToUse, proposal, payments);
|
package/src/saveIssuer.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
// @ts-check
|
|
2
2
|
import { E } from '@endo/far';
|
|
3
3
|
|
|
4
|
-
/** @typedef {import('@agoric/deploy-script-support/src/externalTypes').Petname} Petname */
|
|
4
|
+
/** @typedef {import('@agoric/deploy-script-support/src/externalTypes.js').Petname} Petname */
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* @param {ERef<any>} walletAdmin - an internal type of the
|
|
8
8
|
* wallet, not defined here
|
|
9
|
-
* @param {ERef<import('./startInstance').IssuerManager>} issuerManager
|
|
9
|
+
* @param {ERef<import('./startInstance.js').IssuerManager>} issuerManager
|
|
10
10
|
*/
|
|
11
11
|
export const makeSaveIssuer = (walletAdmin, issuerManager) => {
|
|
12
12
|
/**
|
package/src/startInstance.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { assert } from '@agoric/assert';
|
|
3
3
|
import { E, passStyleOf } from '@endo/far';
|
|
4
4
|
|
|
5
|
-
/** @typedef {import('@agoric/deploy-script-support/src/externalTypes').Petname} Petname */
|
|
5
|
+
/** @typedef {import('@agoric/deploy-script-support/src/externalTypes.js').Petname} Petname */
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* @template T
|
|
@@ -100,9 +100,8 @@ export const makeStartInstance = (
|
|
|
100
100
|
`creatorInvitation must be defined to be deposited`,
|
|
101
101
|
);
|
|
102
102
|
console.log(`-- Adding Invitation for: ${instancePetname}`);
|
|
103
|
-
const invitationAmount =
|
|
104
|
-
creatorInvitation
|
|
105
|
-
);
|
|
103
|
+
const invitationAmount =
|
|
104
|
+
await E(zoeInvitationPurse).deposit(creatorInvitation);
|
|
106
105
|
console.log(`- Created Contract Instance: ${instancePetname}`);
|
|
107
106
|
|
|
108
107
|
const creatorInvitationDetails = invitationAmount.value[0];
|