@agoric/orchestration 0.2.0-upgrade-20-dev-ef71cfd.0 → 0.2.0-upgrade-19-devnet-dev-5428c4d.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 (125) hide show
  1. package/package.json +27 -29
  2. package/src/chain-capabilities.d.ts +12 -7
  3. package/src/chain-capabilities.d.ts.map +1 -1
  4. package/src/chain-capabilities.js +21 -46
  5. package/src/chain-info.d.ts +97 -839
  6. package/src/chain-info.d.ts.map +1 -1
  7. package/src/chain-info.js +12 -38
  8. package/src/cosmos-api.d.ts +13 -41
  9. package/src/cosmos-api.d.ts.map +1 -1
  10. package/src/cosmos-api.ts +16 -52
  11. package/src/ethereum-api.d.ts +5 -6
  12. package/src/ethereum-api.d.ts.map +1 -1
  13. package/src/ethereum-api.ts +5 -7
  14. package/src/examples/auto-stake-it-tap-kit.d.ts +4 -4
  15. package/src/examples/auto-stake-it-tap-kit.d.ts.map +1 -1
  16. package/src/examples/auto-stake-it-tap-kit.js +8 -8
  17. package/src/examples/auto-stake-it.contract.d.ts +23 -5
  18. package/src/examples/auto-stake-it.contract.d.ts.map +1 -1
  19. package/src/examples/auto-stake-it.contract.js +0 -1
  20. package/src/examples/basic-flows.contract.d.ts +13 -5
  21. package/src/examples/basic-flows.contract.d.ts.map +1 -1
  22. package/src/examples/basic-flows.contract.js +0 -1
  23. package/src/examples/send-anywhere.contract.d.ts +27 -7
  24. package/src/examples/send-anywhere.contract.d.ts.map +1 -1
  25. package/src/examples/send-anywhere.contract.js +12 -40
  26. package/src/examples/send-anywhere.flows.d.ts +3 -563
  27. package/src/examples/send-anywhere.flows.d.ts.map +1 -1
  28. package/src/examples/send-anywhere.flows.js +31 -112
  29. package/src/examples/stake-bld.contract.d.ts +7 -8
  30. package/src/examples/stake-bld.contract.d.ts.map +1 -1
  31. package/src/examples/stake-bld.contract.js +1 -3
  32. package/src/examples/stake-ica.contract.d.ts +13 -82
  33. package/src/examples/stake-ica.contract.d.ts.map +1 -1
  34. package/src/examples/stake-ica.contract.js +0 -1
  35. package/src/examples/staking-combinations.contract.d.ts +11 -3
  36. package/src/examples/staking-combinations.contract.d.ts.map +1 -1
  37. package/src/examples/staking-combinations.contract.js +4 -5
  38. package/src/examples/staking-combinations.flows.d.ts +2 -2
  39. package/src/examples/staking-combinations.flows.d.ts.map +1 -1
  40. package/src/examples/staking-combinations.flows.js +4 -4
  41. package/src/examples/swap.contract.d.ts +13 -4
  42. package/src/examples/swap.contract.d.ts.map +1 -1
  43. package/src/examples/swap.contract.js +2 -2
  44. package/src/examples/unbond.contract.d.ts +2 -2
  45. package/src/exos/README.md +0 -1
  46. package/src/exos/chain-hub-admin.d.ts +9 -9
  47. package/src/exos/chain-hub-admin.d.ts.map +1 -1
  48. package/src/exos/chain-hub-admin.js +17 -17
  49. package/src/exos/chain-hub.d.ts +17 -69
  50. package/src/exos/chain-hub.d.ts.map +1 -1
  51. package/src/exos/chain-hub.js +55 -289
  52. package/src/exos/cosmos-orchestration-account.d.ts +17 -86
  53. package/src/exos/cosmos-orchestration-account.d.ts.map +1 -1
  54. package/src/exos/cosmos-orchestration-account.js +26 -111
  55. package/src/exos/ibc-packet.d.ts +0 -1
  56. package/src/exos/ibc-packet.d.ts.map +1 -1
  57. package/src/exos/ibc-packet.js +1 -8
  58. package/src/exos/ica-account-kit.d.ts +4 -8
  59. package/src/exos/ica-account-kit.d.ts.map +1 -1
  60. package/src/exos/ica-account-kit.js +5 -8
  61. package/src/exos/local-chain-facade.d.ts +23 -3
  62. package/src/exos/local-chain-facade.d.ts.map +1 -1
  63. package/src/exos/local-chain-facade.js +3 -3
  64. package/src/exos/local-orchestration-account.d.ts +12 -16
  65. package/src/exos/local-orchestration-account.d.ts.map +1 -1
  66. package/src/exos/local-orchestration-account.js +8 -13
  67. package/src/exos/orchestrator.d.ts +15 -5
  68. package/src/exos/orchestrator.d.ts.map +1 -1
  69. package/src/exos/orchestrator.js +10 -9
  70. package/src/exos/packet-tools.d.ts +1 -1
  71. package/src/exos/packet-tools.d.ts.map +1 -1
  72. package/src/exos/packet-tools.js +12 -17
  73. package/src/exos/portfolio-holder-kit.d.ts +0 -1
  74. package/src/exos/portfolio-holder-kit.d.ts.map +1 -1
  75. package/src/exos/portfolio-holder-kit.js +0 -1
  76. package/src/exos/remote-chain-facade.d.ts +15 -5
  77. package/src/exos/remote-chain-facade.d.ts.map +1 -1
  78. package/src/exos/remote-chain-facade.js +13 -23
  79. package/src/facade.js +1 -1
  80. package/src/fetched-chain-info.d.ts +86 -676
  81. package/src/fetched-chain-info.js +41 -553
  82. package/src/fixtures/query-flows.contract.d.ts +4 -5
  83. package/src/fixtures/query-flows.contract.d.ts.map +1 -1
  84. package/src/fixtures/query-flows.contract.js +0 -1
  85. package/src/orchestration-api.d.ts +16 -73
  86. package/src/orchestration-api.d.ts.map +1 -1
  87. package/src/orchestration-api.ts +19 -89
  88. package/src/proposals/start-send-anywhere.js +0 -4
  89. package/src/typeGuards.d.ts +4 -20
  90. package/src/typeGuards.d.ts.map +1 -1
  91. package/src/typeGuards.js +13 -52
  92. package/src/types.d.ts +1 -1
  93. package/src/types.d.ts.map +1 -1
  94. package/src/types.ts +1 -2
  95. package/src/utils/address.d.ts +3 -13
  96. package/src/utils/address.d.ts.map +1 -1
  97. package/src/utils/address.js +5 -97
  98. package/src/utils/chain-hub-helper.d.ts +2 -2
  99. package/src/utils/chain-hub-helper.d.ts.map +1 -1
  100. package/src/utils/chain-hub-helper.js +5 -9
  101. package/src/utils/cosmos.d.ts +1 -1
  102. package/src/utils/cosmos.d.ts.map +1 -1
  103. package/src/utils/cosmos.js +2 -2
  104. package/src/utils/orchestrationAccount.js +5 -6
  105. package/src/utils/registry.d.ts +12 -2
  106. package/src/utils/registry.d.ts.map +1 -1
  107. package/src/utils/registry.js +2 -4
  108. package/src/utils/start-helper.d.ts +6 -20
  109. package/src/utils/start-helper.d.ts.map +1 -1
  110. package/src/utils/start-helper.js +2 -13
  111. package/src/utils/zoe-tools.d.ts +2 -2
  112. package/src/utils/zoe-tools.d.ts.map +1 -1
  113. package/src/utils/zoe-tools.js +2 -5
  114. package/tools/ibc-mocks.d.ts +5 -6
  115. package/tools/ibc-mocks.d.ts.map +1 -1
  116. package/tools/ibc-mocks.ts +4 -10
  117. package/tools/make-test-address.d.ts +1 -2
  118. package/tools/make-test-address.d.ts.map +1 -1
  119. package/tools/make-test-address.js +2 -6
  120. package/src/cctp-chain-info.d.ts +0 -65
  121. package/src/cctp-chain-info.d.ts.map +0 -1
  122. package/src/cctp-chain-info.js +0 -52
  123. package/src/utils/chain-info.d.ts +0 -5
  124. package/src/utils/chain-info.d.ts.map +0 -1
  125. package/src/utils/chain-info.js +0 -11
