@agoric/orchestration 0.2.0-upgrade-17-dev-ec448b0.0 → 0.2.0-upgrade-18-dev-b9b8db4.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 (126) hide show
  1. package/index.d.ts +1 -1
  2. package/index.js +2 -1
  3. package/package.json +29 -28
  4. package/src/chain-info.d.ts +31 -387
  5. package/src/chain-info.d.ts.map +1 -1
  6. package/src/chain-info.js +10 -64
  7. package/src/cosmos-api.d.ts +21 -10
  8. package/src/cosmos-api.d.ts.map +1 -1
  9. package/src/cosmos-api.ts +33 -14
  10. package/src/examples/README.md +3 -4
  11. package/src/examples/auto-stake-it-tap-kit.d.ts.map +1 -1
  12. package/src/examples/auto-stake-it-tap-kit.js +4 -7
  13. package/src/examples/auto-stake-it.contract.d.ts +1 -1
  14. package/src/examples/auto-stake-it.flows.d.ts +1 -1
  15. package/src/examples/auto-stake-it.flows.d.ts.map +1 -1
  16. package/src/examples/basic-flows.contract.d.ts +1 -1
  17. package/src/examples/basic-flows.flows.d.ts +1 -1
  18. package/src/examples/send-anywhere.contract.d.ts +20 -2
  19. package/src/examples/send-anywhere.contract.d.ts.map +1 -1
  20. package/src/examples/send-anywhere.contract.js +34 -18
  21. package/src/examples/send-anywhere.flows.d.ts +7 -7
  22. package/src/examples/send-anywhere.flows.d.ts.map +1 -1
  23. package/src/examples/send-anywhere.flows.js +40 -20
  24. package/src/examples/shared.flows.d.ts +4 -0
  25. package/src/examples/shared.flows.d.ts.map +1 -0
  26. package/src/examples/shared.flows.js +21 -0
  27. package/src/examples/stake-bld.contract.d.ts +49 -0
  28. package/src/examples/stake-bld.contract.d.ts.map +1 -0
  29. package/src/examples/{stakeBld.contract.js → stake-bld.contract.js} +10 -1
  30. package/src/examples/stake-ica.contract.d.ts +126 -0
  31. package/src/examples/stake-ica.contract.d.ts.map +1 -0
  32. package/src/examples/{stakeIca.contract.js → stake-ica.contract.js} +6 -2
  33. package/src/examples/staking-combinations.contract.d.ts +1 -1
  34. package/src/examples/staking-combinations.contract.d.ts.map +1 -1
  35. package/src/examples/staking-combinations.contract.js +16 -13
  36. package/src/examples/staking-combinations.flows.d.ts +6 -9
  37. package/src/examples/staking-combinations.flows.d.ts.map +1 -1
  38. package/src/examples/staking-combinations.flows.js +19 -16
  39. package/src/examples/swap.contract.d.ts.map +1 -1
  40. package/src/examples/swap.contract.js +0 -1
  41. package/src/examples/unbond.contract.d.ts +1 -1
  42. package/src/examples/unbond.contract.d.ts.map +1 -1
  43. package/src/examples/unbond.contract.js +10 -5
  44. package/src/examples/unbond.flows.d.ts +4 -3
  45. package/src/examples/unbond.flows.d.ts.map +1 -1
  46. package/src/examples/unbond.flows.js +23 -31
  47. package/src/exos/chain-hub.d.ts +12 -4
  48. package/src/exos/chain-hub.d.ts.map +1 -1
  49. package/src/exos/chain-hub.js +28 -19
  50. package/src/exos/combine-invitation-makers.d.ts +1 -0
  51. package/src/exos/combine-invitation-makers.d.ts.map +1 -1
  52. package/src/exos/combine-invitation-makers.js +6 -0
  53. package/src/exos/cosmos-interchain-service.d.ts +20 -70
  54. package/src/exos/cosmos-interchain-service.d.ts.map +1 -1
  55. package/src/exos/cosmos-orchestration-account.d.ts +152 -47
  56. package/src/exos/cosmos-orchestration-account.d.ts.map +1 -1
  57. package/src/exos/cosmos-orchestration-account.js +355 -13
  58. package/src/exos/exo-interfaces.d.ts +3 -3
  59. package/src/exos/exo-interfaces.d.ts.map +1 -1
  60. package/src/exos/exo-interfaces.ts +3 -3
  61. package/src/exos/ica-account-kit.d.ts +2 -2
  62. package/src/exos/ica-account-kit.d.ts.map +1 -1
  63. package/src/exos/icq-connection-kit.d.ts +17 -1
  64. package/src/exos/icq-connection-kit.d.ts.map +1 -1
  65. package/src/exos/local-chain-facade.d.ts +22 -170
  66. package/src/exos/local-chain-facade.d.ts.map +1 -1
  67. package/src/exos/local-orchestration-account.d.ts +41 -48
  68. package/src/exos/local-orchestration-account.d.ts.map +1 -1
  69. package/src/exos/local-orchestration-account.js +94 -13
  70. package/src/exos/orchestrator.d.ts +44 -136
  71. package/src/exos/orchestrator.d.ts.map +1 -1
  72. package/src/exos/orchestrator.js +42 -44
  73. package/src/exos/packet-tools.d.ts +21 -81
  74. package/src/exos/packet-tools.d.ts.map +1 -1
  75. package/src/exos/portfolio-holder-kit.d.ts +4 -4
  76. package/src/exos/portfolio-holder-kit.d.ts.map +1 -1
  77. package/src/exos/portfolio-holder-kit.js +65 -10
  78. package/src/exos/remote-chain-facade.d.ts +35 -128
  79. package/src/exos/remote-chain-facade.d.ts.map +1 -1
  80. package/src/facade.d.ts.map +1 -1
  81. package/src/facade.js +7 -0
  82. package/src/fetched-chain-info.d.ts +30 -340
  83. package/src/fetched-chain-info.js +18 -329
  84. package/src/fixtures/query-flows.flows.d.ts.map +1 -1
  85. package/src/orchestration-api.d.ts +4 -8
  86. package/src/orchestration-api.d.ts.map +1 -1
  87. package/src/orchestration-api.ts +3 -8
  88. package/src/proposals/init-chain-info.js +3 -3
  89. package/src/proposals/orchestration-proposal.d.ts.map +1 -1
  90. package/src/proposals/start-stakeAtom.d.ts +78 -16
  91. package/src/proposals/start-stakeAtom.d.ts.map +1 -1
  92. package/src/proposals/start-stakeAtom.js +9 -4
  93. package/src/proposals/start-stakeBld.d.ts +13 -39
  94. package/src/proposals/start-stakeBld.d.ts.map +1 -1
  95. package/src/proposals/start-stakeBld.js +2 -2
  96. package/src/proposals/start-stakeOsmo.d.ts +77 -15
  97. package/src/proposals/start-stakeOsmo.d.ts.map +1 -1
  98. package/src/proposals/start-stakeOsmo.js +9 -4
  99. package/src/typeGuards.d.ts +5 -1
  100. package/src/typeGuards.d.ts.map +1 -1
  101. package/src/typeGuards.js +21 -9
  102. package/src/types-index.d.ts +1 -0
  103. package/src/types-index.js +1 -0
  104. package/src/types.d.ts +14 -4
  105. package/src/types.d.ts.map +1 -1
  106. package/src/types.ts +15 -4
  107. package/src/utils/cosmos.d.ts +40 -1
  108. package/src/utils/cosmos.d.ts.map +1 -1
  109. package/src/utils/cosmos.js +48 -1
  110. package/src/utils/orchestrationAccount.js +1 -1
  111. package/src/utils/registry.d.ts.map +1 -1
  112. package/src/utils/registry.js +0 -3
  113. package/src/utils/start-helper.d.ts +4 -10
  114. package/src/utils/start-helper.d.ts.map +1 -1
  115. package/src/utils/start-helper.js +18 -15
  116. package/src/utils/zcf-tools.d.ts +5 -0
  117. package/src/utils/zcf-tools.d.ts.map +1 -0
  118. package/src/utils/zcf-tools.js +35 -0
  119. package/src/utils/zoe-tools.d.ts +5 -8
  120. package/src/utils/zoe-tools.d.ts.map +1 -1
  121. package/src/utils/zoe-tools.js +136 -33
  122. package/src/vat-orchestration.d.ts.map +1 -1
  123. package/src/examples/stakeBld.contract.d.ts +0 -75
  124. package/src/examples/stakeBld.contract.d.ts.map +0 -1
  125. package/src/examples/stakeIca.contract.d.ts +0 -64
  126. package/src/examples/stakeIca.contract.d.ts.map +0 -1
