@agoric/orchestration 0.1.1-dev-0cfea88.0 → 0.1.1-dev-944adea.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-0cfea88.0+0cfea88",
3
+ "version": "0.1.1-dev-944adea.0+944adea",
4
4
  "description": "Chain abstraction for Agoric's orchestration clients",
5
5
  "type": "module",
6
6
  "main": "index.js",
@@ -33,20 +33,20 @@
33
33
  },
34
34
  "homepage": "https://github.com/Agoric/agoric-sdk#readme",
35
35
  "dependencies": {
36
- "@agoric/assert": "0.6.1-dev-0cfea88.0+0cfea88",
37
- "@agoric/async-flow": "0.1.1-dev-0cfea88.0+0cfea88",
38
- "@agoric/cosmic-proto": "0.4.1-dev-0cfea88.0+0cfea88",
39
- "@agoric/ertp": "0.16.3-dev-0cfea88.0+0cfea88",
40
- "@agoric/internal": "0.3.3-dev-0cfea88.0+0cfea88",
41
- "@agoric/network": "0.1.1-dev-0cfea88.0+0cfea88",
42
- "@agoric/notifier": "0.6.3-dev-0cfea88.0+0cfea88",
43
- "@agoric/store": "0.9.3-dev-0cfea88.0+0cfea88",
44
- "@agoric/time": "0.3.3-dev-0cfea88.0+0cfea88",
45
- "@agoric/vat-data": "0.5.3-dev-0cfea88.0+0cfea88",
46
- "@agoric/vats": "0.15.2-dev-0cfea88.0+0cfea88",
47
- "@agoric/vow": "0.1.1-dev-0cfea88.0+0cfea88",
48
- "@agoric/zoe": "0.26.3-dev-0cfea88.0+0cfea88",
49
- "@agoric/zone": "0.2.3-dev-0cfea88.0+0cfea88",
36
+ "@agoric/assert": "0.6.1-dev-944adea.0+944adea",
37
+ "@agoric/async-flow": "0.1.1-dev-944adea.0+944adea",
38
+ "@agoric/cosmic-proto": "0.4.1-dev-944adea.0+944adea",
39
+ "@agoric/ertp": "0.16.3-dev-944adea.0+944adea",
40
+ "@agoric/internal": "0.3.3-dev-944adea.0+944adea",
41
+ "@agoric/network": "0.1.1-dev-944adea.0+944adea",
42
+ "@agoric/notifier": "0.6.3-dev-944adea.0+944adea",
43
+ "@agoric/store": "0.9.3-dev-944adea.0+944adea",
44
+ "@agoric/time": "0.3.3-dev-944adea.0+944adea",
45
+ "@agoric/vat-data": "0.5.3-dev-944adea.0+944adea",
46
+ "@agoric/vats": "0.15.2-dev-944adea.0+944adea",
47
+ "@agoric/vow": "0.1.1-dev-944adea.0+944adea",
48
+ "@agoric/zoe": "0.26.3-dev-944adea.0+944adea",
49
+ "@agoric/zone": "0.2.3-dev-944adea.0+944adea",
50
50
  "@endo/base64": "^1.0.5",
51
51
  "@endo/far": "^1.1.2",
52
52
  "@endo/marshal": "^1.5.0",
@@ -90,5 +90,5 @@
90
90
  "typeCoverage": {
91
91
  "atLeast": 97.1
92
92
  },
93
- "gitHead": "0cfea88fb59d27dddb8b031a5b5539127b6a305e"
93
+ "gitHead": "944adea10660e68a65c10a2b32b6899919315e31"
94
94
  }
@@ -1,3 +1,4 @@
1
+ export function registerChain(agoricNamesAdmin: ERef<import("@agoric/vats").NameHubKit["nameAdmin"]>, name: string, chainInfo: CosmosChainInfo, log?: (...messages: string[]) => void): Promise<void>;
1
2
  export function registerChainNamespace(agoricNamesAdmin: ERef<import("@agoric/vats").NameHubKit["nameAdmin"]>, log: (...messages: string[]) => void): Promise<void>;
2
3
  export type ChainInfo = CosmosChainInfo | EthChainInfo;
3
4
  export type KnownChains = typeof knownChains;