@@ -1,6 +1,16 @@
1
- export function prepareRemoteChainFacade(zone: Zone, powers: RemoteChainFacadePowers): (remoteChainInfo: ChainInfo, connectionInfo?: IBCConnectionInfo | undefined) => import("@endo/exo").Guarded<{
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<{
2
12
  getChainInfo(): Vow<any>;
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("../cosmos-api.js").NobleMethods> | 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 & import("../cosmos-api.js").NobleMethods> | 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>>;
13
+ 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>>;
4
14
  query(msgs: {
5
15
  data: string;
6
16
  path: string;
@@ -32,14 +42,13 @@ export type RemoteChainFacadePowers = {
32
42
  vowTools: VowTools;
33
43
  };
34
44
  export type RemoteChainFacadeState = {
35
- remoteChainInfo: ChainInfo;
36
- connectionInfo: IBCConnectionInfo | undefined;
45
+ remoteChainInfo: CosmosChainInfo;
46
+ connectionInfo: IBCConnectionInfo;
37
47
  icqConnection: ICQConnection | undefined;
38
48
  };
39
49
  export type MakeRemoteChainFacade = ReturnType<typeof prepareRemoteChainFacade>;
40
50
  export type RemoteChainFacade = ReturnType<MakeRemoteChainFacade>;
41
51
  import type { Zone } from '@agoric/base-zone';
42
- import type { ChainInfo } from '../types.js';
43
52
  import type { IBCConnectionInfo } from '../types.js';
44
53
  import type { Vow } from '@agoric/vow';
45
54
  import type { prepareCosmosOrchestrationAccount } from './cosmos-orchestration-account.js';
@@ -47,5 +56,6 @@ import type { CosmosInterchainService } from './exo-interfaces.js';
47
56
  import type { Remote } from '@agoric/internal';
48
57
  import type { TimerService } from '@agoric/time';
49
58
  import type { VowTools } from '@agoric/vow';
59
+ import type { CosmosChainInfo } from '../types.js';
50
60
  import type { ICQConnection } from '../types.js';
51
61
  //# 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":"AAiRO,+CAHI,IAAI,UACJ,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;GAKjC;sCAtPY;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;oCAyOU,UAAU,CAAC,OAAO,wBAAwB,CAAC;gCAC3C,UAAU,CAAC,qBAAqB,CAAC;0BAzQxB,mBAAmB;+BAS4E,aAAa;uCAAb,aAAa;yBAJnG,aAAa;uDAGO,mCAAmC;6CAD7C,qBAAqB;4BAHtC,kBAAkB;kCADZ,cAAc;8BAEb,aAAa;mCAIyE,aAAa"}
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;uCAS2D,aAAa;yBAJlF,aAAa;uDAGO,mCAAmC;6CAD7C,qBAAqB;4BAHtC,kBAAkB;kCADZ,cAAc;8BAEb,aAAa;qCAIwD,aAAa;mCAAb,aAAa"}
@@ -6,7 +6,7 @@ import { M } from '@endo/patterns';
6
6
  import { pickFacet } from '@agoric/vat-data';
7
7
  import { VowShape } from '@agoric/vow';
8
8
  import {
9
- CosmosChainAddressShape,
9
+ ChainAddressShape,
10
10
  chainFacadeMethods,
11
11
  ICQMsgShape,
12
12
  } from '../typeGuards.js';
@@ -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, ChainInfo} from '../types.js';
25
+ * @import {CosmosChainInfo, IBCConnectionInfo, ChainAddress, IcaAccount, Chain, ICQConnection} 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: ChainInfo;
45
- * connectionInfo: IBCConnectionInfo | undefined;
44
+ * remoteChainInfo: CosmosChainInfo;
45
+ * connectionInfo: IBCConnectionInfo;
46
46
  * icqConnection: ICQConnection | undefined;
47
47
  * }} RemoteChainFacadeState
48
48
  */
@@ -89,22 +89,22 @@ const prepareRemoteChainFacadeKit = (
89
89
  ),
90
90
  getAddressesWatcher: M.interface('getAddressWatcher', {
91
91
  onFulfilled: M.call(
92
- [CosmosChainAddressShape, M.string(), M.string()],
92
+ [ChainAddressShape, M.string(), M.string()],
93
93
  M.remotable(),
94
94
  ).returns(VowShape),
95
95
  }),
96
96
  makeChildNodeWatcher: M.interface('makeChildNodeWatcher', {
97
97
  onFulfilled: M.call(M.or(M.remotable(), M.undefined()), {
98
98
  account: M.remotable(),
99
- chainAddress: CosmosChainAddressShape,
99
+ chainAddress: ChainAddressShape,
100
100
  localAddress: M.string(),
101
101
  remoteAddress: M.string(),
102
102
  }).returns(M.remotable()),
103
103
  }),
104
104
  },
