@agoric/orchestration 0.1.1-dev-fd6c64a.0 → 0.1.1-dev-69f57d5.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.
Files changed (61) hide show
  1. package/package.json +16 -16
  2. package/src/cctp-chain-info.d.ts +65 -0
  3. package/src/cctp-chain-info.d.ts.map +1 -0
  4. package/src/cctp-chain-info.js +52 -0
  5. package/src/chain-capabilities.d.ts +4 -1
  6. package/src/chain-capabilities.d.ts.map +1 -1
  7. package/src/chain-capabilities.js +1 -1
  8. package/src/chain-info.d.ts +562 -55
  9. package/src/chain-info.d.ts.map +1 -1
  10. package/src/chain-info.js +21 -5
  11. package/src/cosmos-api.d.ts +17 -6
  12. package/src/cosmos-api.d.ts.map +1 -1
  13. package/src/cosmos-api.ts +16 -8
  14. package/src/ethereum-api.d.ts +6 -5
  15. package/src/ethereum-api.d.ts.map +1 -1
  16. package/src/ethereum-api.ts +7 -5
  17. package/src/examples/auto-stake-it-tap-kit.d.ts +1 -1
  18. package/src/examples/auto-stake-it-tap-kit.d.ts.map +1 -1
  19. package/src/examples/auto-stake-it-tap-kit.js +1 -1
  20. package/src/examples/auto-stake-it.contract.d.ts +3 -22
  21. package/src/examples/auto-stake-it.contract.d.ts.map +1 -1
  22. package/src/examples/basic-flows.contract.d.ts +2 -11
  23. package/src/examples/basic-flows.contract.d.ts.map +1 -1
  24. package/src/examples/send-anywhere.contract.d.ts +3 -23
  25. package/src/examples/send-anywhere.contract.d.ts.map +1 -1
  26. package/src/examples/staking-combinations.contract.d.ts +1 -11
  27. package/src/examples/staking-combinations.contract.d.ts.map +1 -1
  28. package/src/examples/swap.contract.d.ts +2 -11
  29. package/src/examples/swap.contract.d.ts.map +1 -1
  30. package/src/examples/swap.contract.js +2 -2
  31. package/src/exos/chain-hub-admin.d.ts +7 -7
  32. package/src/exos/chain-hub-admin.d.ts.map +1 -1
  33. package/src/exos/chain-hub-admin.js +13 -11
  34. package/src/exos/chain-hub.d.ts +13 -10
  35. package/src/exos/chain-hub.d.ts.map +1 -1
  36. package/src/exos/chain-hub.js +65 -32
  37. package/src/exos/local-chain-facade.d.ts +3 -23
  38. package/src/exos/local-chain-facade.d.ts.map +1 -1
  39. package/src/exos/orchestrator.d.ts +2 -12
  40. package/src/exos/orchestrator.d.ts.map +1 -1
  41. package/src/exos/orchestrator.js +2 -7
  42. package/src/exos/remote-chain-facade.d.ts +4 -14
  43. package/src/exos/remote-chain-facade.d.ts.map +1 -1
  44. package/src/exos/remote-chain-facade.js +21 -8
  45. package/src/fetched-chain-info.d.ts +676 -86
  46. package/src/fetched-chain-info.js +553 -41
  47. package/src/orchestration-api.d.ts +30 -5
  48. package/src/orchestration-api.d.ts.map +1 -1
  49. package/src/orchestration-api.ts +33 -7
  50. package/src/typeGuards.d.ts +4 -1
  51. package/src/typeGuards.d.ts.map +1 -1
  52. package/src/typeGuards.js +25 -6
  53. package/src/types.d.ts +0 -1
  54. package/src/types.d.ts.map +1 -1
  55. package/src/types.ts +0 -1
  56. package/src/utils/registry.d.ts +2 -12
  57. package/src/utils/registry.d.ts.map +1 -1
  58. package/src/utils/registry.js +4 -2
  59. package/src/utils/start-helper.d.ts +12 -3
  60. package/src/utils/start-helper.d.ts.map +1 -1
  61. package/src/utils/start-helper.js +13 -2
@@ -3,9 +3,10 @@
3
3
  * @import {Vow, VowTools} from '@agoric/vow';
4
4
  * @import {Zone} from '@agoric/zone';
5
5
  * @import {CosmosAssetInfo, CosmosChainInfo, ForwardInfo, IBCConnectionInfo, IBCMsgTransferOptions, TransferRoute, GoDuration, Bech32Address} from '../cosmos-api.js';
6
- * @import {ChainInfo, KnownChains} from '../chain-info.js';
7
- * @import {AccountId, CosmosChainAddress, ScopedChainId, Denom, DenomAmount, AccountIdArg} from '../orchestration-api.js';
6
+ * @import {KnownChains} from '../chain-info.js';
7
+ * @import {AccountId, CosmosChainAddress, ChainInfo, ScopedChainId, Denom, DenomAmount, AccountIdArg} from '../orchestration-api.js';
8
8
  * @import {Remote, TypedPattern} from '@agoric/internal';
9
+ * @import {Pattern} from '@endo/patterns';
9
10
  */
10
11
  /** receiver address value for ibc transfers that involve PFM */
11
12
  export const PFM_RECEIVER: "pfm";
@@ -26,7 +27,9 @@ export function connectionKey(chainId1: string, chainId2: string): string;
26
27
  export function normalizeConnectionInfo(primaryChainId: string, counterChainId: string, directed: IBCConnectionInfo): [string, IBCConnectionInfo];