@@ -1 +1 @@
1
- {"version":3,"file":"chain-info.d.ts","sourceRoot":"","sources":["chain-info.js"],"names":[],"mappings":"AAsEO,yDAHI,IAAI,CAAC,OAAO,cAAc,EAAE,UAAU,CAAC,WAAW,CAAC,CAAC,OACpD,CAAC,GAAG,QAAQ,EAAE,MAAM,EAAE,KAAK,IAAI,iBAMzC;wBAnEa,eAAe,GAAG,YAAY;0BAyD9B,OAAO,WAAW;qCA3DiB,YAAY;k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-hub.js';
2
-
3
- // Refresh with scripts/refresh-chain-info.ts
4
- import fetchedChainInfo from './fetched-chain-info.js';
1
+ import { E } from '@endo/far';
2
+ import { mustMatch } from '@endo/patterns';
3
+ import { connectionKey } from './exos/chain-hub.js';
4
+ import fetchedChainInfo from './fetched-chain-info.js'; // Refresh with scripts/refresh-chain-info.ts
5
+ import { CosmosChainInfoShape } from './typeGuards.js';
5
6
 
6
7
  /** @import {CosmosChainInfo, EthChainInfo} from './types.js'; */
7
8
 
@@ -64,6 +65,44 @@ const knownChains = /** @satisfies {Record<string, ChainInfo>} */ (
64
65
 
65
66
  /** @typedef {typeof knownChains} KnownChains */
66
67
 
68
+ /**
69
+ * @param {ERef<import('@agoric/vats').NameHubKit['nameAdmin']>} agoricNamesAdmin
70
+ * @param {string} name
71
+ * @param {CosmosChainInfo} chainInfo
72
+ * @param {(...messages: string[]) => void} log
73
+ */
74
+ export const registerChain = async (
75
+ agoricNamesAdmin,
76
+ name,
77
+ chainInfo,
78
+ log = () => {},
79
+ ) => {
80
+ const { nameAdmin } = await E(agoricNamesAdmin).provideChild('chain');
81
+ const { nameAdmin: connAdmin } =
82
+ await E(agoricNamesAdmin).provideChild('chainConnection');
83
+
84
+ mustMatch(chainInfo, CosmosChainInfoShape);
85
+ const { connections = {}, ...vertex } = chainInfo;
86
+
87
+ const promises = [
88
+ E(nameAdmin)
89
+ .update(name, vertex)
90
+ .then(() => log(`registered agoricNames chain.${name}`)),
91
+ ];
92
+
93
+ // FIXME updates redundantly, twice per edge
94
+ for (const [counterChainId, connInfo] of Object.entries(connections)) {
95
+ const key = connectionKey(chainInfo.chainId, counterChainId);
96
+ promises.push(
97
+ E(connAdmin)
98
+ .update(key, connInfo)
99
+ .then(() => log(`registering agoricNames chainConnection.${key}`)),
100
+ );
101
+ }
102
+ // Bundle to pipeline IO
103
+ await Promise.all(promises);
104
+ };
105
+
67
106
  /**
68
107
  * @param {ERef<import('@agoric/vats').NameHubKit['nameAdmin']>} agoricNamesAdmin
69
108
  * @param {(...messages: string[]) => void} log
@@ -1 +1 @@
1
- {"version":3,"file":"sendAnywhere.contract.d.ts","sourceRoot":"","sources":["sendAnywhere.contract.js"],"names":[],"mappings":"AAYA;;;;;;;;GAQG;AAEH;;;;;;;;GAQG;AAEH,kEAKE;AASK,2BANI,GAAG,eACH,mBAAmB,GAAG;IAChC,UAAc,EAAE,UAAU,CAAC;CACxB,WACO,OAAO;;;;;QAsFZ;;;WAGG;4BAFQ,eAAe,kBACf,iBAAiB;;GAiBjC;kCA9HY;IACZ,UAAc,EAAE,OAAO,UAAU,CAAC,CAAC;IACnC,oBAAwB,EAAE,OAAO,oBAAoB,CAAC,CAAC;IACvD,WAAe,EAAE,OAAO,WAAW,CAAC,CAAC;IACrC,YAAgB,EAAE,OAAO,YAAY,CAAC,CAAC;IACvC,WAAe,EAAE,OAAO,OAAO,CAAC,CAAC;CAC9B;6BAhBsB,kBAAkB;qCACS,eAAe;uCAAf,eAAe;gCAEvC,gCAAgC;4BAGpC,aAAa;0CAFC,eAAe;kCAFX,cAAc;6BAG/B,cAAc"}
1
+ {"version":3,"file":"sendAnywhere.contract.d.ts","sourceRoot":"","sources":["sendAnywhere.contract.js"],"names":[],"mappings":"AAYA;;;;;;;;GAQG;AAEH;;;;;;;;GAQG;AAEH,kEAKE;AASK,2BANI,GAAG,eACH,mBAAmB,GAAG;IAChC,UAAc,EAAE,UAAU,CAAC;CACxB,WACO,OAAO;;;;;QAsFZ;;;WAGG;4BAFQ,eAAe,kBACf,iBAAiB;;GAmBjC;kCAhIY;IACZ,UAAc,EAAE,OAAO,UAAU,CAAC,CAAC;IACnC,oBAAwB,EAAE,OAAO,oBAAoB,CAAC,CAAC;IACvD,WAAe,EAAE,OAAO,WAAW,CAAC,CAAC;IACrC,YAAgB,EAAE,OAAO,YAAY,CAAC,CAAC;IACvC,WAAe,EAAE,OAAO,OAAO,CAAC,CAAC;CAC9B;6BAhBsB,kBAAkB;qCACS,eAAe;uCAAf,eAAe;gCAEvC,gCAAgC;4BAGpC,aAAa;0CAFC,eAAe;kCAFX,cAAc;6BAG/B,cAAc"}
@@ -2,7 +2,7 @@ import { withdrawFromSeat } from '@agoric/zoe/src/contractSupport/zoeHelpers.js'
2
2
  import { InvitationShape } from '@agoric/zoe/src/typeGuards.js';
3
3
  import { E } from '@endo/far';
4
4
  import { M, mustMatch } from '@endo/patterns';
5
-
5
+ import { V } from '@agoric/vow/vat.js';
6
6
  import { AmountShape } from '@agoric/ertp';
7
7
  import { CosmosChainInfoShape } from '../typeGuards.js';
8
8
  import { provideOrchestration } from '../utils/start-helper.js';
@@ -134,7 +134,9 @@ export const start = async (zcf, privateArgs, baggage) => {
134
134
  */
135
135
  async addChain(chainInfo, connectionInfo) {
136
136
  const chainKey = `${chainInfo.chainId}-${(nonce += 1n)}`;
137
- const agoricChainInfo = await chainHub.getChainInfo('agoric');
137
+ // when() because chainHub methods return vows. If this were inside
138
+ // orchestrate() the membrane would wrap/unwrap automatically.
139
+ const agoricChainInfo = await V.when(chainHub.getChainInfo('agoric'));
138
140
  chainHub.registerChain(chainKey, chainInfo);
139
141
  chainHub.registerConnection(
140
142
  agoricChainInfo.chainId,
@@ -1,5 +1,6 @@
1
1
  /**
2
2
  * @import {NameHub} from '@agoric/vats';
3
+ * @import {Vow} from '@agoric/vow';
3
4
  * @import {CosmosChainInfo, IBCConnectionInfo} from '../cosmos-api.js';
4
5
  * @import {ChainInfo, KnownChains} from '../chain-info.js';
5
6
  * @import {Remote} from '@agoric/internal';
@@ -33,9 +34,9 @@ export function makeChainHub(agoricNames: Remote<NameHub>, zone?: Zone | undefin
33
34
  /**
34
35
  * @template {string} K
35
36
  * @param {K} chainName
36
- * @returns {Promise<ActualChainInfo<K>>}
37
+ * @returns {Vow<ActualChainInfo<K>>}
37
38
  */
38
- getChainInfo<K extends string>(chainName: K): Promise<ActualChainInfo<K>>;
39
+ getChainInfo<K extends string>(chainName: K): Vow<ActualChainInfo<K>>;
39
40
  /**
40
41
  * @param {string} chainId1
41
42
  * @param {string} chainId2
@@ -45,22 +46,31 @@ export function makeChainHub(agoricNames: Remote<NameHub>, zone?: Zone | undefin
45
46
  /**
46
47
  * @param {string | { chainId: string }} chain1
47
48
  * @param {string | { chainId: string }} chain2
48
- * @returns {Promise<IBCConnectionInfo>}
49
+ * @returns {Vow<IBCConnectionInfo>}
49
50
  */
50
51
  getConnectionInfo(chain1: string | {
51
52
  chainId: string;
52
53
  }, chain2: string | {
53
54
  chainId: string;
54
- }): Promise<IBCConnectionInfo>;
55
+ }): Vow<IBCConnectionInfo>;
56
+ /**
57
+ * @template {string} C1
58
+ * @template {string} C2
59
+ * @param {C1} chainName1
60
+ * @param {C2} chainName2
61
+ * @returns {Vow<
62
+ * [ActualChainInfo<C1>, ActualChainInfo<C2>, IBCConnectionInfo]
63
+ * >}
64
+ */
65
+ getChainsAndConnection<C1 extends string, C2 extends string>(chainName1: C1, chainName2: C2): Vow<[ActualChainInfo<C1>, ActualChainInfo<C2>, IBCConnectionInfo]>;
55
66
  }>;
56
- export function registerChain(agoricNamesAdmin: ERef<import("@agoric/vats").NameHubKit["nameAdmin"]>, name: string, chainInfo: CosmosChainInfo, log?: (...messages: string[]) => void): Promise<void>;
57
- export function getChainsAndConnection<C1 extends string, C2 extends string>(chainHub: ChainHub, chainName1: C1, chainName2: C2): Promise<[ActualChainInfo<C1>, ActualChainInfo<C2>, IBCConnectionInfo]>;
58
67
  export type ActualChainInfo<K extends string> = K extends keyof KnownChains ? Omit<KnownChains[K], "connections"> : ChainInfo;
59
68
  export type ChainHub = ReturnType<typeof makeChainHub>;
60
69
  import type { NameHub } from '@agoric/vats';
61
70
  import type { Remote } from '@agoric/internal';
62
71
  import type { Zone } from '@agoric/zone';
63
72
  import type { CosmosChainInfo } from '../cosmos-api.js';
73
+ import type { Vow } from '@agoric/vow';
64
74
  import type { IBCConnectionInfo } from '../cosmos-api.js';
65
75
  import type { KnownChains } from '../chain-info.js';
66
76
  import type { ChainInfo } from '../chain-info.js';
@@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iCAC9B,kBAAkB;+BAAlB,kBAAkB"}
1
+ {"version":3,"file":"chain-hub.d.ts","sourceRoot":"","sources":["chain-hub.js"],"names":[],"mappings":"AASA;;;;;;;GAOG;AAEH;;;;;GAKG;AAEH,wCAAwC;AACxC,gCAAiC;AACjC,kCAAkC;AAClC,gDAAiD;AAqB1C,wCAHI,MAAM,YACN,MAAM,UAUhB;AAoCM,0CAHI,OAAO,OAAO,CAAC;IAgBtB;;;;;;;;;;;OAWG;wBAFQ,MAAM,aACN,eAAe;IAK1B;;;;OAIG;iBAHmB,CAAC,SAAV,MAAQ,aACV,CAAC,GACC,IAAI,eAAe,CAAC,CAAC,CAAC,CAAC;IAoBpC;;;;OAIG;iCAHQ,MAAM,YACN,MAAM,kBACN,iBAAiB;IAO5B;;;;OAIG;8BAHQ,MAAM,GAAG;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE,UAC5B,MAAM,GAAG;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE,GAC1B,IAAI,iBAAiB,CAAC;IAqBnC;;;;;;;;OAQG;2BAPmB,EAAE,SAAX,MAAQ,EACC,EAAE,SAAX,MAAQ,cACV,EAAE,cACF,EAAE,GACA,IACZ,CAAK,eAAe,CAAC,EAAE,CAAC,EAAE,eAAe,CAAC,EAAE,CAAC,EAAE,iBAAiB,CAAC,CAC9D;GAsBP;4BA5LqB,CAAC,SAAV,MAAQ,IACR,CAAC,SAAS,MAAM,WAAW,GACjC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,aAAa,CAAC,GACnC,SAAS;uBA0LF,UAAU,CAAC,OAAO,YAAY,CAAC;6BAtMnB,cAAc;4BAIf,kBAAkB;0BACpB,cAAc;qCAHgB,kBAAkB;yBADjD,aAAa;uCACkB,kBAAkB;iCAC9B,kBAAkB;+BAAlB,kBAAkB"}
@@ -1,12 +1,15 @@
1
- import { E } from '@endo/far';
2
- import { M, mustMatch } from '@endo/patterns';
1
+ import { VowShape } from '@agoric/vow';
2
+ import { allVows, watch } from '@agoric/vow/vat.js';
3
3
  import { makeHeapZone } from '@agoric/zone';
4
+ import { E } from '@endo/far';
5
+ import { M } from '@endo/patterns';
4
6
  import { CosmosChainInfoShape, IBCConnectionInfoShape } from '../typeGuards.js';
5
7
 
6
8
  const { Fail } = assert;
7
9
 
8
10
  /**
9
11
  * @import {NameHub} from '@agoric/vats';
12
+ * @import {Vow} from '@agoric/vow';
10
13
  * @import {CosmosChainInfo, IBCConnectionInfo} from '../cosmos-api.js';
11
14
  * @import {ChainInfo, KnownChains} from '../chain-info.js';
12
15
  * @import {Remote} from '@agoric/internal';
@@ -67,15 +70,14 @@ const ChainIdArgShape = M.or(
67
70
 
68
71
  const ChainHubI = M.interface('ChainHub', {
69
72
  registerChain: M.call(M.string(), CosmosChainInfoShape).returns(),
70
- getChainInfo: M.callWhen(M.string()).returns(CosmosChainInfoShape),
71
- registerConnection: M.callWhen(
73
+ getChainInfo: M.call(M.string()).returns(VowShape),
74
+ registerConnection: M.call(
72
75
  M.string(),
73
76
  M.string(),
74
77
  IBCConnectionInfoShape,
75
78
  ).returns(),
76
- getConnectionInfo: M.callWhen(ChainIdArgShape, ChainIdArgShape).returns(
77
- IBCConnectionInfoShape,
78
- ),
79
+ getConnectionInfo: M.call(ChainIdArgShape, ChainIdArgShape).returns(VowShape),
80
+ getChainsAndConnection: M.call(M.string(), M.string()).returns(VowShape),
79
81
  });
80
82
 
81
83
  /**
@@ -120,22 +122,25 @@ export const makeChainHub = (agoricNames, zone = makeHeapZone()) => {
120
122
  /**
121
123
  * @template {string} K
122
124
  * @param {K} chainName
123
- * @returns {Promise<ActualChainInfo<K>>}
125
+ * @returns {Vow<ActualChainInfo<K>>}
124
126
  */
125
- async getChainInfo(chainName) {
127
+ getChainInfo(chainName) {
126
128
  // Either from registerChain or memoized remote lookup()
127
129
  if (chainInfos.has(chainName)) {
128
- // @ts-expect-error cast
129
- return chainInfos.get(chainName);
130
+ return /** @type {Vow<ActualChainInfo<K>>} */ (
131
+ watch(chainInfos.get(chainName))
132
+ );
130
133
  }
131
134
 
132
- const chainInfo = await E(agoricNames)
133
- .lookup(CHAIN_KEY, chainName)
134
- .catch(_cause => {
135
+ return watch(E(agoricNames).lookup(CHAIN_KEY, chainName), {
136
+ onFulfilled: chainInfo => {
137
+ chainInfos.init(chainName, chainInfo);
138
+ return chainInfo;
139
+ },
140
+ onRejected: _cause => {
135
141
  throw assert.error(`chain not found:${chainName}`);
136
- });
137
- chainInfos.init(chainName, chainInfo);
138
- return chainInfo;
142
+ },
143
+ });
139
144
  },
140
145
  /**
141
146
  * @param {string} chainId1
@@ -150,88 +155,55 @@ export const makeChainHub = (agoricNames, zone = makeHeapZone()) => {
150
155
  /**
151
156
  * @param {string | { chainId: string }} chain1
152
157
  * @param {string | { chainId: string }} chain2
153
- * @returns {Promise<IBCConnectionInfo>}
158
+ * @returns {Vow<IBCConnectionInfo>}
154
159
  */
155
- async getConnectionInfo(chain1, chain2) {
160
+ getConnectionInfo(chain1, chain2) {
156
161
  const chainId1 = typeof chain1 === 'string' ? chain1 : chain1.chainId;
157
162
  const chainId2 = typeof chain2 === 'string' ? chain2 : chain2.chainId;
158
163
  const key = connectionKey(chainId1, chainId2);
159
164
  if (connectionInfos.has(key)) {
160
- return connectionInfos.get(key);
165
+ return watch(connectionInfos.get(key));
161
166
  }
162
167
 
163
- const connectionInfo = await E(agoricNames)
164
- .lookup(CONNECTIONS_KEY, key)
165
- .catch(_cause => {
168
+ return watch(E(agoricNames).lookup(CONNECTIONS_KEY, key), {
169
+ onFulfilled: connectionInfo => {
170
+ connectionInfos.init(key, connectionInfo);
171
+ return connectionInfo;
172
+ },
173
+ onRejected: _cause => {
166
174
  throw assert.error(`connection not found: ${chainId1}<->${chainId2}`);
167
- });
168
- connectionInfos.init(key, connectionInfo);
169
- return connectionInfo;
175
+ },
176
+ });
177
+ },
178
+
179
+ /**
180
+ * @template {string} C1
181
+ * @template {string} C2
182
+ * @param {C1} chainName1
183
+ * @param {C2} chainName2
184
+ * @returns {Vow<
185
+ * [ActualChainInfo<C1>, ActualChainInfo<C2>, IBCConnectionInfo]
186
+ * >}
187
+ */
188
+ getChainsAndConnection(chainName1, chainName2) {
189
+ return watch(
190
+ allVows([
191
+ chainHub.getChainInfo(chainName1),
192
+ chainHub.getChainInfo(chainName2),
193
+ ]),
194
+ {
195
+ onFulfilled: ([chain1, chain2]) => {
196
+ return watch(chainHub.getConnectionInfo(chain2, chain1), {
197
+ onFulfilled: connectionInfo => {
198
+ return [chain1, chain2, connectionInfo];
199
+ },
200
+ });
201
+ },
202
+ },
203
+ );
170
204
  },
171
205
  });
172
206
 
173
207
  return chainHub;
174
208
  };
