@agoric/orchestration 0.1.1-dev-e3b1b71.0 → 0.1.1-dev-20cb52f.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agoric/orchestration",
3
- "version": "0.1.1-dev-e3b1b71.0+e3b1b71",
3
+ "version": "0.1.1-dev-20cb52f.0+20cb52f",
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-e3b1b71.0+e3b1b71",
37
- "@agoric/cosmic-proto": "0.4.1-dev-e3b1b71.0+e3b1b71",
38
- "@agoric/ertp": "0.16.3-dev-e3b1b71.0+e3b1b71",
39
- "@agoric/internal": "0.3.3-dev-e3b1b71.0+e3b1b71",
40
- "@agoric/network": "0.1.1-dev-e3b1b71.0+e3b1b71",
41
- "@agoric/notifier": "0.6.3-dev-e3b1b71.0+e3b1b71",
42
- "@agoric/store": "0.9.3-dev-e3b1b71.0+e3b1b71",
43
- "@agoric/time": "0.3.3-dev-e3b1b71.0+e3b1b71",
44
- "@agoric/vat-data": "0.5.3-dev-e3b1b71.0+e3b1b71",
45
- "@agoric/vats": "0.15.2-dev-e3b1b71.0+e3b1b71",
46
- "@agoric/vow": "0.1.1-dev-e3b1b71.0+e3b1b71",
47
- "@agoric/zoe": "0.26.3-dev-e3b1b71.0+e3b1b71",
48
- "@agoric/zone": "0.2.3-dev-e3b1b71.0+e3b1b71",
36
+ "@agoric/async-flow": "0.1.1-dev-20cb52f.0+20cb52f",
37
+ "@agoric/cosmic-proto": "0.4.1-dev-20cb52f.0+20cb52f",
38
+ "@agoric/ertp": "0.16.3-dev-20cb52f.0+20cb52f",
39
+ "@agoric/internal": "0.3.3-dev-20cb52f.0+20cb52f",
40
+ "@agoric/network": "0.1.1-dev-20cb52f.0+20cb52f",
41
+ "@agoric/notifier": "0.6.3-dev-20cb52f.0+20cb52f",
42
+ "@agoric/store": "0.9.3-dev-20cb52f.0+20cb52f",
43
+ "@agoric/time": "0.3.3-dev-20cb52f.0+20cb52f",
44
+ "@agoric/vat-data": "0.5.3-dev-20cb52f.0+20cb52f",
45
+ "@agoric/vats": "0.15.2-dev-20cb52f.0+20cb52f",
46
+ "@agoric/vow": "0.1.1-dev-20cb52f.0+20cb52f",
47
+ "@agoric/zoe": "0.26.3-dev-20cb52f.0+20cb52f",
48
+ "@agoric/zone": "0.2.3-dev-20cb52f.0+20cb52f",
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-e3b1b71.0+e3b1b71",
57
+ "@agoric/swingset-liveslots": "0.10.3-dev-20cb52f.0+20cb52f",
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": "e3b1b71b15707cc442dbce757cdece8c70eeca97"
97
+ "gitHead": "20cb52f605da9535ead8778086b1900dfda0f375"
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":"AAkPO,qDAHI,IAAI,YACJ,QAAQ;IAnDX;;;;;;OAMG;yBALQ,MAAM,oBACN,eAAe,0BAEf,eAAe,GACb,IAAI,UAAU,CAAC;IAiB5B;;;OAGG;iDAFQ,eAAe,GACb,IAAI,aAAa,CAAC,GAAG,aAAa;GA4CtD;;mBAvOa,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;0CA8M1D,UAAU,CAAC,OAAO,8BAA8B,CAAC;sCACjD,UAAU,CAAC,2BAA2B,CAAC;0BAvP9B,mBAAmB;8BAKV,aAAa;qCAFX,cAAc;gCAG+B,aAAa;yBAD5D,aAAa;mCACkC,aAAa;mCAJ1C,iBAAiB;4BAD1C,kBAAkB;sCAKoC,aAAa;qCAAb,aAAa"}
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
- * @template {keyof OrchestrationPowers} K
47
- * @param {PowerStore} powers
48
- * @param {K} name
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
- /** @typedef {{ powers: PowerStore; icqConnections: ICQConnectionStore }} OrchestrationState */
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
- controllerConnectionId: M.string(),
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
- { saveICQConnection: M.string() },
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()).returns(
97
- Vow$(M.remotable('ChainAccountKit')),
98
- ),
99
- provideICQConnection: M.call(M.string()).returns(
100
- Vow$(M.remotable('ICQConnection')),
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>} [initialPowers] */
105
- initialPowers => {
106
- /** @type {PowerStore} */
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} */ ({ powers, icqConnections });
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
- * controllerConnectionId: IBCConnectionID;
141
+ * icqLookupKey: string;
144
142
  * }} watchContext
145
143
  */
146
- onFulfilled(port, { remoteConnAddr, controllerConnectionId }) {
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
- saveICQConnection: controllerConnectionId,
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
- * saveICQConnection?: IBCConnectionID;
171
+ * icqLookupKey?: string;
172
172
  * }} watchContext
173
173
  */
174
- onFulfilled(
175
- _connection,
176
- { connectionKit, returnFacet, saveICQConnection },
177
- ) {
178
- if (saveICQConnection) {
174
+ onFulfilled(_connection, { connectionKit, returnFacet, icqLookupKey }) {
175
+ if (icqLookupKey) {
179
176
  this.state.icqConnections.init(
180
- saveICQConnection,
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 = getPower(this.state.powers, '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
- if (this.state.icqConnections.has(controllerConnectionId)) {
218
- // TODO #9281 do not return synchronously. see https://github.com/Agoric/agoric-sdk/pull/9454#discussion_r1626898694
219
- return this.state.icqConnections.get(controllerConnectionId)
220
- .connection;
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(controllerConnectionId);
223
- const portAllocator = getPower(this.state.powers, 'portAllocator');
224
- return watch(
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":"AAyBO,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;mCAjJ8B,iBAAiB"}
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"}
@@ -9,7 +9,6 @@ const trace = makeTracer('CoreEvalOrchestration', true);
9
9
 
10
10
  /**
11
11
  * @import {PortAllocator} from '@agoric/network';
12
- * @import {CosmosInterchainService} from '../exos/cosmos-interchain-service.js'
13
12
  */
14
13
 
15
14
  /**
@@ -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
- } | undefined): RemoteIbcAddress;
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":"AAoBO,wDAXI,eAAe,0BACf,eAAe;;;;;gBAQb,gBAAgB,CAuB5B;AAQM,8DAJI,eAAe;cACH,MAAM;gBAChB,gBAAgB,CAQ5B;AAaM,sDAJI,gBAAgB,GAEd,YAAY,CAAC,OAAO,CAAC,GAAG,SAAS,CAW7C;qCA1EiC,cAAc;sCAEb,iCAAiC;kCADrC,aAAa"}
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"}
@@ -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 {object} [opts]
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 {{ version?: string }} [opts]
53
+ * @param {string} version defaults to icq-1
48
54
  * @returns {RemoteIbcAddress}
49
55
  */
50
56
  export const makeICQChannelAddress = (
51
57
  controllerConnectionId,
52
- { version = 'icq-1' } = {},
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>;