@@ -1,5 +1,6 @@
1
- export function unbondAndLiquidStake(orch: Orchestrator, { zcf }: {
2
- zcf: ZCF;
3
- }, _seat: ZCFSeat, _offerArgs: undefined): Promise<void>;
1
+ export function unbondAndTransfer(orch: Orchestrator, { zcfTools }: {
2
+ zcfTools: ZcfTools;
3
+ }): Promise<void>;
4
4
  import type { Orchestrator } from '../types.js';
5
+ import type { ZcfTools } from '../types.js';
5
6
  //# sourceMappingURL=unbond.flows.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"unbond.flows.d.ts","sourceRoot":"","sources":["unbond.flows.js"],"names":[],"mappings":"AAmBO,2CANI,YAAY,WAEpB;IAAiB,GAAG,EAAZ,GAAG;CACX,SAAQ,OAAO,cACP,SAAS,iBA4BnB;kCA5CiD,aAAa"}
1
+ {"version":3,"file":"unbond.flows.d.ts","sourceRoot":"","sources":["unbond.flows.js"],"names":[],"mappings":"AAcO,wCAJI,YAAY,gBAEpB;IAAsB,QAAQ,EAAtB,QAAQ;CAClB,iBAwBA;kCAhCqF,aAAa;8BAAb,aAAa"}
@@ -1,47 +1,39 @@
1
+ import { makeTracer } from '@agoric/internal';
2
+
3
+ const trace = makeTracer('UnbondAndTransfer');
4
+
1
5
  /**
2
- * @import {Orchestrator, OrchestrationFlow} from '../types.js'
3
- * @import {TimerService} from '@agoric/time';
4
- * @import {LocalChain} from '@agoric/vats/src/localchain.js';
5
- * @import {NameHub} from '@agoric/vats';
6
- * @import {Remote} from '@agoric/internal';
7
- * @import {Zone} from '@agoric/zone';
8
- * @import {CosmosInterchainService} from '../exos/exo-interfaces.js';
9
- * @import {OrchestrationTools} from '../utils/start-helper.js';
6
+ * @import {Orchestrator, OrchestrationFlow, CosmosDelegationResponse, ZcfTools} from '../types.js'
10
7
  */