175
209
  /** @typedef {ReturnType<typeof makeChainHub>} ChainHub */
176
-
177
- /**
178
- * @param {ERef<import('@agoric/vats').NameHubKit['nameAdmin']>} agoricNamesAdmin
179
- * @param {string} name
180
- * @param {CosmosChainInfo} chainInfo
181
- * @param {(...messages: string[]) => void} log
182
- */
183
- export const registerChain = async (
184
- agoricNamesAdmin,
185
- name,
186
- chainInfo,
187
- log = () => {},
188
- ) => {
189
- const { nameAdmin } = await E(agoricNamesAdmin).provideChild('chain');
190
- const { nameAdmin: connAdmin } =
191
- await E(agoricNamesAdmin).provideChild('chainConnection');
192
-
193
- mustMatch(chainInfo, CosmosChainInfoShape);
194
- const { connections = {}, ...vertex } = chainInfo;
195
-
196
- const promises = [
197
- E(nameAdmin)
198
- .update(name, vertex)
199
- .then(() => log(`registered agoricNames chain.${name}`)),
200
- ];
201
-
202
- // FIXME updates redundantly, twice per edge
203
- for await (const [counterChainId, connInfo] of Object.entries(connections)) {
204
- const key = connectionKey(chainInfo.chainId, counterChainId);
205
- promises.push(
206
- E(connAdmin)
207
- .update(key, connInfo)
208
- .then(() => log(`registering agoricNames chainConnection.${key}`)),
209
- );
210
- }
211
- // Bundle to pipeline IO
212
- await Promise.all(promises);
213
- };
214
-
215
- /**
216
- * @template {string} C1
217
- * @template {string} C2
218
- * @param {ChainHub} chainHub
219
- * @param {C1} chainName1
220
- * @param {C2} chainName2
221
- * @returns {Promise<
222
- * [ActualChainInfo<C1>, ActualChainInfo<C2>, IBCConnectionInfo]
223
- * >}
224
- */
225
- export const getChainsAndConnection = async (
226
- chainHub,
227
- chainName1,
228
- chainName2,
229
- ) => {
230
- const [chain1, chain2] = await Promise.all([
231
- chainHub.getChainInfo(chainName1),
232
- chainHub.getChainInfo(chainName2),
233
- ]);
234
- const connectionInfo = await chainHub.getConnectionInfo(chain2, chain1);
235
-
236
- return [chain1, chain2, connectionInfo];
237
- };
@@ -31,7 +31,7 @@ export function prepareLocalOrchestrationAccountKit(zone: Zone, makeRecorderKit:
31
31
  */
32
32
  onFulfilled(agoricChainInfo: ChainInfo, { destination }: {
33
33
  destination: ChainAddress;
34
- }): Promise<IBCConnectionInfo>;
34
+ }): import("@agoric/vow").Vow<IBCConnectionInfo>;
35
35
  };
