@agoric/orchestration 0.2.0 → 0.2.1-upgrade-23-dev-bd79330.0.bd79330

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 (234) hide show
  1. package/index.js +0 -4
  2. package/package.json +27 -27
  3. package/src/axelar-types.d.ts +2 -0
  4. package/src/axelar-types.d.ts.map +1 -1
  5. package/src/axelar-types.js +2 -0
  6. package/src/cctp-chain-info.js +4 -1
  7. package/src/chain-info.d.ts +21 -6
  8. package/src/chain-info.d.ts.map +1 -1
  9. package/src/chain-info.js +9 -8
  10. package/src/cosmos-api.d.ts +102 -29
  11. package/src/cosmos-api.d.ts.map +1 -1
  12. package/src/cosmos-api.js +585 -0
  13. package/src/{ethereum-api.ts → ethereum-api.js} +1 -1
  14. package/src/examples/auto-stake-it-tap-kit.d.ts +4 -3
  15. package/src/examples/auto-stake-it-tap-kit.d.ts.map +1 -1
  16. package/src/examples/auto-stake-it-tap-kit.js +3 -4
  17. package/src/examples/auto-stake-it.contract.d.ts +6 -4
  18. package/src/examples/auto-stake-it.contract.d.ts.map +1 -1
  19. package/src/examples/auto-stake-it.contract.js +3 -1
  20. package/src/examples/auto-stake-it.flows.d.ts +2 -1
  21. package/src/examples/auto-stake-it.flows.d.ts.map +1 -1
  22. package/src/examples/auto-stake-it.flows.js +1 -0
  23. package/src/examples/axelar-gmp-account-kit.d.ts +6 -4
  24. package/src/examples/axelar-gmp-account-kit.d.ts.map +1 -1
  25. package/src/examples/axelar-gmp-account-kit.js +4 -2
  26. package/src/examples/axelar-gmp.contract.d.ts +8 -8
  27. package/src/examples/axelar-gmp.contract.d.ts.map +1 -1
  28. package/src/examples/axelar-gmp.contract.js +2 -2
  29. package/src/examples/axelar-gmp.flows.d.ts +1 -1
  30. package/src/examples/basic-flows.contract.d.ts +7 -5
  31. package/src/examples/basic-flows.contract.d.ts.map +1 -1
  32. package/src/examples/basic-flows.contract.js +3 -1
  33. package/src/examples/basic-flows.flows.d.ts +2 -1
  34. package/src/examples/basic-flows.flows.d.ts.map +1 -1
  35. package/src/examples/basic-flows.flows.js +1 -0
  36. package/src/examples/send-anywhere.contract.d.ts +12 -6
  37. package/src/examples/send-anywhere.contract.d.ts.map +1 -1
  38. package/src/examples/send-anywhere.contract.js +4 -1
  39. package/src/examples/send-anywhere.flows.d.ts +3 -2
  40. package/src/examples/send-anywhere.flows.d.ts.map +1 -1
  41. package/src/examples/send-anywhere.flows.js +3 -6
  42. package/src/examples/stake-bld.contract.d.ts +206 -25
  43. package/src/examples/stake-bld.contract.d.ts.map +1 -1
  44. package/src/examples/stake-bld.contract.js +19 -4
  45. package/src/examples/stake-ica.contract.d.ts +434 -71
  46. package/src/examples/stake-ica.contract.d.ts.map +1 -1
  47. package/src/examples/stake-ica.contract.js +28 -6
  48. package/src/examples/staking-combinations.contract.d.ts +4 -2
  49. package/src/examples/staking-combinations.contract.d.ts.map +1 -1
  50. package/src/examples/staking-combinations.contract.js +5 -3
  51. package/src/examples/staking-combinations.flows.d.ts +3 -2
  52. package/src/examples/staking-combinations.flows.d.ts.map +1 -1
  53. package/src/examples/staking-combinations.flows.js +7 -6
  54. package/src/examples/swap-anything.contract.d.ts +14 -7
  55. package/src/examples/swap-anything.contract.d.ts.map +1 -1
  56. package/src/examples/swap-anything.contract.js +12 -8
  57. package/src/examples/swap.contract.d.ts +18 -6
  58. package/src/examples/swap.contract.d.ts.map +1 -1
  59. package/src/examples/swap.contract.js +9 -3
  60. package/src/examples/swap.flows.d.ts +2 -0
  61. package/src/examples/swap.flows.d.ts.map +1 -1
  62. package/src/examples/swap.flows.js +2 -0
  63. package/src/examples/unbond.contract.d.ts +7 -4
  64. package/src/examples/unbond.contract.d.ts.map +1 -1
  65. package/src/examples/unbond.contract.js +6 -3
  66. package/src/exos/chain-hub-admin.d.ts +1 -19
  67. package/src/exos/chain-hub-admin.d.ts.map +1 -1
  68. package/src/exos/chain-hub-admin.js +1 -1
  69. package/src/exos/chain-hub.d.ts +4 -2
  70. package/src/exos/chain-hub.d.ts.map +1 -1
  71. package/src/exos/chain-hub.js +2 -1
  72. package/src/exos/combine-invitation-makers.d.ts +2 -1
  73. package/src/exos/combine-invitation-makers.d.ts.map +1 -1
  74. package/src/exos/combine-invitation-makers.js +2 -1
  75. package/src/exos/cosmos-orchestration-account.d.ts +615 -98
  76. package/src/exos/cosmos-orchestration-account.d.ts.map +1 -1
  77. package/src/exos/cosmos-orchestration-account.js +695 -306
  78. package/src/exos/exo-interfaces.js +35 -0
  79. package/src/exos/ibc-packet.d.ts +11 -9
  80. package/src/exos/ibc-packet.d.ts.map +1 -1
  81. package/src/exos/ibc-packet.js +33 -8
  82. package/src/exos/ica-account-kit.d.ts +4 -9
  83. package/src/exos/ica-account-kit.d.ts.map +1 -1
  84. package/src/exos/ica-account-kit.js +10 -7
  85. package/src/exos/icq-connection-kit.d.ts +1 -1
  86. package/src/exos/local-chain-facade.d.ts +1542 -5
  87. package/src/exos/local-chain-facade.d.ts.map +1 -1
  88. package/src/exos/local-chain-facade.js +4 -2
  89. package/src/exos/local-orchestration-account.d.ts +201 -56
  90. package/src/exos/local-orchestration-account.d.ts.map +1 -1
  91. package/src/exos/local-orchestration-account.js +260 -51
  92. package/src/exos/orchestrator.d.ts +35813 -73
  93. package/src/exos/orchestrator.d.ts.map +1 -1
  94. package/src/exos/orchestrator.js +7 -10
  95. package/src/exos/packet-tools.d.ts +19 -8
  96. package/src/exos/packet-tools.d.ts.map +1 -1
  97. package/src/exos/packet-tools.js +92 -9
  98. package/src/exos/portfolio-holder-kit.d.ts +90 -2
  99. package/src/exos/portfolio-holder-kit.d.ts.map +1 -1
  100. package/src/exos/remote-chain-facade.d.ts +1499 -1
  101. package/src/exos/remote-chain-facade.d.ts.map +1 -1
  102. package/src/exos/remote-chain-facade.js +8 -3
  103. package/src/facade.d.ts +1 -0
  104. package/src/facade.d.ts.map +1 -1
  105. package/src/facade.js +4 -6
  106. package/src/fixtures/query-flows.contract.d.ts +8 -6
  107. package/src/fixtures/query-flows.contract.d.ts.map +1 -1
  108. package/src/fixtures/query-flows.contract.js +3 -1
  109. package/src/fixtures/query-flows.flows.d.ts +1 -0
  110. package/src/fixtures/query-flows.flows.d.ts.map +1 -1
  111. package/src/fixtures/query-flows.flows.js +1 -0
  112. package/src/orchestration-api.d.ts +46 -16
  113. package/src/orchestration-api.d.ts.map +1 -1
  114. package/src/orchestration-api.js +410 -0
  115. package/src/proposals/init-chain-info.js +10 -2
  116. package/src/proposals/orchestration-proposal.js +3 -0
  117. package/src/proposals/revise-chain-info.js +4 -1
  118. package/src/proposals/start-auto-stake-it.js +1 -0
  119. package/src/proposals/start-axelar-gmp.js +2 -2
  120. package/src/proposals/start-basic-flows.js +5 -0
  121. package/src/proposals/start-send-anywhere.js +4 -2
  122. package/src/proposals/start-stakeAtom.js +5 -4
  123. package/src/proposals/start-stakeBld.js +8 -6
  124. package/src/proposals/start-stakeOsmo.js +5 -4
  125. package/src/proposals/start-swap-anything.js +4 -2
  126. package/src/stubs/{viem-abi.d.ts → viem-typedData.js} +10 -4
  127. package/src/typeGuards.d.ts +38 -5
  128. package/src/typeGuards.d.ts.map +1 -1
  129. package/src/typeGuards.js +92 -22
  130. package/src/types.d.ts +1 -0
  131. package/src/types.d.ts.map +1 -1
  132. package/src/types.js +27 -0
  133. package/src/utils/abitype.d.ts +6 -0
  134. package/src/utils/abitype.d.ts.map +1 -0
  135. package/src/utils/abitype.js +13 -0
  136. package/src/utils/address.d.ts +3 -1
  137. package/src/utils/address.d.ts.map +1 -1
  138. package/src/utils/address.js +24 -2
  139. package/src/utils/agd-lib.d.ts +1 -51
  140. package/src/utils/agd-lib.d.ts.map +1 -1
  141. package/src/utils/agd-lib.js +1 -1
  142. package/src/utils/amounts.d.ts +1 -0
  143. package/src/utils/amounts.d.ts.map +1 -1
  144. package/src/utils/amounts.js +1 -0
  145. package/src/utils/asset.d.ts +1 -0
  146. package/src/utils/asset.d.ts.map +1 -1
  147. package/src/utils/asset.js +1 -0
  148. package/src/utils/chain-hub-helper.d.ts +1 -0
  149. package/src/utils/chain-hub-helper.d.ts.map +1 -1
  150. package/src/utils/chain-hub-helper.js +1 -0
  151. package/src/utils/codecs.d.ts +145 -0
  152. package/src/utils/codecs.d.ts.map +1 -0
  153. package/src/utils/codecs.js +206 -0
  154. package/src/utils/cosmos.d.ts +5 -4
  155. package/src/utils/cosmos.d.ts.map +1 -1
  156. package/src/utils/cosmos.js +29 -9
  157. package/src/utils/exo-helpers.d.ts +156 -0
  158. package/src/utils/exo-helpers.d.ts.map +1 -0
  159. package/src/utils/exo-helpers.js +241 -0
  160. package/src/utils/gmp.d.ts +2 -2
  161. package/src/utils/gmp.d.ts.map +1 -1
  162. package/src/utils/gmp.js +31 -15
  163. package/src/utils/orchestrationAccount.d.ts +79 -0
  164. package/src/utils/orchestrationAccount.d.ts.map +1 -1
  165. package/src/utils/orchestrationAccount.js +210 -6
  166. package/src/utils/packet.d.ts.map +1 -1
  167. package/src/utils/packet.js +5 -0
  168. package/src/utils/permit2/signatureTransfer.d.ts +221 -0
  169. package/src/utils/permit2/signatureTransfer.d.ts.map +1 -0
  170. package/src/utils/permit2/signatureTransfer.js +265 -0
  171. package/src/utils/permit2/signatureTransferHelpers.d.ts +334 -0
  172. package/src/utils/permit2/signatureTransferHelpers.d.ts.map +1 -0
  173. package/src/utils/permit2/signatureTransferHelpers.js +270 -0
  174. package/src/utils/permit2.d.ts +11 -0
  175. package/src/utils/permit2.d.ts.map +1 -0
  176. package/src/utils/permit2.js +11 -0
  177. package/src/utils/progress.d.ts +41 -0
  178. package/src/utils/progress.d.ts.map +1 -0
  179. package/src/utils/progress.js +180 -0
  180. package/src/utils/start-helper.d.ts +28 -10
  181. package/src/utils/start-helper.d.ts.map +1 -1
  182. package/src/utils/start-helper.js +30 -7
  183. package/src/utils/time.d.ts +2 -2
  184. package/src/utils/time.d.ts.map +1 -1
  185. package/src/utils/time.js +1 -1
  186. package/src/utils/viem-utils/hashTypedData.d.ts +21 -0
  187. package/src/utils/viem-utils/hashTypedData.d.ts.map +1 -0
  188. package/src/utils/viem-utils/hashTypedData.js +61 -0
  189. package/src/utils/viem-utils/types.d.ts +6 -0
  190. package/src/utils/viem-utils/types.d.ts.map +1 -0
  191. package/src/utils/viem-utils/types.js +18 -0
  192. package/src/utils/viem.d.ts +11 -0
  193. package/src/utils/viem.d.ts.map +1 -0
  194. package/src/utils/viem.js +11 -0
  195. package/src/utils/zcf-tools.d.ts +15 -1
  196. package/src/utils/zcf-tools.d.ts.map +1 -1
  197. package/src/utils/zcf-tools.js +19 -3
  198. package/src/utils/zoe-tools.d.ts +5 -2
  199. package/src/utils/zoe-tools.d.ts.map +1 -1
  200. package/src/utils/zoe-tools.js +8 -2
  201. package/src/vat-orchestration.d.ts +5 -3
  202. package/src/vat-orchestration.d.ts.map +1 -1
  203. package/src/vat-orchestration.js +4 -3
  204. package/src/vendor/viem/{_esm-YOAV66U4.js → _esm-OKAICHVC.js} +2 -2
  205. package/src/vendor/viem/{ccip-AAQDZF3N.js → ccip-34BSSMV5.js} +1 -2
  206. package/src/vendor/viem/{chunk-4EF4K2MH.js → chunk-GCI53Z2G.js} +35 -1
  207. package/src/vendor/viem/chunk-ZKSIP2AM.js +326 -0
  208. package/src/vendor/viem/viem-abi.js +2 -2
  209. package/src/vendor/viem/viem-typedData.d.ts +19 -0
  210. package/src/vendor/viem/viem-typedData.js +59 -0
  211. package/tools/contract-tests.d.ts +34 -19
  212. package/tools/contract-tests.d.ts.map +1 -1
  213. package/tools/contract-tests.ts +15 -3
  214. package/tools/ibc-mock-fixtures.d.ts +49 -0
  215. package/tools/ibc-mock-fixtures.d.ts.map +1 -0
  216. package/tools/ibc-mock-fixtures.ts +161 -0
  217. package/tools/ibc-mocks.d.ts +2 -3
  218. package/tools/ibc-mocks.d.ts.map +1 -1
  219. package/tools/ibc-mocks.ts +2 -1
  220. package/tools/make-test-address.d.ts +1 -1
  221. package/tools/make-test-address.d.ts.map +1 -1
  222. package/tools/make-test-address.js +1 -2
  223. package/tools/network-fakes.d.ts +142 -0
  224. package/tools/network-fakes.d.ts.map +1 -0
  225. package/tools/network-fakes.ts +388 -0
  226. package/tsup.config.ts +3 -1
  227. package/src/cosmos-api.ts +0 -469
  228. package/src/exos/exo-interfaces.ts +0 -35
  229. package/src/orchestration-api.ts +0 -365
  230. package/src/stubs/viem-abi.d.ts.map +0 -1
  231. package/src/types.ts +0 -26
  232. package/src/vendor/viem/chunk-XN4LUOIH.js +0 -253
  233. package/src/vendor/viem/secp256k1-WHBDSQB2.js +0 -1914
  234. /package/src/stubs/{viem-abi.ts → viem-abi.js} +0 -0