11
8
 
12
9
  /**
13
10
  * @satisfies {OrchestrationFlow}
14
11
  * @param {Orchestrator} orch
15
12
  * @param {object} ctx
16
- * @param {ZCF} ctx.zcf
17
- * @param {ZCFSeat} _seat
18
- * @param {undefined} _offerArgs
13
+ * @param {ZcfTools} ctx.zcfTools
19
14
  */
20
- export const unbondAndLiquidStake = async (
21
- orch,
22
- { zcf },
23
- _seat,
24
- _offerArgs,
25
- ) => {
26
- console.log('zcf within the membrane', zcf);
15
+ export const unbondAndTransfer = async (orch, { zcfTools }) => {
16
+ trace('zcfTools within the membrane', zcfTools);
27
17
  // Osmosis is one of the few chains with icqEnabled
28
18
  const osmosis = await orch.getChain('osmosis');
29
- // In a real world scenario, accounts would be re-used across invokations of the handler
19
+ const osmoDenom = (await osmosis.getChainInfo()).stakingTokens[0].denom;
20
+
21
+ // In a real world scenario, accounts would be reused across invokations of the handler.
22
+ // See the staking-combinations contract for an example of how to reuse an account.
30
23
  const osmoAccount = await osmosis.makeAccount();
31
24
 
32
- // TODO https://github.com/Agoric/agoric-sdk/issues/10016
33
- // const delegations = await celestiaAccount.getDelegations();
34
- // // wait for the undelegations to be complete (may take weeks)
35
- // await celestiaAccount.undelegate(delegations);
36
- // ??? should this be synchronous? depends on how names are resolved.
25
+ /** @type {CosmosDelegationResponse[]} Cosmos */
26
+ const delegations = await osmoAccount.getDelegations();
27
+ trace('delegations', delegations);
28
+ const osmoDelegations = delegations.filter(d => d.amount.denom === osmoDenom);
29
+
30
+ // wait for the undelegations to be complete (may take weeks)
31
+ await osmoAccount.undelegate(osmoDelegations);
32
+
37
33
  const stride = await orch.getChain('stride');
38
34
  const strideAccount = await stride.makeAccount();
39
35
 
40
- // TODO the `TIA` string actually needs to be the Brand from AgoricNames
41
- // const tiaAmt = await celestiaAccount.getBalance('TIA');
42
- // await celestiaAccount.transfer(tiaAmt, strideAccount.getAddress());
43
- // TODO https://github.com/Agoric/agoric-sdk/issues/10017
44
- // await strideAccount.liquidStake(tiaAmt);
45
- console.log(osmoAccount, strideAccount);
36
+ const balance = await osmoAccount.getBalance(osmoDenom);
37
+ await osmoAccount.transfer(strideAccount.getAddress(), balance);
46
38
  };
47
- harden(unbondAndLiquidStake);
39
+ harden(unbondAndTransfer);
@@ -1,6 +1,7 @@
1
1
  /**
2
2
  * @import {NameHub} from '@agoric/vats';
3
3
  * @import {Vow, VowTools} from '@agoric/vow';
4
+ * @import {Zone} from '@agoric/zone';
4
5
  * @import {CosmosAssetInfo, CosmosChainInfo, IBCConnectionInfo} from '../cosmos-api.js';
5
6
  * @import {ChainInfo, KnownChains} from '../chain-info.js';
6
7
  * @import {Denom} from '../orchestration-api.js';
@@ -26,15 +27,21 @@
26
27
  */
27
28
  /** @type {TypedPattern<DenomDetail>} */
28
29
  export const DenomDetailShape: TypedPattern<DenomDetail>;
29
- /** agoricNames key for ChainInfo hub */
30
+ export type HubName = (typeof HubName)[keyof typeof HubName];
31
+ export namespace HubName {
32
+ let Chain: "chain";
33
+ let ChainAssets: "chainAssets";
34
+ let ChainConnection: "chainConnection";
35
+ }
36
+ /** @deprecated use HubName.Chain */
30
37
  export const CHAIN_KEY: "chain";
31
- /** namehub for connection info */
38
+ /** @deprecated use HubName.ChainConnection */
32
39
  export const CONNECTIONS_KEY: "chainConnection";
33
- /** namehub for assets info */
40
+ /** @deprecated use HubName.ChainAssets */
34
41
  export const ASSETS_KEY: "chainAssets";
35
42
  export function connectionKey(chainId1: string, chainId2: string): string;
36
43
  export function normalizeConnectionInfo(primaryChainId: string, counterChainId: string, directed: IBCConnectionInfo): [string, IBCConnectionInfo];
37
- export function makeChainHub(agoricNames: Remote<NameHub>, vowTools: VowTools): import("@endo/exo").Guarded<{
44
+ export function makeChainHub(zone: Zone, agoricNames: Remote<NameHub>, vowTools: VowTools): import("@endo/exo").Guarded<{
38
45
  /**
39
46
  * Register a new chain. The name will override a name in well known chain
40
47
  * names.
@@ -130,6 +137,7 @@ export type DenomDetail = {
130
137
  export type ChainHub = ReturnType<typeof makeChainHub>;
131
138
  import type { TypedPattern } from '@agoric/internal';
132
139
  import type { IBCConnectionInfo } from '../cosmos-api.js';
140
+ import type { Zone } from '@agoric/zone';
133
141
  import type { NameHub } from '@agoric/vats';
134
142
  import type { Remote } from '@agoric/internal';
135
143
  import type { VowTools } from '@agoric/vow';
@@ -1 +1 @@
1
- {"version":3,"file":"chain-hub.d.ts","sourceRoot":"","sources":["chain-hub.js"],"names":[],"mappings":"AASA;;;;;;;;GAQG;AAEH;;;;;;;;GAQG;AAEH;;;;;;;GAOG;AACH,wCAAwC;AACxC,+BADW,aAAa,WAAW,CAAC,CAIlC;AAGF,wCAAwC;AACxC,gCAAiC;AACjC,kCAAkC;AAClC,gDAAiD;AACjD,8BAA8B;AAC9B,uCAAwC;AAqBjC,wCAHI,MAAM,YACN,MAAM,UAUhB;AAuCM,wDALI,MAAM,kBACN,MAAM,YACN,iBAAiB,GACf,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAavC;AA0DM,0CAHI,OAAO,OAAO,CAAC,YACf,QAAQ;IA+Gf;;;;;;;;;;;OAWG;wBAFQ,MAAM,aACN,eAAe;IAK1B;;;;OAIG;iBAHmB,CAAC,SAAV,MAAQ,aACV,CAAC,GACC,IAAI,eAAe,CAAC,CAAC,CAAC,CAA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CAAC,GAC/C,SAAS;;;;;cAMF,MAAM;;;;eACN,KAAK;;;;eACL,MAAM;;;;;;uBA8YN,UAAU,CAAC,OAAO,YAAY,CAAC;kCA/Zd,kBAAkB;uCAJqB,kBAAkB;0BADjE,cAAc;6BAFX,cAAc;4BAMf,kBAAkB;8BALX,aAAa;qCAEyB,kBAAkB;yBAFxD,aAAa;2BAIrB,yBAAyB;qCAFqB,kBAAkB;iCAC/C,kBAAkB;+BAAlB,kBAAkB"}
@@ -4,12 +4,12 @@ import { M } from '@endo/patterns';
4
4
  import { BrandShape } from '@agoric/ertp/src/typeGuards.js';
5
5
 
6
6
  import { VowShape } from '@agoric/vow';
7
- import { makeHeapZone } from '@agoric/zone';
8
7
  import { CosmosChainInfoShape, IBCConnectionInfoShape } from '../typeGuards.js';
9
8
 
10
9
  /**
11
10
  * @import {NameHub} from '@agoric/vats';
12
11
  * @import {Vow, VowTools} from '@agoric/vow';
12
+ * @import {Zone} from '@agoric/zone';
13
13
  * @import {CosmosAssetInfo, CosmosChainInfo, IBCConnectionInfo} from '../cosmos-api.js';
14
14
  * @import {ChainInfo, KnownChains} from '../chain-info.js';
15
15
  * @import {Denom} from '../orchestration-api.js';
@@ -41,13 +41,25 @@ export const DenomDetailShape = M.splitRecord(
41
41
  { brand: BrandShape },
42
42
  );
43
43
 
44
- // TODO refactor into an enum-ish object
45
- /** agoricNames key for ChainInfo hub */
46
- export const CHAIN_KEY = 'chain';
47
- /** namehub for connection info */
48
- export const CONNECTIONS_KEY = 'chainConnection';
49
- /** namehub for assets info */
50
- export const ASSETS_KEY = 'chainAssets';
44
+ /**
45
+ * @enum {(typeof HubName)[keyof typeof HubName]}
46
+ */
47
+ export const HubName = /** @type {const} */ ({
48
+ /** agoricNames key for ChainInfo hub */
49
+ Chain: 'chain',
50
+ /** namehub for assets info */
51
+ ChainAssets: 'chainAssets',
52
+ /** namehub for connection info */
53
+ ChainConnection: 'chainConnection',
54
+ });
55
+ harden(HubName);
56
+
57
+ /** @deprecated use HubName.Chain */
58
+ export const CHAIN_KEY = HubName.Chain;
59
+ /** @deprecated use HubName.ChainConnection */
60
+ export const CONNECTIONS_KEY = HubName.ChainConnection;
61
+ /** @deprecated use HubName.ChainAssets */
62
+ export const ASSETS_KEY = HubName.ChainAssets;
51
63
 
52
64
  /**
53
65
  * Character used in a connection tuple key to separate the two chain ids. Valid
@@ -92,9 +104,6 @@ const reverseConnInfo = connInfo => {
92
104
  counterparty: {
93
105
  client_id: connInfo.client_id,
94
106
  connection_id: connInfo.id,
95
- prefix: {
96
- key_prefix: 'FIXME',
97
- },
98
107
  },
99
108
  state: connInfo.state,
100
109
  transferChannel: {
@@ -174,18 +183,18 @@ const ChainHubI = M.interface('ChainHub', {
174
183
  });
175
184
 
176
185
  /**
177
- * Make a new ChainHub in the zone (or in the heap if no zone is provided).
186
+ * Make a new ChainHub in the zone.
178
187
  *
179
188
  * The resulting object is an Exo singleton. It has no precious state. It's only
180
189
  * state is a cache of queries to agoricNames and whatever info was provided in
181
190
  * registration calls. When you need a newer version you can simply make a hub
182
191
  * hub and repeat the registrations.
183
192
  *
193
+ * @param {Zone} zone
184
194
  * @param {Remote<NameHub>} agoricNames
185
195
  * @param {VowTools} vowTools
186
196
  */
187
- export const makeChainHub = (agoricNames, vowTools) => {
188
- const zone = makeHeapZone();
197
+ export const makeChainHub = (zone, agoricNames, vowTools) => {
189
198
  /** @type {MapStore<string, CosmosChainInfo>} */
190
199
  const chainInfos = zone.mapStore('chainInfos', {
191
200
  keyShape: M.string(),
@@ -208,7 +217,7 @@ export const makeChainHub = (agoricNames, vowTools) => {
208
217
  valueShape: M.string(),
209
218
  });
210
219
 
211
- const lookupChainInfo = vowTools.retriable(
220
+ const lookupChainInfo = vowTools.retryable(
212
221
  zone,
213
222
  'lookupChainInfo',
214
223
  /** @param {string} chainName */
@@ -216,7 +225,7 @@ export const makeChainHub = (agoricNames, vowTools) => {
216
225
  async chainName => {
217
226
  await null;
218
227
  try {
219
- const chainInfo = await E(agoricNames).lookup(CHAIN_KEY, chainName);
228
+ const chainInfo = await E(agoricNames).lookup(HubName.Chain, chainName);
220
229
  // It may have been set by another concurrent call
221
230
  // TODO consider makeAtomicProvider for vows
222
231
  if (!chainInfos.has(chainName)) {
@@ -230,7 +239,7 @@ export const makeChainHub = (agoricNames, vowTools) => {
230
239
  },
231
240
  );
232
241
 
233
- const lookupConnectionInfo = vowTools.retriable(
242
+ const lookupConnectionInfo = vowTools.retryable(
234
243
  zone,
235
244
  'lookupConnectionInfo',
236
245
  /**
@@ -243,7 +252,7 @@ export const makeChainHub = (agoricNames, vowTools) => {
243
252
  const key = connectionKey(chainId1, chainId2);
244
253
  try {
245
254
  const connectionInfo = await E(agoricNames).lookup(
246
- CONNECTIONS_KEY,
255
+ HubName.ChainConnection,
247
256
  key,
248
257
  );
249
258
  // It may have been set by another concurrent call
@@ -261,7 +270,7 @@ export const makeChainHub = (agoricNames, vowTools) => {
261
270
  );
262
271
 
263
272
  /* eslint-disable no-use-before-define -- chainHub defined below */
264
- const lookupChainsAndConnection = vowTools.retriable(
273
+ const lookupChainsAndConnection = vowTools.retryable(
265
274
  zone,
266
275
  'lookupChainsAndConnection',
267
276
  /**
@@ -1,5 +1,6 @@
1
1
  export function prepareCombineInvitationMakers(zone: Zone, ...interfaceGuards: import("@endo/patterns").InterfaceGuard[]): <IM extends InvitationMakers[]>(...invitationMakers: IM) => IM[number];
2
2
  export type MakeCombineInvitationMakers = ReturnType<typeof prepareCombineInvitationMakers>;
3
+ export type CombinedInvitationMakers = ReturnType<MakeCombineInvitationMakers>;
3
4
  import type { Zone } from '@agoric/zone';
4
5
  import type { InvitationMakers } from '@agoric/smart-wallet/src/types.js';
5
6
  //# sourceMappingURL=combine-invitation-makers.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"combine-invitation-makers.d.ts","sourceRoot":"","sources":["combine-invitation-makers.js"],"names":[],"mappings":"AAmBO,qDAHI,IAAI,sBACJ,OAAO,gBAAgB,EAAE,cAAc,EAAE,IAchB,EAAE,SAAtB,gBAAgB,EAAG,uBACtB,EAAE,KACA,EAAE,CAAC,MAAM,CAAC,CAiBxB;0CAEa,UAAU,CAAC,OAAO,8BAA8B,CAAC;0BA3CxC,cAAc;sCADF,mCAAmC"}
1
+ {"version":3,"file":"combine-invitation-makers.d.ts","sourceRoot":"","sources":["combine-invitation-makers.js"],"names":[],"mappings":"AAwBO,qDAHI,IAAI,sBACJ,OAAO,gBAAgB,EAAE,cAAc,EAAE,IAchB,EAAE,SAAtB,gBAAgB,EAAG,uBACtB,EAAE,KACA,EAAE,CAAC,MAAM,CAAC,CAiBxB;0CAEa,UAAU,CAAC,OAAO,8BAA8B,CAAC;uCACjD,UAAU,CAAC,2BAA2B,CAAC;0BAjD9B,cAAc;sCADF,mCAAmC"}
@@ -13,6 +13,11 @@ import { getMethodNames } from '@agoric/internal';
13
13
  // TODO use a helper from Endo https://github.com/endojs/endo/issues/2448
14
14
  /**
15
15
  * Takes two or more InvitationMaker exos and combines them into a new one.
16
+ * Combine with `publicTopics` to form a {@link ContinuingOfferResult} that can
17
+ * be returned to a smart-wallet client.
18
+ *
19
+ * Useful for writing your own invitationMakers while preserving
20
+ * platform-provided ones like `Delegate`, `Transfer`, `Send`.
16
21
  *
17
22
  * @param {Zone} zone
18
23
  * @param {import('@endo/patterns').InterfaceGuard[]} interfaceGuards
@@ -51,3 +56,4 @@ export const prepareCombineInvitationMakers = (zone, ...interfaceGuards) => {
51
56
  };
52
57
 
53
58
  /** @typedef {ReturnType<typeof prepareCombineInvitationMakers>} MakeCombineInvitationMakers */
59
+ /** @typedef {ReturnType<MakeCombineInvitationMakers>} CombinedInvitationMakers */
@@ -1,71 +1,23 @@
1
- export function prepareCosmosInterchainService(zone: Zone, vowTools: VowTools): (powers: Partial<OrchestrationPowers>) => ReturnType<(powers: Partial<OrchestrationPowers>) => import("@endo/exo").GuardedKit<{
2
- requestICAChannelWatcher: {
3
- /**
4
- * @param {Port} port
5
- * @param {{
6
- * chainId: string;
7
- * remoteConnAddr: RemoteIbcAddress;
8
- * }} watchContext
9
- */
10
- onFulfilled(port: Port, { chainId, remoteConnAddr }: {
11
- chainId: string;
12
- remoteConnAddr: RemoteIbcAddress;
13
- }): Vow<any>;
14
- };
15
- requestICQChannelWatcher: {
16
- /**
17
- * @param {Port} port
18
- * @param {{
19
- * remoteConnAddr: RemoteIbcAddress;
20
- * icqLookupKey: string;
21
- * }} watchContext
22
- */
23
- onFulfilled(port: Port, { remoteConnAddr, icqLookupKey }: {
24
- remoteConnAddr: RemoteIbcAddress;
25
- icqLookupKey: string;
26
- }): Vow<any>;
27
- };
1
+ export function prepareCosmosInterchainService(zone: Zone, vowTools: VowTools): (powers: Partial<OrchestrationPowers>) => import("@endo/exo").Guarded<{
28
2
  /**
29
- * Waits for a channel (ICA, ICQ) to open and returns the consumer-facing
30
- * facet of the ConnectionKit, specified by `returnFacet`. Saves the
31
- * ConnectionKit if `saveICQConnection` is provided.
3
+ * @satisfies {CosmosInterchainService['makeAccount']}
4
+ * @param {string} chainId
5
+ * @param {IBCConnectionID} hostConnectionId the counterparty
6
+ * connection_id
7
+ * @param {IBCConnectionID} controllerConnectionId self connection_id
8
+ * @param {ICAChannelAddressOpts} [opts] optional to configure the
9
+ * channel address, such as version and ordering
10
+ * @returns {Vow<IcaAccount>}
32
11
  */
33
- channelOpenWatcher: {
34
- /**
35
- * @param {Connection} _connection
36
- * @param {{
37
- * connectionKit: ConnectionKit;
38
- * returnFacet: string;
39
- * icqLookupKey?: string;
40
- * }} watchContext
41
- */
42
- onFulfilled(_connection: Connection, { connectionKit, returnFacet, icqLookupKey }: {
43
- connectionKit: ConnectionKit;
44
- returnFacet: string;
45
- icqLookupKey?: string;
46
- }): any;
47
- };
48
- public: {
49
- /**
50
- * @satisfies {CosmosInterchainService['makeAccount']}
51
- * @param {string} chainId
52
- * @param {IBCConnectionID} hostConnectionId the counterparty
53
- * connection_id
54
- * @param {IBCConnectionID} controllerConnectionId self connection_id
55
- * @param {ICAChannelAddressOpts} [opts] optional to configure the
56
- * channel address, such as version and ordering
57
- * @returns {Vow<IcaAccount>}
58
- */
59
- makeAccount(chainId: string, hostConnectionId: IBCConnectionID, controllerConnectionId: IBCConnectionID, opts?: ICAChannelAddressOpts | undefined): Vow<IcaAccount>;
60
- /**
61
- * @satisfies {CosmosInterchainService['provideICQConnection']}
62
- * @param {IBCConnectionID} controllerConnectionId
63
- * @param {string} [version]
64
- * @returns {Vow<ICQConnection> | ICQConnection}
65
- */
66
- provideICQConnection(controllerConnectionId: IBCConnectionID, version?: string | undefined): Vow<ICQConnection> | ICQConnection;
67
- };
68
- }>>["public"];
12
+ makeAccount(chainId: string, hostConnectionId: IBCConnectionID, controllerConnectionId: IBCConnectionID, opts?: ICAChannelAddressOpts | undefined): Vow<IcaAccount>;
13
+ /**
14
+ * @satisfies {CosmosInterchainService['provideICQConnection']}
15
+ * @param {IBCConnectionID} controllerConnectionId
16
+ * @param {string} [version]
17
+ * @returns {Vow<ICQConnection> | ICQConnection}
18
+ */
19
+ provideICQConnection(controllerConnectionId: IBCConnectionID, version?: string | undefined): Vow<ICQConnection> | ICQConnection;
20
+ }>;
69
21
  export type OrchestrationPowers = {
70
22
  portAllocator: Remote<PortAllocator>;
71
23
  /**
@@ -83,16 +35,14 @@ export type OrchestrationState = {
83
35
  export type MakeCosmosInterchainService = ReturnType<typeof prepareCosmosInterchainService>;
84
36
  import type { Zone } from '@agoric/base-zone';
85
37
  import type { VowTools } from '@agoric/vow';
86
- import type { Port } from '@agoric/network';
87
- import type { RemoteIbcAddress } from '@agoric/vats/tools/ibc-utils.js';
88
- import type { Vow } from '@agoric/vow';
89
- import type { Connection } from '@agoric/network';
90
38
  import type { IBCConnectionID } from '@agoric/vats';
91
39
  import type { ICAChannelAddressOpts } from '../utils/address.js';
92
40
  import type { IcaAccount } from '../types.js';
41
+ import type { Vow } from '@agoric/vow';
93
42
  import type { ICQConnection } from '../types.js';
94
43
  import type { PortAllocator } from '@agoric/network';
95
44
  import type { Remote } from '@agoric/internal';
96
45
  import type { ICQConnectionKit } from '../types.js';
97
46
  import type { IcaAccountKit } from '../types.js';
47
+ import type { Port } from '@agoric/network';
98
48
  //# 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":"AAmQO,qDAJI,IAAI,YACJ,QAAQ;;QA5IX;;;;;;WAMG;0BALQ,IAAI,+BACJ;YACV,OAAW,EAAE,MAAM,CAAC;YACpB,cAAkB,EAAE,gBAAgB,CAAC;SAClC;;;QAgBJ;;;;;;WAMG;0BALQ,IAAI,oCACJ;YACV,cAAkB,EAAE,gBAAgB,CAAC;YACrC,YAAgB,EAAE,MAAM,CAAC;SACtB;;IAkBN;;;;OAIG;;QAED;;;;;;;WAOG;iCANQ,UAAU,gDACV;YACV,aAAiB,EAAE,aAAa,CAAC;YACjC,WAAe,EAAE,MAAM,CAAC;YACxB,YAAgB,CAAC,EAAE,MAAM,CAAC;SACvB;;;QAaJ;;;;;;;;;WASG;6BAPQ,MAAM,oBACN,eAAe,0BAEf,eAAe,6CAGb,IAAI,UAAU,CAAC;QAkB5B;;;;;WAKG;qDAHQ,eAAe,iCAEb,IAAI,aAAa,CAAC,GAAG,aAAa;;cA6DtD;;mBAxPa,OAAO,aAAa,CAAC;;;;;cACrB,SAAS;;iCAIT,QAAQ,CAAC,MAAM,EAAE,gBAAgB,CAAC;4BAElC,aAAa,GAAG,gBAAgB;iCAGjC;IACZ,cAAkB,EAAE,kBAAkB,CAAC;IACvC,aAAiB,EAAE,OAAO,IAAI,CAAC,GAAG,SAAS,CAAC;CACzC,GAAG,mBAAmB;0CA8OZ,UAAU,CAAC,OAAO,8BAA8B,CAAC;0BAxQxC,mBAAmB;8BAKV,aAAa;0BAHK,iBAAiB;sCAEhC,iCAAiC;yBACpC,aAAa;gCAHK,iBAAiB;qCACjC,cAAc;2CAIR,qBAAqB;gCAD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