@agoric/orchestration 0.1.1-dev-217005a.0 → 0.1.1-dev-b196804.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/index.d.ts +1 -1
- package/index.js +1 -1
- package/package.json +16 -15
- package/src/examples/sendAnywhere.contract.d.ts +12 -7
- package/src/examples/sendAnywhere.contract.d.ts.map +1 -1
- package/src/examples/sendAnywhere.contract.js +22 -17
- package/src/examples/stakeBld.contract.js +1 -1
- package/src/examples/stakeIca.contract.d.ts +4 -4
- package/src/examples/stakeIca.contract.d.ts.map +1 -1
- package/src/examples/stakeIca.contract.js +9 -4
- package/src/examples/swapExample.contract.d.ts +6 -12
- package/src/examples/swapExample.contract.d.ts.map +1 -1
- package/src/examples/swapExample.contract.js +25 -43
- package/src/examples/unbondExample.contract.d.ts +6 -8
- package/src/examples/unbondExample.contract.d.ts.map +1 -1
- package/src/examples/unbondExample.contract.js +26 -43
- package/src/exos/chain-hub.d.ts +3 -3
- package/src/exos/chain-hub.d.ts.map +1 -1
- package/src/exos/chain-hub.js +93 -44
- package/src/exos/cosmos-interchain-service.d.ts +43 -0
- package/src/exos/cosmos-interchain-service.d.ts.map +1 -0
- package/src/{service.js → exos/cosmos-interchain-service.js} +21 -18
- package/src/exos/local-chain-facade.d.ts +2 -2
- package/src/exos/local-chain-facade.d.ts.map +1 -1
- package/src/exos/local-chain-facade.js +2 -2
- package/src/exos/orchestrator.d.ts +2 -2
- package/src/exos/orchestrator.d.ts.map +1 -1
- package/src/exos/orchestrator.js +2 -2
- package/src/exos/remote-chain-facade.d.ts +2 -2
- package/src/exos/remote-chain-facade.d.ts.map +1 -1
- package/src/exos/remote-chain-facade.js +2 -2
- package/src/facade.d.ts +2 -2
- package/src/facade.d.ts.map +1 -1
- package/src/facade.js +2 -2
- package/src/proposals/orchestration-proposal.d.ts +2 -11
- package/src/proposals/orchestration-proposal.d.ts.map +1 -1
- package/src/proposals/orchestration-proposal.js +8 -31
- package/src/proposals/start-stakeAtom.d.ts +3 -3
- package/src/proposals/start-stakeAtom.d.ts.map +1 -1
- package/src/proposals/start-stakeAtom.js +9 -6
- package/src/proposals/start-stakeOsmo.d.ts +3 -3
- package/src/proposals/start-stakeOsmo.d.ts.map +1 -1
- package/src/proposals/start-stakeOsmo.js +9 -6
- package/src/types.d.ts +1 -1
- package/src/types.d.ts.map +1 -1
- package/src/types.ts +1 -1
- package/src/utils/start-helper.d.ts +9 -3
- package/src/utils/start-helper.d.ts.map +1 -1
- package/src/utils/start-helper.js +56 -13
- package/src/vat-orchestration.d.ts +7 -49
- package/src/vat-orchestration.d.ts.map +1 -1
- package/src/vat-orchestration.js +7 -7
- package/src/service.d.ts +0 -97
- package/src/service.d.ts.map +0 -1
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { makeTracer } from '@agoric/internal';
|
|
2
2
|
import { makeStorageNodeChild } from '@agoric/internal/src/lib-chainStorage.js';
|
|
3
|
-
import {
|
|
3
|
+
import { prepareVowTools } from '@agoric/vow';
|
|
4
|
+
import { makeHeapZone } from '@agoric/zone';
|
|
5
|
+
import { E } from '@endo/far';
|
|
4
6
|
import { makeChainHub } from '../exos/chain-hub.js';
|
|
5
7
|
|
|
6
8
|
/**
|
|
@@ -27,7 +29,7 @@ export const startStakeAtom = async ({
|
|
|
27
29
|
board,
|
|
28
30
|
chainStorage,
|
|
29
31
|
chainTimerService,
|
|
30
|
-
|
|
32
|
+
cosmosInterchainService,
|
|
31
33
|
startUpgradable,
|
|
32
34
|
},
|
|
33
35
|
installation: {
|
|
@@ -44,9 +46,10 @@ export const startStakeAtom = async ({
|
|
|
44
46
|
const storageNode = await makeStorageNodeChild(chainStorage, VSTORAGE_PATH);
|
|
45
47
|
const marshaller = await E(board).getPublishingMarshaller();
|
|
46
48
|
|
|
47
|
-
const
|
|
49
|
+
const vt = prepareVowTools(makeHeapZone());
|
|
50
|
+
const chainHub = makeChainHub(await agoricNames, vt);
|
|
48
51
|
|
|
49
|
-
const [_, cosmoshub, connectionInfo] = await
|
|
52
|
+
const [_, cosmoshub, connectionInfo] = await vt.when(
|
|
50
53
|
chainHub.getChainsAndConnection('agoric', 'cosmoshub'),
|
|
51
54
|
);
|
|
52
55
|
|
|
@@ -62,7 +65,7 @@ export const startStakeAtom = async ({
|
|
|
62
65
|
icqEnabled: cosmoshub.icqEnabled,
|
|
63
66
|
},
|
|
64
67
|
privateArgs: {
|
|
65
|
-
|
|
68
|
+
cosmosInterchainService: await cosmosInterchainService,
|
|
66
69
|
storageNode,
|
|
67
70
|
marshaller,
|
|
68
71
|
timer: await chainTimerService,
|
|
@@ -86,7 +89,7 @@ export const getManifestForStakeAtom = (
|
|
|
86
89
|
board: true,
|
|
87
90
|
chainStorage: true,
|
|
88
91
|
chainTimerService: true,
|
|
89
|
-
|
|
92
|
+
cosmosInterchainService: true,
|
|
90
93
|
startUpgradable: true,
|
|
91
94
|
},
|
|
92
95
|
installation: {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export function startStakeOsmo({ consume: { agoricNames, board, chainStorage, chainTimerService,
|
|
1
|
+
export function startStakeOsmo({ consume: { agoricNames, board, chainStorage, chainTimerService, cosmosInterchainService, startUpgradable, }, installation: { consume: { stakeIca }, }, instance: { produce: { stakeOsmo: produceInstance }, }, }: BootstrapPowers & {
|
|
2
2
|
installation: {
|
|
3
3
|
consume: {
|
|
4
4
|
stakeIca: Installation<(zcf: ZCF<StakeIcaTerms>, privateArgs: {
|
|
5
|
-
|
|
5
|
+
cosmosInterchainService: import("../types.js").CosmosInterchainService;
|
|
6
6
|
storageNode: StorageNode;
|
|
7
7
|
marshaller: Marshaller;
|
|
8
8
|
timer: import("@agoric/time").TimerService;
|
|
@@ -82,7 +82,7 @@ export function getManifestForStakeOsmo({ restoreRef }: {
|
|
|
82
82
|
board: boolean;
|
|
83
83
|
chainStorage: boolean;
|
|
84
84
|
chainTimerService: boolean;
|
|
85
|
-
|
|
85
|
+
cosmosInterchainService: boolean;
|
|
86
86
|
startUpgradable: boolean;
|
|
87
87
|
};
|
|
88
88
|
installation: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"start-stakeOsmo.d.ts","sourceRoot":"","sources":["start-stakeOsmo.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"start-stakeOsmo.d.ts","sourceRoot":"","sources":["start-stakeOsmo.js"],"names":[],"mappings":"AAyBO,mPAVI,eAAe,GAAG;IAC5B,YAAgB,EAAE;QAClB,OAAa,EAAE;YACf,QAAgB,EAAE,YAAY,CAC9B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAA0D,CACjD,CAAC;SACH,CAAC;KACH,CAAC;CACH,iBAsDH;AAGM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA4BN"}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { makeTracer } from '@agoric/internal';
|
|
2
2
|
import { makeStorageNodeChild } from '@agoric/internal/src/lib-chainStorage.js';
|
|
3
|
-
import {
|
|
3
|
+
import { prepareVowTools } from '@agoric/vow';
|
|
4
|
+
import { makeHeapZone } from '@agoric/zone';
|
|
5
|
+
import { E } from '@endo/far';
|
|
4
6
|
import { makeChainHub } from '../exos/chain-hub.js';
|
|
5
7
|
|
|
6
8
|
/**
|
|
@@ -27,7 +29,7 @@ export const startStakeOsmo = async ({
|
|
|
27
29
|
board,
|
|
28
30
|
chainStorage,
|
|
29
31
|
chainTimerService,
|
|
30
|
-
|
|
32
|
+
cosmosInterchainService,
|
|
31
33
|
startUpgradable,
|
|
32
34
|
},
|
|
33
35
|
installation: {
|
|
@@ -45,9 +47,10 @@ export const startStakeOsmo = async ({
|
|
|
45
47
|
const storageNode = await makeStorageNodeChild(chainStorage, VSTORAGE_PATH);
|
|
46
48
|
const marshaller = await E(board).getPublishingMarshaller();
|
|
47
49
|
|
|
48
|
-
const
|
|
50
|
+
const vt = prepareVowTools(makeHeapZone());
|
|
51
|
+
const chainHub = makeChainHub(await agoricNames, vt);
|
|
49
52
|
|
|
50
|
-
const [_, osmosis, connectionInfo] = await
|
|
53
|
+
const [_, osmosis, connectionInfo] = await vt.when(
|
|
51
54
|
chainHub.getChainsAndConnection('agoric', 'osmosis'),
|
|
52
55
|
);
|
|
53
56
|
|
|
@@ -63,7 +66,7 @@ export const startStakeOsmo = async ({
|
|
|
63
66
|
icqEnabled: osmosis.icqEnabled,
|
|
64
67
|
},
|
|
65
68
|
privateArgs: {
|
|
66
|
-
|
|
69
|
+
cosmosInterchainService: await cosmosInterchainService,
|
|
67
70
|
storageNode,
|
|
68
71
|
marshaller,
|
|
69
72
|
timer: await chainTimerService,
|
|
@@ -87,7 +90,7 @@ export const getManifestForStakeOsmo = (
|
|
|
87
90
|
board: true,
|
|
88
91
|
chainStorage: true,
|
|
89
92
|
chainTimerService: true,
|
|
90
|
-
|
|
93
|
+
cosmosInterchainService: true,
|
|
91
94
|
startUpgradable: true,
|
|
92
95
|
},
|
|
93
96
|
installation: {
|
package/src/types.d.ts
CHANGED
|
@@ -6,6 +6,6 @@ export type * from './exos/chain-account-kit.js';
|
|
|
6
6
|
export type * from './exos/icq-connection-kit.js';
|
|
7
7
|
export type * from './internal.js';
|
|
8
8
|
export type * from './orchestration-api.js';
|
|
9
|
-
export type * from './service.js';
|
|
9
|
+
export type * from './exos/cosmos-interchain-service.js';
|
|
10
10
|
export type * from './vat-orchestration.js';
|
|
11
11
|
//# sourceMappingURL=types.d.ts.map
|
package/src/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["types.ts"],"names":[],"mappings":"AAAA,gGAAgG;AAEhG,mBAAmB,iBAAiB,CAAC;AACrC,mBAAmB,iBAAiB,CAAC;AACrC,mBAAmB,mBAAmB,CAAC;AACvC,mBAAmB,6BAA6B,CAAC;AACjD,mBAAmB,8BAA8B,CAAC;AAClD,mBAAmB,eAAe,CAAC;AACnC,mBAAmB,wBAAwB,CAAC;AAC5C,mBAAmB,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["types.ts"],"names":[],"mappings":"AAAA,gGAAgG;AAEhG,mBAAmB,iBAAiB,CAAC;AACrC,mBAAmB,iBAAiB,CAAC;AACrC,mBAAmB,mBAAmB,CAAC;AACvC,mBAAmB,6BAA6B,CAAC;AACjD,mBAAmB,8BAA8B,CAAC;AAClD,mBAAmB,eAAe,CAAC;AACnC,mBAAmB,wBAAwB,CAAC;AAC5C,mBAAmB,qCAAqC,CAAC;AACzD,mBAAmB,wBAAwB,CAAC"}
|
package/src/types.ts
CHANGED
|
@@ -7,5 +7,5 @@ export type * from './exos/chain-account-kit.js';
|
|
|
7
7
|
export type * from './exos/icq-connection-kit.js';
|
|
8
8
|
export type * from './internal.js';
|
|
9
9
|
export type * from './orchestration-api.js';
|
|
10
|
-
export type * from './service.js';
|
|
10
|
+
export type * from './exos/cosmos-interchain-service.js';
|
|
11
11
|
export type * from './vat-orchestration.js';
|
|
@@ -17,8 +17,9 @@ export function provideOrchestration(zcf: ZCF, baggage: Baggage, remotePowers: O
|
|
|
17
17
|
allVows: (maybeVows: import("@agoric/vow").EVow<unknown>[]) => import("@agoric/vow").Vow<any[]>;
|
|
18
18
|
asVow: <T extends unknown>(fn: (...args: any[]) => import("@agoric/vow").Vow<Awaited<T>> | Awaited<T> | import("@agoric/vow").PromiseVow<T>) => import("@agoric/vow").Vow<Awaited<T>>;
|
|
19
19
|
asPromise: import("@agoric/vow").AsPromiseFunction;
|
|
20
|
+
retriable: <T>(fnZone: Zone, name: string, fn: (...args: unknown[]) => import("@agoric/vow").ERef<T>) => (...args: unknown[]) => import("@agoric/vow").Vow<T>;
|
|
20
21
|
};
|
|
21
|
-
zone:
|
|
22
|
+
zone: Zone;
|
|
22
23
|
orchestrate<GuestReturn, HostReturn, GuestContext, HostContext, GuestArgs extends any[], HostArgs extends any[]>(durableName: string, hostCtx: HostContext, guestFn: (guestOrc: import("../orchestration-api.js").Orchestrator, guestCtx: GuestContext, ...args: GuestArgs) => Promise<GuestReturn>): (...args: HostArgs) => Promise<HostReturn>;
|
|
23
24
|
adminAsyncFlow: import("@endo/exo").Guarded<{
|
|
24
25
|
getFailures(): import("@endo/patterns").CopyMap<any, import("@endo/pass-style").Passable>;
|
|
@@ -26,17 +27,22 @@ export function provideOrchestration(zcf: ZCF, baggage: Baggage, remotePowers: O
|
|
|
26
27
|
getFlowForOutcomeVow(outcomeVow: any): any;
|
|
27
28
|
}>;
|
|
28
29
|
};
|
|
30
|
+
export function withOrchestration<CT extends Record<string, unknown>, PA extends OrchestrationPowers & {
|
|
31
|
+
marshaller: Marshaller;
|
|
32
|
+
}, R>(contractFn: (zcf: ZCF<CT>, privateArgs: PA, zone: Zone, tools: OrchestrationTools) => Promise<R>): (zcf: ZCF<CT>, privateArgs: PA, baggage: Baggage) => Promise<R>;
|
|
29
33
|
export type OrchestrationPowers = {
|
|
30
34
|
localchain: Remote<LocalChain>;
|
|
31
|
-
orchestrationService: Remote<
|
|
35
|
+
orchestrationService: Remote<CosmosInterchainService>;
|
|
32
36
|
storageNode: Remote<StorageNode>;
|
|
33
37
|
timerService: Remote<TimerService>;
|
|
34
38
|
agoricNames: Remote<NameHub>;
|
|
35
39
|
};
|
|
40
|
+
export type OrchestrationTools = Omit<ReturnType<typeof provideOrchestration>, "zone">;
|
|
36
41
|
import type { Baggage } from '@agoric/vat-data';
|
|
42
|
+
import type { Zone } from '@agoric/zone';
|
|
37
43
|
import type { LocalChain } from '@agoric/vats/src/localchain.js';
|
|
38
44
|
import type { Remote } from '@agoric/vow';
|
|
39
|
-
import type {
|
|
45
|
+
import type { CosmosInterchainService } from '../exos/cosmos-interchain-service.js';
|
|
40
46
|
import type { TimerService } from '@agoric/time';
|
|
41
47
|
import type { NameHub } from '@agoric/vats';
|
|
42
48
|
//# sourceMappingURL=start-helper.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"start-helper.d.ts","sourceRoot":"","sources":["start-helper.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"start-helper.d.ts","sourceRoot":"","sources":["start-helper.js"],"names":[],"mappings":"AAyCO,0CALI,GAAG,WACH,OAAO,gBACP,mBAAmB,cACnB,UAAU;;;;;;;;;;;;;;;;;wCAwC0B,GAAG;;wDA9Cd,GAAG,uDAC9B,GAAG;;;4PAsEK,GAAa,4CAK1B,GAAG;;;;;;EAaN;AAuBM,kCAdgC,EAAE,SAA3B,MAAM,CAAC,MAAM,EAAE,OAAO,CAAE,EAGhC,EAAE,SAFM,mBAAmB,GAAG;IACnC,UAAc,EAAE,UAAU,CAAC;CACvB,EACQ,CAAC,cACH,CACV,GAAO,EAAE,GAAG,CAAC,EAAE,CAAC,EAChB,WAAe,EAAE,EAAE,EACnB,IAAQ,EAAE,IAAI,EACd,KAAS,EAAE,kBAAkB,KACtB,OAAO,CAAC,CAAC,CAAC,GACL,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,CAAC,EAAE,WAAW,EAAE,EAAE,EAAE,OAAO,EAAE,OAAO,KAAK,OAAO,CAAC,CAAC,CAAC,CAYzE;kCAnIU;IACZ,UAAc,EAAE,OAAO,UAAU,CAAC,CAAC;IACnC,oBAAwB,EAAE,OAAO,uBAAuB,CAAC,CAAC;IAC1D,WAAe,EAAE,OAAO,WAAW,CAAC,CAAC;IACrC,YAAgB,EAAE,OAAO,YAAY,CAAC,CAAC;IACvC,WAAe,EAAE,OAAO,OAAO,CAAC,CAAC;CAC9B;iCAgGU,IAAI,CAAC,UAAU,CAAC,OAAO,oBAAoB,CAAC,EAAE,MAAM,CAAC;6BA9GzC,kBAAkB;0BAGrB,cAAc;gCALR,gCAAgC;4BAIpC,aAAa;6CAEI,sCAAsC;kCALrC,cAAc;6BAE/B,cAAc"}
|
|
@@ -16,13 +16,14 @@ import { prepareLocalChainFacade } from '../exos/local-chain-facade.js';
|
|
|
16
16
|
* @import {Baggage} from '@agoric/vat-data';
|
|
17
17
|
* @import {NameHub} from '@agoric/vats';
|
|
18
18
|
* @import {Remote} from '@agoric/vow';
|
|
19
|
-
* @import {
|
|
19
|
+
* @import {Zone} from '@agoric/zone';
|
|
20
|
+
* @import {CosmosInterchainService} from '../exos/cosmos-interchain-service.js';
|
|
20
21
|
*/
|
|
21
22
|
|
|
22
23
|
/**
|
|
23
24
|
* @typedef {{
|
|
24
25
|
* localchain: Remote<LocalChain>;
|
|
25
|
-
* orchestrationService: Remote<
|
|
26
|
+
* orchestrationService: Remote<CosmosInterchainService>;
|
|
26
27
|
* storageNode: Remote<StorageNode>;
|
|
27
28
|
* timerService: Remote<TimerService>;
|
|
28
29
|
* agoricNames: Remote<NameHub>;
|
|
@@ -48,16 +49,27 @@ export const provideOrchestration = (
|
|
|
48
49
|
baggage,
|
|
49
50
|
}));
|
|
50
51
|
|
|
51
|
-
|
|
52
|
+
// separate zones
|
|
53
|
+
const zones = (() => {
|
|
54
|
+
const zone = makeDurableZone(baggage);
|
|
55
|
+
return {
|
|
56
|
+
asyncFlow: zone.subZone('asyncFlow'),
|
|
57
|
+
/** for contract-provided names */
|
|
58
|
+
contract: zone.subZone('contract'),
|
|
59
|
+
orchestration: zone.subZone('orchestration'),
|
|
60
|
+
vows: zone.subZone('vows'),
|
|
61
|
+
};
|
|
62
|
+
})();
|
|
63
|
+
|
|
52
64
|
const { agoricNames, timerService } = remotePowers;
|
|
53
65
|
|
|
54
|
-
const
|
|
66
|
+
const vowTools = prepareVowTools(zones.vows);
|
|
55
67
|
|
|
56
|
-
const
|
|
68
|
+
const chainHub = makeChainHub(agoricNames, vowTools);
|
|
57
69
|
|
|
58
70
|
const { makeRecorderKit } = prepareRecorderKitMakers(baggage, marshaller);
|
|
59
71
|
const makeLocalOrchestrationAccountKit = prepareLocalOrchestrationAccountKit(
|
|
60
|
-
|
|
72
|
+
zones.orchestration,
|
|
61
73
|
makeRecorderKit,
|
|
62
74
|
zcf,
|
|
63
75
|
timerService,
|
|
@@ -65,19 +77,18 @@ export const provideOrchestration = (
|
|
|
65
77
|
chainHub,
|
|
66
78
|
);
|
|
67
79
|
|
|
68
|
-
const asyncFlowTools = prepareAsyncFlowTools(
|
|
80
|
+
const asyncFlowTools = prepareAsyncFlowTools(zones.asyncFlow, {
|
|
69
81
|
vowTools,
|
|
70
82
|
});
|
|
71
83
|
|
|
72
84
|
const makeCosmosOrchestrationAccount = prepareCosmosOrchestrationAccount(
|
|
73
|
-
|
|
74
|
-
zone,
|
|
85
|
+
zones.orchestration,
|
|
75
86
|
makeRecorderKit,
|
|
76
87
|
vowTools,
|
|
77
88
|
zcf,
|
|
78
89
|
);
|
|
79
90
|
|
|
80
|
-
const makeRemoteChainFacade = prepareRemoteChainFacade(
|
|
91
|
+
const makeRemoteChainFacade = prepareRemoteChainFacade(zones.orchestration, {
|
|
81
92
|
makeCosmosOrchestrationAccount,
|
|
82
93
|
orchestration: remotePowers.orchestrationService,
|
|
83
94
|
storageNode: remotePowers.storageNode,
|
|
@@ -85,7 +96,7 @@ export const provideOrchestration = (
|
|
|
85
96
|
vowTools,
|
|
86
97
|
});
|
|
87
98
|
|
|
88
|
-
const makeLocalChainFacade = prepareLocalChainFacade(
|
|
99
|
+
const makeLocalChainFacade = prepareLocalChainFacade(zones.orchestration, {
|
|
89
100
|
makeLocalOrchestrationAccountKit,
|
|
90
101
|
localchain: remotePowers.localchain,
|
|
91
102
|
// FIXME what path?
|
|
@@ -97,7 +108,7 @@ export const provideOrchestration = (
|
|
|
97
108
|
|
|
98
109
|
const facade = makeOrchestrationFacade({
|
|
99
110
|
zcf,
|
|
100
|
-
zone,
|
|
111
|
+
zone: zones.orchestration,
|
|
101
112
|
chainHub,
|
|
102
113
|
makeLocalOrchestrationAccountKit,
|
|
103
114
|
makeRecorderKit,
|
|
@@ -108,6 +119,38 @@ export const provideOrchestration = (
|
|
|
108
119
|
vowTools,
|
|
109
120
|
...remotePowers,
|
|
110
121
|
});
|
|
111
|
-
return { ...facade, chainHub, vowTools, zone };
|
|
122
|
+
return { ...facade, chainHub, vowTools, zone: zones.contract };
|
|
112
123
|
};
|
|
113
124
|
harden(provideOrchestration);
|
|
125
|
+
|
|
126
|
+
/** @typedef {Omit<ReturnType<typeof provideOrchestration>, 'zone'>} OrchestrationTools */
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* Simplifies contract functions for Orchestration by wrapping a simpler
|
|
130
|
+
* function with all the tools it needs in order to use Orchestration.
|
|
131
|
+
*
|
|
132
|
+
* @template {Record<string, unknown>} CT
|
|
133
|
+
* @template {OrchestrationPowers & {
|
|
134
|
+
* marshaller: Marshaller;
|
|
135
|
+
* }} PA
|
|
136
|
+
* @template R
|
|
137
|
+
* @param {(
|
|
138
|
+
* zcf: ZCF<CT>,
|
|
139
|
+
* privateArgs: PA,
|
|
140
|
+
* zone: Zone,
|
|
141
|
+
* tools: OrchestrationTools,
|
|
142
|
+
* ) => Promise<R>} contractFn
|
|
143
|
+
* @returns {(zcf: ZCF<CT>, privateArgs: PA, baggage: Baggage) => Promise<R>} a
|
|
144
|
+
* Zoe start function
|
|
145
|
+
*/
|
|
146
|
+
export const withOrchestration =
|
|
147
|
+
contractFn => async (zcf, privateArgs, baggage) => {
|
|
148
|
+
const { zone, ...tools } = provideOrchestration(
|
|
149
|
+
zcf,
|
|
150
|
+
baggage,
|
|
151
|
+
privateArgs,
|
|
152
|
+
privateArgs.marshaller,
|
|
153
|
+
);
|
|
154
|
+
return contractFn(zcf, privateArgs, zone, tools);
|
|
155
|
+
};
|
|
156
|
+
harden(withOrchestration);
|
|
@@ -1,58 +1,16 @@
|
|
|
1
1
|
export function buildRootObject(_vatPowers: any, _args: any, baggage: any): {
|
|
2
2
|
/** @param {Partial<OrchestrationPowers>} [initialPowers] */
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
chainId: string;
|
|
7
|
-
remoteConnAddr: import("@agoric/vats/tools/ibc-utils.js").RemoteIbcAddress;
|
|
8
|
-
}): import("@agoric/vow").Vow<any>;
|
|
9
|
-
};
|
|
10
|
-
requestICQChannelWatcher: {
|
|
11
|
-
onFulfilled(port: import("@agoric/network").Port, { remoteConnAddr, controllerConnectionId }: {
|
|
12
|
-
remoteConnAddr: import("@agoric/vats/tools/ibc-utils.js").RemoteIbcAddress;
|
|
13
|
-
controllerConnectionId: import("@agoric/vats").IBCConnectionID;
|
|
14
|
-
}): import("@agoric/vow").Vow<any>;
|
|
15
|
-
};
|
|
16
|
-
channelOpenWatcher: {
|
|
17
|
-
onFulfilled(_connection: import("@agoric/network").Connection, { connectionKit, returnFacet, saveICQConnection }: {
|
|
18
|
-
connectionKit: ConnectionKit;
|
|
19
|
-
returnFacet: string;
|
|
20
|
-
saveICQConnection?: import("@agoric/vats").IBCConnectionID;
|
|
21
|
-
}): any;
|
|
22
|
-
};
|
|
23
|
-
public: {
|
|
24
|
-
makeAccount(chainId: string, hostConnectionId: import("@agoric/vats").IBCConnectionID, controllerConnectionId: import("@agoric/vats").IBCConnectionID): import("@agoric/vow").Vow<import("./cosmos-api.js").IcaAccount>;
|
|
25
|
-
provideICQConnection(controllerConnectionId: import("@agoric/vats").IBCConnectionID): import("@agoric/vow").Vow<import("./types.js").ICQConnection> | import("./types.js").ICQConnection;
|
|
26
|
-
};
|
|
3
|
+
makeCosmosInterchainService(initialPowers?: Partial<OrchestrationPowers> | undefined): import("@endo/exo").Guarded<{
|
|
4
|
+
makeAccount(chainId: string, hostConnectionId: import("@agoric/vats").IBCConnectionID, controllerConnectionId: import("@agoric/vats").IBCConnectionID): import("@agoric/vow").Vow<import("./cosmos-api.js").IcaAccount>;
|
|
5
|
+
provideICQConnection(controllerConnectionId: import("@agoric/vats").IBCConnectionID): import("@agoric/vow").Vow<import("./types.js").ICQConnection> | import("./types.js").ICQConnection;
|
|
27
6
|
}>;
|
|
28
7
|
} & import("@endo/pass-style").RemotableObject<`Alleged: ${string}`> & import("@endo/eventual-send").RemotableBrand<{}, {
|
|
29
8
|
/** @param {Partial<OrchestrationPowers>} [initialPowers] */
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
chainId: string;
|
|
34
|
-
remoteConnAddr: import("@agoric/vats/tools/ibc-utils.js").RemoteIbcAddress;
|
|
35
|
-
}): import("@agoric/vow").Vow<any>;
|
|
36
|
-
};
|
|
37
|
-
requestICQChannelWatcher: {
|
|
38
|
-
onFulfilled(port: import("@agoric/network").Port, { remoteConnAddr, controllerConnectionId }: {
|
|
39
|
-
remoteConnAddr: import("@agoric/vats/tools/ibc-utils.js").RemoteIbcAddress;
|
|
40
|
-
controllerConnectionId: import("@agoric/vats").IBCConnectionID;
|
|
41
|
-
}): import("@agoric/vow").Vow<any>;
|
|
42
|
-
};
|
|
43
|
-
channelOpenWatcher: {
|
|
44
|
-
onFulfilled(_connection: import("@agoric/network").Connection, { connectionKit, returnFacet, saveICQConnection }: {
|
|
45
|
-
connectionKit: ConnectionKit;
|
|
46
|
-
returnFacet: string;
|
|
47
|
-
saveICQConnection?: import("@agoric/vats").IBCConnectionID;
|
|
48
|
-
}): any;
|
|
49
|
-
};
|
|
50
|
-
public: {
|
|
51
|
-
makeAccount(chainId: string, hostConnectionId: import("@agoric/vats").IBCConnectionID, controllerConnectionId: import("@agoric/vats").IBCConnectionID): import("@agoric/vow").Vow<import("./cosmos-api.js").IcaAccount>;
|
|
52
|
-
provideICQConnection(controllerConnectionId: import("@agoric/vats").IBCConnectionID): import("@agoric/vow").Vow<import("./types.js").ICQConnection> | import("./types.js").ICQConnection;
|
|
53
|
-
};
|
|
9
|
+
makeCosmosInterchainService(initialPowers?: Partial<OrchestrationPowers> | undefined): import("@endo/exo").Guarded<{
|
|
10
|
+
makeAccount(chainId: string, hostConnectionId: import("@agoric/vats").IBCConnectionID, controllerConnectionId: import("@agoric/vats").IBCConnectionID): import("@agoric/vow").Vow<import("./cosmos-api.js").IcaAccount>;
|
|
11
|
+
provideICQConnection(controllerConnectionId: import("@agoric/vats").IBCConnectionID): import("@agoric/vow").Vow<import("./types.js").ICQConnection> | import("./types.js").ICQConnection;
|
|
54
12
|
}>;
|
|
55
13
|
}>;
|
|
56
14
|
export type OrchestrationVat = ReturnType<typeof buildRootObject>;
|
|
57
|
-
import type { OrchestrationPowers } from './service.js';
|
|
15
|
+
import type { OrchestrationPowers } from './exos/cosmos-interchain-service.js';
|
|
58
16
|
//# sourceMappingURL=vat-orchestration.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vat-orchestration.d.ts","sourceRoot":"","sources":["vat-orchestration.js"],"names":[],"mappings":"AAOO;IASH,4DAA4D
|
|
1
|
+
{"version":3,"file":"vat-orchestration.d.ts","sourceRoot":"","sources":["vat-orchestration.js"],"names":[],"mappings":"AAOO;IASH,4DAA4D;;;;;;IAA5D,4DAA4D;;;;;GAK/D;+BAEa,UAAU,CAAC,OAAO,eAAe,CAAC;yCAlBT,qCAAqC"}
|
package/src/vat-orchestration.js
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
import { Far } from '@endo/far';
|
|
2
|
-
import {
|
|
2
|
+
import { prepareSwingsetVowTools } from '@agoric/vow/vat.js';
|
|
3
3
|
import { makeDurableZone } from '@agoric/zone/durable.js';
|
|
4
|
-
import {
|
|
4
|
+
import { prepareCosmosInterchainService } from './exos/cosmos-interchain-service.js';
|
|
5
5
|
|
|
6
|
-
/** @import {OrchestrationPowers} from './service.js' */
|
|
6
|
+
/** @import {OrchestrationPowers} from './exos/cosmos-interchain-service.js' */
|
|
7
7
|
|
|
8
8
|
export const buildRootObject = (_vatPowers, _args, baggage) => {
|
|
9
9
|
const zone = makeDurableZone(baggage);
|
|
10
|
-
const vowTools =
|
|
11
|
-
const
|
|
10
|
+
const vowTools = prepareSwingsetVowTools(zone.subZone('VowTools'));
|
|
11
|
+
const makeCosmosInterchainService = prepareCosmosInterchainService(
|
|
12
12
|
zone.subZone('orchestration'),
|
|
13
13
|
vowTools,
|
|
14
14
|
);
|
|
15
15
|
|
|
16
16
|
return Far('OrchestrationVat', {
|
|
17
17
|
/** @param {Partial<OrchestrationPowers>} [initialPowers] */
|
|
18
|
-
|
|
19
|
-
return
|
|
18
|
+
makeCosmosInterchainService(initialPowers = {}) {
|
|
19
|
+
return makeCosmosInterchainService(initialPowers);
|
|
20
20
|
},
|
|
21
21
|
});
|
|
22
22
|
};
|
package/src/service.d.ts
DELETED
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
export function prepareOrchestrationTools(zone: Zone, vowTools: VowTools): {
|
|
2
|
-
makeOrchestrationKit: (initialPowers?: Partial<OrchestrationPowers> | undefined) => import("@endo/exo").GuardedKit<{
|
|
3
|
-
requestICAChannelWatcher: {
|
|
4
|
-
/**
|
|
5
|
-
* @param {Port} port
|
|
6
|
-
* @param {{
|
|
7
|
-
* chainId: string;
|
|
8
|
-
* remoteConnAddr: RemoteIbcAddress;
|
|
9
|
-
* }} watchContext
|
|
10
|
-
*/
|
|
11
|
-
onFulfilled(port: Port, { chainId, remoteConnAddr }: {
|
|
12
|
-
chainId: string;
|
|
13
|
-
remoteConnAddr: RemoteIbcAddress;
|
|
14
|
-
}): Vow<any>;
|
|
15
|
-
};
|
|
16
|
-
requestICQChannelWatcher: {
|
|
17
|
-
/**
|
|
18
|
-
* @param {Port} port
|
|
19
|
-
* @param {{
|
|
20
|
-
* remoteConnAddr: RemoteIbcAddress;
|
|
21
|
-
* controllerConnectionId: IBCConnectionID;
|
|
22
|
-
* }} watchContext
|
|
23
|
-
*/
|
|
24
|
-
onFulfilled(port: Port, { remoteConnAddr, controllerConnectionId }: {
|
|
25
|
-
remoteConnAddr: RemoteIbcAddress;
|
|
26
|
-
controllerConnectionId: IBCConnectionID;
|
|
27
|
-
}): Vow<any>;
|
|
28
|
-
};
|
|
29
|
-
/**
|
|
30
|
-
* Waits for a channel (ICA, ICQ) to open and returns the consumer-facing
|
|
31
|
-
* facet of the ConnectionKit, specified by `returnFacet`. Saves the
|
|
32
|
-
* ConnectionKit if `saveICQConnection` is provided.
|
|
33
|
-
*/
|
|
34
|
-
channelOpenWatcher: {
|
|
35
|
-
/**
|
|
36
|
-
* @param {Connection} _connection
|
|
37
|
-
* @param {{
|
|
38
|
-
* connectionKit: ConnectionKit;
|
|
39
|
-
* returnFacet: string;
|
|
40
|
-
* saveICQConnection?: IBCConnectionID;
|
|
41
|
-
* }} watchContext
|
|
42
|
-
*/
|
|
43
|
-
onFulfilled(_connection: Connection, { connectionKit, returnFacet, saveICQConnection }: {
|
|
44
|
-
connectionKit: ConnectionKit;
|
|
45
|
-
returnFacet: string;
|
|
46
|
-
saveICQConnection?: IBCConnectionID;
|
|
47
|
-
}): any;
|
|
48
|
-
};
|
|
49
|
-
public: {
|
|
50
|
-
/**
|
|
51
|
-
* @param {string} chainId
|
|
52
|
-
* @param {IBCConnectionID} hostConnectionId the counterparty
|
|
53
|
-
* connection_id
|
|
54
|
-
* @param {IBCConnectionID} controllerConnectionId self connection_id
|
|
55
|
-
* @returns {Vow<IcaAccount>}
|
|
56
|
-
*/
|
|
57
|
-
makeAccount(chainId: string, hostConnectionId: IBCConnectionID, controllerConnectionId: IBCConnectionID): Vow<IcaAccount>;
|
|
58
|
-
/**
|
|
59
|
-
* @param {IBCConnectionID} controllerConnectionId
|
|
60
|
-
* @returns {Vow<ICQConnection> | ICQConnection}
|
|
61
|
-
*/
|
|
62
|
-
provideICQConnection(controllerConnectionId: IBCConnectionID): Vow<ICQConnection> | ICQConnection;
|
|
63
|
-
};
|
|
64
|
-
}>;
|
|
65
|
-
};
|
|
66
|
-
export type OrchestrationPowers = {
|
|
67
|
-
portAllocator: Remote<PortAllocator>;
|
|
68
|
-
};
|
|
69
|
-
/**
|
|
70
|
-
* PowerStore is used so additional powers can be added on upgrade. See
|
|
71
|
-
* [#7337](https://github.com/Agoric/agoric-sdk/issues/7337) for tracking on Exo
|
|
72
|
-
* state migrations.
|
|
73
|
-
*/
|
|
74
|
-
export type PowerStore = MapStore<keyof OrchestrationPowers, OrchestrationPowers[keyof OrchestrationPowers]>;
|
|
75
|
-
export type ICQConnectionStore = MapStore<IBCConnectionID, ICQConnectionKit>;
|
|
76
|
-
export type ConnectionKit = ChainAccountKit | ICQConnectionKit;
|
|
77
|
-
export type OrchestrationState = {
|
|
78
|
-
powers: PowerStore;
|
|
79
|
-
icqConnections: ICQConnectionStore;
|
|
80
|
-
};
|
|
81
|
-
export type OrchestrationTools = ReturnType<typeof prepareOrchestrationTools>;
|
|
82
|
-
export type OrchestrationKit = ReturnType<OrchestrationTools["makeOrchestrationKit"]>;
|
|
83
|
-
export type OrchestrationService = OrchestrationKit["public"];
|
|
84
|
-
import type { Zone } from '@agoric/base-zone';
|
|
85
|
-
import type { VowTools } from '@agoric/vow';
|
|
86
|
-
import type { Port } from '@agoric/network';
|
|
87
|
-
import type { RemoteIbcAddress } from '@agoric/vats/tools/ibc-utils.js';
|
|
88
|
-
import type { Vow } from '@agoric/vow';
|
|
89
|
-
import type { IBCConnectionID } from '@agoric/vats';
|
|
90
|
-
import type { Connection } from '@agoric/network';
|
|
91
|
-
import type { IcaAccount } from './types.js';
|
|
92
|
-
import type { ICQConnection } from './types.js';
|
|
93
|
-
import type { PortAllocator } from '@agoric/network';
|
|
94
|
-
import type { Remote } from '@agoric/internal';
|
|
95
|
-
import type { ICQConnectionKit } from './types.js';
|
|
96
|
-
import type { ChainAccountKit } from './types.js';
|
|
97
|
-
//# sourceMappingURL=service.d.ts.map
|
package/src/service.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"service.d.ts","sourceRoot":"","sources":["service.js"],"names":[],"mappings":"AAkPO,gDAHI,IAAI,YACJ,QAAQ;;;YA3HX;;;;;;eAMG;8BALQ,IAAI,+BACJ;gBACV,OAAW,EAAE,MAAM,CAAC;gBACpB,cAAkB,EAAE,gBAAgB,CAAC;aAClC;;;YAgBJ;;;;;;eAMG;8BALQ,IAAI,8CACJ;gBACV,cAAkB,EAAE,gBAAgB,CAAC;gBACrC,sBAA0B,EAAE,eAAe,CAAC;aACzC;;QAgBN;;;;WAIG;;YAED;;;;;;;eAOG;qCANQ,UAAU,qDACV;gBACV,aAAiB,EAAE,aAAa,CAAC;gBACjC,WAAe,EAAE,MAAM,CAAC;gBACxB,iBAAqB,CAAC,EAAE,eAAe,CAAC;aACrC;;;YAkBJ;;;;;;eAMG;iCALQ,MAAM,oBACN,eAAe,0BAEf,eAAe,GACb,IAAI,UAAU,CAAC;YAiB5B;;;eAGG;yDAFQ,eAAe,GACb,IAAI,aAAa,CAAC,GAAG,aAAa;;;EAwCtD;;mBAnOa,OAAO,aAAa,CAAC;;;;;;;yBAQtB,QAAQ,CACpB,MAAU,mBAAmB,EAC7B,mBAAuB,CAAC,MAAM,mBAAmB,CAAC,CAC/C;iCAGU,QAAQ,CAAC,eAAe,EAAE,gBAAgB,CAAC;4BAE3C,eAAe,GAAG,gBAAgB;iCAYlC;IAAE,MAAM,EAAE,UAAU,CAAC;IAAC,cAAc,EAAE,kBAAkB,CAAA;CAAE;iCA0M1D,UAAU,CAAC,OAAO,yBAAyB,CAAC;+BAC5C,UAAU,CAAC,kBAAkB,CAAC,sBAAsB,CAAC,CAAC;mCACtD,gBAAgB,CAAC,QAAQ,CAAC;0BApPjB,mBAAmB;8BAKV,aAAa;0BAHK,iBAAiB;sCAEhC,iCAAiC;yBACpC,aAAa;qCAFX,cAAc;gCADE,iBAAiB;gCAIY,YAAY;mCAAZ,YAAY;mCAJzC,iBAAiB;4BAD1C,kBAAkB;sCAKoC,YAAY;qCAAZ,YAAY"}
|