@@ -1,365 +0,0 @@
1
- /**
2
- * @file General API of orchestration
3
- * - must not have chain-specific types without runtime narrowing by chain id
4
- * - should remain relatively stable.
5
- */
6
- import type { Amount, Brand, NatAmount } from '@agoric/ertp/src/types.js';
7
- // eslint-disable-next-line @typescript-eslint/no-unused-vars -- fails to notice the @see uses
8
- import type { CurrentWalletRecord } from '@agoric/smart-wallet/src/smartWallet.js';
9
- import type { Timestamp } from '@agoric/time';
10
- import type { QueryManyFn } from '@agoric/vats/src/localchain.js';
11
- import type { ResolvedPublicTopic } from '@agoric/zoe/src/contractSupport/topics.js';
12
- import type { Passable } from '@endo/marshal';
13
- import type {
14
- AgoricChainMethods,
15
- CosmosChainAccountMethods,
16
- CosmosChainInfo,
17
- IBCMsgTransferOptions,
18
- KnownChains,
19
- LocalAccountMethods,
20
- ICQQueryFunction,
21
- KnownNamespace,
22
- NobleMethods,
23
- Bech32Address,
24
- } from './types.js';
25
- import type { ResolvedContinuingOfferResult } from './utils/zoe-tools.js';
26
-
27
- /**
28
- * A denom that designates a path to a token type on some blockchain.
29
- *
30
- * Multiple denoms may designate the same underlying base denom (e.g., `uist`,
31
- * `uatom`) on different Chains or on the same Chain via different paths. On
32
- * Cosmos chains, all but the base denom are IBC style denoms, but that may vary
33
- * across other chains. All the denoms that designate the same underlying base
34
- * denom form an equivalence class, along with the unique Brand on the local
35
- * Chain. Some operations accept any member of the equivalence class to
36
- * effectively designate the corresponding token type on the target chain.
37
- */
38
- export type Denom = string; // ibc/... or uist
39
-
40
- // ??? when multiple Denoms provide paths to the same remote token type,
41
- // should the brand be 1:1 with that equivalence class or each Denom?
42
- /**
43
- * In many cases, either a denom string or a local Brand can be used to
44
- * designate a remote token type.
45
- */
46
- export type DenomArg = Denom | Brand<'nat'>;
47
-
48
- /**
49
- * Count of some fungible token on some blockchain.
50
- *
51
- * @see {@link Orchestrator.asAmount} to convert to an Amount surjectively
52
- */
53
- export type DenomAmount = {
54
- denom: Denom;
55
- value: bigint; // Nat
56
- };
57
-
58
- /** Amounts can be provided as pure data using denoms or as ERTP Amounts */
59
- export type AmountArg = DenomAmount | Amount<'nat'>;
60
-
61
- /**
62
- * Per `chain_id` in CAIP-2. In that spec all chain IDs are scoped
63
- * (namespace:reference) but in the Cosmos ecosystem the namespace is implied
64
- * and they use `chain_id`/`chainId` for what CAIP-2 calls the `reference`. We
65
- * qualify the term here to avoid confusion.
66
- *
67
- * @see {@link https://chainagnostic.org/CAIPs/caip-2}
68
- */
69
- export type CaipChainId = `${string}:${string}`;
70
-
71
- /**
72
- * à la CAIP-10
73
- *
74
- * account_id: chain_id + ":" + account_address
75
- * chain_id: [-a-z0-9]{3,8}:[-_a-zA-Z0-9]{1,32} (See [CAIP-2][])
76
- * account_address: [-.%a-zA-Z0-9]{1,128}
77
- *
78
- * @see {@link https://chainagnostic.org/CAIPs/caip-10}
79
- */
80
- export type AccountId = `${CaipChainId}:${string}`;
81
-
82
- /**
83
- * Specific to Cosmos chains
84
- * @see {AccountId} for universal account identifier
85
- */
86
- export type CosmosChainAddress = {
87
- /** Within the Cosmos ecosystem. e.g. `agoric-3' or 'cosmoshub-4' */
88
- chainId: string;
89
- /** The address value used on-chain */
90
- value: Bech32Address;
91
- encoding: 'bech32';
92
- };
93
-
94
- /**
95
- * Info used to identify blockchains across ecosystems
96
- * @see {@link https://chainagnostic.org/CAIPs/caip-2}
97
- */
98
- export interface BaseChainInfo<N extends KnownNamespace = KnownNamespace> {
99
- /** CAIP-2 namespace, e.g. 'cosmos', 'eip155' */
100
- namespace: N;
101
- /** CAIP-2 reference, `e.g. `1`, `agoric-3` */
102
- reference: N extends 'eip155' ? `${number}` : string;
103
- /**
104
- * Circle CCTP Destination Domain
105
- * @see {@link https://developers.circle.com/stablecoins/supported-domains}
106
- */
107
- cctpDestinationDomain?: number;
108
- }
109
-
110
- /**
111
- * Shape that `ChainHub` is expecting
112
- */
113
- export type ChainInfo<N extends KnownNamespace = KnownNamespace> =
114
- N extends 'cosmos' ? CosmosChainInfo : BaseChainInfo<N>;
115
-
116
- /**
117
- * A value that can be converted mechanically to an AccountId.
118
- * @see {@link ChainHub.resolveAccountId}
119
- */
120
- export type AccountIdArg = AccountId | CosmosChainAddress;
121
-
122
- export type Caip10Record = {
123
- namespace: string;
124
- reference: string;
125
- accountAddress: string;
126
- };
127
-
128
- /**
129
- * Object that controls an account on a particular chain.
130
- *
131
- * The methods available depend on the chain and its capabilities.
132
- */
133
- export type OrchestrationAccount<CI extends Partial<ChainInfo>> =
134
- OrchestrationAccountCommon &
135
- (CI extends { chainId: string }
136
- ? CI['chainId'] extends `agoric${string}`
137
- ? LocalAccountMethods
138
- : CI['chainId'] extends `noble${string}`
139
- ? CosmosChainAccountMethods<CI> & NobleMethods
140
- : CosmosChainAccountMethods<CI>
141
- : object);
142
-
143
- /**
144
- * An object for access the core functions of a remote chain.
145
- *
146
- * Note that "remote" can mean the local chain; it's just that
147
- * accounts are treated as remote/arms length for consistency.
148
- */
149
- export interface Chain<CI extends Partial<ChainInfo>> {
150
- getChainInfo: () => Promise<CI>;
151
-
152
- // "makeAccount" suggests an operation within a vat
153
- // TODO: scope to { icaEnabled: true }. Currently, only scoped to `namespace: 'cosmos'` chains
154
- /**
155
- * Creates a new Orchestration Account on the current Chain.
156
- * @returns an object that controls the account
157
- */
158
- makeAccount: () => CI extends { chainId: string }
159
- ? Promise<OrchestrationAccount<CI>>
160
- : never;
161
- // FUTURE supply optional port object; also fetch port object
162
-
163
- query: CI extends { icqEnabled: true }
164
- ? ICQQueryFunction
165
- : CI extends { chainId: string }
166
- ? CI['chainId'] extends `agoric${string}`
167
- ? QueryManyFn
168
- : never
169
- : never;
170
-
171
- // TODO provide a way to get the local denom/brand/whatever for this chain
172
- }
173
-
174
- /**
175
- * Used with `orch.getDenomInfo('ibc/1234')`. See {@link Orchestrator.getDenomInfo}
176
- */
177
- export interface DenomInfo<
178
- HoldingChain extends keyof KnownChains,
179
- IssuingChain extends keyof KnownChains,
180
- > {
181
- /** The well-known Brand on Agoric for the direct asset */
182
- brand?: Brand;
183
- /** The Chain at which the argument `denom` exists (where the asset is currently held) */
184
- chain: Chain<KnownChains[HoldingChain]>;
185
- /** The Chain that is the issuer of the underlying asset */
186
- base: Chain<KnownChains[IssuingChain]>;
187
- /** the Denom for the underlying asset on its issuer chain */
188
- baseDenom: Denom;
189
- }
190
-
191
- /**
192
- * Provided in the callback to `orchestrate()`.
193
- */
194
- export interface Orchestrator {
195
- /**
196
- * Get a Chain object for working with the given chain.
197
- *
198
- * @param {C} chainName name of the chain in KnownChains or the ChainHub backing the Orchestrator
199
- */
200
- getChain: <C extends string>(
201
- chainName: C,
202
- ) => Promise<
203
- Chain<C extends keyof KnownChains ? KnownChains[C] : any> &
204
- (C extends 'agoric' ? AgoricChainMethods : object)
205
- >;
206
-
207
- /**
208
- * For a denom, return information about a denom including the equivalent
209
- * local Brand, the Chain on which the denom is held, and the Chain that
210
- * issues the corresponding asset.
211
- * @param denom
212
- */
213
- getDenomInfo: <
214
- HoldingChain extends keyof KnownChains,
215
- IssuingChain extends keyof KnownChains,
216
- >(
217
- denom: Denom,
218
- srcChainName: HoldingChain,
219
- ) => DenomInfo<HoldingChain, IssuingChain>;
220
-
221
- /**
222
- * Convert an amount described in native data to a local, structured Amount.
223
- * @param amount - the described amount
224
- * @returns the Amount in local structuerd format
225
- */
226
- asAmount: (amount: DenomAmount) => NatAmount;
227
- }
228
-
229
- /**
230
- * An object that supports high-level operations for an account on a remote chain.
231
- */
232
- export interface OrchestrationAccountCommon {
233
- /**
234
- * @returns the address of the account on the remote chain
235
- */
236
- getAddress: () => CosmosChainAddress;
237
-
238
- /**
239
- * @returns an array of amounts for every balance in the account.
240
- *
241
- * @throws when prohibited (see `icqEnabled` in {@link CosmosChainInfo})
242
- */
243
- getBalances: () => Promise<DenomAmount[]>;
244
-
245
- /**
246
- * @returns the balance of a specific denom for the account.
247
- *
248
- * @throws when prohibited (see `icqEnabled` in {@link CosmosChainInfo})
249
- */
250
- getBalance: (denom: DenomArg) => Promise<DenomAmount>;
251
-
252
- /**
253
- * Transfer amount to another account on the same chain. The promise settles when the transfer is complete.
254
- * @param toAccount - the account to send the amount to. MUST be on the same chain
255
- * @param amount - the amount to send
256
- * @returns void
257
- */
258
- send: (toAccount: AccountIdArg, amount: AmountArg) => Promise<void>;
259
-
260
- /**
261
- * Transfer multiple amounts to another account on the same chain. The promise settles when the transfer is complete.
262
- * @param toAccount - the account to send the amount to. MUST be on the same chain
263
- * @param amounts - the amounts to send
264
- * @returns void
265
- */
266
- sendAll: (
267
- toAccount: CosmosChainAddress,
268
- amounts: AmountArg[],
269
- ) => Promise<void>;
270
-
271
- /**
272
- * Transfer an amount to another account, typically on another chain.
273
- * The promise settles when the transfer is complete.
274
- * @param amount - the amount to transfer. Can be provided as pure data using denoms or as ERTP Amounts.
275
- * @param destination - the account to transfer the amount to.
276
- * @param [opts] - an optional memo to include with the transfer, which could drive custom PFM behavior, and timeout parameters
277
- * @returns void
278
- * @throws {Error} if route is not determinable, asset is not recognized, or
279
- * the transfer is rejected (insufficient funds, timeout)
280
- */
281
- transfer: (
282
- destination: AccountIdArg,
283
- amount: AmountArg,
284
- opts?: IBCMsgTransferOptions,
285
- ) => Promise<void>;
286
-
287
- /**
288
- * Transfer an amount to another account in multiple steps. The promise settles when
289
- * the entire path of the transfer is complete.
290
- * @param amount - the amount to transfer
291
- * @param msg - the transfer message, including follow-up steps
292
- * @returns void
293
- */
294
- transferSteps: (amount: AmountArg, msg: TransferMsg) => Promise<void>;
295
-
296
- /**
297
- * Returns `invitationMakers` and `publicSubscribers` to the account
298
- * holder's smart wallet so they can continue interacting with the account
299
- * and read account state in vstorage if published.
300
- */
301
- asContinuingOffer: () => Promise<ResolvedContinuingOfferResult>;
302
-
303
- /**
304
- * Public topics are a map to different vstorage paths and subscribers that
305
- * can be shared with on or offchain clients.
306
- * When returned as part of a continuing invitation, it will appear
307
- * in the {@link CurrentWalletRecord} in vstorage.
308
- */
309
- getPublicTopics: () => Promise<Record<string, ResolvedPublicTopic<unknown>>>;
310
- }
311
-
312
- /**
313
- * Flows to orchestrate are regular Javascript functions but have some
314
- * constraints to fulfill the requirements of resumability after termination of
315
- * the enclosing vat. Some requirements for each orchestration flow:
316
- * - must not close over any values that could change between invocations
317
- * - must satisfy the `OrchestrationFlow` interface
318
- * - must be hardened
319
- * - must not use `E()` (eventual send)
320
- *
321
- * The call to `orchestrate` using a flow function in reincarnations of the vat
322
- * must have the same `durableName` as before. To help enforce these
323
- * constraints, we recommend:
324
- *
325
- * - keeping flows in a `.flows.js` module
326
- * - importing them all with `import * as flows` to get a single object keyed by
327
- * the export name
328
- * - using `orchestrateAll` to treat each export name as the `durableName` of
329
- * the flow
330
- * - adopting `@agoric/eslint-config` that has rules to help detect problems
331
- */
332
- export interface OrchestrationFlow<CT = unknown> {
333
- (orc: Orchestrator, ctx: CT, ...args: Passable[]): Promise<unknown>;
334
- }
335
-
336
- /**
337
- * Internal structure for TransferMsgs.
338
- * The type must be able to express transfers across different chains and transports.
339
- *
340
- * NOTE Expected to change, so consider an opaque structure.
341
- * @internal
342
- */
343
- export interface TransferMsg {
344
- toAccount: CosmosChainAddress;
345
- timeout?: Timestamp;
346
- next?: TransferMsg;
347
- data?: object;
348
- }
349
-
350
- /** @alpha */
351
- export interface AfterAction {
352
- destChain: string;
353
- destAddress: CosmosChainAddress;
354
- }
355
- /** @alpha */
356
- export interface SwapExact {
357
- amountIn: Amount;
358
- amountOut: Amount;
359
- }
360
- /** @alpha */
361
- export interface SwapMaxSlippage {
362
- amountIn: Amount;
363
- brandOut: Brand;
364
- slippage: number;
365
- }
@@ -1 +0,0 @@
1
- {"version":3,"file":"viem-abi.d.ts","sourceRoot":"","sources":["viem-abi.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC"}
package/src/types.ts DELETED
@@ -1,26 +0,0 @@
1
- /** @file Rollup of all type definitions in the package, for local import and external export */
2
-
3
- import type { ZCF } from '@agoric/zoe';
4
-
5
- export type * from './chain-info.js';
6
- export type * from './cosmos-api.js';
7
- export type * from './exos/chain-hub.js';
8
- export type * from './exos/combine-invitation-makers.js';
9
- export type * from './exos/cosmos-interchain-service.js';
10
- export type * from './exos/exo-interfaces.js';
11
- export type * from './exos/ica-account-kit.js';
12
- export type * from './exos/icq-connection-kit.js';
13
- export type * from './exos/local-chain-facade.js';
14
- export type * from './exos/portfolio-holder-kit.js';
15
- export type * from './orchestration-api.js';
16
- export type * from './vat-orchestration.js';
17
- export type * from './utils/start-helper.js';
18
-
19
- /**
20
- * ({@link ZCF})-like tools for use in {@link OrchestrationFlow}s.
21
- */
22
- export interface ZcfTools {
23
- assertUniqueKeyword: ZCF['assertUniqueKeyword'];
24
- atomicRearrange: ZCF['atomicRearrange'];
25
- makeInvitation: ZCF['makeInvitation'];
26
- }
@@ -1,253 +0,0 @@
1
- // ../../node_modules/@noble/curves/esm/abstract/utils.js
2
- var _0n = /* @__PURE__ */ BigInt(0);
3
- var _1n = /* @__PURE__ */ BigInt(1);
4
- function isBytes(a) {
5
- return a instanceof Uint8Array || ArrayBuffer.isView(a) && a.constructor.name === "Uint8Array";
6
- }
7
- function abytes(item) {
8
- if (!isBytes(item))
9
- throw new Error("Uint8Array expected");
10
- }
11
- function abool(title, value) {
12
- if (typeof value !== "boolean")
13
- throw new Error(title + " boolean expected, got " + value);
14
- }
15
- function numberToHexUnpadded(num) {
16
- const hex = num.toString(16);
17
- return hex.length & 1 ? "0" + hex : hex;
18
- }
19
- function hexToNumber(hex) {
20
- if (typeof hex !== "string")
21
- throw new Error("hex string expected, got " + typeof hex);
22
- return hex === "" ? _0n : BigInt("0x" + hex);
23
- }
24
- var hasHexBuiltin = (
25
- // @ts-ignore
26
- typeof Uint8Array.from([]).toHex === "function" && typeof Uint8Array.fromHex === "function"
27
- );
28
- var hexes = /* @__PURE__ */ Array.from({ length: 256 }, (_, i) => i.toString(16).padStart(2, "0"));
29
- function bytesToHex(bytes) {
30
- abytes(bytes);
31
- if (hasHexBuiltin)
32
- return bytes.toHex();
33
- let hex = "";
34
- for (let i = 0; i < bytes.length; i++) {
35
- hex += hexes[bytes[i]];
36
- }
37
- return hex;
38
- }
39
- var asciis = { _0: 48, _9: 57, A: 65, F: 70, a: 97, f: 102 };
40
- function asciiToBase16(ch) {
41
- if (ch >= asciis._0 && ch <= asciis._9)
42
- return ch - asciis._0;
43
- if (ch >= asciis.A && ch <= asciis.F)
44
- return ch - (asciis.A - 10);
45
- if (ch >= asciis.a && ch <= asciis.f)
46
- return ch - (asciis.a - 10);
47
- return;
48
- }
49
- function hexToBytes(hex) {
50
- if (typeof hex !== "string")
51
- throw new Error("hex string expected, got " + typeof hex);
52
- if (hasHexBuiltin)
53
- return Uint8Array.fromHex(hex);
54
- const hl = hex.length;
55
- const al = hl / 2;
56
- if (hl % 2)
57
- throw new Error("hex string expected, got unpadded hex of length " + hl);
58
- const array = new Uint8Array(al);
59
- for (let ai = 0, hi = 0; ai < al; ai++, hi += 2) {
60
- const n1 = asciiToBase16(hex.charCodeAt(hi));
61
- const n2 = asciiToBase16(hex.charCodeAt(hi + 1));
62
- if (n1 === void 0 || n2 === void 0) {
63
- const char = hex[hi] + hex[hi + 1];
64
- throw new Error('hex string expected, got non-hex character "' + char + '" at index ' + hi);
65
- }
66
- array[ai] = n1 * 16 + n2;
67
- }
68
- return array;
69
- }
70
- function bytesToNumberBE(bytes) {
71
- return hexToNumber(bytesToHex(bytes));
72
- }
73
- function bytesToNumberLE(bytes) {
74
- abytes(bytes);
75
- return hexToNumber(bytesToHex(Uint8Array.from(bytes).reverse()));
76
- }
77
- function numberToBytesBE(n, len) {
78
- return hexToBytes(n.toString(16).padStart(len * 2, "0"));
79
- }
80
- function numberToBytesLE(n, len) {
81
- return numberToBytesBE(n, len).reverse();
82
- }
83
- function ensureBytes(title, hex, expectedLength) {
84
- let res;
85
- if (typeof hex === "string") {
86
- try {
87
- res = hexToBytes(hex);
88
- } catch (e) {
89
- throw new Error(title + " must be hex string or Uint8Array, cause: " + e);
90
- }
91
- } else if (isBytes(hex)) {
92
- res = Uint8Array.from(hex);
93
- } else {
94
- throw new Error(title + " must be hex string or Uint8Array");
95
- }
96
- const len = res.length;
97
- if (typeof expectedLength === "number" && len !== expectedLength)
98
- throw new Error(title + " of length " + expectedLength + " expected, got " + len);
99
- return res;
100
- }
101
- function concatBytes(...arrays) {
102
- let sum = 0;
103
- for (let i = 0; i < arrays.length; i++) {
104
- const a = arrays[i];
105
- abytes(a);
106
- sum += a.length;
107
- }
108
- const res = new Uint8Array(sum);
109
- for (let i = 0, pad = 0; i < arrays.length; i++) {
110
- const a = arrays[i];
111
- res.set(a, pad);
112
- pad += a.length;
113
- }
114
- return res;
115
- }
116
- function utf8ToBytes(str) {
117
- if (typeof str !== "string")
118
- throw new Error("string expected");
119
- return new Uint8Array(new TextEncoder().encode(str));
120
- }
121
- var isPosBig = (n) => typeof n === "bigint" && _0n <= n;
122
- function inRange(n, min, max) {
123
- return isPosBig(n) && isPosBig(min) && isPosBig(max) && min <= n && n < max;
124
- }
125
- function aInRange(title, n, min, max) {
126
- if (!inRange(n, min, max))
127
- throw new Error("expected valid " + title + ": " + min + " <= n < " + max + ", got " + n);
128
- }
129
- function bitLen(n) {
130
- let len;
131
- for (len = 0; n > _0n; n >>= _1n, len += 1)
132
- ;
133
- return len;
134
- }
135
- var bitMask = (n) => (_1n << BigInt(n)) - _1n;
136
- var u8n = (len) => new Uint8Array(len);
137
- var u8fr = (arr) => Uint8Array.from(arr);
138
- function createHmacDrbg(hashLen, qByteLen, hmacFn) {
139
- if (typeof hashLen !== "number" || hashLen < 2)
140
- throw new Error("hashLen must be a number");
141
- if (typeof qByteLen !== "number" || qByteLen < 2)
142
- throw new Error("qByteLen must be a number");
143
- if (typeof hmacFn !== "function")
144
- throw new Error("hmacFn must be a function");
145
- let v = u8n(hashLen);
146
- let k = u8n(hashLen);
147
- let i = 0;
148
- const reset = () => {
149
- v.fill(1);
150
- k.fill(0);
151
- i = 0;
152
- };
153
- const h = (...b) => hmacFn(k, v, ...b);
154
- const reseed = (seed = u8n(0)) => {
155
- k = h(u8fr([0]), seed);
156
- v = h();
157
- if (seed.length === 0)
158
- return;
159
- k = h(u8fr([1]), seed);
160
- v = h();
161
- };
162
- const gen = () => {
163
- if (i++ >= 1e3)
164
- throw new Error("drbg: tried 1000 values");
165
- let len = 0;
166
- const out = [];
167
- while (len < qByteLen) {
168
- v = h();
169
- const sl = v.slice();
170
- out.push(sl);
171
- len += v.length;
172
- }
173
- return concatBytes(...out);
174
- };
175
- const genUntil = (seed, pred) => {
176
- reset();
177
- reseed(seed);
178
- let res = void 0;
179
- while (!(res = pred(gen())))
180
- reseed();
181
- reset();
182
- return res;
183
- };
184
- return genUntil;
185
- }
186
- var validatorFns = {
187
- bigint: (val) => typeof val === "bigint",
188
- function: (val) => typeof val === "function",
189
- boolean: (val) => typeof val === "boolean",
190
- string: (val) => typeof val === "string",
191
- stringOrUint8Array: (val) => typeof val === "string" || isBytes(val),
192
- isSafeInteger: (val) => Number.isSafeInteger(val),
193
- array: (val) => Array.isArray(val),
194
- field: (val, object) => object.Fp.isValid(val),
195
- hash: (val) => typeof val === "function" && Number.isSafeInteger(val.outputLen)
196
- };
197
- function validateObject(object, validators, optValidators = {}) {
198
- const checkField = (fieldName, type, isOptional) => {
199
- const checkVal = validatorFns[type];
200
- if (typeof checkVal !== "function")
201
- throw new Error("invalid validator function");
202
- const val = object[fieldName];
203
- if (isOptional && val === void 0)
204
- return;
205
- if (!checkVal(val, object)) {
206
- throw new Error("param " + String(fieldName) + " is invalid. Expected " + type + ", got " + val);
207
- }
208
- };
209
- for (const [fieldName, type] of Object.entries(validators))
210
- checkField(fieldName, type, false);
211
- for (const [fieldName, type] of Object.entries(optValidators))
212
- checkField(fieldName, type, true);
213
- return object;
214
- }
215
- function memoized(fn) {
216
- const map = /* @__PURE__ */ new WeakMap();
217
- return (arg, ...args) => {
218
- const val = map.get(arg);
219
- if (val !== void 0)
220
- return val;
221
- const computed = fn(arg, ...args);
222
- map.set(arg, computed);
223
- return computed;
224
- };
225
- }
226
-
227
- export {
228
- isBytes,
229
- abytes,
230
- abool,
231
- numberToHexUnpadded,
232
- bytesToHex,
233
- hexToBytes,
234
- bytesToNumberBE,
235
- bytesToNumberLE,
236
- numberToBytesBE,
237
- numberToBytesLE,
238
- ensureBytes,
239
- concatBytes,
240
- utf8ToBytes,
241
- inRange,
242
- aInRange,
243
- bitLen,
244
- bitMask,
245
- createHmacDrbg,
246
- validateObject,
247
- memoized
248
- };
249
- /*! Bundled license information:
250
-
251
- @noble/curves/esm/abstract/utils.js:
252
- (*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
253
- */