@agoric/deploy-script-support 0.10.4-dev-df2faae.0 → 0.10.4-dev-bcab39d.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 +10 -10
- package/src/cachedBundleSpec.js +3 -0
- package/src/externalTypes.js +43 -0
- package/src/helpers.js +8 -0
- package/src/writeCoreEvalParts.js +13 -12
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agoric/deploy-script-support",
|
|
3
|
-
"version": "0.10.4-dev-
|
|
3
|
+
"version": "0.10.4-dev-bcab39d.0+bcab39d",
|
|
4
4
|
"description": "Helpers and other support for writing deploy scripts",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/helpers.js",
|
|
@@ -34,13 +34,13 @@
|
|
|
34
34
|
},
|
|
35
35
|
"homepage": "https://github.com/Agoric/agoric-sdk#readme",
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@agoric/ertp": "0.16.3-dev-
|
|
38
|
-
"@agoric/import-manager": "0.3.12-dev-
|
|
39
|
-
"@agoric/internal": "0.3.3-dev-
|
|
40
|
-
"@agoric/notifier": "0.6.3-dev-
|
|
41
|
-
"@agoric/store": "0.9.3-dev-
|
|
42
|
-
"@agoric/time": "0.3.3-dev-
|
|
43
|
-
"@agoric/zoe": "0.26.3-dev-
|
|
37
|
+
"@agoric/ertp": "0.16.3-dev-bcab39d.0+bcab39d",
|
|
38
|
+
"@agoric/import-manager": "0.3.12-dev-bcab39d.0+bcab39d",
|
|
39
|
+
"@agoric/internal": "0.3.3-dev-bcab39d.0+bcab39d",
|
|
40
|
+
"@agoric/notifier": "0.6.3-dev-bcab39d.0+bcab39d",
|
|
41
|
+
"@agoric/store": "0.9.3-dev-bcab39d.0+bcab39d",
|
|
42
|
+
"@agoric/time": "0.3.3-dev-bcab39d.0+bcab39d",
|
|
43
|
+
"@agoric/zoe": "0.26.3-dev-bcab39d.0+bcab39d",
|
|
44
44
|
"@endo/base64": "^1.0.8",
|
|
45
45
|
"@endo/bundle-source": "^3.4.2",
|
|
46
46
|
"@endo/errors": "^1.2.7",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"@endo/zip": "^1.0.8"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
|
-
"@agoric/vats": "0.15.2-dev-
|
|
54
|
+
"@agoric/vats": "0.15.2-dev-bcab39d.0+bcab39d",
|
|
55
55
|
"@endo/init": "^1.1.6",
|
|
56
56
|
"ava": "^5.3.0",
|
|
57
57
|
"import-meta-resolve": "^2.2.1"
|
|
@@ -74,5 +74,5 @@
|
|
|
74
74
|
"typeCoverage": {
|
|
75
75
|
"atLeast": 82.6
|
|
76
76
|
},
|
|
77
|
-
"gitHead": "
|
|
77
|
+
"gitHead": "bcab39d18519bc8edf27ba0c3b59da34812cc134"
|
|
78
78
|
}
|
package/src/cachedBundleSpec.js
CHANGED
|
@@ -6,6 +6,9 @@ import { Fail } from '@endo/errors';
|
|
|
6
6
|
*/
|
|
7
7
|
export const makeCacheAndGetBundleSpec =
|
|
8
8
|
(cacheDir, { now, fs, pathResolve }) =>
|
|
9
|
+
/**
|
|
10
|
+
* @param {Promise<import('@endo/bundle-source').BundleSourceResult<'endoZipBase64'>>} bundleP
|
|
11
|
+
*/
|
|
9
12
|
async bundleP => {
|
|
10
13
|
const bundle = await bundleP;
|
|
11
14
|
const { endoZipBase64Sha512: hash } = bundle;
|
package/src/externalTypes.js
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
// @ts-check
|
|
2
2
|
export {};
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* @import {NameHub} from '@agoric/vats';
|
|
6
|
+
*/
|
|
7
|
+
|
|
4
8
|
// TODO move this type somewhere better
|
|
5
9
|
/**
|
|
6
10
|
* @typedef {string | string[]} Petname A petname can either be a plain string
|
|
@@ -47,3 +51,42 @@ export {};
|
|
|
47
51
|
* @param {...any} args
|
|
48
52
|
* @returns {Promise<CoreEvalDescriptor>}
|
|
49
53
|
*/
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* @typedef {{
|
|
57
|
+
* bundleSource: typeof import('@endo/bundle-source').default,
|
|
58
|
+
* cacheDir: string,
|
|
59
|
+
* lookup: (...path: string[]) => unknown,
|
|
60
|
+
* now: () => number,
|
|
61
|
+
* pathResolve: (...path: string[]) => string,
|
|
62
|
+
* publishBundle: PublishBundleRef,
|
|
63
|
+
* scriptArgs?: string[],
|
|
64
|
+
* }} DeployScriptEndownments
|
|
65
|
+
*/
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* @typedef {{
|
|
69
|
+
* scratch: ERef<import('@agoric/internal/src/scratch.js').ScratchPad>,
|
|
70
|
+
* }} CommonHome
|
|
71
|
+
*/
|
|
72
|
+
|
|
73
|
+
// TODO wallet as import('@agoric/wallet-backend/src/types').WalletAdmin once it's a module
|
|
74
|
+
/**
|
|
75
|
+
* @typedef {CommonHome & {
|
|
76
|
+
* agoricNames: ERef<NameHub>,
|
|
77
|
+
* bank: ERef<import("@agoric/vats/src/vat-bank.js").Bank>,
|
|
78
|
+
* board: ERef<import("@agoric/vats").Board>,
|
|
79
|
+
* faucet: unknown,
|
|
80
|
+
* myAddressNameAdmin: ERef<import("@agoric/vats").NameAdmin>,
|
|
81
|
+
* namesByAddress: ERef<NameHub>,
|
|
82
|
+
* wallet: any,
|
|
83
|
+
* zoe: ERef<ZoeService>,
|
|
84
|
+
* }} AgSoloHome
|
|
85
|
+
*/
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* @callback DeployScriptFunction
|
|
89
|
+
* @param {Promise<CommonHome>} homeP
|
|
90
|
+
* @param {DeployScriptEndownments} endowments
|
|
91
|
+
* @returns {Promise<void>}
|
|
92
|
+
*/
|
package/src/helpers.js
CHANGED
|
@@ -52,6 +52,10 @@ const makeLazyObject = sourceObject => {
|
|
|
52
52
|
return /** @type {T} */ (lazyObject);
|
|
53
53
|
};
|
|
54
54
|
|
|
55
|
+
/**
|
|
56
|
+
* @param {Promise<import('./externalTypes.js').CommonHome | import('./externalTypes.js').AgSoloHome>} homePromise
|
|
57
|
+
* @param {import('./externalTypes.js').DeployScriptEndownments} endowments
|
|
58
|
+
*/
|
|
55
59
|
export const makeHelpers = async (homePromise, endowments) => {
|
|
56
60
|
// Endowments provided via `agoric run` or `agoric deploy`.
|
|
57
61
|
const {
|
|
@@ -84,6 +88,7 @@ export const makeHelpers = async (homePromise, endowments) => {
|
|
|
84
88
|
return E(deps.walletAdmin).getIssuerManager();
|
|
85
89
|
},
|
|
86
90
|
get offerAndFind() {
|
|
91
|
+
assert('wallet' in deps.home, 'expected AgSolo home');
|
|
87
92
|
return makeOfferAndFindInvitationAmount(
|
|
88
93
|
deps.walletAdmin,
|
|
89
94
|
deps.home.zoe,
|
|
@@ -91,6 +96,7 @@ export const makeHelpers = async (homePromise, endowments) => {
|
|
|
91
96
|
);
|
|
92
97
|
},
|
|
93
98
|
get walletAdmin() {
|
|
99
|
+
assert('wallet' in deps.home, 'expected AgSolo home');
|
|
94
100
|
return E(deps.home.wallet).getAdminFacet();
|
|
95
101
|
},
|
|
96
102
|
get zoeInvitationPurse() {
|
|
@@ -110,6 +116,7 @@ export const makeHelpers = async (homePromise, endowments) => {
|
|
|
110
116
|
return deps.offerAndFind.findInvitationAmount;
|
|
111
117
|
},
|
|
112
118
|
get install() {
|
|
119
|
+
assert('wallet' in deps.home, 'expected AgSolo home');
|
|
113
120
|
return makeInstall(
|
|
114
121
|
bundleSource,
|
|
115
122
|
deps.home.zoe,
|
|
@@ -127,6 +134,7 @@ export const makeHelpers = async (homePromise, endowments) => {
|
|
|
127
134
|
return makeSaveIssuer(deps.walletAdmin, deps.issuerManager);
|
|
128
135
|
},
|
|
129
136
|
get startInstance() {
|
|
137
|
+
assert('wallet' in deps.home, 'expected AgSolo home');
|
|
130
138
|
return makeStartInstance(
|
|
131
139
|
deps.issuerManager,
|
|
132
140
|
deps.instanceManager,
|
|
@@ -11,7 +11,8 @@ import {
|
|
|
11
11
|
} from './coreProposalBehavior.js';
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
|
-
* @import {
|
|
14
|
+
* @import {BundleSource, BundleSourceResult} from '@endo/bundle-source';
|
|
15
|
+
* @import {AgSoloHome, CanonicalHome, CommonHome, CoreEvalBuilder, CoreEvalDescriptor, ManifestBundleRef} from './externalTypes.js';
|
|
15
16
|
*/
|
|
16
17
|
|
|
17
18
|
/**
|
|
@@ -27,20 +28,20 @@ import {
|
|
|
27
28
|
* summary to `${filePrefix}-plan.json), plus whatever bundles bundles the code loads)
|
|
28
29
|
* see CoreEval in {@link '/golang/cosmos/x/swingset/types/swingset.pb.go'}
|
|
29
30
|
* @param {string} filePrefix name on disk
|
|
30
|
-
* @param {
|
|
31
|
+
* @param {CoreEvalBuilder} builder
|
|
31
32
|
* @returns {Promise<CoreEvalPlan>}
|
|
32
33
|
*/
|
|
33
34
|
|
|
34
35
|
/**
|
|
35
36
|
*
|
|
36
|
-
* @param {
|
|
37
|
+
* @param {Promise<CommonHome | AgSoloHome>} homeP
|
|
37
38
|
* @param {{
|
|
38
|
-
* bundleSource:
|
|
39
|
+
* bundleSource: BundleSource,
|
|
39
40
|
* pathResolve: (path: string) => string,
|
|
40
41
|
* }} endowments
|
|
41
42
|
* @param {{
|
|
42
43
|
* getBundlerMaker: () => Promise<import('./getBundlerMaker.js').BundleMaker>,
|
|
43
|
-
* getBundleSpec: (
|
|
44
|
+
* getBundleSpec: (bundle: Promise<BundleSourceResult<'endoZipBase64'>>, getBundle: () => import('./getBundlerMaker.js').Bundler, opts?: any) => Promise<ManifestBundleRef>,
|
|
44
45
|
* log?: typeof console.log,
|
|
45
46
|
* writeFile?: typeof fs.promises.writeFile
|
|
46
47
|
* }} io
|
|
@@ -63,6 +64,7 @@ export const makeWriteCoreEval = (
|
|
|
63
64
|
const getBundler = () => {
|
|
64
65
|
if (!bundlerCache) {
|
|
65
66
|
bundlerCache = E(getBundlerMaker()).makeBundler({
|
|
67
|
+
// @ts-expect-error lazily resolved for AgSoloHome
|
|
66
68
|
zoe: E.get(homeP).zoe,
|
|
67
69
|
});
|
|
68
70
|
}
|
|
@@ -95,17 +97,16 @@ export const makeWriteCoreEval = (
|
|
|
95
97
|
};
|
|
96
98
|
};
|
|
97
99
|
|
|
98
|
-
let mutex =
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
);
|
|
100
|
+
let mutex = /** @type {Promise<ManifestBundleRef | undefined>} */ (
|
|
101
|
+
Promise.resolve()
|
|
102
|
+
);
|
|
102
103
|
/** @type {WriteCoreEval} */
|
|
103
104
|
const writeCoreEval = async (filePrefix, builder) => {
|
|
104
105
|
/**
|
|
105
106
|
*
|
|
106
107
|
* @param {string} entrypoint
|
|
107
108
|
* @param {string} [bundlePath]
|
|
108
|
-
* @returns {Promise<
|
|
109
|
+
* @returns {Promise<BundleSourceResult<'endoZipBase64'>>}
|
|
109
110
|
*/
|
|
110
111
|
const getBundle = async (entrypoint, bundlePath) => {
|
|
111
112
|
if (!bundlePath) {
|
|
@@ -125,7 +126,7 @@ export const makeWriteCoreEval = (
|
|
|
125
126
|
* @param {string} entrypoint
|
|
126
127
|
* @param {string} [bundlePath]
|
|
127
128
|
* @param {unknown} [opts]
|
|
128
|
-
* @returns {Promise<
|
|
129
|
+
* @returns {Promise<ManifestBundleRef>}
|
|
129
130
|
*/
|
|
130
131
|
const install = async (entrypoint, bundlePath, opts) => {
|
|
131
132
|
const bundle = getBundle(entrypoint, bundlePath);
|
|
@@ -146,7 +147,7 @@ export const makeWriteCoreEval = (
|
|
|
146
147
|
|
|
147
148
|
// Await a reference then publish to the board.
|
|
148
149
|
const cmds = [];
|
|
149
|
-
/** @param {Promise<
|
|
150
|
+
/** @param {Promise<ManifestBundleRef>} refP */
|
|
150
151
|
const publishRef = async refP => {
|
|
151
152
|
const { fileName, ...ref } = await refP;
|
|
152
153
|
if (fileName) {
|