@agoric/builders 0.2.0-u16.2 → 0.2.0-u17.1

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.
@@ -0,0 +1,90 @@
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 { deeplyFulfilledObject, makeTracer } from '@agoric/internal';
6
+ import { makeStorageNodeChild } from '@agoric/internal/src/lib-chainStorage.js';
7
+ import { E } from '@endo/far';
8
+
9
+ /// <reference types="@agoric/vats/src/core/types-ambient"/>
10
+
11
+ const trace = makeTracer('RestartSA', true);
12
+
13
+ /**
14
+ * @import {start as StartFn} from '@agoric/orchestration/src/examples/stakeIca.contract.js';
15
+ */
16
+
17
+ /**
18
+ * @param {BootstrapPowers} powers
19
+ */
20
+ export const restartStakeAtom = async ({
21
+ consume: {
22
+ agoricNames,
23
+ board,
24
+ chainStorage,
25
+ chainTimerService,
26
+ cosmosInterchainService,
27
+ contractKits,
28
+ },
29
+ instance: instances,
30
+ }) => {
31
+ trace(restartStakeAtom.name);
32
+
33
+ const instance = await instances.consume.stakeAtom;
34
+ trace('instance', instance);
35
+
36
+ /** @type {StartedInstanceKit<StartFn>} */
37
+ const kit = /** @type {any} */ (await E(contractKits).get(instance));
38
+
39
+ const marshaller = await E(board).getReadonlyMarshaller();
40
+
41
+ const privateArgs = await deeplyFulfilledObject(
42
+ harden({
43
+ agoricNames,
44
+ cosmosInterchainService,
45
+ storageNode: makeStorageNodeChild(chainStorage, 'stakeAtom'),
46
+ marshaller,
47
+ timer: chainTimerService,
48
+ }),
49
+ );
50
+
51
+ await E(kit.adminFacet).restartContract(privateArgs);
52
+ trace('done');
53
+ };
54
+ harden(restartStakeAtom);
55
+
56
+ export const getManifest = () => {
57
+ return {
58
+ manifest: {
59
+ [restartStakeAtom.name]: {
60
+ consume: {
61
+ agoricNames: true,
62
+ board: true,
63
+ chainStorage: true,
64
+ chainTimerService: true,
65
+ cosmosInterchainService: true,
66
+ contractKits: true,
67
+ },
68
+ instance: {
69
+ consume: { stakeAtom: true },
70
+ },
71
+ },
72
+ },
73
+ };
74
+ };
75
+
76
+ /** @type {import('@agoric/deploy-script-support/src/externalTypes.js').CoreEvalBuilder} */
77
+ export const defaultProposalBuilder = async () =>
78
+ harden({
79
+ // Somewhat unorthodox, source the exports from this builder module
80
+ sourceSpec: '@agoric/builders/scripts/testing/restart-stakeAtom.js',
81
+ getManifestCall: [getManifest.name],
82
+ });
83
+
84
+ export default async (homeP, endowments) => {
85
+ // import dynamically so the module can work in CoreEval environment
86
+ const dspModule = await import('@agoric/deploy-script-support');
87
+ const { makeHelpers } = dspModule;
88
+ const { writeCoreEval } = await makeHelpers(homeP, endowments);
89
+ await writeCoreEval(restartStakeAtom.name, defaultProposalBuilder);
90
+ };
@@ -0,0 +1,81 @@
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 { makeTracer } from '@agoric/internal';
6
+ import { E } from '@endo/far';
7
+
8
+ /// <reference types="@agoric/vats/src/core/types-ambient"/>
9
+ /**
10
+ * @import {Instance} from '@agoric/zoe/src/zoeService/utils.js';
11
+ */
12
+
13
+ const trace = makeTracer('RestartValueVow', true);
14
+
15
+ /**
16
+ * @param {BootstrapPowers & {
17
+ * instance: {
18
+ * consume: {
19
+ * valueVow: Instance<
20
+ * import('@agoric/zoe/src/contracts/valueVow.contract.js').start
21
+ * >;
22
+ * };
23
+ * };
24
+ * }} powers
25
+ */
26
+ export const restartValueVow = async ({
27
+ consume: { contractKits },
28
+ instance: instances,
29
+ }) => {
30
+ trace(restartValueVow.name);
31
+
32
+ const vvInstance = await instances.consume.valueVow;
33
+ trace('vvInstance', vvInstance);
34
+ const vvKit = await E(contractKits).get(vvInstance);
35
+
36
+ await E(vvKit.adminFacet).restartContract({});
37
+ trace('done');
38
+ };
39
+ harden(restartValueVow);
40
+
41
+ export const getManifestForValueVow = ({ restoreRef }, { valueVowRef }) => {
42
+ console.log('valueVowRef', valueVowRef);
43
+ return {
44
+ manifest: {
45
+ [restartValueVow.name]: {
46
+ consume: {
47
+ contractKits: true,
48
+ },
49
+ instance: {
50
+ consume: { valueVow: true },
51
+ },
52
+ },
53
+ },
54
+ installations: {
55
+ valueVow: restoreRef(valueVowRef),
56
+ },
57
+ };
58
+ };
59
+
60
+ /** @type {import('@agoric/deploy-script-support/src/externalTypes.js').CoreEvalBuilder} */
61
+ export const defaultProposalBuilder = async ({ publishRef, install }) =>
62
+ harden({
63
+ // Somewhat unorthodox, source the exports from this builder module
64
+ sourceSpec: '@agoric/builders/scripts/testing/restart-valueVow.js',
65
+ getManifestCall: [
66
+ 'getManifestForValueVow',
67
+ {
68
+ valueVowRef: publishRef(
69
+ install('@agoric/zoe/src/contracts/valueVow.contract.js'),
70
+ ),
71
+ },
72
+ ],
73
+ });
74
+
75
+ export default async (homeP, endowments) => {
76
+ // import dynamically so the module can work in CoreEval environment
77
+ const dspModule = await import('@agoric/deploy-script-support');
78
+ const { makeHelpers } = dspModule;
79
+ const { writeCoreEval } = await makeHelpers(homeP, endowments);
80
+ await writeCoreEval(restartValueVow.name, defaultProposalBuilder);
81
+ };
@@ -0,0 +1,127 @@
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
+ export default async (homeP, endowments) => {
122
+ // import dynamically so the module can work in CoreEval environment
123
+ const dspModule = await import('@agoric/deploy-script-support');
124
+ const { makeHelpers } = dspModule;
125
+ const { writeCoreEval } = await makeHelpers(homeP, endowments);
126
+ await writeCoreEval(startAutoStakeIt.name, defaultProposalBuilder);
127
+ };
@@ -0,0 +1,134 @@
1
+ /**
2
+ * @file A proposal to start the query-flows contract.
3
+ *
4
+ * QueryFlows is a testing fixture that publishes query results to vstorage.
5
+ * It's purpose is to support E2E testing.
6
+ */
7
+ import { deeplyFulfilledObject, makeTracer } from '@agoric/internal';
8
+ import { makeStorageNodeChild } from '@agoric/internal/src/lib-chainStorage.js';
9
+ import { E } from '@endo/far';
10
+
11
+ /**
12
+ * @import {QueryFlowsSF as StartFn} from '@agoric/orchestration/src/fixtures/query-flows.contract.js';
13
+ */
14
+
15
+ const contractName = 'queryFlows';
16
+ const trace = makeTracer(contractName, true);
17
+
18
+ /**
19
+ * See `@agoric/builders/builders/scripts/orchestration/init-query-flows.js` for
20
+ * the accompanying proposal builder. Run `agoric run
21
+ * packages/builders/scripts/orchestration/init-query-flows.js` to build the
22
+ * contract and proposal files.
23
+ *
24
+ * @param {BootstrapPowers & {
25
+ * installation: {
26
+ * consume: {
27
+ * queryFlows: Installation<StartFn>;
28
+ * };
29
+ * };
30
+ * }} powers
31
+ */
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 },
48
+ },
49
+ }) => {
50
+ trace(`start ${contractName}`);
51
+
52
+ const storageNode = await makeStorageNodeChild(chainStorage, contractName);
53
+ const marshaller = await E(board).getPublishingMarshaller();
54
+
55
+ /** @type {StartUpgradableOpts<StartFn>} */
56
+ const startOpts = {
57
+ label: 'queryFlows',
58
+ installation,
59
+ terms: undefined,
60
+ privateArgs: await deeplyFulfilledObject(
61
+ harden({
62
+ agoricNames,
63
+ orchestrationService: cosmosInterchainService,
64
+ localchain,
65
+ storageNode,
66
+ marshaller,
67
+ timerService: chainTimerService,
68
+ }),
69
+ ),
70
+ };
71
+
72
+ const { instance } = await E(startUpgradable)(startOpts);
73
+ produceInstance.resolve(instance);
74
+ };
75
+ harden(startQueryFlows);
76
+
77
+ export const getManifestForContract = (
78
+ { restoreRef },
79
+ { installKeys, ...options },
80
+ ) => {
81
+ return {
82
+ manifest: {
83
+ [startQueryFlows.name]: {
84
+ consume: {
85
+ agoricNames: true,
86
+ board: true,
87
+ chainStorage: true,
88
+ chainTimerService: true,
89
+ cosmosInterchainService: true,
90
+ localchain: true,
91
+ startUpgradable: true,
92
+ },
93
+ installation: {
94
+ consume: { [contractName]: true },
95
+ },
96
+ instance: {
97
+ produce: { [contractName]: true },
98
+ },
99
+ },
100
+ },
101
+ installations: {
102
+ [contractName]: restoreRef(installKeys[contractName]),
103
+ },
104
+ options,
105
+ };
106
+ };
107
+
108
+ /** @type {import('@agoric/deploy-script-support/src/externalTypes.js').CoreEvalBuilder} */
109
+ export const defaultProposalBuilder = async ({ publishRef, install }) => {
110
+ return harden({
111
+ // Somewhat unorthodox, source the exports from this builder module
112
+ sourceSpec: '@agoric/builders/scripts/testing/start-query-flows.js',
113
+ getManifestCall: [
114
+ 'getManifestForContract',
115
+ {
116
+ installKeys: {
117
+ queryFlows: publishRef(
118
+ install(
119
+ '@agoric/orchestration/src/fixtures/query-flows.contract.js',
120
+ ),
121
+ ),
122
+ },
123
+ },
124
+ ],
125
+ });
126
+ };
127
+
128
+ export default async (homeP, endowments) => {
129
+ // import dynamically so the module can work in CoreEval environment
130
+ const dspModule = await import('@agoric/deploy-script-support');
131
+ const { makeHelpers } = dspModule;
132
+ const { writeCoreEval } = await makeHelpers(homeP, endowments);
133
+ await writeCoreEval(startQueryFlows.name, defaultProposalBuilder);
134
+ };
@@ -0,0 +1,135 @@
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
+ * @import {Installation} from '@agoric/zoe/src/zoeService/utils.js';
15
+ */
16
+
17
+ const trace = makeTracer('StartSA', 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
+ issuer: {
50
+ consume: { IST },
51
+ },
52
+ }) => {
53
+ trace(startSendAnywhere.name);
54
+
55
+ const marshaller = await E(board).getReadonlyMarshaller();
56
+
57
+ const privateArgs = await deeplyFulfilledObject(
58
+ harden({
59
+ agoricNames,
60
+ localchain,
61
+ marshaller,
62
+ orchestrationService: cosmosInterchainService,
63
+ storageNode: E(NonNullish(await chainStorage)).makeChildNode(
64
+ 'send-anywhere',
65
+ ),
66
+ timerService: chainTimerService,
67
+ }),
68
+ );
69
+
70
+ const { instance } = await E(startUpgradable)({
71
+ label: 'send-anywhere',
72
+ installation: sendAnywhere,
73
+ issuerKeywordRecord: { Stable: await IST },
74
+ privateArgs,
75
+ });
76
+ produceInstance.resolve(instance);
77
+ trace('done');
78
+ };
79
+ harden(startSendAnywhere);
80
+
81
+ export const getManifest = ({ restoreRef }, { installationRef }) => {
82
+ return {
83
+ manifest: {
84
+ [startSendAnywhere.name]: {
85
+ consume: {
86
+ agoricNames: true,
87
+ board: true,
88
+ chainStorage: true,
89
+ chainTimerService: true,
90
+ cosmosInterchainService: true,
91
+ localchain: true,
92
+
93
+ startUpgradable: true,
94
+ },
95
+ installation: {
96
+ consume: { sendAnywhere: true },
97
+ },
98
+ instance: {
99
+ produce: { sendAnywhere: true },
100
+ },
101
+ issuer: {
102
+ consume: { IST: true },
103
+ },
104
+ },
105
+ },
106
+ installations: {
107
+ sendAnywhere: restoreRef(installationRef),
108
+ },
109
+ };
110
+ };
111
+
112
+ /** @type {import('@agoric/deploy-script-support/src/externalTypes.js').CoreEvalBuilder} */
113
+ export const defaultProposalBuilder = async ({ publishRef, install }) =>
114
+ harden({
115
+ // Somewhat unorthodox, source the exports from this builder module
116
+ sourceSpec: '@agoric/builders/scripts/testing/start-send-anywhere.js',
117
+ getManifestCall: [
118
+ getManifest.name,
119
+ {
120
+ installationRef: publishRef(
121
+ install(
122
+ '@agoric/orchestration/src/examples/send-anywhere.contract.js',
123
+ ),
124
+ ),
125
+ },
126
+ ],
127
+ });
128
+
129
+ 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;
133
+ const { writeCoreEval } = await makeHelpers(homeP, endowments);
134
+ await writeCoreEval(startSendAnywhere.name, defaultProposalBuilder);
135
+ };
@@ -0,0 +1,92 @@
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 { makeTracer } from '@agoric/internal';
6
+ import { E } from '@endo/far';
7
+
8
+ /// <reference types="@agoric/vats/src/core/types-ambient"/>
9
+ /**
10
+ * @import {Installation} from '@agoric/zoe/src/zoeService/utils.js';
11
+ */
12
+
13
+ const trace = makeTracer('StartValueVow', true);
14
+
15
+ /**
16
+ * @param {BootstrapPowers & {
17
+ * installation: {
18
+ * consume: {
19
+ * valueVow: Installation<
20
+ * import('@agoric/zoe/src/contracts/valueVow.contract.js').start
21
+ * >;
22
+ * };
23
+ * };
24
+ * }} powers
25
+ */
26
+ export const startValueVow = async ({
27
+ consume: { startUpgradable },
28
+ installation: {
29
+ consume: { valueVow },
30
+ },
31
+ instance: {
32
+ // @ts-expect-error unknown instance
33
+ produce: { valueVow: produceInstance },
34
+ },
35
+ }) => {
36
+ trace(startValueVow.name);
37
+
38
+ const startOpts = {
39
+ label: 'valueVow',
40
+ installation: valueVow,
41
+ };
42
+
43
+ const { instance } = await E(startUpgradable)(startOpts);
44
+ produceInstance.resolve(instance);
45
+ trace('done');
46
+ };
47
+ harden(startValueVow);
48
+
49
+ export const getManifestForValueVow = ({ restoreRef }, { valueVowRef }) => {
50
+ console.log('valueVowRef', valueVowRef);
51
+ return {
52
+ manifest: {
53
+ [startValueVow.name]: {
54
+ consume: {
55
+ startUpgradable: true,
56
+ },
57
+ installation: {
58
+ consume: { valueVow: true },
59
+ },
60
+ instance: {
61
+ produce: { valueVow: true },
62
+ },
63
+ },
64
+ },
65
+ installations: {
66
+ valueVow: restoreRef(valueVowRef),
67
+ },
68
+ };
69
+ };
70
+
71
+ /** @type {import('@agoric/deploy-script-support/src/externalTypes.js').CoreEvalBuilder} */
72
+ export const defaultProposalBuilder = async ({ publishRef, install }) =>
73
+ harden({
74
+ // Somewhat unorthodox, source the exports from this builder module
75
+ sourceSpec: '@agoric/builders/scripts/testing/start-valueVow.js',
76
+ getManifestCall: [
77
+ 'getManifestForValueVow',
78
+ {
79
+ valueVowRef: publishRef(
80
+ install('@agoric/zoe/src/contracts/valueVow.contract.js'),
81
+ ),
82
+ },
83
+ ],
84
+ });
85
+
86
+ export default async (homeP, endowments) => {
87
+ // import dynamically so the module can work in CoreEval environment
88
+ const dspModule = await import('@agoric/deploy-script-support');
89
+ const { makeHelpers } = dspModule;
90
+ const { writeCoreEval } = await makeHelpers(homeP, endowments);
91
+ await writeCoreEval('start-valueVow', defaultProposalBuilder);
92
+ };