@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
package/src/cosmos-api.ts DELETED
@@ -1,469 +0,0 @@
1
- /* eslint-disable @typescript-eslint/no-unused-vars -- fails to notice the @see uses */
2
- import type { AnyJson, JsonSafe, TypedJson } from '@agoric/cosmic-proto';
3
- import type { Coin } from '@agoric/cosmic-proto/cosmos/base/v1beta1/coin.js';
4
- import type {
5
- RedelegationResponse,
6
- UnbondingDelegation,
7
- } from '@agoric/cosmic-proto/cosmos/staking/v1beta1/staking.js';
8
- import type { TxBody } from '@agoric/cosmic-proto/cosmos/tx/v1beta1/tx.js';
9
- import type { MsgTransfer } from '@agoric/cosmic-proto/ibc/applications/transfer/v1/tx.js';
10
- import type { FungibleTokenPacketData } from '@agoric/cosmic-proto/ibc/applications/transfer/v2/packet.js';
11
- import type {
12
- State as IBCChannelState,
13
- Order,
14
- } from '@agoric/cosmic-proto/ibc/core/channel/v1/channel.js';
15
- import type { State as IBCConnectionState } from '@agoric/cosmic-proto/ibc/core/connection/v1/connection.js';
16
- import type {
17
- RequestQuery,
18
- ResponseQuery,
19
- } from '@agoric/cosmic-proto/tendermint/abci/types.js';
20
- import type { Amount, Payment } from '@agoric/ertp/src/types.js';
21
- import type { Port, SendOptions } from '@agoric/network';
22
- import type { TimerService } from '@agoric/time';
23
- import type {
24
- IBCChannelID,
25
- IBCConnectionID,
26
- IBCPortID,
27
- VTransferIBCEvent,
28
- } from '@agoric/vats';
29
- import type {
30
- TargetApp,
31
- TargetRegistration,
32
- } from '@agoric/vats/src/bridge-target.js';
33
- import type {
34
- LocalIbcAddress,
35
- RemoteIbcAddress,
36
- } from '@agoric/vats/tools/ibc-utils.js';
37
- import { PFM_RECEIVER } from './exos/chain-hub.js';
38
- import type {
39
- AccountId,
40
- AmountArg,
41
- BaseChainInfo,
42
- CosmosChainAddress,
43
- Denom,
44
- DenomAmount,
45
- } from './types.js';
46
-
47
- /**
48
- * @example
49
- *
50
- * agoric1megzytg65cyrgzs6fvzxgrcqvwwl7ugpt62346
51
- * cosmosvaloper1npm9gvss52mlmk
52
- */
53
- export type Bech32Address = `${string}1${string}`;
54
-
55
- /** An address for a validator on some blockchain, e.g., cosmos, eth, etc. */
56
- export type CosmosValidatorAddress = CosmosChainAddress & {
57
- // infix for Validator Operator https://docs.cosmos.network/main/learn/beginner/accounts#addresses
58
- value: `${string}valoper${string}`;
59
- encoding: 'bech32';
60
- };
61
-
62
- /** Represents an IBC Connection between two chains, which can contain multiple Channels. */
63
- export interface IBCConnectionInfo {
64
- id: IBCConnectionID; // e.g. connection-0
65
- client_id: string; // '07-tendermint-0'
66
- state: IBCConnectionState;
67
- counterparty: {
68
- client_id: string;
69
- connection_id: IBCConnectionID;
70
- };
71
- transferChannel: {
72
- portId: string;
73
- channelId: IBCChannelID;
74
- counterPartyPortId: string;
75
- counterPartyChannelId: IBCChannelID;
76
- ordering: Order;
77
- state: IBCChannelState;
78
- version: string; // e.eg. 'ics20-1'
79
- };
80
- }
81
-
82
- /**
83
- * https://github.com/cosmos/chain-registry/blob/master/assetlist.schema.json
84
- */
85
- export interface CosmosAssetInfo extends Record<string, unknown> {
86
- base: Denom;
87
- name: string;
88
- display: string;
89
- symbol: string;
90
- denom_units: Array<{ denom: Denom; exponent: number }>;
91
- traces?: Array<{
92
- type: 'ibc';
93
- counterparty: {
94
- chain_name: string;
95
- base_denom: Denom;
96
- channel_id: IBCChannelID;
97
- };
98
- chain: {
99
- channel_id: IBCChannelID;
100
- path: string;
101
- };
102
- }>;
103
- }
104
-
105
- /**
106
- * Info for a Cosmos-based chain.
107
- */
108
- export interface CosmosChainInfo extends BaseChainInfo {
109
- /** can be used to lookup chainInfo (chainId) from an address value */
110
- bech32Prefix: string;
111
- /** Cosmos chain ID. The CAIP-2 fields (namespace, reference) are on {@link BaseChainInfo}. */
112
- chainId: string;
113
- /** IBC connections between this chain and others, keyed by chainId */
114
- connections?: Record<string, IBCConnectionInfo>;
115
- /** indicates the host chain supports Interchain Accounts (ICS-27). Not currently used at runtime - only for types */
116
- icaEnabled?: boolean;
117
- /**
118
- * indicates the host chain support the async-icq IBC Application protocol. Used at runtime to permit `Chain.query()` operations.
119
- *
120
- * in the future (@see https://github.com/Agoric/agoric-sdk/issues/9326), querying will be supported by the ICA protocol natively and this will likely deprecate
121
- */
122
- icqEnabled?: boolean;
123
- namespace: 'cosmos';
124
- /**
125
- * Note: developers must provide this value themselves for `.transfer` to work
126
- * as expected. Please see examples for details.
127
- */
128
- pfmEnabled?: boolean;
129
- /**
130
- * cf https://github.com/cosmos/chain-registry/blob/master/chain.schema.json#L117
131
- */
132
- stakingTokens?: Readonly<Array<{ denom: string }>>;
133
- }
134
-
135
- // #region Orchestration views on Cosmos response types
136
- // Naming scheme: Cosmos for the chain system, Rewards b/c getRewards function,
137
- // and Response because it's the return value.
138
-
139
- /** @see {QueryDelegationTotalRewardsResponse} */
140
- export interface CosmosRewardsResponse {
141
- rewards: { validator: CosmosValidatorAddress; reward: DenomAmount[] }[];
142
- total: DenomAmount[];
143
- }
144
-
145
- /** @see {DelegationResponse} */
146
- export interface CosmosDelegationResponse {
147
- delegator: CosmosChainAddress;
148
- validator: CosmosValidatorAddress;
149
- amount: DenomAmount;
150
- }
151
- // #endregion
152
-
153
- /**
154
- * Queries for the staking properties of an account.
155
- *
156
- * @see {@link https://docs.cosmos.network/main/build/modules/staking#messages x/staking messages}
157
- * {@link https://cosmos.github.io/cosmjs/latest/stargate/interfaces/StakingExtension.html StakingExtension} in cosmjs
158
- */
159
- export interface StakingAccountQueries {
160
- /**
161
- * @returns all active delegations from the account to any validator (or [] if none)
162
- */
163
- getDelegations: () => Promise<CosmosDelegationResponse[]>;
164
-
165
- /**
166
- * @returns the active delegation from the account to a specific validator. Return an
167
- * empty Delegation if there is no delegation.
168
- */
169
- getDelegation: (
170
- validator: CosmosValidatorAddress,
171
- ) => Promise<CosmosDelegationResponse>;
172
-
173
- /**
174
- * @returns the unbonding delegations from the account to any validator (or [] if none)
175
- */
176
- getUnbondingDelegations: () => Promise<UnbondingDelegation[]>;
177
-
178
- /**
179
- * @returns the unbonding delegations from the account to a specific validator (or [] if none)
180
- */
181
- getUnbondingDelegation: (
182
- validator: CosmosValidatorAddress,
183
- ) => Promise<UnbondingDelegation>;
184
-
185
- getRedelegations: () => Promise<RedelegationResponse[]>;
186
-
187
- /**
188
- * Get the pending rewards for the account.
189
- * @returns the amounts of the account's rewards pending from all validators
190
- */
191
- getRewards: () => Promise<CosmosRewardsResponse>;
192
-
193
- /**
194
- * Get the rewards pending with a specific validator.
195
- * @param validator - the validator address to query for
196
- * @returns the amount of the account's rewards pending from a specific validator
197
- */
198
- getReward: (validator: CosmosValidatorAddress) => Promise<DenomAmount[]>;
199
- }
200
-
201
- /**
202
- * Transactions for doing staking operations on an individual account.
203
- *
204
- * @see {@link https://docs.cosmos.network/main/build/modules/staking#messages x/staking messages} and
205
- * {@link https://cosmos.github.io/cosmjs/latest/stargate/interfaces/StakingExtension.html StakingExtension} in cosmjs
206
- */
207
- export interface StakingAccountActions {
208
- /**
209
- * Delegate an amount to a validator. The promise settles when the delegation is complete.
210
- * @param validator - the validator to delegate to
211
- * @param amount - the amount to delegate
212
- * @returns void
213
- */
214
- delegate: (
215
- validator: CosmosValidatorAddress,
216
- amount: AmountArg,
217
- ) => Promise<void>;
218
-
219
- /**
220
- * Redelegate from one delegator to another.
221
- * Settles when the redelegation is established, not 21 days later.
222
- * @param srcValidator - the current validator for the delegation.
223
- * @param dstValidator - the validator that will receive the delegation.
224
- * @param amount - how much to redelegate.
225
- * @returns
226
- */
227
- redelegate: (
228
- srcValidator: CosmosValidatorAddress,
229
- dstValidator: CosmosValidatorAddress,
230
- amount: AmountArg,
231
- ) => Promise<void>;
232
-
233
- /**
234
- * Undelegate multiple delegations (concurrently). To delegate independently, pass an array with one item.
235
- * Resolves when the undelegation is complete and the tokens are no longer bonded. Note it may take weeks.
236
- * The unbonding time is padded by 10 minutes to account for clock skew.
237
- * @param delegations - the delegation to undelegate
238
- */
239
- undelegate: (
240
- delegations: {
241
- amount: AmountArg;
242
- delegator?: CosmosChainAddress;
243
- validator: CosmosValidatorAddress;
244
- }[],
245
- ) => Promise<void>;
246
-
247
- /**
248
- * Withdraw rewards from all validators. The promise settles when the rewards are withdrawn.
249
- * @returns The total amounts of rewards withdrawn
250
- */
251
- withdrawRewards: () => Promise<DenomAmount[]>;
252
-
253
- /**
254
- * Withdraw rewards from a specific validator. The promise settles when the rewards are withdrawn.
255
- * @param validator - the validator to withdraw rewards from
256
- * @returns
257
- */
258
- withdrawReward: (validator: CosmosValidatorAddress) => Promise<DenomAmount[]>;
259
- }
260
-
261
- /**
262
- * Low level methods from IcaAccount that we pass through to CosmosOrchestrationAccount
263
- */
264
-
265
- export interface IcaAccountMethods {
266
- /**
267
- * Submit a transaction on behalf of the remote account for execution on the remote chain.
268
- * @param msgs - records for the transaction
269
- * @param [opts] - optional parameters for the Tx. use `opts.sendOpts.relativeTimeoutNs` to specify a timeout for the ICA tx packet
270
- * @returns acknowledgement string
271
- */
272
- executeEncodedTx: (
273
- msgs: AnyJson[],
274
- opts?: Partial<Omit<TxBody, 'messages'>> & { sendOpts?: SendOptions },
275
- ) => Promise<string>;
276
- /**
277
- * Deactivates the ICA account by closing the ICA channel. The `Port` is
278
- * persisted so holders can always call `.reactivate()` to re-establish a new
279
- * channel with the same chain address.
280
- * CAVEAT: Does not retrieve assets so they may be lost if left.
281
- * @throws {Error} if connection is not available or already deactivated
282
- */
283
- deactivate: () => Promise<void>;
284
- /**
285
- * Reactivates the ICA account by re-establishing a new channel with the
286
- * original Port and requested address.
287
- * If a channel is closed for an unexpected reason, such as a packet timeout,
288
- * an automatic attempt to re will be made and the holder should not need
289
- * to call `.reactivate()`.
290
- * @throws {Error} if connection is currently active
291
- */
292
- reactivate: () => Promise<void>;
293
- }
294
-
295
- /**
296
- * Low level object that supports queries and operations for an account on a remote chain.
297
- */
298
- export interface IcaAccount extends IcaAccountMethods {
299
- /**
300
- * @returns the address of the account on the remote chain
301
- */
302
- getAddress: () => CosmosChainAddress;
303
-
304
- /**
305
- * Submit a transaction on behalf of the remote account for execution on the remote chain.
306
- * @param msgs - records for the transaction
307
- * @returns acknowledgement string
308
- */
309
- executeTx: (msgs: TypedJson[]) => Promise<string>;
310
- /** @returns the address of the remote channel */
311
- getRemoteAddress: () => RemoteIbcAddress;
312
- /** @returns the address of the local channel */
313
- getLocalAddress: () => LocalIbcAddress;
314
- /** @returns the port the ICA channel is bound to */
315
- getPort: () => Port;
316
- }
317
-
318
- /** Methods on chains that support Liquid Staking */
319
- export interface LiquidStakingMethods {
320
- liquidStake: (amount: AmountArg) => Promise<void>;
321
- }
322
-
323
- /**
324
- * Noble is the gateway to transferring USDC among Cosmos chains. We can
325
- * transfer funds from any cosmos account using depositForBurn().
326
- */
327
- export interface NobleMethods {
328
- /** burn USDC on Noble and mint on a destination chain via CCTP */
329
- depositForBurn: (
330
- mintRecipient: AccountId,
331
- amount: AmountArg,
332
- /** if specified, only this account can call MsgReceive on the destination chain */
333
- caller?: AccountId,
334
- ) => Promise<void>;
335
- }
336
-
337
- // TODO support StakingAccountQueries
338
- /** Methods supported only on Agoric chain accounts */
339
- export interface LocalAccountMethods extends StakingAccountActions {
340
- /** deposit payment (from zoe, for example) to the account */
341
- deposit: (payment: Payment<'nat'>) => Promise<Amount<'nat'>>;
342
- /** withdraw a Payment from the account */
343
- withdraw: (amount: Amount<'nat'>) => Promise<Payment<'nat'>>;
344
- /**
345
- * Register a handler that receives an event each time ICS-20 transfers are
346
- * sent or received by the underlying account.
347
- *
348
- * Handler includes {@link VTransferIBCEvent} and
349
- * {@link FungibleTokenPacketData} that can be used for application logic.
350
- *
351
- * Each account may be associated with at most one handler at a given time.
352
- *
353
- * Does not grant the handler the ability to intercept a transfer. For a
354
- * blocking handler, aka 'IBC Hooks', leverage `registerActiveTap` from
355
- * `transferMiddleware` directly.
356
- *
357
- * @param tap
358
- */
359
- monitorTransfers: (tap: TargetApp) => Promise<TargetRegistration>;
360
- /**
361
- * Parse an incoming transfer message and return its details.
362
- */
363
- parseInboundTransfer: (packet: Record<string, any>) => Promise<{
364
- amount: DenomAmount;
365
- fromAccount: string;
366
- toAccount: string;
367
- extra: Record<string, any>;
368
- }>;
369
- }
370
-
371
- /**
372
- * Options for {@link OrchestrationAccountI} `transfer` method.
373
- *
374
- * If specifying a custom timeout, use one of `timeoutHeight`, `timeoutTimestamp`, or `timeoutRelativeSeconds`.
375
- *
376
- * @see {@link https://github.com/cosmos/ibc/tree/master/spec/app/ics-020-fungible-token-transfer#data-structures ICS 20 Data Structures}
377
- */
378
- export type IBCMsgTransferOptions = {
379
- timeoutHeight?: MsgTransfer['timeoutHeight'];
380
- timeoutTimestamp?: MsgTransfer['timeoutTimestamp'];
381
- /** converted using {@link TimerService} to a `timeoutTimestamp` value `timeoutRelativeSeconds` in the future */
382
- timeoutRelativeSeconds?: bigint;
383
- memo?: string;
384
- forwardOpts?: {
385
- /** The recipient address for the intermediate transfer. Defaults to 'pfm' unless specified */
386
- intermediateRecipient?: CosmosChainAddress;
387
- timeout?: ForwardInfo['forward']['timeout'];
388
- retries?: ForwardInfo['forward']['retries'];
389
- };
390
- };
391
-
392
- /**
393
- * Cosmos-specific methods to extend `OrchestrationAccountI`, parameterized
394
- * by `CosmosChainInfo`.
395
- *
396
- * In particular, if the chain info includes a staking token, {@link StakingAccountActions}
397
- * are available.
398
- *
399
- * @see {OrchestrationAccountI}
400
- */
401
- export type CosmosChainAccountMethods<CCI extends { chainId: string }> =
402
- IcaAccountMethods &
403
- (CCI extends {
404
- stakingTokens: object;
405
- }
406
- ? StakingAccountActions & StakingAccountQueries
407
- : object);
408
-
409
- export type ICQQueryFunction = (
410
- msgs: JsonSafe<RequestQuery>[],
411
- ) => Promise<JsonSafe<ResponseQuery>[]>;
412
-
413
- /**
414
- * Message structure for PFM memo
415
- *
416
- * @see {@link https://github.com/cosmos/chain-registry/blob/58b603bbe01f70e911e3ad2bdb6b90c4ca665735/_memo_keys/ICS20_memo_keys.json#L38-L60}
417
- */
418
- export interface ForwardInfo {
419
- forward: {
420
- receiver: CosmosChainAddress['value'];
421
- port: IBCPortID;
422
- channel: IBCChannelID;
423
- /** e.g. '10m' */
424
- timeout: GoDuration;
425
- /** default is 3? */
426
- retries: number;
427
- next?: {
428
- forward: ForwardInfo;
429
- };
430
- };
431
- }
432
-
433
- /**
434
- * Object used to help build MsgTransfer parameters for IBC transfers.
435
- *
436
- * If `forwardInfo` is present:
437
- * - it must be stringified and provided as the `memo` field value for
438
- * use with `MsgTransfer`.
439
- * - `receiver` will be set to `"pfm"` - purposely invalid bech32. see {@link https://github.com/cosmos/ibc-apps/blob/26f3ad8f58e4ffc7769c6766cb42b954181dc100/middleware/packet-forward-middleware/README.md#minimal-example---chain-forward-a-b-c}
440
- */
441
- export type TransferRoute = {
442
- /** typically, `transfer` */
443
- sourcePort: string;
444
- sourceChannel: IBCChannelID;
445
- token: Coin;
446
- } & (
447
- | {
448
- receiver: typeof PFM_RECEIVER | CosmosChainAddress['value'];
449
- /** contains PFM forwarding info */
450
- forwardInfo: ForwardInfo;
451
- }
452
- | {
453
- receiver: string;
454
- forwardInfo?: never;
455
- }
456
- );
457
-
458
- /** Single units allowed in Go time duration strings */
459
- type GoDurationUnit = 'h' | 'm' | 's' | 'ms' | 'us' | 'ns';
460
-
461
- /**
462
- * Type for a time duration string in Go (cosmos-sdk). For example, "1h", "3m".
463
- *
464
- * Note: this does not support composite values like "1h30m", "1m30s",
465
- * which are allowed in Go.
466
- *
467
- * @see https://pkg.go.dev/time#ParseDuration
468
- */
469
- export type GoDuration = `${number}${GoDurationUnit}`;
@@ -1,35 +0,0 @@
1
- import type { IBCConnectionID } from '@agoric/vats';
2
- import type { Vow } from '@agoric/vow';
3
- import type { IcaAccount } from '../cosmos-api.js';
4
- import type { ICAChannelAddressOpts } from '../utils/address.js';
5
- import type { ICQConnection } from './icq-connection-kit.js';
6
-
7
- /**
8
- * Authority to make a Cosmos interchain account or an interchain query connection.
9
- */
10
- export interface CosmosInterchainService {
11
- /**
12
- * @param {string} chainId
13
- * @param {IBCConnectionID} hostConnectionId the counterparty
14
- * connection_id
15
- * @param {IBCConnectionID} controllerConnectionId self connection_id
16
- * @param {ICAChannelAddressOpts} [opts] optional to configure the
17
- * channel address, such as version and ordering
18
- * @returns {Vow<IcaAccount>}
19
- */
20
- makeAccount(
21
- chainId: string,
22
- hostConnectionId: IBCConnectionID,
23
- controllerConnectionId: IBCConnectionID,
24
- opts?: ICAChannelAddressOpts | undefined,
25
- ): Vow<IcaAccount>;
26
- /**
27
- * @param {IBCConnectionID} controllerConnectionId
28
- * @param {string} [version]
29
- * @returns {Vow<ICQConnection> | ICQConnection}
30
- */
31
- provideICQConnection(
32
- controllerConnectionId: IBCConnectionID,
33
- version?: string | undefined,
34
- ): Vow<ICQConnection> | ICQConnection;
35
- }