105
105
  /**
106
- * @param {ChainInfo} remoteChainInfo
107
- * @param {IBCConnectionInfo} [connectionInfo]
106
+ * @param {CosmosChainInfo} remoteChainInfo
107
+ * @param {IBCConnectionInfo} connectionInfo
108
108
  */
109
109
  (remoteChainInfo, connectionInfo) => {
110
110
  trace('making a RemoteChainFacade');
@@ -126,21 +126,15 @@ 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
-
134
129
  // icqConnection is ultimately retrieved from state, but let's
135
130
  // create a connection if it doesn't exist
136
131
  const icqConnOrUndefinedV =
137
- /** @type {CosmosChainInfo} */ (remoteChainInfo)?.icqEnabled &&
138
- !this.state.icqConnection
132
+ remoteChainInfo.icqEnabled && !this.state.icqConnection
139
133
  ? E(orchestration).provideICQConnection(connectionInfo.id)
140
134
  : undefined;
141
135
 
142
136
  const makeAccountV = E(orchestration).makeAccount(
143
- /** @type {CosmosChainInfo} */ (remoteChainInfo).chainId,
137
+ remoteChainInfo.chainId,
144
138
  connectionInfo.counterparty.connection_id,
145
139
  connectionInfo.id,
146
140
  );
@@ -159,16 +153,12 @@ const prepareRemoteChainFacadeKit = (
159
153
  query(msgs) {
160
154
  return asVow(() => {
161
155
  const {
162
- /** @type {CosmosChainInfo} */
163
156
  remoteChainInfo: { icqEnabled, chainId },
164
- /** @type {IBCConnectionInfo | undefined} */
165
157
  connectionInfo,
166
- } = /** @type {any} */ (this.state);
167
-
158
+ } = this.state;
168
159
  if (!icqEnabled) {
169
160
  throw Fail`Queries not available for chain ${q(chainId)}`;
170
161
  }
171
- if (!connectionInfo) throw Fail`IBC connection info not found`;
172
162
  // if none exists, make one and still send the query in the handler
173
163
  if (!this.state.icqConnection) {
174
164
  return watch(
@@ -216,7 +206,7 @@ const prepareRemoteChainFacadeKit = (
216
206
  },
217
207
  getAddressesWatcher: {
218
208
  /**
219
- * @param {[CosmosChainAddress, LocalIbcAddress, RemoteIbcAddress]} chainAddresses
209
+ * @param {[ChainAddress, LocalIbcAddress, RemoteIbcAddress]} chainAddresses
220
210
  * @param {IcaAccount} account
221
211
  */
222
212
  onFulfilled([chainAddress, localAddress, remoteAddress], account) {
@@ -236,7 +226,7 @@ const prepareRemoteChainFacadeKit = (
236
226
  * @param {Remote<StorageNode> | undefined} childNode
237
227
  * @param {{
238
228
  * account: IcaAccount;
239
- * chainAddress: CosmosChainAddress;
229
+ * chainAddress: ChainAddress;
240
230
  * localAddress: LocalIbcAddress;
241
231
  * remoteAddress: RemoteIbcAddress;
242
232
  * }} ctx
package/src/facade.js CHANGED
@@ -118,7 +118,7 @@ export const makeOrchestrationFacade = ({
118
118
 
119
119
  const mappedContext = deepMapObject(
120
120
  hostCtx,
121
- val => mappedFlows.get(/** @type {any} */ (val)) || val,
121
+ val => mappedFlows.get(val) || val,
122
122
  );
123
123
 
124
124
  const orcFns = /** @type {{ [N in keyof GFM]: HostForGuest<GFM[N]> }} */ (