@agoric/orchestration 0.1.1-dev-e3b1b71.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/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/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
|
/**
|
|
@@ -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,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>;
|