27
28
  /** @type {TypedPattern<TransferRoute>} */
28
29
  export const TransferRouteShape: TypedPattern<TransferRoute>;
29
- export function makeChainHub(zone: Zone, agoricNames: Remote<NameHub>, vowTools: VowTools): import("@endo/exo").Guarded<{
30
+ export function makeChainHub(zone: Zone, agoricNames: Remote<NameHub>, vowTools: VowTools, { chainInfoValueShape }?: {
31
+ chainInfoValueShape?: Pattern;
32
+ }): import("@endo/exo").Guarded<{
30
33
  /**
31
34
  * Register a new chain. The name will override a name in well known chain
32
35
  * names.
@@ -37,17 +40,17 @@ export function makeChainHub(zone: Zone, agoricNames: Remote<NameHub>, vowTools:
37
40
  * contract `start` the call will happen again naturally.
38
41
  *
39
42
  * @param {string} name
40
- * @param {CosmosChainInfo} chainInfo
43
+ * @param {ChainInfo} chainInfo
41
44
  */
42
- registerChain(name: string, chainInfo: CosmosChainInfo): void;
45
+ registerChain(name: string, chainInfo: ChainInfo): void;
43
46
  /**
44
47
  * Update chain info by completely replacing existing entry
45
48
  *
46
49
  * @param {string} chainName - Name of the chain to update
47
- * @param {CosmosChainInfo} chainInfo - New chain info
50
+ * @param {ChainInfo} chainInfo - New chain info
48
51
  * @throws {Error} If chain not registered
49
52
  */
50
- updateChain(chainName: string, chainInfo: CosmosChainInfo): void;
53
+ updateChain(chainName: string, chainInfo: ChainInfo): void;
51
54
  /**
52
55
  * @template {string} K
53
56
  * @param {K} chainName
@@ -135,7 +138,7 @@ export function makeChainHub(zone: Zone, agoricNames: Remote<NameHub>, vowTools:
135
138
  */
136
139
  makeChainAddress(partialId: string): CosmosChainAddress;
137
140
  /**
138
- * Determine the transfer route for a destination and amount given the
141
+ * Determine the IBC transfer route for a destination and amount given the
139
142
  * current holding chain.
140
143
  *
141
144
  * Does not account for routes with more than 1 intermediary hop - that is,
@@ -183,7 +186,8 @@ import type { Zone } from '@agoric/zone';
183
186
  import type { NameHub } from '@agoric/vats';
184
187
  import type { Remote } from '@agoric/internal';
185
188
  import type { VowTools } from '@agoric/vow';
186
- import type { CosmosChainInfo } from '../cosmos-api.js';
189
+ import type { Pattern } from '@endo/patterns';
190
+ import type { ChainInfo } from '../orchestration-api.js';
187
191
  import type { Vow } from '@agoric/vow';
188
192
  import type { Denom } from '../orchestration-api.js';
189
193
  import type { AccountId } from '../orchestration-api.js';
@@ -193,5 +197,4 @@ import type { DenomAmount } from '../orchestration-api.js';
193
197
  import type { IBCMsgTransferOptions } from '../cosmos-api.js';
194
198
  import type { CosmosAssetInfo } from '../cosmos-api.js';
195
199
  import type { KnownChains } from '../chain-info.js';
196
- import type { ChainInfo } from '../chain-info.js';
197
200
  //# sourceMappingURL=chain-hub.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"chain-hub.d.ts","sourceRoot":"","sources":["chain-hub.js"],"names":[],"mappings":"AAoBA;;;;;;;;GAQG;AAEH,gEAAgE;AAChE,2BAAkD,KAAK,CAAE;sBAsB/C,CAAC,OAAO,OAAO,EAAE,MAAM,OAAO,OAAO,CAAC;;;;;;AAYhD,oCAAoC;AACpC,gCAAuC;AACvC,8CAA8C;AAC9C,gDAAuD;AACvD,0CAA0C;AAC1C,uCAA8C;AAgBvC,uCAHI,MAAM,UAOd;AAUI,wCAHI,MAAM,YACN,MAAM,UAOhB;AAoCM,wDALI,MAAM,kBACN,MAAM,YACN,iBAAiB,GACf,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAavC;AAwCD,0CAA0C;AAC1C,iCADW,aAAa,aAAa,CAAC,CAUpC;AA2CK,mCAJI,IAAI,eACJ,OAAO,OAAO,CAAC,YACf,QAAQ;IA0If;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G/H,kBAAkB;0BAJlC,cAAc;6BAFX,cAAc;4BAMD,kBAAkB;8BALzB,aAAa;6BAMnB,gBAAgB;+BAFkE,yBAAyB;yBAJrG,aAAa;2BAI+D,yBAAyB;+BAAzB,yBAAyB;wCAAzB,yBAAyB;kCAAzB,yBAAyB;iCAAzB,yBAAyB;2CAFe,kBAAkB;qCAAlB,kBAAkB;iCACxI,kBAAkB"}
@@ -7,7 +7,6 @@ import { VowShape } from '@agoric/vow';
7
7
  import {
8
8
  CosmosChainAddressShape,
9
9
  CoinShape,
10
- CosmosChainInfoShape,
11
10
  DenomAmountShape,
12
11
  DenomDetailShape,
13
12
  ForwardInfoShape,
@@ -15,6 +14,7 @@ import {
15
14
  IBCChannelIDShape,
16
15
  IBCConnectionInfoShape,
17
16
  AccountArgShape,
17
+ ChainInfoShape,
18
18
  } from '../typeGuards.js';
19
19
  import { getBech32Prefix, parseAccountId } from '../utils/address.js';
20
20
 
@@ -23,9 +23,10 @@ import { getBech32Prefix, parseAccountId } from '../utils/address.js';
23
23
  * @import {Vow, VowTools} from '@agoric/vow';
24
24
  * @import {Zone} from '@agoric/zone';
25
25
  * @import {CosmosAssetInfo, CosmosChainInfo, ForwardInfo, IBCConnectionInfo, IBCMsgTransferOptions, TransferRoute, GoDuration, Bech32Address} from '../cosmos-api.js';
26
- * @import {ChainInfo, KnownChains} from '../chain-info.js';
27
- * @import {AccountId, CosmosChainAddress, ScopedChainId, Denom, DenomAmount, AccountIdArg} from '../orchestration-api.js';
26
+ * @import {KnownChains} from '../chain-info.js';
27
+ * @import {AccountId, CosmosChainAddress, ChainInfo, ScopedChainId, Denom, DenomAmount, AccountIdArg} from '../orchestration-api.js';
28
28
  * @import {Remote, TypedPattern} from '@agoric/internal';
29
+ * @import {Pattern} from '@endo/patterns';
29
30
  */
30
31
 
31
32
  /** receiver address value for ibc transfers that involve PFM */
@@ -203,8 +204,8 @@ export const TransferRouteShape = M.splitRecord(
203
204
  );
204
205
 
205
206
  const ChainHubI = M.interface('ChainHub', {
206
- registerChain: M.call(M.string(), CosmosChainInfoShape).returns(),
207
- updateChain: M.call(M.string(), CosmosChainInfoShape).returns(),
207
+ registerChain: M.call(M.string(), ChainInfoShape).returns(),
208
+ updateChain: M.call(M.string(), ChainInfoShape).returns(),
208
209
  getChainInfo: M.call(M.string()).returns(VowShape),
209
210
  registerConnection: M.call(
210
211
  M.string(),
@@ -234,20 +235,29 @@ const ChainHubI = M.interface('ChainHub', {
234
235
  /**
235
236
  * Make a new ChainHub in the zone.
236
237
  *
237
- * The resulting object is an Exo singleton. It has no precious state. It's only
238
+ * The resulting object is an Exo singleton. It has no precious state. Its only
238
239
  * state is a cache of queries to agoricNames and whatever info was provided in
239
240
  * registration calls. When you need a newer version you can simply make a hub
240
- * hub and repeat the registrations.
241
+ * and repeat the registrations.
241
242
  *
242
243
  * @param {Zone} zone
243
244
  * @param {Remote<NameHub>} agoricNames
244
245
  * @param {VowTools} vowTools
246
+ * @param {object} [opts]
247
+ * @param {Pattern} [opts.chainInfoValueShape] legacy support for contracts
248
+ * deployed with `valueShape: CosmosChainInfoShape`. If nothing is supplied,
249
+ * defaults to {@link ChainInfoShape}
245
250
  */
246
- export const makeChainHub = (zone, agoricNames, vowTools) => {
247
- /** @type {MapStore<string, CosmosChainInfo>} */
251
+ export const makeChainHub = (
252
+ zone,
253
+ agoricNames,
254
+ vowTools,
255
+ { chainInfoValueShape = /** @type {Pattern} */ (ChainInfoShape) } = {},
256
+ ) => {
257
+ /** @type {MapStore<string, ChainInfo>} */
248
258
  const chainInfos = zone.mapStore('chainInfos', {
249
259
  keyShape: M.string(),
250
- valueShape: CosmosChainInfoShape,
260
+ valueShape: chainInfoValueShape,
251
261
  });
252
262
  /** @type {MapStore<string, IBCConnectionInfo>} */
253
263
  const connectionInfos = zone.mapStore('connectionInfos', {
@@ -288,7 +298,9 @@ export const makeChainHub = (zone, agoricNames, vowTools) => {
288
298
  throw makeError(`Chain info not found for bech32Prefix ${q(prefix)}`);
289
299
  }
290
300
  const chainName = bech32PrefixToChainName.get(prefix);
291
- const { chainId } = chainInfos.get(chainName);
301
+ const { chainId } = /** @type {CosmosChainInfo} */ (
302
+ chainInfos.get(chainName)
303
+ );
292
304
  return chainId;
293
305
  };
294
306
 
@@ -356,7 +368,11 @@ export const makeChainHub = (zone, agoricNames, vowTools) => {
356
368
  * @param {C1} primaryName
357
369
  * @param {C2} counterName
358
370
  * @returns {Promise<
359
- * [ActualChainInfo<C1>, ActualChainInfo<C2>, IBCConnectionInfo]
371
+ * [
372
+ * ActualChainInfo<C1>,
373
+ * ActualChainInfo<C2>,
374
+ * IBCConnectionInfo | undefined,
375
+ * ]
360
376
  * >}
361
377
  */
362
378
  // eslint-disable-next-line no-restricted-syntax -- TODO more exact rules for vow best practices
@@ -367,14 +383,22 @@ export const makeChainHub = (zone, agoricNames, vowTools) => {
367
383
  chainHub.getChainInfo(counterName),
368
384
  ]),
369
385
  );
370
- const connectionInfo = await vowTools.asPromise(
371
- chainHub.getConnectionInfo(primary, counter),
386
+
387
+ const connectionInfo =
388
+ primary.namespace === 'cosmos' && counter.namespace === 'cosmos'
389
+ ? await vowTools.asPromise(
390
+ chainHub.getConnectionInfo(primary, counter),
391
+ )
392
+ : undefined;
393
+ return (
394
+ /**
395
+ * @type {[
396
+ * ActualChainInfo<C1>,
397
+ * ActualChainInfo<C2>,
398
+ * IBCConnectionInfo | undefined,
399
+ * ]}
400
+ */ ([primary, counter, connectionInfo])
372
401
  );
373
- return /** @type {[ActualChainInfo<C1>, ActualChainInfo<C2>, IBCConnectionInfo]} */ ([
374
- primary,
375
- counter,
376
- connectionInfo,
377
- ]);
378
402
  },
379
403
  );
380
404
 
@@ -389,19 +413,22 @@ export const makeChainHub = (zone, agoricNames, vowTools) => {
389
413
  * contract `start` the call will happen again naturally.
390
414
  *
391
415
  * @param {string} name
392
- * @param {CosmosChainInfo} chainInfo
416
+ * @param {ChainInfo} chainInfo
393
417
  */
394
418
  registerChain(name, chainInfo) {
395
419
  chainInfos.init(name, chainInfo);
396
- if (chainInfo.bech32Prefix) {
397
- bech32PrefixToChainName.init(chainInfo.bech32Prefix, name);
420
+ if (/** @type {CosmosChainInfo} */ (chainInfo).bech32Prefix) {
421
+ bech32PrefixToChainName.init(
422
+ /** @type {CosmosChainInfo} */ (chainInfo).bech32Prefix,
423
+ name,
424
+ );
398
425
  }
399
426
  },
400
427
  /**
401
428
  * Update chain info by completely replacing existing entry
402
429
  *
403
430
  * @param {string} chainName - Name of the chain to update
404
- * @param {CosmosChainInfo} chainInfo - New chain info
431
+ * @param {ChainInfo} chainInfo - New chain info
405
432
  * @throws {Error} If chain not registered
406
433
  */
407
434
  updateChain(chainName, chainInfo) {
@@ -409,12 +436,17 @@ export const makeChainHub = (zone, agoricNames, vowTools) => {
409
436
  throw makeError(`Chain ${q(chainName)} not registered`);
410
437
  }
411
438
  const oldInfo = chainInfos.get(chainName);
412
- if (oldInfo.bech32Prefix) {
413
- bech32PrefixToChainName.delete(oldInfo.bech32Prefix);
439
+ if (/** @type {CosmosChainInfo} */ (oldInfo).bech32Prefix) {
440
+ bech32PrefixToChainName.delete(
441
+ /** @type {CosmosChainInfo} */ (oldInfo).bech32Prefix,
442
+ );
414
443
  }
415
444
  chainInfos.set(chainName, chainInfo);
416
- if (chainInfo.bech32Prefix) {
417
- bech32PrefixToChainName.init(chainInfo.bech32Prefix, chainName);
445
+ if (/** @type {CosmosChainInfo} */ (chainInfo).bech32Prefix) {
446
+ bech32PrefixToChainName.init(
447
+ /** @type {CosmosChainInfo} */ (chainInfo).bech32Prefix,
448
+ chainName,
449
+ );
418
450
  }
419
451
  },
420
452
  /**
@@ -629,10 +661,8 @@ export const makeChainHub = (zone, agoricNames, vowTools) => {
629
661
  encoding: /** @type {const} */ ('bech32'),
630
662
  });
631
663
  },
632
- // TODO document whether this is limited to IBC
633
- // Not urgent because it's vat-local
634
664
  /**
635
- * Determine the transfer route for a destination and amount given the
665
+ * Determine the IBC transfer route for a destination and amount given the
636
666
  * current holding chain.
637
667
  *
638
668
  * Does not account for routes with more than 1 intermediary hop - that is,
@@ -665,9 +695,12 @@ export const makeChainHub = (zone, agoricNames, vowTools) => {
665
695
  chainInfos.has(baseName) ||
666
696
  Fail`chain info not found for issuing chain: ${q(baseName)}`;
667
697
 
668
- const { chainId: baseChainId, pfmEnabled } = chainInfos.get(baseName);
698
+ const { chainId: baseChainId, pfmEnabled } =
699
+ /** @type {CosmosChainInfo} */ (chainInfos.get(baseName));
669
700
 
670
- const holdingChainId = chainInfos.get(srcChainName).chainId;
701
+ const holdingChainId = /** @type {CosmosChainInfo} */ (
702
+ chainInfos.get(srcChainName)
703
+ ).chainId;
671
704
 
672
705
  destination =
673
706
  typeof destination === 'string'
@@ -1,25 +1,5 @@
1
- export function prepareLocalChainFacade(zone: Zone, powers: LocalChainFacadePowers): (localChainInfo: Readonly<{
2
- bech32Prefix?: string;
3
- chainId: string;
4
- connections?: Record<string, IBCConnectionInfo>;
5
- icqEnabled?: boolean;
6
- pfmEnabled?: boolean;
7
- stakingTokens?: Readonly<Array<{
8
- denom: string;
9
- }>>;
10
- icaEnabled?: boolean;
11
- }>) => import("@endo/exo").Guarded<{
12
- getChainInfo(): Vow<Readonly<{
13
- bech32Prefix?: string;
14
- chainId: string;
15
- connections?: Record<string, IBCConnectionInfo>;
16
- icqEnabled?: boolean;
17
- pfmEnabled?: boolean;
18
- stakingTokens?: Readonly<Array<{
19
- denom: string;
20
- }>>;
21
- icaEnabled?: boolean;
22
- }>>;
1
+ export function prepareLocalChainFacade(zone: Zone, powers: LocalChainFacadePowers): (localChainInfo: CosmosChainInfo) => import("@endo/exo").Guarded<{
2
+ getChainInfo(): Vow<CosmosChainInfo>;
23
3
  /** @returns {Vow<LocalOrchestrationAccountKit['holder']>} */
24
4
  makeAccount(): Vow<LocalOrchestrationAccountKit["holder"]>;
25
5
  query(args_0: {
@@ -56,7 +36,7 @@ export type LocalChainFacadePowers = {
56
36
  export type MakeLocalChainFacade = ReturnType<typeof prepareLocalChainFacade>;
57
37
  export type LocalChainFacade = ReturnType<MakeLocalChainFacade>;
58
38
  import type { Zone } from '@agoric/base-zone';
59
- import type { IBCConnectionInfo } from '../types.js';
39
+ import type { CosmosChainInfo } from '../types.js';
60
40
  import type { Vow } from '@agoric/vow';
61
41
  import type { LocalOrchestrationAccountKit } from './local-orchestration-account.js';
62
42
  import type { AssetInfo } from '@agoric/vats/src/vat-bank.js';
@@ -1 +1 @@
1
- {"version":3,"file":"local-chain-facade.d.ts","sourceRoot":"","sources":["local-chain-facade.js"],"names":[],"mappings":"AA8LO,8CAJI,IAAI,UACJ,sBAAsB;;;;;;;;;;;;;;;;;;;;;;IAtFzB,6DAA6D;mBAA/C,IAAI,4BAA4B,CAAC,QAAQ,CAAC,CAAC;;;;;;;;;;GA4FhE;;;;;;;;;;;uBArKa,MAAM,OAAO,CAAC,SAAS,EAAE,CAAC;;qCAO3B;IACR,gCAAgC,EAAE,gCAAgC,CAAC;IACnE,aAAa,EAAE,OAAO,uBAAuB,CAAC,CAAC;IAC/C,WAAW,EAAE,OAAO,WAAW,CAAC,GAAG,SAAS,CAAC;IAC7C,WAAW,EAAE,OAAO,OAAO,CAAC,CAAC;IAC7B,KAAK,EAAE,OAAO,YAAY,CAAC,CAAC;IAC5B,UAAU,EAAE,OAAO,UAAU,CAAC,CAAC;IAC/B,QAAQ,EAAE,QAAQ,CAAC;CACpB;mCAyJU,UAAU,CAAC,OAAO,uBAAuB,CAAC;+BAC1C,UAAU,CAAC,oBAAoB,CAAC;0BAzLvB,mBAAmB;uCASuE,aAAa;yBAH9F,aAAa;kDAEoC,kCAAkC;+BAJvF,8BAA8B;sDAIuB,kCAAkC;6CADzE,qBAAqB;4BALtC,kBAAkB;6BAGjB,cAAc;kCAJT,cAAc;gCAEgB,gCAAgC;8BAG7D,aAAa"}
1
+ {"version":3,"file":"local-chain-facade.d.ts","sourceRoot":"","sources":["local-chain-facade.js"],"names":[],"mappings":"AA8LO,8CAJI,IAAI,UACJ,sBAAsB;;IAtFzB,6DAA6D;mBAA/C,IAAI,4BAA4B,CAAC,QAAQ,CAAC,CAAC;;;;;;;;;;GA4FhE;;;;;;;;;;;uBArKa,MAAM,OAAO,CAAC,SAAS,EAAE,CAAC;;qCAO3B;IACR,gCAAgC,EAAE,gCAAgC,CAAC;IACnE,aAAa,EAAE,OAAO,uBAAuB,CAAC,CAAC;IAC/C,WAAW,EAAE,OAAO,WAAW,CAAC,GAAG,SAAS,CAAC;IAC7C,WAAW,EAAE,OAAO,OAAO,CAAC,CAAC;IAC7B,KAAK,EAAE,OAAO,YAAY,CAAC,CAAC;IAC5B,UAAU,EAAE,OAAO,UAAU,CAAC,CAAC;IAC/B,QAAQ,EAAE,QAAQ,CAAC;CACpB;mCAyJU,UAAU,CAAC,OAAO,uBAAuB,CAAC;+BAC1C,UAAU,CAAC,oBAAoB,CAAC;0BAzLvB,mBAAmB;qCASuE,aAAa;yBAH9F,aAAa;kDAEoC,kCAAkC;+BAJvF,8BAA8B;sDAIuB,kCAAkC;6CADzE,qBAAqB;4BALtC,kBAAkB;6BAGjB,cAAc;kCAJT,cAAc;gCAEgB,gCAAgC;8BAG7D,aAAa"}
@@ -51,17 +51,7 @@ declare function prepareOrchestratorKit(zone: Zone, { chainHub, makeLocalChainFa
51
51
  * @param {ActualChainInfo<'agoric'>} agoricChainInfo
52
52
  */
53
53
  onFulfilled(agoricChainInfo: ActualChainInfo<"agoric">): import("@endo/exo").Guarded<{
54
- getChainInfo(): Vow<Readonly<{
55
- bech32Prefix?: string;
56
- chainId: string;
57
- connections?: Record<string, IBCConnectionInfo>;
58
- icqEnabled?: boolean;
59
- pfmEnabled?: boolean;
60
- stakingTokens?: Readonly<Array<{
61
- denom: string;
62
- }>>;
63
- icaEnabled?: boolean;
64
- }>>;
54
+ getChainInfo(): Vow<import("../cosmos-api.js").CosmosChainInfo>;
65
55
  makeAccount(): Vow<import("./local-orchestration-account.js").LocalOrchestrationAccountKit["holder"]>;
66
56
  query(args_0: {
67
57
  '@type': string;
@@ -121,7 +111,7 @@ declare function prepareOrchestratorKit(zone: Zone, { chainHub, makeLocalChainFa
121
111
  };
122
112
  }>;
123
113
  import type { ActualChainInfo } from './chain-hub.js';
124
- import type { IBCConnectionInfo } from '../types.js';
125
114
  import type { ChainInfo } from '../types.js';
115
+ import type { IBCConnectionInfo } from '../types.js';
126
116
  export {};
127
117
  //# sourceMappingURL=orchestrator.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"orchestrator.d.ts","sourceRoot":"","sources":["orchestrator.js"],"names":[],"mappings":"AAiCA,0BAA0B;AAC1B;;;;GAIG;AAqJI,0CARI,IAAI,UACJ;IACN,QAAQ,EAAE,QAAQ,CAAC;IACnB,oBAAoB,EAAE,oBAAoB,CAAC;IAC3C,qBAAqB,EAAE,qBAAqB,CAAC;IAC7C,QAAQ,EAAE,QAAQ,CAAC;CACpB;;;IAfI,+CAA+C;cAApC,OAAO,YAAY,CAAC,UAAU,CAAC,CAAC;GAoBlD;;;;;+BAMY,UAAU,CAClB,UAAU,CAAC,OAAO,sBAAsB,CAAC,CAC1C,CAAC,cAAc,CAAC;0BAvLG,mBAAmB;8BACE,gBAAgB;0CASrB,yBAAyB;2CACxB,0BAA0B;8BARlC,aAAa;2BASoC,aAAa;mCAVtC,oBAAoB;yBAC5C,aAAa;kCASoC,aAAa;4BAVtC,oBAAoB;AAuB5E;;;;;;;;GAQG;AACH,8CARW,IAAI,0FACJ;IACN,QAAQ,EAAE,QAAQ,CAAC;IACnB,oBAAoB,EAAE,oBAAoB,CAAC;IAC3C,qBAAqB,EAAE,qBAAqB,CAAC;IAC7C,QAAQ,EAAE,QAAQ,CAAC;CACpB;IA4CE,2DAA2D;;QAEzD;;WAEG;qCADQ,gBAAgB,QAAQ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;IAQtC;;;OAGG;;QAED;;;;;;WAMG;0HADQ,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QA0DjB,+CAA+C;kBAApC,OAAO,YAAY,CAAC,UAAU,CAAC,CAAC;;GAKlD;qCA/J2C,gBAAgB;uCAWqB,aAAa;+BAAb,aAAa"}
1
+ {"version":3,"file":"orchestrator.d.ts","sourceRoot":"","sources":["orchestrator.js"],"names":[],"mappings":"AA4BA,0BAA0B;AAC1B;;;;GAIG;AAqJI,0CARI,IAAI,UACJ;IACN,QAAQ,EAAE,QAAQ,CAAC;IACnB,oBAAoB,EAAE,oBAAoB,CAAC;IAC3C,qBAAqB,EAAE,qBAAqB,CAAC;IAC7C,QAAQ,EAAE,QAAQ,CAAC;CACpB;;;IAfI,+CAA+C;cAApC,OAAO,YAAY,CAAC,UAAU,CAAC,CAAC;GAoBlD;;;;;+BAMY,UAAU,CAClB,UAAU,CAAC,OAAO,sBAAsB,CAAC,CAC1C,CAAC,cAAc,CAAC;0BAvLG,mBAAmB;8BACE,gBAAgB;0CASrB,yBAAyB;2CACxB,0BAA0B;8BARlC,aAAa;2BASoC,aAAa;mCAVtC,oBAAoB;yBAC5C,aAAa;kCASoC,aAAa;4BAVtC,oBAAoB;AAuB5E;;;;;;;;GAQG;AACH,8CARW,IAAI,0FACJ;IACN,QAAQ,EAAE,QAAQ,CAAC;IACnB,oBAAoB,EAAE,oBAAoB,CAAC;IAC3C,qBAAqB,EAAE,qBAAqB,CAAC;IAC7C,QAAQ,EAAE,QAAQ,CAAC;CACpB;IA4CE,2DAA2D;;QAEzD;;WAEG;qCADQ,gBAAgB,QAAQ,CAAC;;;;;;;;;;;;;;IAQtC;;;OAGG;;QAED;;;;;;WAMG;yEAFQ,CAAC,SAAS,EAAE,SAAS,EAAE,iBAAiB,CAAC,QACzC,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QA0DjB,+CAA+C;kBAApC,OAAO,YAAY,CAAC,UAAU,CAAC,CAAC;;GAKlD;qCA/J2C,gBAAgB;+BAWqB,aAAa;uCAAb,aAAa"}
@@ -5,12 +5,7 @@ import { makeTracer } from '@agoric/internal';
5
5
  import { Shape as NetworkShape } from '@agoric/network';
6
6
  import { Fail, q } from '@endo/errors';
7
7
  import { M } from '@endo/patterns';
8
- import {
9
- DenomInfoShape,
10
- ChainInfoShape,
11
- DenomAmountShape,
12
- DenomShape,
13
- } from '../typeGuards.js';
8
+ import { DenomInfoShape, DenomAmountShape, DenomShape } from '../typeGuards.js';
14
9
 
15
10
  /**
16
11
  * @import {Zone} from '@agoric/base-zone';
@@ -33,7 +28,7 @@ const trace = makeTracer('Orchestrator');
33
28
 
34
29
  /** @see {Orchestrator} */
35
30
  export const OrchestratorI = M.interface('Orchestrator', {
36
- getChain: M.call(M.string()).returns(Vow$(ChainInfoShape)),
31
+ getChain: M.call(M.string()).returns(Vow$(M.remotable('ChainFacade'))),
37
32
  getDenomInfo: M.call(DenomShape, M.string()).returns(DenomInfoShape),
38
33
  asAmount: M.call(DenomAmountShape).returns(AmountShape),
39
34
  });
@@ -1,14 +1,4 @@
1
- export function prepareRemoteChainFacade(zone: Zone, powers: RemoteChainFacadePowers): (remoteChainInfo: Readonly<{
2
- bech32Prefix?: string;
3
- chainId: string;
4
- connections?: Record<string, IBCConnectionInfo>;
5
- icqEnabled?: boolean;
6
- pfmEnabled?: boolean;
7
- stakingTokens?: Readonly<Array<{
8
- denom: string;
9
- }>>;
10
- icaEnabled?: boolean;
11
- }>, connectionInfo: IBCConnectionInfo) => import("@endo/exo").Guarded<{
1
+ export function prepareRemoteChainFacade(zone: Zone, powers: RemoteChainFacadePowers): (remoteChainInfo: ChainInfo, connectionInfo?: IBCConnectionInfo | undefined) => import("@endo/exo").Guarded<{
12
2
  getChainInfo(): Vow<any>;
13
3
  makeAccount(): Vow<import("@agoric/async-flow").HostInterface<import("../orchestration-api.js").OrchestrationAccountCommon & object> | import("@agoric/async-flow").HostInterface<import("../orchestration-api.js").OrchestrationAccountCommon & import("../cosmos-api.js").LocalAccountMethods> | import("@agoric/async-flow").HostInterface<import("../orchestration-api.js").OrchestrationAccountCommon & import("../cosmos-api.js").IcaAccountMethods & object> | import("@agoric/async-flow").HostInterface<import("../orchestration-api.js").OrchestrationAccountCommon & import("../cosmos-api.js").IcaAccountMethods & import("../cosmos-api.js").StakingAccountActions & import("../cosmos-api.js").StakingAccountQueries>>;
14
4
  query(msgs: {
@@ -42,13 +32,14 @@ export type RemoteChainFacadePowers = {
42
32
  vowTools: VowTools;
43
33
  };
44
34
  export type RemoteChainFacadeState = {
45
- remoteChainInfo: CosmosChainInfo;
46
- connectionInfo: IBCConnectionInfo;
35
+ remoteChainInfo: ChainInfo;
36
+ connectionInfo: IBCConnectionInfo | undefined;
47
37
  icqConnection: ICQConnection | undefined;
48
38
  };
49
39
  export type MakeRemoteChainFacade = ReturnType<typeof prepareRemoteChainFacade>;
50
40
  export type RemoteChainFacade = ReturnType<MakeRemoteChainFacade>;
51
41
  import type { Zone } from '@agoric/base-zone';
42
+ import type { ChainInfo } from '../types.js';
52
43
  import type { IBCConnectionInfo } from '../types.js';
53
44
  import type { Vow } from '@agoric/vow';
54
45
  import type { prepareCosmosOrchestrationAccount } from './cosmos-orchestration-account.js';
@@ -56,6 +47,5 @@ import type { CosmosInterchainService } from './exo-interfaces.js';
56
47
  import type { Remote } from '@agoric/internal';
57
48
  import type { TimerService } from '@agoric/time';
58
49
  import type { VowTools } from '@agoric/vow';
59
- import type { CosmosChainInfo } from '../types.js';
60
50
  import type { ICQConnection } from '../types.js';
61
51
  //# sourceMappingURL=remote-chain-facade.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"remote-chain-facade.d.ts","sourceRoot":"","sources":["remote-chain-facade.js"],"names":[],"mappings":"AAuQO,+CAHI,IAAI,UACJ,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAKjC;sCA5OY;IACR,8BAA8B,EAAE,UAAU,CAC9C,wCAA8C,CACzC,CAAC;IACF,aAAa,EAAE,OAAO,uBAAuB,CAAC,CAAC;IAC/C,WAAW,EAAE,OAAO,WAAW,CAAC,GAAG,SAAS,CAAC;IAC7C,KAAK,EAAE,OAAO,YAAY,CAAC,CAAC;IAC5B,QAAQ,EAAE,QAAQ,CAAC;CACpB;qCAIS;IACR,eAAe,EAAE,eAAe,CAAC;IACjC,cAAc,EAAE,iBAAiB,CAAC;IAClC,aAAa,EAAE,aAAa,GAAG,SAAS,CAAC;CAC1C;oCA+NU,UAAU,CAAC,OAAO,wBAAwB,CAAC;gCAC3C,UAAU,CAAC,qBAAqB,CAAC;0BA/PxB,mBAAmB;uCASiE,aAAa;yBAJxF,aAAa;uDAGO,mCAAmC;6CAD7C,qBAAqB;4BAHtC,kBAAkB;kCADZ,cAAc;8BAEb,aAAa;qCAI8D,aAAa;mCAAb,aAAa"}
1
+ {"version":3,"file":"remote-chain-facade.d.ts","sourceRoot":"","sources":["remote-chain-facade.js"],"names":[],"mappings":"AAoRO,+CAHI,IAAI,UACJ,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;GAKjC;sCAzPY;IACR,8BAA8B,EAAE,UAAU,CAC9C,wCAA8C,CACzC,CAAC;IACF,aAAa,EAAE,OAAO,uBAAuB,CAAC,CAAC;IAC/C,WAAW,EAAE,OAAO,WAAW,CAAC,GAAG,SAAS,CAAC;IAC7C,KAAK,EAAE,OAAO,YAAY,CAAC,CAAC;IAC5B,QAAQ,EAAE,QAAQ,CAAC;CACpB;qCAIS;IACR,eAAe,EAAE,SAAS,CAAC;IAC3B,cAAc,EAAE,iBAAiB,GAAG,SAAS,CAAC;IAC9C,aAAa,EAAE,aAAa,GAAG,SAAS,CAAC;CAC1C;oCA4OU,UAAU,CAAC,OAAO,wBAAwB,CAAC;gCAC3C,UAAU,CAAC,qBAAqB,CAAC;0BA5QxB,mBAAmB;+BAS4E,aAAa;uCAAb,aAAa;yBAJnG,aAAa;uDAGO,mCAAmC;6CAD7C,qBAAqB;4BAHtC,kBAAkB;kCADZ,cAAc;8BAEb,aAAa;mCAIyE,aAAa"}
@@ -22,7 +22,7 @@ import {
22
22
  * @import {LocalIbcAddress, RemoteIbcAddress} from '@agoric/vats/tools/ibc-utils.js';
23
23
  * @import {CosmosInterchainService} from './exo-interfaces.js';
24
24
  * @import {prepareCosmosOrchestrationAccount} from './cosmos-orchestration-account.js';
25
- * @import {CosmosChainInfo, IBCConnectionInfo, CosmosChainAddress, IcaAccount, Chain, ICQConnection} from '../types.js';
25
+ * @import {CosmosChainInfo, IBCConnectionInfo, CosmosChainAddress, IcaAccount, Chain, ICQConnection, ChainInfo} from '../types.js';
26
26
  */
27
27
 
28
28
  const trace = makeTracer('RemoteChainFacade');
@@ -41,8 +41,8 @@ const trace = makeTracer('RemoteChainFacade');
41
41
 
42
42
  /**
43
43
  * @typedef {{
44
- * remoteChainInfo: CosmosChainInfo;
45
- * connectionInfo: IBCConnectionInfo;
44
+ * remoteChainInfo: ChainInfo;
45
+ * connectionInfo: IBCConnectionInfo | undefined;
46
46
  * icqConnection: ICQConnection | undefined;
47
47
  * }} RemoteChainFacadeState
48
48
  */
@@ -103,8 +103,8 @@ const prepareRemoteChainFacadeKit = (
103
103
  }),
104
104
  },
105
105
  /**
106
- * @param {CosmosChainInfo} remoteChainInfo
107
- * @param {IBCConnectionInfo} connectionInfo
106
+ * @param {ChainInfo} remoteChainInfo
107
+ * @param {IBCConnectionInfo} [connectionInfo]
108
108
  */
109
109
  (remoteChainInfo, connectionInfo) => {
110
110
  trace('making a RemoteChainFacade');
@@ -126,15 +126,21 @@ const prepareRemoteChainFacadeKit = (
126
126
  return asVow(() => {
127
127
  const { remoteChainInfo, connectionInfo } = this.state;
128
128
 
129
+ if (remoteChainInfo.namespace !== 'cosmos') {
130
+ throw Fail`only supported on 'cosmos' chains, not ${remoteChainInfo.namespace}`;
131
+ }
132
+ if (!connectionInfo) throw Fail`IBC connection info not found`;
133
+
129
134
  // icqConnection is ultimately retrieved from state, but let's
130
135
  // create a connection if it doesn't exist
131
136
  const icqConnOrUndefinedV =
132
- remoteChainInfo.icqEnabled && !this.state.icqConnection
137
+ /** @type {CosmosChainInfo} */ (remoteChainInfo)?.icqEnabled &&
138
+ !this.state.icqConnection
133
139
  ? E(orchestration).provideICQConnection(connectionInfo.id)
134
140
  : undefined;
135
141
 
136
142
  const makeAccountV = E(orchestration).makeAccount(
137
- remoteChainInfo.chainId,
143
+ /** @type {CosmosChainInfo} */ (remoteChainInfo).chainId,
138
144
  connectionInfo.counterparty.connection_id,
139
145
  connectionInfo.id,
140
146
  );
@@ -155,10 +161,17 @@ const prepareRemoteChainFacadeKit = (
155
161
  const {
156
162
  remoteChainInfo: { icqEnabled, chainId },
157
163
  connectionInfo,
158
- } = this.state;
164
+ } = /**
165
+ * @type {{
166
+ * remoteChainInfo: CosmosChainInfo;
167
+ * connectionInfo?: IBCConnectionInfo;
168
+ * }}
169
+ */ (this.state);
170
+
159
171
  if (!icqEnabled) {
160
172
  throw Fail`Queries not available for chain ${q(chainId)}`;
161
173
  }
174
+ if (!connectionInfo) throw Fail`IBC connection info not found`;
162
175
  // if none exists, make one and still send the query in the handler
163
176
  if (!this.state.icqConnection) {
164
177
  return watch(