@agoric/orchestration 0.1.1-dev-4696a6a.0 → 0.1.1-dev-8718c07.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 +16 -16
- package/src/exos/cosmos-interchain-service.d.ts +15 -11
- package/src/exos/cosmos-interchain-service.d.ts.map +1 -1
- package/src/exos/cosmos-interchain-service.js +83 -72
- package/src/exos/orchestrator.d.ts +92 -3
- package/src/exos/orchestrator.d.ts.map +1 -1
- package/src/exos/orchestrator.js +25 -1
- package/src/facade.d.ts +0 -5
- package/src/facade.d.ts.map +1 -1
- package/src/facade.js +9 -12
- package/src/proposals/orchestration-proposal.d.ts.map +1 -1
- package/src/proposals/orchestration-proposal.js +0 -1
- package/src/utils/address.d.ts +20 -6
- package/src/utils/address.d.ts.map +1 -1
- package/src/utils/address.js +15 -9
- package/src/utils/start-helper.d.ts +39 -5
- package/src/utils/start-helper.d.ts.map +1 -1
- package/src/utils/start-helper.js +34 -17
- package/src/vat-orchestration.d.ts +4 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agoric/orchestration",
|
|
3
|
-
"version": "0.1.1-dev-
|
|
3
|
+
"version": "0.1.1-dev-8718c07.0+8718c07",
|
|
4
4
|
"description": "Chain abstraction for Agoric's orchestration clients",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "index.js",
|
|
@@ -33,19 +33,19 @@
|
|
|
33
33
|
},
|
|
34
34
|
"homepage": "https://github.com/Agoric/agoric-sdk#readme",
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@agoric/async-flow": "0.1.1-dev-
|
|
37
|
-
"@agoric/cosmic-proto": "0.4.1-dev-
|
|
38
|
-
"@agoric/ertp": "0.16.3-dev-
|
|
39
|
-
"@agoric/internal": "0.3.3-dev-
|
|
40
|
-
"@agoric/network": "0.1.1-dev-
|
|
41
|
-
"@agoric/notifier": "0.6.3-dev-
|
|
42
|
-
"@agoric/store": "0.9.3-dev-
|
|
43
|
-
"@agoric/time": "0.3.3-dev-
|
|
44
|
-
"@agoric/vat-data": "0.5.3-dev-
|
|
45
|
-
"@agoric/vats": "0.15.2-dev-
|
|
46
|
-
"@agoric/vow": "0.1.1-dev-
|
|
47
|
-
"@agoric/zoe": "0.26.3-dev-
|
|
48
|
-
"@agoric/zone": "0.2.3-dev-
|
|
36
|
+
"@agoric/async-flow": "0.1.1-dev-8718c07.0+8718c07",
|
|
37
|
+
"@agoric/cosmic-proto": "0.4.1-dev-8718c07.0+8718c07",
|
|
38
|
+
"@agoric/ertp": "0.16.3-dev-8718c07.0+8718c07",
|
|
39
|
+
"@agoric/internal": "0.3.3-dev-8718c07.0+8718c07",
|
|
40
|
+
"@agoric/network": "0.1.1-dev-8718c07.0+8718c07",
|
|
41
|
+
"@agoric/notifier": "0.6.3-dev-8718c07.0+8718c07",
|
|
42
|
+
"@agoric/store": "0.9.3-dev-8718c07.0+8718c07",
|
|
43
|
+
"@agoric/time": "0.3.3-dev-8718c07.0+8718c07",
|
|
44
|
+
"@agoric/vat-data": "0.5.3-dev-8718c07.0+8718c07",
|
|
45
|
+
"@agoric/vats": "0.15.2-dev-8718c07.0+8718c07",
|
|
46
|
+
"@agoric/vow": "0.1.1-dev-8718c07.0+8718c07",
|
|
47
|
+
"@agoric/zoe": "0.26.3-dev-8718c07.0+8718c07",
|
|
48
|
+
"@agoric/zone": "0.2.3-dev-8718c07.0+8718c07",
|
|
49
49
|
"@endo/base64": "^1.0.5",
|
|
50
50
|
"@endo/errors": "^1.2.2",
|
|
51
51
|
"@endo/far": "^1.1.2",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"@noble/hashes": "github:paulmillr/noble-hashes#ae060da"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
|
-
"@agoric/swingset-liveslots": "0.10.3-dev-
|
|
57
|
+
"@agoric/swingset-liveslots": "0.10.3-dev-8718c07.0+8718c07",
|
|
58
58
|
"@chain-registry/client": "^1.47.4",
|
|
59
59
|
"@cosmjs/amino": "^0.32.3",
|
|
60
60
|
"@cosmjs/proto-signing": "^0.32.3",
|
|
@@ -94,5 +94,5 @@
|
|
|
94
94
|
"typeCoverage": {
|
|
95
95
|
"atLeast": 98.05
|
|
96
96
|
},
|
|
97
|
-
"gitHead": "
|
|
97
|
+
"gitHead": "8718c0748521ceeb0f7bab04bbe8fe5d1bc643b0"
|
|
98
98
|
}
|
|
@@ -4,35 +4,38 @@ export function prepareCosmosInterchainService(zone: Zone, vowTools: VowTools):
|
|
|
4
4
|
* @param {IBCConnectionID} hostConnectionId the counterparty
|
|
5
5
|
* connection_id
|
|
6
6
|
* @param {IBCConnectionID} controllerConnectionId self connection_id
|
|
7
|
+
* @param {ICAChannelAddressOpts} [opts] optional to configure the
|
|
8
|
+
* channel address, such as version and ordering
|
|
7
9
|
* @returns {Vow<IcaAccount>}
|
|
8
10
|
*/
|
|
9
|
-
makeAccount(chainId: string, hostConnectionId: IBCConnectionID, controllerConnectionId: IBCConnectionID): Vow<IcaAccount>;
|
|
11
|
+
makeAccount(chainId: string, hostConnectionId: IBCConnectionID, controllerConnectionId: IBCConnectionID, opts?: ICAChannelAddressOpts | undefined): Vow<IcaAccount>;
|
|
10
12
|
/**
|
|
11
13
|
* @param {IBCConnectionID} controllerConnectionId
|
|
14
|
+
* @param {string} [version]
|
|
12
15
|
* @returns {Vow<ICQConnection> | ICQConnection}
|
|
13
16
|
*/
|
|
14
|
-
provideICQConnection(controllerConnectionId: IBCConnectionID): Vow<ICQConnection> | ICQConnection;
|
|
17
|
+
provideICQConnection(controllerConnectionId: IBCConnectionID, version?: string | undefined): Vow<ICQConnection> | ICQConnection;
|
|
15
18
|
}>;
|
|
16
19
|
export type OrchestrationPowers = {
|
|
17
20
|
portAllocator: Remote<PortAllocator>;
|
|
21
|
+
/**
|
|
22
|
+
* reserve a state key for future use. can hold
|
|
23
|
+
* an additional power or a record of powers
|
|
24
|
+
*/
|
|
25
|
+
reserved: undefined;
|
|
18
26
|
};
|
|
19
|
-
|
|
20
|
-
* PowerStore is used so additional powers can be added on upgrade. See
|
|
21
|
-
* [#7337](https://github.com/Agoric/agoric-sdk/issues/7337) for tracking on Exo
|
|
22
|
-
* state migrations.
|
|
23
|
-
*/
|
|
24
|
-
export type PowerStore = MapStore<keyof OrchestrationPowers, OrchestrationPowers[keyof OrchestrationPowers]>;
|
|
25
|
-
export type ICQConnectionStore = MapStore<IBCConnectionID, ICQConnectionKit>;
|
|
27
|
+
export type ICQConnectionStore = MapStore<string, ICQConnectionKit>;
|
|
26
28
|
export type ConnectionKit = ChainAccountKit | ICQConnectionKit;
|
|
27
29
|
export type OrchestrationState = {
|
|
28
|
-
powers: PowerStore;
|
|
29
30
|
icqConnections: ICQConnectionStore;
|
|
30
|
-
|
|
31
|
+
sharedICQPort: Remote<Port> | undefined;
|
|
32
|
+
} & OrchestrationPowers;
|
|
31
33
|
export type MakeCosmosInterchainService = ReturnType<typeof prepareCosmosInterchainService>;
|
|
32
34
|
export type CosmosInterchainService = ReturnType<MakeCosmosInterchainService>;
|
|
33
35
|
import type { Zone } from '@agoric/base-zone';
|
|
34
36
|
import type { VowTools } from '@agoric/vow';
|
|
35
37
|
import type { IBCConnectionID } from '@agoric/vats';
|
|
38
|
+
import type { ICAChannelAddressOpts } from '../utils/address.js';
|
|
36
39
|
import type { IcaAccount } from '../types.js';
|
|
37
40
|
import type { Vow } from '@agoric/vow';
|
|
38
41
|
import type { ICQConnection } from '../types.js';
|
|
@@ -40,4 +43,5 @@ import type { PortAllocator } from '@agoric/network';
|
|
|
40
43
|
import type { Remote } from '@agoric/internal';
|
|
41
44
|
import type { ICQConnectionKit } from '../types.js';
|
|
42
45
|
import type { ChainAccountKit } from '../types.js';
|
|
46
|
+
import type { Port } from '@agoric/network';
|
|
43
47
|
//# sourceMappingURL=cosmos-interchain-service.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cosmos-interchain-service.d.ts","sourceRoot":"","sources":["cosmos-interchain-service.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"cosmos-interchain-service.d.ts","sourceRoot":"","sources":["cosmos-interchain-service.js"],"names":[],"mappings":"AA6PO,qDAHI,IAAI,YACJ,QAAQ;IAnEX;;;;;;;;OAQG;yBAPQ,MAAM,oBACN,eAAe,0BAEf,eAAe,6CAGb,IAAI,UAAU,CAAC;IAkB5B;;;;OAIG;iDAHQ,eAAe,iCAEb,IAAI,aAAa,CAAC,GAAG,aAAa;GAwDtD;;mBAjPa,OAAO,aAAa,CAAC;;;;;cACrB,SAAS;;iCAIT,QAAQ,CAAC,MAAM,EAAE,gBAAgB,CAAC;4BAElC,eAAe,GAAG,gBAAgB;iCAGnC;IACZ,cAAkB,EAAE,kBAAkB,CAAC;IACvC,aAAiB,EAAE,OAAO,IAAI,CAAC,GAAG,SAAS,CAAC;CACzC,GAAG,mBAAmB;0CAuOZ,UAAU,CAAC,OAAO,8BAA8B,CAAC;sCACjD,UAAU,CAAC,2BAA2B,CAAC;0BAlQ9B,mBAAmB;8BAKV,aAAa;qCAFX,cAAc;2CAIR,qBAAqB;gCADkB,aAAa;yBAD5D,aAAa;mCACkC,aAAa;mCAJ1C,iBAAiB;4BAD1C,kBAAkB;sCAKoC,aAAa;qCAAb,aAAa;0BAJ1C,iBAAiB"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/** @file Orchestration service */
|
|
2
2
|
|
|
3
|
-
import { Fail, b } from '@endo/errors';
|
|
4
3
|
import { E } from '@endo/far';
|
|
5
|
-
import { M } from '@endo/patterns';
|
|
4
|
+
import { M, mustMatch } from '@endo/patterns';
|
|
6
5
|
import { Shape as NetworkShape } from '@agoric/network';
|
|
7
6
|
import { prepareChainAccountKit } from './chain-account-kit.js';
|
|
8
7
|
import { prepareICQConnectionKit } from './icq-connection-kit.js';
|
|
9
8
|
import {
|
|
9
|
+
DEFAULT_ICQ_VERSION,
|
|
10
10
|
makeICAChannelAddress,
|
|
11
11
|
makeICQChannelAddress,
|
|
12
12
|
} from '../utils/address.js';
|
|
@@ -19,40 +19,39 @@ import {
|
|
|
19
19
|
* @import {RemoteIbcAddress} from '@agoric/vats/tools/ibc-utils.js';
|
|
20
20
|
* @import {Vow, VowTools} from '@agoric/vow';
|
|
21
21
|
* @import {ICQConnection, IcaAccount, ICQConnectionKit, ChainAccountKit} from '../types.js';
|
|
22
|
+
* @import {ICAChannelAddressOpts} from '../utils/address.js';
|
|
22
23
|
*/
|
|
23
24
|
|
|
24
25
|
const { Vow$ } = NetworkShape; // TODO #9611
|
|
25
26
|
/**
|
|
26
27
|
* @typedef {object} OrchestrationPowers
|
|
27
28
|
* @property {Remote<PortAllocator>} portAllocator
|
|
29
|
+
* @property {undefined} reserved reserve a state key for future use. can hold
|
|
30
|
+
* an additional power or a record of powers
|
|
28
31
|
*/
|
|
29
32
|
|
|
30
|
-
/**
|
|
31
|
-
* PowerStore is used so additional powers can be added on upgrade. See
|
|
32
|
-
* [#7337](https://github.com/Agoric/agoric-sdk/issues/7337) for tracking on Exo
|
|
33
|
-
* state migrations.
|
|
34
|
-
*
|
|
35
|
-
* @typedef {MapStore<
|
|
36
|
-
* keyof OrchestrationPowers,
|
|
37
|
-
* OrchestrationPowers[keyof OrchestrationPowers]
|
|
38
|
-
* >} PowerStore
|
|
39
|
-
*/
|
|
40
|
-
|
|
41
|
-
/** @typedef {MapStore<IBCConnectionID, ICQConnectionKit>} ICQConnectionStore */
|
|
33
|
+
/** @typedef {MapStore<string, ICQConnectionKit>} ICQConnectionStore */
|
|
42
34
|
|
|
43
35
|
/** @typedef {ChainAccountKit | ICQConnectionKit} ConnectionKit */
|
|
44
36
|
|
|
45
37
|
/**
|
|
46
|
-
* @
|
|
47
|
-
*
|
|
48
|
-
*
|
|
38
|
+
* @typedef {{
|
|
39
|
+
* icqConnections: ICQConnectionStore;
|
|
40
|
+
* sharedICQPort: Remote<Port> | undefined;
|
|
41
|
+
* } & OrchestrationPowers} OrchestrationState
|
|
49
42
|
*/
|
|
50
|
-
const getPower = (powers, name) => {
|
|
51
|
-
powers.has(name) || Fail`need powers.${b(name)} for this method`;
|
|
52
|
-
return /** @type {OrchestrationPowers[K]} */ (powers.get(name));
|
|
53
|
-
};
|
|
54
43
|
|
|
55
|
-
/**
|
|
44
|
+
/**
|
|
45
|
+
* Creates a key for the icqConnections mapStore based on connectionId and
|
|
46
|
+
* version
|
|
47
|
+
*
|
|
48
|
+
* @param {IBCConnectionID} controllerConnectionId
|
|
49
|
+
* @param {string} [version]
|
|
50
|
+
* @returns {string}
|
|
51
|
+
*/
|
|
52
|
+
const getICQConnectionKey = (controllerConnectionId, version) => {
|
|
53
|
+
return `${controllerConnectionId}:${version || DEFAULT_ICQ_VERSION}`;
|
|
54
|
+
};
|
|
56
55
|
|
|
57
56
|
/**
|
|
58
57
|
* @param {Zone} zone
|
|
@@ -62,7 +61,7 @@ const getPower = (powers, name) => {
|
|
|
62
61
|
*/
|
|
63
62
|
const prepareCosmosOrchestrationServiceKit = (
|
|
64
63
|
zone,
|
|
65
|
-
{ watch },
|
|
64
|
+
{ watch, asVow },
|
|
66
65
|
makeChainAccountKit,
|
|
67
66
|
makeICQConnectionKit,
|
|
68
67
|
) =>
|
|
@@ -78,7 +77,7 @@ const prepareCosmosOrchestrationServiceKit = (
|
|
|
78
77
|
onFulfilled: M.call(M.remotable('Port'))
|
|
79
78
|
.optional({
|
|
80
79
|
remoteConnAddr: M.string(),
|
|
81
|
-
|
|
80
|
+
icqLookupKey: M.string(),
|
|
82
81
|
})
|
|
83
82
|
.returns(Vow$(NetworkShape.Connection)),
|
|
84
83
|
}),
|
|
@@ -87,31 +86,30 @@ const prepareCosmosOrchestrationServiceKit = (
|
|
|
87
86
|
.optional(
|
|
88
87
|
M.splitRecord(
|
|
89
88
|
{ connectionKit: M.record(), returnFacet: M.string() },
|
|
90
|
-
{
|
|
89
|
+
{ icqLookupKey: M.string() },
|
|
91
90
|
),
|
|
92
91
|
)
|
|
93
92
|
.returns(M.remotable('ConnectionKit Holder facet')),
|
|
94
93
|
}),
|
|
95
94
|
public: M.interface('CosmosInterchainService', {
|
|
96
|
-
makeAccount: M.call(M.string(), M.string(), M.string())
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
provideICQConnection: M.call(M.string())
|
|
100
|
-
|
|
101
|
-
|
|
95
|
+
makeAccount: M.call(M.string(), M.string(), M.string())
|
|
96
|
+
.optional(M.record())
|
|
97
|
+
.returns(Vow$(M.remotable('ChainAccountKit'))),
|
|
98
|
+
provideICQConnection: M.call(M.string())
|
|
99
|
+
.optional(M.string())
|
|
100
|
+
.returns(Vow$(M.remotable('ICQConnection'))),
|
|
102
101
|
}),
|
|
103
102
|
},
|
|
104
|
-
/** @param {Partial<OrchestrationPowers>}
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
const powers = zone.detached().mapStore('PowerStore');
|
|
108
|
-
if (initialPowers) {
|
|
109
|
-
for (const [name, power] of Object.entries(initialPowers)) {
|
|
110
|
-
powers.init(/** @type {keyof OrchestrationPowers} */ (name), power);
|
|
111
|
-
}
|
|
112
|
-
}
|
|
103
|
+
/** @param {Partial<OrchestrationPowers>} powers */
|
|
104
|
+
powers => {
|
|
105
|
+
mustMatch(powers?.portAllocator, M.remotable('PortAllocator'));
|
|
113
106
|
const icqConnections = zone.detached().mapStore('ICQConnections');
|
|
114
|
-
return /** @type {OrchestrationState} */ ({
|
|
107
|
+
return /** @type {OrchestrationState} */ ({
|
|
108
|
+
icqConnections,
|
|
109
|
+
sharedICQPort: undefined,
|
|
110
|
+
reserved: undefined,
|
|
111
|
+
...powers,
|
|
112
|
+
});
|
|
115
113
|
},
|
|
116
114
|
{
|
|
117
115
|
requestICAChannelWatcher: {
|
|
@@ -140,19 +138,21 @@ const prepareCosmosOrchestrationServiceKit = (
|
|
|
140
138
|
* @param {Port} port
|
|
141
139
|
* @param {{
|
|
142
140
|
* remoteConnAddr: RemoteIbcAddress;
|
|
143
|
-
*
|
|
141
|
+
* icqLookupKey: string;
|
|
144
142
|
* }} watchContext
|
|
145
143
|
*/
|
|
146
|
-
onFulfilled(port, { remoteConnAddr,
|
|
144
|
+
onFulfilled(port, { remoteConnAddr, icqLookupKey }) {
|
|
145
|
+
if (!this.state.sharedICQPort) {
|
|
146
|
+
this.state.sharedICQPort = port;
|
|
147
|
+
}
|
|
147
148
|
const connectionKit = makeICQConnectionKit(port);
|
|
148
|
-
/** @param {ICQConnectionKit} kit */
|
|
149
149
|
return watch(
|
|
150
150
|
E(port).connect(remoteConnAddr, connectionKit.connectionHandler),
|
|
151
151
|
this.facets.channelOpenWatcher,
|
|
152
152
|
{
|
|
153
153
|
connectionKit,
|
|
154
154
|
returnFacet: 'connection',
|
|
155
|
-
|
|
155
|
+
icqLookupKey,
|
|
156
156
|
},
|
|
157
157
|
);
|
|
158
158
|
},
|
|
@@ -168,23 +168,18 @@ const prepareCosmosOrchestrationServiceKit = (
|
|
|
168
168
|
* @param {{
|
|
169
169
|
* connectionKit: ConnectionKit;
|
|
170
170
|
* returnFacet: string;
|
|
171
|
-
*
|
|
171
|
+
* icqLookupKey?: string;
|
|
172
172
|
* }} watchContext
|
|
173
173
|
*/
|
|
174
|
-
onFulfilled(
|
|
175
|
-
|
|
176
|
-
{ connectionKit, returnFacet, saveICQConnection },
|
|
177
|
-
) {
|
|
178
|
-
if (saveICQConnection) {
|
|
174
|
+
onFulfilled(_connection, { connectionKit, returnFacet, icqLookupKey }) {
|
|
175
|
+
if (icqLookupKey) {
|
|
179
176
|
this.state.icqConnections.init(
|
|
180
|
-
|
|
177
|
+
icqLookupKey,
|
|
181
178
|
/** @type {ICQConnectionKit} */ (connectionKit),
|
|
182
179
|
);
|
|
183
180
|
}
|
|
184
181
|
return connectionKit[returnFacet];
|
|
185
182
|
},
|
|
186
|
-
// TODO #9317 if we fail, should we revoke the port (if it was created in this flow)?
|
|
187
|
-
// onRejected() {}
|
|
188
183
|
},
|
|
189
184
|
public: {
|
|
190
185
|
/**
|
|
@@ -192,14 +187,17 @@ const prepareCosmosOrchestrationServiceKit = (
|
|
|
192
187
|
* @param {IBCConnectionID} hostConnectionId the counterparty
|
|
193
188
|
* connection_id
|
|
194
189
|
* @param {IBCConnectionID} controllerConnectionId self connection_id
|
|
190
|
+
* @param {ICAChannelAddressOpts} [opts] optional to configure the
|
|
191
|
+
* channel address, such as version and ordering
|
|
195
192
|
* @returns {Vow<IcaAccount>}
|
|
196
193
|
*/
|
|
197
|
-
makeAccount(chainId, hostConnectionId, controllerConnectionId) {
|
|
194
|
+
makeAccount(chainId, hostConnectionId, controllerConnectionId, opts) {
|
|
198
195
|
const remoteConnAddr = makeICAChannelAddress(
|
|
199
196
|
hostConnectionId,
|
|
200
197
|
controllerConnectionId,
|
|
198
|
+
opts,
|
|
201
199
|
);
|
|
202
|
-
const portAllocator =
|
|
200
|
+
const { portAllocator } = this.state;
|
|
203
201
|
return watch(
|
|
204
202
|
E(portAllocator).allocateICAControllerPort(),
|
|
205
203
|
this.facets.requestICAChannelWatcher,
|
|
@@ -211,29 +209,42 @@ const prepareCosmosOrchestrationServiceKit = (
|
|
|
211
209
|
},
|
|
212
210
|
/**
|
|
213
211
|
* @param {IBCConnectionID} controllerConnectionId
|
|
212
|
+
* @param {string} [version]
|
|
214
213
|
* @returns {Vow<ICQConnection> | ICQConnection}
|
|
215
214
|
*/
|
|
216
|
-
provideICQConnection(controllerConnectionId) {
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
215
|
+
provideICQConnection(controllerConnectionId, version) {
|
|
216
|
+
const icqLookupKey = getICQConnectionKey(
|
|
217
|
+
controllerConnectionId,
|
|
218
|
+
version,
|
|
219
|
+
);
|
|
220
|
+
if (this.state.icqConnections.has(icqLookupKey)) {
|
|
221
|
+
return asVow(
|
|
222
|
+
() => this.state.icqConnections.get(icqLookupKey).connection,
|
|
223
|
+
);
|
|
221
224
|
}
|
|
222
|
-
const remoteConnAddr = makeICQChannelAddress(
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
// allocate a new Port for every Connection
|
|
226
|
-
// TODO #9317 optimize ICQ port allocation
|
|
227
|
-
E(portAllocator).allocateICQControllerPort(),
|
|
228
|
-
this.facets.requestICQChannelWatcher,
|
|
229
|
-
{
|
|
230
|
-
remoteConnAddr,
|
|
231
|
-
controllerConnectionId,
|
|
232
|
-
},
|
|
225
|
+
const remoteConnAddr = makeICQChannelAddress(
|
|
226
|
+
controllerConnectionId,
|
|
227
|
+
version,
|
|
233
228
|
);
|
|
229
|
+
const { portAllocator, sharedICQPort } = this.state;
|
|
230
|
+
const portOrPortVow =
|
|
231
|
+
sharedICQPort || E(portAllocator).allocateICQControllerPort();
|
|
232
|
+
|
|
233
|
+
return watch(portOrPortVow, this.facets.requestICQChannelWatcher, {
|
|
234
|
+
remoteConnAddr,
|
|
235
|
+
icqLookupKey,
|
|
236
|
+
});
|
|
234
237
|
},
|
|
235
238
|
},
|
|
236
239
|
},
|
|
240
|
+
{
|
|
241
|
+
stateShape: {
|
|
242
|
+
icqConnections: M.remotable('icqConnections mapStore'),
|
|
243
|
+
sharedICQPort: M.or(M.remotable('Port'), M.undefined()),
|
|
244
|
+
portAllocator: M.remotable('PortAllocator'),
|
|
245
|
+
reserved: M.any(),
|
|
246
|
+
},
|
|
247
|
+
},
|
|
237
248
|
);
|
|
238
249
|
|
|
239
250
|
/**
|
|
@@ -5,7 +5,7 @@ export const OrchestratorI: import("@endo/patterns").InterfaceGuard<{
|
|
|
5
5
|
getBrandInfo: import("@endo/patterns").MethodGuard;
|
|
6
6
|
asAmount: import("@endo/patterns").MethodGuard;
|
|
7
7
|
}>;
|
|
8
|
-
export function
|
|
8
|
+
export function prepareOrchestrator(zone: Zone, powers: {
|
|
9
9
|
asyncFlowTools: AsyncFlowTools;
|
|
10
10
|
chainHub: ChainHub;
|
|
11
11
|
localchain: Remote<LocalChain>;
|
|
@@ -18,7 +18,7 @@ export function prepareOrchestratorKit(zone: Zone, { chainHub, localchain, chain
|
|
|
18
18
|
timerService: Remote<TimerService>;
|
|
19
19
|
vowTools: VowTools;
|
|
20
20
|
zcf: ZCF;
|
|
21
|
-
}): () => import("@endo/exo").GuardedKit<{
|
|
21
|
+
}): () => ReturnType<() => import("@endo/exo").GuardedKit<{
|
|
22
22
|
/** Waits for `chainInfo` and returns a LocalChainFacade */
|
|
23
23
|
makeLocalChainFacadeWatcher: {
|
|
24
24
|
/**
|
|
@@ -75,7 +75,7 @@ export function prepareOrchestratorKit(zone: Zone, { chainHub, localchain, chain
|
|
|
75
75
|
/** @type {HostOf<Orchestrator['asAmount']>} */
|
|
76
76
|
asAmount: HostOf<Orchestrator["asAmount"]>;
|
|
77
77
|
};
|
|
78
|
-
}
|
|
78
|
+
}>>["orchestrator"];
|
|
79
79
|
/**
|
|
80
80
|
* Host side of the Orchestrator interface. (Methods return vows instead of
|
|
81
81
|
* promises as the interface within the guest function.)
|
|
@@ -99,4 +99,93 @@ import type { IBCConnectionInfo } from '../types.js';
|
|
|
99
99
|
import type { Vow } from '@agoric/vow';
|
|
100
100
|
import type { Orchestrator } from '../types.js';
|
|
101
101
|
import type { HostOf } from '@agoric/async-flow';
|
|
102
|
+
/**
|
|
103
|
+
* @param {Zone} zone
|
|
104
|
+
* @param {{
|
|
105
|
+
* asyncFlowTools: AsyncFlowTools;
|
|
106
|
+
* chainHub: ChainHub;
|
|
107
|
+
* localchain: Remote<LocalChain>;
|
|
108
|
+
* chainByName: MapStore<string, HostInterface<Chain>>;
|
|
109
|
+
* makeRecorderKit: MakeRecorderKit;
|
|
110
|
+
* makeLocalChainFacade: MakeLocalChainFacade;
|
|
111
|
+
* makeRemoteChainFacade: MakeRemoteChainFacade;
|
|
112
|
+
* orchestrationService: Remote<CosmosInterchainService>;
|
|
113
|
+
* storageNode: Remote<StorageNode>;
|
|
114
|
+
* timerService: Remote<TimerService>;
|
|
115
|
+
* vowTools: VowTools;
|
|
116
|
+
* zcf: ZCF;
|
|
117
|
+
* }} powers
|
|
118
|
+
*/
|
|
119
|
+
declare function prepareOrchestratorKit(zone: Zone, { chainHub, localchain, chainByName, makeLocalChainFacade, makeRemoteChainFacade, vowTools: { watch, asVow }, }: {
|
|
120
|
+
asyncFlowTools: AsyncFlowTools;
|
|
121
|
+
chainHub: ChainHub;
|
|
122
|
+
localchain: Remote<LocalChain>;
|
|
123
|
+
chainByName: MapStore<string, HostInterface<Chain<any>>>;
|
|
124
|
+
makeRecorderKit: MakeRecorderKit;
|
|
125
|
+
makeLocalChainFacade: MakeLocalChainFacade;
|
|
126
|
+
makeRemoteChainFacade: MakeRemoteChainFacade;
|
|
127
|
+
orchestrationService: Remote<CosmosInterchainService>;
|
|
128
|
+
storageNode: Remote<StorageNode>;
|
|
129
|
+
timerService: Remote<TimerService>;
|
|
130
|
+
vowTools: VowTools;
|
|
131
|
+
zcf: ZCF;
|
|
132
|
+
}): () => import("@endo/exo").GuardedKit<{
|
|
133
|
+
/** Waits for `chainInfo` and returns a LocalChainFacade */
|
|
134
|
+
makeLocalChainFacadeWatcher: {
|
|
135
|
+
/**
|
|
136
|
+
* @param {ChainInfo} agoricChainInfo
|
|
137
|
+
* @param {string} name
|
|
138
|
+
*/
|
|
139
|
+
onFulfilled(agoricChainInfo: ChainInfo, name: string): import("@endo/exo").Guarded<{
|
|
140
|
+
getChainInfo(): Vow<Readonly<{
|
|
141
|
+
chainId: string;
|
|
142
|
+
connections?: Record<string, IBCConnectionInfo>;
|
|
143
|
+
icqEnabled?: boolean;
|
|
144
|
+
stakingTokens?: Readonly<Array<{
|
|
145
|
+
denom: string;
|
|
146
|
+
}>>;
|
|
147
|
+
}>>;
|
|
148
|
+
makeAccount(): Vow<import("./local-orchestration-account.js").LocalOrchestrationAccountKit["holder"]>;
|
|
149
|
+
}>;
|
|
150
|
+
};
|
|
151
|
+
/**
|
|
152
|
+
* Waits for `chainInfo` for `agoric` and a remote chain and returns a
|
|
153
|
+
* RemoteChainFacade
|
|
154
|
+
*/
|
|
155
|
+
makeRemoteChainFacadeWatcher: {
|
|
156
|
+
/**
|
|
157
|
+
* Waits for `chainInfo` for `agoric` and a remote chain and returns a
|
|
158
|
+
* RemoteChainFacade
|
|
159
|
+
*
|
|
160
|
+
* @param {[ChainInfo, ChainInfo, IBCConnectionInfo]} chainsAndConnection
|
|
161
|
+
* @param {string} name
|
|
162
|
+
*/
|
|
163
|
+
onFulfilled([_agoricChainInfo, remoteChainInfo, connectionInfo]: [ChainInfo, ChainInfo, IBCConnectionInfo], name: string): import("@endo/exo").Guarded<{
|
|
164
|
+
getChainInfo(): Vow<any extends import("@endo/pass-style").Passable ? any : HostInterface<any>>;
|
|
165
|
+
makeAccount(): Vow<import("../orchestration-api.js").OrchestrationAccount<any> extends import("@endo/pass-style").Passable ? import("@endo/pass-style").Passable & import("../orchestration-api.js").OrchestrationAccount<any> : HostInterface<import("../orchestration-api.js").OrchestrationAccount<any>>>;
|
|
166
|
+
}>;
|
|
167
|
+
};
|
|
168
|
+
orchestrator: {
|
|
169
|
+
/** @type {HostOf<Orchestrator['getChain']>} */
|
|
170
|
+
getChain(chainName: string): Vow<Chain<any> extends import("@endo/pass-style").Passable ? import("@endo/pass-style").Passable & Chain<any> : HostInterface<Chain<any>>>;
|
|
171
|
+
makeLocalAccount(): Vow<import("@endo/exo").Guarded<{
|
|
172
|
+
getAddress(): string;
|
|
173
|
+
getBalance(brand: Brand<"nat">): import("@agoric/vow").PromiseVow<Amount<"nat">>;
|
|
174
|
+
deposit(payment: Payment<"nat">, optAmountShape?: Pattern): import("@agoric/vow").PromiseVow<Amount<"nat">>;
|
|
175
|
+
withdraw(amount: Amount<"nat">): import("@agoric/vow").PromiseVow<Payment<"nat">>;
|
|
176
|
+
executeTx<MT extends import("@agoric/cosmic-proto").TypedJson[]>(messages: MT): PromiseVowOfTupleMappedToGenerics<{ [K in keyof MT]: import("@agoric/cosmic-proto").JsonSafe<import("@agoric/cosmic-proto").ResponseTo<MT[K]>>; }>;
|
|
177
|
+
monitorTransfers(tap: import("@agoric/vats/src/bridge-target.js").TargetApp): import("@agoric/vow").PromiseVow<import("@agoric/vats/src/bridge-target.js").TargetRegistration>;
|
|
178
|
+
}>>;
|
|
179
|
+
/** @type {HostOf<Orchestrator['getBrandInfo']>} */
|
|
180
|
+
getBrandInfo<HoldingChain extends keyof import("../chain-info.js").KnownChains, IssuingChain extends keyof import("../chain-info.js").KnownChains>(denom: import("../orchestration-api.js").Denom): {
|
|
181
|
+
brand?: globalThis.Brand;
|
|
182
|
+
chain: Chain<import("../chain-info.js").KnownChains[HoldingChain]>;
|
|
183
|
+
base: Chain<import("../chain-info.js").KnownChains[IssuingChain]>;
|
|
184
|
+
baseDenom: import("../orchestration-api.js").Denom;
|
|
185
|
+
};
|
|
186
|
+
/** @type {HostOf<Orchestrator['asAmount']>} */
|
|
187
|
+
asAmount: HostOf<Orchestrator["asAmount"]>;
|
|
188
|
+
};
|
|
189
|
+
}>;
|
|
190
|
+
export {};
|
|
102
191
|
//# sourceMappingURL=orchestrator.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"orchestrator.d.ts","sourceRoot":"","sources":["orchestrator.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"orchestrator.d.ts","sourceRoot":"","sources":["orchestrator.js"],"names":[],"mappings":"AAoCA,0BAA0B;AAC1B;;;;;GAKG;AA4II,0CAhBI,IAAI,UACJ;IACV,cAAkB,EAAE,cAAc,CAAC;IACnC,QAAY,EAAE,QAAQ,CAAC;IACvB,UAAc,EAAE,OAAO,UAAU,CAAC,CAAC;IACnC,WAAe,EAAE,QAAQ,CAAC,MAAM,EAAE,yBAAoB,CAAC,CAAC;IACxD,eAAmB,EAAE,eAAe,CAAC;IACrC,oBAAwB,EAAE,oBAAoB,CAAC;IAC/C,qBAAyB,EAAE,qBAAqB,CAAC;IACjD,oBAAwB,EAAE,OAAO,uBAAuB,CAAC,CAAC;IAC1D,WAAe,EAAE,OAAO,WAAW,CAAC,CAAC;IACrC,YAAgB,EAAE,OAAO,YAAY,CAAC,CAAC;IACvC,QAAY,EAAE,QAAQ,CAAC;IACvB,GAAO,EAAE,GAAG,CAAC;CACV;IAvFE,2DAA2D;;QAEzD;;;WAGG;sDADQ,MAAM;;;;;;;;;;;;IAQnB;;;OAGG;;QAED;;;;;;WAMG;0HADQ,MAAM;;;;;;QASjB,+CAA+C;;;;;;;;;;QAqB/C,mDAAmD;;iBA3BpC,CAAC;;;;;QAwChB,+CAA+C;kBAApC,OAAO,YAAY,CAAC,UAAU,CAAC,CAAC;;oBA2BlD;;;;;+BAMY,UAAU,CACtB,UAAc,CAAC,OAAO,sBAAsB,CAAC,CAC1C,CAAC,cAAc,CAAC;0BAhLG,mBAAmB;oCAEc,oBAAoB;8BADjD,gBAAgB;gCAId,gCAAgC;4BAEpC,kBAAkB;2BAMyB,aAAa;mCAXzB,oBAAoB;qCAI7B,6CAA6C;0CAKrD,yBAAyB;2CACxB,0BAA0B;6CAHxB,gCAAgC;kCAL3C,cAAc;8BADb,aAAa;+BAUuB,aAAa;uCAAb,aAAa;yBAVjD,aAAa;kCAUuB,aAAa;4BAXzB,oBAAoB;AAyB5E;;;;;;;;;;;;;;;;GAgBG;AACH,8CAhBW,IAAI,mHACJ;IACV,cAAkB,EAAE,cAAc,CAAC;IACnC,QAAY,EAAE,QAAQ,CAAC;IACvB,UAAc,EAAE,OAAO,UAAU,CAAC,CAAC;IACnC,WAAe,EAAE,QAAQ,CAAC,MAAM,EAAE,yBAAoB,CAAC,CAAC;IACxD,eAAmB,EAAE,eAAe,CAAC;IACrC,oBAAwB,EAAE,oBAAoB,CAAC;IAC/C,qBAAyB,EAAE,qBAAqB,CAAC;IACjD,oBAAwB,EAAE,OAAO,uBAAuB,CAAC,CAAC;IAC1D,WAAe,EAAE,OAAO,WAAW,CAAC,CAAC;IACrC,YAAgB,EAAE,OAAO,YAAY,CAAC,CAAC;IACvC,QAAY,EAAE,QAAQ,CAAC;IACvB,GAAO,EAAE,GAAG,CAAC;CACV;IAkCE,2DAA2D;;QAEzD;;;WAGG;sDADQ,MAAM;;;;;;;;;;;;IAQnB;;;OAGG;;QAED;;;;;;WAMG;0HADQ,MAAM;;;;;;QASjB,+CAA+C;;;;;;;;;;QAqB/C,mDAAmD;;iBA3BpC,CAAC;;;;;QAwChB,+CAA+C;kBAApC,OAAO,YAAY,CAAC,UAAU,CAAC,CAAC;;GAIhD"}
|
package/src/exos/orchestrator.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/** @file ChainAccount exo */
|
|
2
2
|
import { AmountShape } from '@agoric/ertp';
|
|
3
|
+
import { pickFacet } from '@agoric/vat-data';
|
|
3
4
|
import { makeTracer } from '@agoric/internal';
|
|
4
5
|
import { Shape as NetworkShape } from '@agoric/network';
|
|
5
6
|
import { Fail, q } from '@endo/errors';
|
|
@@ -58,7 +59,7 @@ export const OrchestratorI = M.interface('Orchestrator', {
|
|
|
58
59
|
* zcf: ZCF;
|
|
59
60
|
* }} powers
|
|
60
61
|
*/
|
|
61
|
-
|
|
62
|
+
const prepareOrchestratorKit = (
|
|
62
63
|
zone,
|
|
63
64
|
{
|
|
64
65
|
chainHub,
|
|
@@ -161,6 +162,29 @@ export const prepareOrchestratorKit = (
|
|
|
161
162
|
},
|
|
162
163
|
);
|
|
163
164
|
harden(prepareOrchestratorKit);
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* @param {Zone} zone
|
|
168
|
+
* @param {{
|
|
169
|
+
* asyncFlowTools: AsyncFlowTools;
|
|
170
|
+
* chainHub: ChainHub;
|
|
171
|
+
* localchain: Remote<LocalChain>;
|
|
172
|
+
* chainByName: MapStore<string, HostInterface<Chain>>;
|
|
173
|
+
* makeRecorderKit: MakeRecorderKit;
|
|
174
|
+
* makeLocalChainFacade: MakeLocalChainFacade;
|
|
175
|
+
* makeRemoteChainFacade: MakeRemoteChainFacade;
|
|
176
|
+
* orchestrationService: Remote<CosmosInterchainService>;
|
|
177
|
+
* storageNode: Remote<StorageNode>;
|
|
178
|
+
* timerService: Remote<TimerService>;
|
|
179
|
+
* vowTools: VowTools;
|
|
180
|
+
* zcf: ZCF;
|
|
181
|
+
* }} powers
|
|
182
|
+
*/
|
|
183
|
+
export const prepareOrchestrator = (zone, powers) => {
|
|
184
|
+
const makeOrchestratorKit = prepareOrchestratorKit(zone, powers);
|
|
185
|
+
return pickFacet(makeOrchestratorKit, 'orchestrator');
|
|
186
|
+
};
|
|
187
|
+
|
|
164
188
|
/**
|
|
165
189
|
* Host side of the Orchestrator interface. (Methods return vows instead of
|
|
166
190
|
* promises as the interface within the guest function.)
|
package/src/facade.d.ts
CHANGED
|
@@ -9,11 +9,6 @@ export function makeOrchestrationFacade({ zone, timerService, zcf, storageNode,
|
|
|
9
9
|
vowTools: VowTools;
|
|
10
10
|
asyncFlowTools: AsyncFlowTools;
|
|
11
11
|
}): {
|
|
12
|
-
adminAsyncFlow: import("@endo/exo").Guarded<{
|
|
13
|
-
getFailures(): import("@endo/patterns").CopyMap<any, import("@endo/pass-style").Passable>;
|
|
14
|
-
wakeAll(): void;
|
|
15
|
-
getFlowForOutcomeVow(outcomeVow: any): any;
|
|
16
|
-
}>;
|
|
17
12
|
orchestrate: <HC, GF extends OrchestrationFlow<GuestInterface<HC>>>(durableName: string, hostCtx: HC, guestFn: GF) => HostForGuest<GF>;
|
|
18
13
|
orchestrateAll: <HC, GFM extends {
|
|
19
14
|
[durableName: string]: OrchestrationFlow<GuestInterface<HC>>;
|
package/src/facade.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"facade.d.ts","sourceRoot":"","sources":["facade.js"],"names":[],"mappings":"AA0CO,sKAZI;IACV,IAAQ,EAAE,IAAI,CAAC;IACf,YAAgB,EAAE,OAAO,YAAY,CAAC,CAAC;IACvC,GAAO,EAAE,GAAG,CAAC;IACb,WAAe,EAAE,OAAO,WAAW,CAAC,CAAC;IACrC,oBAAwB,EAAE,OAAO,uBAAuB,CAAC,CAAC;IAC1D,eAAmB,EAAE,eAAe,CAAC;IACrC,gBAAoB,EAAE,MAAM,gBAAgB,CAAC;IAC7C,QAAY,EAAE,QAAQ,CAAC;IACvB,cAAkB,EAAE,cAAc,CAAC;CAChC
|
|
1
|
+
{"version":3,"file":"facade.d.ts","sourceRoot":"","sources":["facade.js"],"names":[],"mappings":"AA0CO,sKAZI;IACV,IAAQ,EAAE,IAAI,CAAC;IACf,YAAgB,EAAE,OAAO,YAAY,CAAC,CAAC;IACvC,GAAO,EAAE,GAAG,CAAC;IACb,WAAe,EAAE,OAAO,WAAW,CAAC,CAAC;IACrC,oBAAwB,EAAE,OAAO,uBAAuB,CAAC,CAAC;IAC1D,eAAmB,EAAE,eAAe,CAAC;IACrC,gBAAoB,EAAE,MAAM,gBAAgB,CAAC;IAC7C,QAAY,EAAE,QAAQ,CAAC;IACvB,cAAkB,EAAE,cAAc,CAAC;CAChC;kBA4BW,EAAE,EACsC,EAAE,SAA1C,kBAAmB,eAAe,EAAE,CAAC,CAAE,eACzC,MAAM,WAEN,EAAE,WACF,EAAE,KACA,YAAY,CAAC,EAAE,CAAC;qBAyBhB,EAAE,EAGT,GAAG,SAFI;QACZ,CAAK,WAAW,EAAE,MAAM,GAAG,kBAAkB,eAAe,EAAE,CAAC,CAAC,CAAC;KAC7D,YAEM,GAAG,WACH,EAAE,KACA,GAAG,CAAc,IAAT,MAAM,GAAG,GAAG,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAE;EAgBxD;;;;yBAvGgC,EAAE,SAAtB,iBAAmB,IACnB,EAAE,SAAS,CACvB,GAAO,EAAE,YAAY,EACrB,GAAO,EAAE,GAAG,EACZ,GAAO,IAAI,EAAE,MAAM,EAAE,KACd,OAAO,CAAC,MAAM,EAAE,CAAC,GAClB,CAAC,GAAG,IAAI,EAAE,SAAS,EAAE,CAAC,KAAK,IAAI,EAAE,CAAC,GAClC,KAAK;kCAkGE,UAAU,CAAC,OAAO,uBAAuB,CAAC;0BAtHjC,cAAc;kCAEN,cAAc;4BAGpB,kBAAkB;6CACD,qCAAqC;qCAHhC,6CAA6C;sCACzD,wBAAwB;8BAH3B,aAAa;oCAFsB,oBAAoB;oCAApB,oBAAoB;uCAQuC,YAAY;kCAAZ,YAAY;8BARvE,oBAAoB;yBAEvD,aAAa"}
|
package/src/facade.js
CHANGED
|
@@ -63,7 +63,7 @@ export const makeOrchestrationFacade = ({
|
|
|
63
63
|
asyncFlowTools,
|
|
64
64
|
});
|
|
65
65
|
|
|
66
|
-
const { prepareEndowment, asyncFlow
|
|
66
|
+
const { prepareEndowment, asyncFlow } = asyncFlowTools;
|
|
67
67
|
|
|
68
68
|
/**
|
|
69
69
|
* @template HC - host context
|
|
@@ -76,21 +76,19 @@ export const makeOrchestrationFacade = ({
|
|
|
76
76
|
*/
|
|
77
77
|
const orchestrate = (durableName, hostCtx, guestFn) => {
|
|
78
78
|
const subZone = zone.subZone(durableName);
|
|
79
|
-
|
|
80
|
-
const hostOrc = makeOrchestrator();
|
|
81
|
-
|
|
82
|
-
const [wrappedOrc, wrappedCtx] = prepareEndowment(subZone, 'endowments', [
|
|
83
|
-
hostOrc,
|
|
84
|
-
hostCtx,
|
|
85
|
-
]);
|
|
86
|
-
|
|
79
|
+
const [wrappedCtx] = prepareEndowment(subZone, 'endowments', [hostCtx]);
|
|
87
80
|
const hostFn = asyncFlow(subZone, 'asyncFlow', guestFn);
|
|
88
81
|
|
|
89
82
|
// cast because return could be arbitrary subtype
|
|
90
83
|
const orcFn = /** @type {HostForGuest<GF>} */ (
|
|
91
|
-
(...args) =>
|
|
84
|
+
(...args) => {
|
|
85
|
+
// each invocation gets a new orchestrator
|
|
86
|
+
const hostOrc = makeOrchestrator();
|
|
87
|
+
// TODO: why are the types showing the guest types for arguments?
|
|
88
|
+
// @ts-expect-error XXX fix broken types
|
|
89
|
+
return hostFn(hostOrc, wrappedCtx, ...args);
|
|
90
|
+
}
|
|
92
91
|
);
|
|
93
|
-
|
|
94
92
|
return harden(orcFn);
|
|
95
93
|
};
|
|
96
94
|
|
|
@@ -119,7 +117,6 @@ export const makeOrchestrationFacade = ({
|
|
|
119
117
|
);
|
|
120
118
|
|
|
121
119
|
return harden({
|
|
122
|
-
adminAsyncFlow,
|
|
123
120
|
orchestrate,
|
|
124
121
|
orchestrateAll,
|
|
125
122
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"orchestration-proposal.d.ts","sourceRoot":"","sources":["orchestration-proposal.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"orchestration-proposal.d.ts","sourceRoot":"","sources":["orchestration-proposal.js"],"names":[],"mappings":"AAwBO,mJAVI,eAAe,GAAG;IAC5B,OAAW,EAAE;QACb,aAAmB,EAAE,aAAa,CAAC;KAC9B,CAAC;IACN,OAAW,EAAE;QACb,gBAAsB,EAAE,QAAQ,CAAC,GAAG,CAAC,CAAC;KACjC,CAAC;CACH,WACO;IAAE,OAAO,EAAE;QAAE,gBAAgB,EAAE,YAAY,CAAA;KAAE,CAAA;CAAE,iBA6BzD;AAoEM,+FAFI,eAAe,iBAYzB;AAGM;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAsBL;mCAhJ8B,iBAAiB"}
|
package/src/utils/address.d.ts
CHANGED
|
@@ -1,13 +1,27 @@
|
|
|
1
|
-
export function makeICAChannelAddress(hostConnectionId: IBCConnectionID, controllerConnectionId: IBCConnectionID, { version, encoding, ordering, txType, }?:
|
|
1
|
+
export function makeICAChannelAddress(hostConnectionId: IBCConnectionID, controllerConnectionId: IBCConnectionID, { version, encoding, ordering, txType, }?: ICAChannelAddressOpts | undefined): RemoteIbcAddress;
|
|
2
|
+
export const DEFAULT_ICQ_VERSION: "icq-1";
|
|
3
|
+
export function makeICQChannelAddress(controllerConnectionId: IBCConnectionID, version?: string): RemoteIbcAddress;
|
|
4
|
+
export function findAddressField(remoteAddressString: RemoteIbcAddress): ChainAddress["value"] | undefined;
|
|
5
|
+
export type ICAChannelAddressOpts = {
|
|
6
|
+
/**
|
|
7
|
+
* message encoding format for the
|
|
8
|
+
* channel
|
|
9
|
+
*/
|
|
2
10
|
encoding?: string | undefined;
|
|
11
|
+
/**
|
|
12
|
+
* channel ordering.
|
|
13
|
+
* currently only `ordered` is supported for ics27-1
|
|
14
|
+
*/
|
|
3
15
|
ordering?: "ordered" | "unordered" | undefined;
|
|
16
|
+
/**
|
|
17
|
+
* default is `sdk_multi_msg`
|
|
18
|
+
*/
|
|
4
19
|
txType?: string | undefined;
|
|
20
|
+
/**
|
|
21
|
+
* default is `ics27-1`
|
|
22
|
+
*/
|
|
5
23
|
version?: string | undefined;
|
|
6
|
-
}
|
|
7
|
-
export function makeICQChannelAddress(controllerConnectionId: IBCConnectionID, { version }?: {
|
|
8
|
-
version?: string;
|
|
9
|
-
} | undefined): RemoteIbcAddress;
|
|
10
|
-
export function findAddressField(remoteAddressString: RemoteIbcAddress): ChainAddress["value"] | undefined;
|
|
24
|
+
};
|
|
11
25
|
import type { IBCConnectionID } from '@agoric/vats';
|
|
12
26
|
import type { RemoteIbcAddress } from '@agoric/vats/tools/ibc-utils.js';
|
|
13
27
|
import type { ChainAddress } from '../types.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"address.d.ts","sourceRoot":"","sources":["address.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"address.d.ts","sourceRoot":"","sources":["address.js"],"names":[],"mappings":"AAwBO,wDALI,eAAe,0BACf,eAAe,iFAEb,gBAAgB,CAuB5B;AAGD,0CAA2C;AAOpC,8DAJI,eAAe,YACf,MAAM,GACJ,gBAAgB,CAQ5B;AAaM,sDAJI,gBAAgB,GAEd,YAAY,CAAC,OAAO,CAAC,GAAG,SAAS,CAW7C;;;;;;;;;;;;;;;;;;;;;qCAhFiC,cAAc;sCAEb,iCAAiC;kCADrC,aAAa"}
|
package/src/utils/address.js
CHANGED
|
@@ -6,16 +6,20 @@ import { Fail } from '@endo/errors';
|
|
|
6
6
|
* @import {RemoteIbcAddress} from '@agoric/vats/tools/ibc-utils.js';
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
+
/**
|
|
10
|
+
* @typedef {object} ICAChannelAddressOpts
|
|
11
|
+
* @property {string} [encoding='proto3'] message encoding format for the
|
|
12
|
+
* channel
|
|
13
|
+
* @property {'ordered' | 'unordered'} [ordering='ordered'] channel ordering.
|
|
14
|
+
* currently only `ordered` is supported for ics27-1
|
|
15
|
+
* @property {string} [txType='sdk_multi_msg'] default is `sdk_multi_msg`
|
|
16
|
+
* @property {string} [version='ics27-1'] default is `ics27-1`
|
|
17
|
+
*/
|
|
18
|
+
|
|
9
19
|
/**
|
|
10
20
|
* @param {IBCConnectionID} hostConnectionId Counterparty Connection ID
|
|
11
21
|
* @param {IBCConnectionID} controllerConnectionId Self Connection ID
|
|
12
|
-
* @param {
|
|
13
|
-
* @param {string} [opts.encoding] - message encoding format for the channel.
|
|
14
|
-
* default is `proto3`
|
|
15
|
-
* @param {'ordered' | 'unordered'} [opts.ordering] - channel ordering.
|
|
16
|
-
* currently only `ordered` is supported for ics27-1
|
|
17
|
-
* @param {string} [opts.txType] - default is `sdk_multi_msg`
|
|
18
|
-
* @param {string} [opts.version] - default is `ics27-1`
|
|
22
|
+
* @param {ICAChannelAddressOpts} [opts]
|
|
19
23
|
* @returns {RemoteIbcAddress}
|
|
20
24
|
*/
|
|
21
25
|
export const makeICAChannelAddress = (
|
|
@@ -42,14 +46,16 @@ export const makeICAChannelAddress = (
|
|
|
42
46
|
};
|
|
43
47
|
harden(makeICAChannelAddress);
|
|
44
48
|
|
|
49
|
+
export const DEFAULT_ICQ_VERSION = 'icq-1';
|
|
50
|
+
|
|
45
51
|
/**
|
|
46
52
|
* @param {IBCConnectionID} controllerConnectionId
|
|
47
|
-
* @param {
|
|
53
|
+
* @param {string} version defaults to icq-1
|
|
48
54
|
* @returns {RemoteIbcAddress}
|
|
49
55
|
*/
|
|
50
56
|
export const makeICQChannelAddress = (
|
|
51
57
|
controllerConnectionId,
|
|
52
|
-
|
|
58
|
+
version = DEFAULT_ICQ_VERSION,
|
|
53
59
|
) => {
|
|
54
60
|
controllerConnectionId || Fail`controllerConnectionId is required`;
|
|
55
61
|
return `/ibc-hop/${controllerConnectionId}/ibc-port/icqhost/unordered/${version}`;
|
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
export function provideOrchestration(zcf: ZCF, baggage: Baggage, remotePowers: OrchestrationPowers, marshaller: Marshaller): {
|
|
2
|
+
makeOrchestrateKit: (zone: Zone) => {
|
|
3
|
+
orchestrate: <HC, GF extends import("../orchestration-api.js").OrchestrationFlow<import("@agoric/async-flow").GuestInterface<HC>>>(durableName: string, hostCtx: HC, guestFn: GF) => HostForGuest<GF>;
|
|
4
|
+
orchestrateAll: <HC, GFM extends {
|
|
5
|
+
[durableName: string]: import("../orchestration-api.js").OrchestrationFlow<import("@agoric/async-flow").GuestInterface<HC>>;
|
|
6
|
+
}>(guestFns: GFM, hostCtx: HC) => { [N in keyof GFM]: HostForGuest<GFM[N]>; };
|
|
7
|
+
};
|
|
2
8
|
chainHub: import("@endo/exo").Guarded<{
|
|
3
9
|
registerChain(name: string, chainInfo: import("../cosmos-api.js").CosmosChainInfo): void;
|
|
4
10
|
getChainInfo<K extends string>(chainName: K): import("@agoric/vow").Vow<ActualChainInfo<K>>;
|
|
@@ -21,15 +27,43 @@ export function provideOrchestration(zcf: ZCF, baggage: Baggage, remotePowers: O
|
|
|
21
27
|
asPromise: import("@agoric/vow").AsPromiseFunction;
|
|
22
28
|
retriable: <F extends (...args: any[]) => Promise<any>>(fnZone: Zone, name: string, fn: F) => F extends (...args: infer Args) => Promise<infer R> ? (...args: Args) => import("@agoric/vow").Vow<R> : never;
|
|
23
29
|
};
|
|
30
|
+
asyncFlowTools: {
|
|
31
|
+
prepareAsyncFlowKit: (zone: Zone, tag: string, guestAsyncFunc: import("@agoric/async-flow").GuestAsyncFunc, options?: {
|
|
32
|
+
startEager?: boolean;
|
|
33
|
+
} | undefined) => (activationArgs: any) => import("@endo/exo").GuardedKit<{
|
|
34
|
+
flow: {
|
|
35
|
+
getFlowState(): import("@agoric/async-flow").FlowState;
|
|
36
|
+
restart(eager?: boolean | undefined): void;
|
|
37
|
+
wake(): void;
|
|
38
|
+
getOutcome(): import("@agoric/vow").Vow<any>;
|
|
39
|
+
dump(): ([op: "doFulfill", vow: import("@agoric/vow").Vow<import("@endo/pass-style").Passable>, fulfillment: import("@endo/pass-style").Passable] | [op: "doReject", vow: import("@agoric/vow").Vow<import("@endo/pass-style").Passable>, reason: import("@endo/pass-style").Passable] | [op: "doReturn", callIndex: number, result: import("@endo/pass-style").Passable] | [op: "doThrow", callIndex: number, problem: import("@endo/pass-style").Passable] | [op: "checkCall", target: import("@endo/pass-style").Passable, optVerb: PropertyKey | undefined, args: import("@endo/pass-style").Passable[], callIndex: number] | [op: "checkSendOnly", target: import("@endo/pass-style").Passable, optVerb: PropertyKey | undefined, args: import("@endo/pass-style").Passable[], callIndex: number] | [op: "checkSend", target: import("@endo/pass-style").Passable, optVerb: PropertyKey | undefined, args: import("@endo/pass-style").Passable[], callIndex: number])[];
|
|
40
|
+
getOptFatalProblem(): any;
|
|
41
|
+
};
|
|
42
|
+
admin: {
|
|
43
|
+
reset(): void;
|
|
44
|
+
complete(): void;
|
|
45
|
+
panic(fatalProblem: any): never;
|
|
46
|
+
};
|
|
47
|
+
wakeWatcher: {
|
|
48
|
+
onFulfilled(_fulfillment: any): void;
|
|
49
|
+
onRejected(_fulfillment: any): void;
|
|
50
|
+
};
|
|
51
|
+
}>;
|
|
52
|
+
asyncFlow: <F extends import("@agoric/async-flow").GuestAsyncFunc>(zone: Zone, tag: string, guestFunc: F, options?: {
|
|
53
|
+
startEager?: boolean;
|
|
54
|
+
} | undefined) => import("@agoric/async-flow").HostOf<F>;
|
|
55
|
+
adminAsyncFlow: import("@endo/exo").Guarded<{
|
|
56
|
+
getFailures(): import("@endo/patterns").CopyMap<any, import("@endo/pass-style").Passable>;
|
|
57
|
+
wakeAll(): void;
|
|
58
|
+
getFlowForOutcomeVow(outcomeVow: any): any;
|
|
59
|
+
}>;
|
|
60
|
+
allWokenP: Promise<void>;
|
|
61
|
+
prepareEndowment: (zone: Zone, tag: string, e: unknown) => any;
|
|
62
|
+
};
|
|
24
63
|
zoeTools: {
|
|
25
64
|
localTransfer: (srcSeat: ZCFSeat, localAccount: import("../cosmos-api.js").LocalAccountMethods, give: AmountKeywordRecord) => import("@agoric/vow").Vow<void>;
|
|
26
65
|
};
|
|
27
66
|
zone: Zone;
|
|
28
|
-
adminAsyncFlow: import("@endo/exo").Guarded<{
|
|
29
|
-
getFailures(): import("@endo/patterns").CopyMap<any, import("@endo/pass-style").Passable>;
|
|
30
|
-
wakeAll(): void;
|
|
31
|
-
getFlowForOutcomeVow(outcomeVow: any): any;
|
|
32
|
-
}>;
|
|
33
67
|
orchestrate: <HC, GF extends import("../orchestration-api.js").OrchestrationFlow<import("@agoric/async-flow").GuestInterface<HC>>>(durableName: string, hostCtx: HC, guestFn: GF) => HostForGuest<GF>;
|
|
34
68
|
orchestrateAll: <HC, GFM extends {
|
|
35
69
|
[durableName: string]: import("../orchestration-api.js").OrchestrationFlow<import("@agoric/async-flow").GuestInterface<HC>>;
|
|
@@ -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":"AA6CO,0CALI,GAAG,WACH,OAAO,gBACP,mBAAmB,cACnB,UAAU;+BAmGR,IAAI;;;;;;;;;;;;;;;;;;;;;;;;wCApEW,GAAG;;+BA/C1B,GAAC,+EAGuB,GAAG,yCAK7B,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAqIL;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;kCA/KU;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;iCA4IU,IAAI,CAAC,UAAU,CAAC,OAAO,oBAAoB,CAAC,EAAE,MAAM,CAAC;6BA1JzC,kBAAkB;0BAGrB,cAAc;gCALR,gCAAgC;4BAIpC,aAAa;6CAEI,sCAAsC;kCALrC,cAAc;6BAE/B,cAAc"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { prepareAsyncFlowTools } from '@agoric/async-flow';
|
|
2
|
-
import { pickFacet } from '@agoric/vat-data';
|
|
3
2
|
import { prepareVowTools } from '@agoric/vow';
|
|
4
3
|
import { prepareRecorderKitMakers } from '@agoric/zoe/src/contractSupport/recorder.js';
|
|
5
4
|
import { makeDurableZone } from '@agoric/zone/durable.js';
|
|
@@ -7,7 +6,7 @@ import { makeChainHub } from '../exos/chain-hub.js';
|
|
|
7
6
|
import { prepareCosmosOrchestrationAccount } from '../exos/cosmos-orchestration-account.js';
|
|
8
7
|
import { prepareLocalChainFacade } from '../exos/local-chain-facade.js';
|
|
9
8
|
import { prepareLocalOrchestrationAccountKit } from '../exos/local-orchestration-account.js';
|
|
10
|
-
import {
|
|
9
|
+
import { prepareOrchestrator } from '../exos/orchestrator.js';
|
|
11
10
|
import { prepareRemoteChainFacade } from '../exos/remote-chain-facade.js';
|
|
12
11
|
import { makeOrchestrationFacade } from '../facade.js';
|
|
13
12
|
import { makeZoeTools } from './zoe-tools.js';
|
|
@@ -58,12 +57,16 @@ export const provideOrchestration = (
|
|
|
58
57
|
const zones = (() => {
|
|
59
58
|
const zone = makeDurableZone(baggage);
|
|
60
59
|
return {
|
|
60
|
+
/** system names for async flow */
|
|
61
61
|
asyncFlow: zone.subZone('asyncFlow'),
|
|
62
|
-
/** for
|
|
63
|
-
contract: zone.subZone('contract'),
|
|
62
|
+
/** system names for orchestration implementation */
|
|
64
63
|
orchestration: zone.subZone('orchestration'),
|
|
64
|
+
/** system names for vows */
|
|
65
65
|
vows: zone.subZone('vows'),
|
|
66
|
+
/** system names for zoe */
|
|
66
67
|
zoe: zone.subZone('zoe'),
|
|
68
|
+
/** contract-provided names, and subzones */
|
|
69
|
+
contract: zone.subZone('contract'),
|
|
67
70
|
};
|
|
68
71
|
})();
|
|
69
72
|
|
|
@@ -116,7 +119,7 @@ export const provideOrchestration = (
|
|
|
116
119
|
|
|
117
120
|
const chainByName = zones.orchestration.mapStore('chainName');
|
|
118
121
|
|
|
119
|
-
const
|
|
122
|
+
const makeOrchestrator = prepareOrchestrator(zones.orchestration, {
|
|
120
123
|
asyncFlowTools,
|
|
121
124
|
chainHub,
|
|
122
125
|
localchain: remotePowers.localchain,
|
|
@@ -131,21 +134,35 @@ export const provideOrchestration = (
|
|
|
131
134
|
zcf,
|
|
132
135
|
});
|
|
133
136
|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
137
|
+
/**
|
|
138
|
+
* Create orchestrate functions in a specific zone, instead of the default
|
|
139
|
+
* `contract.orchestration` zone. This is used for modules that add their own
|
|
140
|
+
* orchestration functions (e.g., a Portfolio with orchestration flows for
|
|
141
|
+
* continuing offers)
|
|
142
|
+
*
|
|
143
|
+
* @param {Zone} zone
|
|
144
|
+
*/
|
|
145
|
+
const makeOrchestrateKit = zone =>
|
|
146
|
+
makeOrchestrationFacade({
|
|
147
|
+
zone,
|
|
148
|
+
zcf,
|
|
149
|
+
makeRecorderKit,
|
|
150
|
+
makeOrchestrator,
|
|
151
|
+
asyncFlowTools,
|
|
152
|
+
vowTools,
|
|
153
|
+
...remotePowers,
|
|
154
|
+
});
|
|
155
|
+
|
|
156
|
+
// Create orchestrate functions for the default `contract.orchestration` zone
|
|
157
|
+
const defaultOrchestrateKit = makeOrchestrateKit(
|
|
158
|
+
zones.contract.subZone('orchestration'),
|
|
159
|
+
);
|
|
145
160
|
return {
|
|
146
|
-
...
|
|
161
|
+
...defaultOrchestrateKit,
|
|
162
|
+
makeOrchestrateKit,
|
|
147
163
|
chainHub,
|
|
148
164
|
vowTools,
|
|
165
|
+
asyncFlowTools,
|
|
149
166
|
zoeTools,
|
|
150
167
|
zone: zones.contract,
|
|
151
168
|
};
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
export function buildRootObject(_vatPowers: any, _args: any, baggage: any): {
|
|
2
2
|
/** @param {Partial<OrchestrationPowers>} [initialPowers] */
|
|
3
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;
|
|
4
|
+
makeAccount(chainId: string, hostConnectionId: import("@agoric/vats").IBCConnectionID, controllerConnectionId: import("@agoric/vats").IBCConnectionID, opts?: import("./utils/address.js").ICAChannelAddressOpts | undefined): import("@agoric/vow").Vow<import("./cosmos-api.js").IcaAccount>;
|
|
5
|
+
provideICQConnection(controllerConnectionId: import("@agoric/vats").IBCConnectionID, version?: string | undefined): import("@agoric/vow").Vow<import("./types.js").ICQConnection> | import("./types.js").ICQConnection;
|
|
6
6
|
}>;
|
|
7
7
|
} & import("@endo/pass-style").RemotableObject<`Alleged: ${string}`> & import("@endo/eventual-send").RemotableBrand<{}, {
|
|
8
8
|
/** @param {Partial<OrchestrationPowers>} [initialPowers] */
|
|
9
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;
|
|
10
|
+
makeAccount(chainId: string, hostConnectionId: import("@agoric/vats").IBCConnectionID, controllerConnectionId: import("@agoric/vats").IBCConnectionID, opts?: import("./utils/address.js").ICAChannelAddressOpts | undefined): import("@agoric/vow").Vow<import("./cosmos-api.js").IcaAccount>;
|
|
11
|
+
provideICQConnection(controllerConnectionId: import("@agoric/vats").IBCConnectionID, version?: string | undefined): import("@agoric/vow").Vow<import("./types.js").ICQConnection> | import("./types.js").ICQConnection;
|
|
12
12
|
}>;
|
|
13
13
|
}>;
|
|
14
14
|
export type OrchestrationVat = ReturnType<typeof buildRootObject>;
|