36
36
  getTimeoutTimestampWatcher: {
37
37
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"local-orchestration-account.d.ts","sourceRoot":"","sources":["local-orchestration-account.js"],"names":[],"mappings":"AAoEO,0DAPI,IAAI,mBACJ,eAAe,OACf,GAAG,gBACH,OAAO,YAAY,CAAC,4BACpB,QAAQ,YACR,QAAQ;aA6DJ,iBAAiB;aACjB,YAAY;iBACZ,OAAO,WAAW,CAAC;;;QAY1B;;;WAGG;mCAFQ,MAAM,cACN,MAAM,CAAC,KAAK,CAAC;QAYxB;;;WAGG;qCAFQ,MAAM,cACN,MAAM,CAAC,KAAK,CAAC;;;;QAgBxB;;;;WAIG;8BAHQ,CACV,UAAc,+CAA+C,CAAC,CAC3D;;;QAWJ;;;WAGG;iEADQ;YAAE,WAAW,EAAE,YAAY,CAAA;SAAE;;;QAUxC;;;WAGG;sCAFQ,MAAM,YACN;YAAE,IAAI,EAAE,qBAAqB,CAAA;SAAE;;;QAW1C;;;;;;;;;;WAUG;6DATQ,CACV;YAAM,eAAe,EAAE,iBAAiB,CAAC,iBAAiB,CAAC,C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yDAAyD;;;GAShE;;aAtYa,MAAM;;oBAIP;IACZ,QAAY,EAAE,YAAY,6BAA6B,CAAC,CAAC;IACzD,OAAW,EAAE,iBAAiB,CAAC;IAC/B,OAAW,EAAE,YAAY,CAAC;CACvB;+CA+XU,UAAU,CAAC,OAAO,mCAAmC,CAAC;2CACtD,UAAU,CAAC,gCAAgC,CAAC;0BArZnC,cAAc;qCADU,6CAA6C;kCAGhC,cAAc;4BADjD,kBAAkB;8BAEJ,aAAa;8BAEzB,gBAAgB;uCARP,gCAAgC;kCAC8D,uBAAuB;qCAI7F,cAAc;+BAE9C,sBAAsB;+BANgF,uBAAuB;uCAAvB,uBAAuB;2CAAvB,uBAAuB;iCAAvB,uBAAuB;gCAKlH,aAAa;+BAL8E,uBAAuB;iCAC1G,6CAA6C"}
@@ -3,6 +3,7 @@ import { typedJson } from '@agoric/cosmic-proto/vatsafe';
3
3
  import { AmountShape, PaymentShape } from '@agoric/ertp';
4
4
  import { makeTracer } from '@agoric/internal';
5
5
  import { M } from '@agoric/vat-data';
6
+ import { VowShape } from '@agoric/vow';
6
7
  import { V } from '@agoric/vow/vat.js';
7
8
  import { TopicsRecordShape } from '@agoric/zoe/src/contractSupport/index.js';
8
9
  import { InvitationShape } from '@agoric/zoe/src/typeGuards.js';
@@ -89,7 +90,7 @@ export const prepareLocalOrchestrationAccountKit = (
89
90
  getChainInfoWatcher: M.interface('getChainInfoWatcher', {
90
91
  onFulfilled: M.call(M.record()) // agoric chain info
91
92
  .optional({ destination: ChainAddressShape }) // empty context
92
- .returns(M.promise()), // transfer channel
93
+ .returns(VowShape), // transfer channel
93
94
  }),
94
95
  getTimeoutTimestampWatcher: M.interface('getTimeoutTimestampWatcher', {
95
96
  onFulfilled: M.call(M.bigint())
@@ -1 +1 @@
1
- {"version":3,"file":"orchestrator.d.ts","sourceRoot":"","sources":["orchestrator.js"],"names":[],"mappings":"AAkCA,0BAA0B;AAC1B;;;;;GAKG;AAkBI,6CAfI,IAAI,qGACJ;I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C,QAAY,EAAE,QAAQ,CAAC;IACvB,GAAO,EAAE,GAAG,CAAC;CACV;IAmCE,2DAA2D;;QAEzD,yCAAyC;;;;;;;;;;;;;IAK3C;;;OAGG;;QAED;;;;;WAKG;;;;;;;;;;;;;;QAMH,uCAAuC;;;;;;;;;;;;;GA0B5C;0BA7HoB,mBAAmB;oCAET,oBAAoB;8BAD1B,gBAAgB;gCAId,gCAAgC;4BAEpC,kBAAkB;qCADI,6CAA6C;0CAKrD,yBAAyB;2CACxB,0BAA0B;0CAH3B,eAAe;kCALvB,cAAc;8BADb,aAAa;+BAU8D,aAAa;uCAAb,aAAa;0CAAb,aAAa;2BAAb,aAAa"}
@@ -4,13 +4,12 @@ import { makeTracer } from '@agoric/internal';
4
4
  import { E } from '@endo/far';
5
5
  import { M } from '@endo/patterns';
6
6
  import {
7
- ChainInfoShape,
8
- LocalChainAccountShape,
9
- DenomShape,
10
7
  BrandInfoShape,
8
+ ChainInfoShape,
11
9
  DenomAmountShape,
10
+ DenomShape,
11
+ LocalChainAccountShape,
12
12
  } from '../typeGuards.js';
13
- import { getChainsAndConnection } from './chain-hub.js';
14
13
 
15
14
  /**
16
15
  * @import {Zone} from '@agoric/base-zone';
@@ -78,7 +77,7 @@ export const prepareOrchestratorKit = (
78
77
  makeRemoteChainFacadeWatcher: M.interface(
79
78
  'makeRemoteChainFacadeWatcher',
80
79
  {
81
- onFulfilled: M.call(M.arrayOf(M.record()))
80
+ onFulfilled: M.call(M.any())
82
81
  .optional(M.arrayOf(M.undefined()))
83
82
  .returns(M.any()), // FIXME narrow
84
83
  },
@@ -115,6 +114,7 @@ export const prepareOrchestratorKit = (
115
114
  /** @type {Orchestrator['getChain']} */
116
115
  getChain(name) {
117
116
  if (name === 'agoric') {
117
+ // XXX when() until membrane
118
118
  return when(
119
119
  watch(
120
120
  chainHub.getChainInfo('agoric'),
@@ -122,9 +122,10 @@ export const prepareOrchestratorKit = (
122
122
  ),
123
123
  );
124
124
  }
125
+ // XXX when() until membrane
125
126
  return when(
126
127
  watch(
127
- getChainsAndConnection(chainHub, 'agoric', name),
128
+ chainHub.getChainsAndConnection('agoric', name),
128
129
  this.facets.makeRemoteChainFacadeWatcher,
129
130
  ),
130
131
  );
package/src/facade.d.ts CHANGED
@@ -15,15 +15,20 @@ export function makeOrchestrationFacade({ zone, timerService, zcf, storageNode,
15
15
  asyncFlowTools: AsyncFlowTools;
16
16
  }): {
17
17
  /**
18
+ * @template Return
18
19
  * @template Context
19
20
  * @template {any[]} Args
20
21
  * @param {string} durableName - the orchestration flow identity in the zone
21
22
  * (to resume across upgrades)
22
23
  * @param {Context} ctx - values to pass through the async flow membrane
23
- * @param {(orc: Orchestrator, ctx2: Context, ...args: Args) => object} fn
24
- * @returns {(...args: Args) => Promise<unknown>}
24
+ * @param {(
25
+ * orc: Orchestrator,
26
+ * ctx2: Context,
27
+ * ...args: Args
28
+ * ) => Promise<Return>} fn
29
+ * @returns {(...args: Args) => Promise<Return>}
25
30
  */
26
- orchestrate<Context, Args extends any[]>(durableName: string, ctx: Context, fn: (orc: Orchestrator, ctx2: Context, ...args: Args) => object): (...args: Args) => Promise<unknown>;
31
+ orchestrate<Return, Context, Args extends any[]>(durableName: string, ctx: Context, fn: (orc: Orchestrator, ctx2: Context, ...args: Args) => Promise<Return>): (...args: Args) => Promise<Return>;
27
32
  };
28
33
  export type OrchestrationFacade = ReturnType<typeof makeOrchestrationFacade>;
29
34
  import type { Zone } from '@agoric/zone';
@@ -1 +1 @@
1
- {"version":3,"file":"facade.d.ts","sourceRoot":"","sources":["facade.js"],"names":[],"mappings":"AAwCO,yPAjBI;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,oBAAoB,CAAC,CAAC;IACvD,UAAc,EAAE,OAAO,UAAU,CAAC,CAAC;IACn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xC,oBAAwB,EAAE,oBAAoB,CAAC;IAC/C,qBAAyB,EAAE,qBAAqB,CAAC;IACjD,QAAY,EAAE,QAAQ,CAAC;IACvB,cAAkB,EAAE,cAAc,CAAC;CAChC;IA+CA;;;;;;;;;;;;;OAaG;gBAZU,MAAM,EACN,OAAO,EACC,IAAI,SAAX,GAAG,EAAG,eACT,MAAM,OAEN,OAAO,MACP,CACV,GAAO,EAAE,YAAY,EACrB,IAAQ,EAAE,OAAO,EACjB,GAAO,IAAI,EAAE,IAAI,KACV,OAAO,CAAC,MAAM,CAAC,GACV,CAAC,GAAG,IAAI,EAAE,IAAI,KAAK,OAAO,CAAC,MAAM,CAAC;EAQlD;kCAEa,UAAU,CAAC,OAAO,uBAAuB,CAAC;0BAnGjC,cAAc;kCAEN,cAAc;4BAIpB,kBAAkB;0CACJ,cAAc;gCAHxB,gCAAgC;sDAOV,uCAAuC;qCAN3C,6CAA6C;0CAIrD,8BAA8B;2CAC7B,+BAA+B;8BATvC,aAAa;oCAFZ,oBAAoB;kCASsD,YAAY"}
package/src/facade.js CHANGED
@@ -84,18 +84,23 @@ export const makeOrchestrationFacade = ({
84
84
 
85
85
  return {
86
86
  /**
87
+ * @template Return
87
88
  * @template Context
88
89
  * @template {any[]} Args
89
90
  * @param {string} durableName - the orchestration flow identity in the zone
90
91
  * (to resume across upgrades)
91
92
  * @param {Context} ctx - values to pass through the async flow membrane
92
- * @param {(orc: Orchestrator, ctx2: Context, ...args: Args) => object} fn
93
- * @returns {(...args: Args) => Promise<unknown>}
93
+ * @param {(
94
+ * orc: Orchestrator,
95
+ * ctx2: Context,
96
+ * ...args: Args
97
+ * ) => Promise<Return>} fn
98
+ * @returns {(...args: Args) => Promise<Return>}
94
99
  */
95
100
  orchestrate(durableName, ctx, fn) {
96
101
  const orc = makeOrchestrator();
97
102
 
98
- return async (...args) => fn(orc, ctx, ...args);
103
+ return async (...args) => vowTools.when(fn(orc, ctx, ...args));
99
104
  },
100
105
  };
101
106
  };
@@ -1 +1 @@
1
- {"version":3,"file":"start-stakeAtom.d.ts","sourceRoot":"","sources":["start-stakeAtom.js"],"names":[],"mappings":"AAuBO,yOAVI,eAAe,GAAG;IAC5B,YAAgB,EAAE;QAClB,OAAa,EAAE;YACf,QAAgB,EAAE,YAAY,CAC9B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAA0D,CACjD,CAAC;SACH,CAAC;KACH,CAAC;CACH,iBAsDH;AAGM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA4BN;mCAnG4C,+BAA+B"}
1
+ {"version":3,"file":"start-stakeAtom.d.ts","sourceRoot":"","sources":["start-stakeAtom.js"],"names":[],"mappings":"AAwBO,yOAVI,eAAe,GAAG;IAC5B,YAAgB,EAAE;QAClB,OAAa,EAAE;YACf,QAAgB,EAAE,YAAY,CAC9B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAA0D,CACjD,CAAC;SACH,CAAC;KACH,CAAC;CACH,iBAoDH;AAGM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA4BN;mCAjG4C,+BAA+B"}
@@ -1,7 +1,8 @@
1
1
  import { makeTracer } from '@agoric/internal';
2
2
  import { makeStorageNodeChild } from '@agoric/internal/src/lib-chainStorage.js';
3
3
  import { E } from '@endo/far';
4
- import { getChainsAndConnection, makeChainHub } from '../exos/chain-hub.js';
4
+ import { V } from '@agoric/vow/vat.js';
5
+ import { makeChainHub } from '../exos/chain-hub.js';
5
6
 
6
7
  /**
7
8
  * @import {IBCConnectionID} from '@agoric/vats';
@@ -46,10 +47,8 @@ export const startStakeAtom = async ({
46
47
 
47
48
  const chainHub = makeChainHub(await agoricNames);
48
49
 
49
- const [_, cosmoshub, connectionInfo] = await getChainsAndConnection(
50
- chainHub,
51
- 'agoric',
52
- 'cosmoshub',
50
+ const [_, cosmoshub, connectionInfo] = await V.when(
51
+ chainHub.getChainsAndConnection('agoric', 'cosmoshub'),
53
52
  );
54
53
 
55
54
  /** @type {StartUpgradableOpts<StakeIcaSF>} */
@@ -1 +1 @@
1
- {"version":3,"file":"start-stakeOsmo.d.ts","sourceRoot":"","sources":["start-stakeOsmo.js"],"names":[],"mappings":"AAuBO,yOAVI,eAAe,GAAG;IAC5B,YAAgB,EAAE;QAClB,OAAa,EAAE;YACf,QAAgB,EAAE,YAAY,CAC9B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAA0D,CACjD,CAAC;SACH,CAAC;KACH,CAAC;CACH,iBAuDH;AAGM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA4BN"}
1
+ {"version":3,"file":"start-stakeOsmo.d.ts","sourceRoot":"","sources":["start-stakeOsmo.js"],"names":[],"mappings":"AAwBO,yOAVI,eAAe,GAAG;IAC5B,YAAgB,EAAE;QAClB,OAAa,EAAE;YACf,QAAgB,EAAE,YAAY,CAC9B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAA0D,CACjD,CAAC;SACH,CAAC;KACH,CAAC;CACH,iBAqDH;AAGM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA4BN"}
@@ -1,7 +1,8 @@
1
1
  import { makeTracer } from '@agoric/internal';
2
2
  import { makeStorageNodeChild } from '@agoric/internal/src/lib-chainStorage.js';
3
+ import { V } from '@agoric/vow/vat.js';
3
4
  import { E } from '@endo/far';
4
- import { getChainsAndConnection, makeChainHub } from '../exos/chain-hub.js';
5
+ import { makeChainHub } from '../exos/chain-hub.js';
5
6
 
6
7
  /**
7
8
  * @import {IBCConnectionID} from '@agoric/vats';
@@ -47,10 +48,8 @@ export const startStakeOsmo = async ({
47
48
 
48
49
  const chainHub = makeChainHub(await agoricNames);
49
50
 
50
- const [_, osmosis, connectionInfo] = await getChainsAndConnection(
51
- chainHub,
52
- 'agoric',
53
- 'osmosis',
51
+ const [_, osmosis, connectionInfo] = await V.when(
52
+ chainHub.getChainsAndConnection('agoric', 'osmosis'),
54
53
  );
55
54
 
56
55
  /** @type {StartUpgradableOpts<StakeIcaSF>} */
@@ -1,16 +1,17 @@
1
1
  export function provideOrchestration(zcf: ZCF, baggage: Baggage, remotePowers: OrchestrationPowers, marshaller: Marshaller): {
2
2
  chainHub: import("@endo/exo").Guarded<{
3
3
  registerChain(name: string, chainInfo: import("../cosmos-api.js").CosmosChainInfo): void;
4
- getChainInfo<K extends string>(chainName: K): Promise<ActualChainInfo<K>>;
4
+ getChainInfo<K extends string>(chainName: K): import("@agoric/vow").Vow<ActualChainInfo<K>>;
5
5
  registerConnection(chainId1: string, chainId2: string, connectionInfo: import("../cosmos-api.js").IBCConnectionInfo): void;
6
6
  getConnectionInfo(chain1: string | {
7
7
  chainId: string;
8
8
  }, chain2: string | {
9
9
  chainId: string;
10
- }): Promise<import("../cosmos-api.js").IBCConnectionInfo>;
10
+ }): import("@agoric/vow").Vow<import("../cosmos-api.js").IBCConnectionInfo>;
11
+ getChainsAndConnection<C1 extends string, C2 extends string>(chainName1: C1, chainName2: C2): import("@agoric/vow").Vow<[ActualChainInfo<C1>, ActualChainInfo<C2>, import("../cosmos-api.js").IBCConnectionInfo]>;
11
12
  }>;
12
13
  zone: import("@agoric/base-zone").Zone;
13
- orchestrate<Context, Args extends any[]>(durableName: string, ctx: Context, fn: (orc: import("../orchestration-api.js").Orchestrator, ctx2: Context, ...args: Args) => object): (...args: Args) => Promise<unknown>;
14
+ orchestrate<Return, Context, Args extends any[]>(durableName: string, ctx: Context, fn: (orc: import("../orchestration-api.js").Orchestrator, ctx2: Context, ...args: Args) => Promise<Return>): (...args: Args) => Promise<Return>;
14
15
  };
15
16
  export type OrchestrationPowers = {
16
17
  localchain: Remote<LocalChain>;
@@ -1 +1 @@
1
- {"version":3,"file":"start-helper.d.ts","sourceRoot":"","sources":["start-helper.js"],"names":[],"mappings":"AAwCO,0CALI,GAAG,WACH,OAAO,gBACP,mBAAmB,cACnB,UAAU;;;;;;;;;;;;yJAyDH,GACjB,yBACQ,GAAG;EAOX;kCAlFY;IACZ,UAAc,EAAE,OAAO,UAAU,CAAC,CAAC;IACnC,oBAAwB,EAAE,OAAO,oBAAoB,CAAC,CAAC;IACvD,WAAe,EAAE,OAAO,WAAW,CAAC,CAAC;IACrC,YAAgB,EAAE,OAAO,YAAY,CAAC,CAAC;IACvC,WAAe,EAAE,OAAO,OAAO,CAAC,CAAC;CAC9B;6BAbsB,kBAAkB;gCAFf,gCAAgC;4BAIpC,aAAa;0CACC,eAAe;kCAJX,cAAc;6BAE/B,cAAc"}
1
+ {"version":3,"file":"start-helper.d.ts","sourceRoot":"","sources":["start-helper.js"],"names":[],"mappings":"AAwCO,0CALI,GAAG,WACH,OAAO,gBACP,mBAAmB,cACnB,UAAU;;;;;;;;;;;;;iKA2DjB,GAAa,kCAGZ,GAAG;EAIP;kCAlFY;IACZ,UAAc,EAAE,OAAO,UAAU,CAAC,CAAC;IACnC,oBAAwB,EAAE,OAAO,oBAAoB,CAAC,CAAC;IACvD,WAAe,EAAE,OAAO,WAAW,CAAC,CAAC;IACrC,YAAgB,EAAE,OAAO,YAAY,CAAC,CAAC;IACvC,WAAe,EAAE,OAAO,OAAO,CAAC,CAAC;CAC9B;6BAbsB,kBAAkB;gCAFf,gCAAgC;4BAIpC,aAAa;0CACC,eAAe;kCAJX,cAAc;6BAE/B,cAAc"}