@agoric/orchestration 0.1.1-dev-6b5e706.0 → 0.1.1-dev-2dc53d7.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.
- package/index.d.ts +4 -0
- package/index.js +0 -1
- package/package.json +17 -15
- package/src/chain-info.d.ts +37 -0
- package/src/chain-info.d.ts.map +1 -0
- package/src/chain-info.ts +64 -0
- package/src/cosmos-api.d.ts +159 -0
- package/src/cosmos-api.d.ts.map +1 -0
- package/src/cosmos-api.ts +199 -0
- package/src/ethereum-api.d.ts +8 -0
- package/src/ethereum-api.d.ts.map +1 -0
- package/src/ethereum-api.ts +7 -0
- package/src/examples/stakeAtom.contract.d.ts +84 -0
- package/src/examples/stakeAtom.contract.d.ts.map +1 -0
- package/src/examples/stakeAtom.contract.js +0 -1
- package/src/examples/stakeBld.contract.d.ts +39 -0
- package/src/examples/stakeBld.contract.d.ts.map +1 -0
- package/src/examples/stakeBld.contract.js +0 -1
- package/src/examples/swapExample.contract.d.ts +31 -0
- package/src/examples/swapExample.contract.d.ts.map +1 -0
- package/src/examples/swapExample.contract.js +2 -3
- package/src/examples/unbondExample.contract.d.ts +24 -0
- package/src/examples/unbondExample.contract.d.ts.map +1 -0
- package/src/examples/unbondExample.contract.js +1 -2
- package/src/exos/chainAccountKit.d.ts +71 -0
- package/src/exos/chainAccountKit.d.ts.map +1 -0
- package/src/exos/chainAccountKit.js +0 -1
- package/src/exos/icqConnectionKit.d.ts +43 -0
- package/src/exos/icqConnectionKit.d.ts.map +1 -0
- package/src/exos/icqConnectionKit.js +0 -1
- package/src/exos/localchainAccountKit.d.ts +68 -0
- package/src/exos/localchainAccountKit.d.ts.map +1 -0
- package/src/exos/localchainAccountKit.js +0 -1
- package/src/exos/stakingAccountKit.d.ts +146 -0
- package/src/exos/stakingAccountKit.d.ts.map +1 -0
- package/src/exos/stakingAccountKit.js +12 -13
- package/src/facade.d.ts +29 -0
- package/src/facade.d.ts.map +1 -0
- package/src/facade.js +7 -3
- package/src/orchestration-api.d.ts +158 -0
- package/src/orchestration-api.d.ts.map +1 -0
- package/src/orchestration-api.ts +195 -0
- package/src/proposals/orchestration-proposal.d.ts +629 -0
- package/src/proposals/orchestration-proposal.d.ts.map +1 -0
- package/src/proposals/orchestration-proposal.js +0 -1
- package/src/proposals/start-stakeAtom.d.ts +115 -0
- package/src/proposals/start-stakeAtom.d.ts.map +1 -0
- package/src/proposals/start-stakeAtom.js +0 -1
- package/src/proposals/start-stakeBld.d.ts +80 -0
- package/src/proposals/start-stakeBld.d.ts.map +1 -0
- package/src/proposals/start-stakeBld.js +2 -2
- package/src/service.d.ts +67 -0
- package/src/service.d.ts.map +1 -0
- package/src/service.js +2 -3
- package/src/typeGuards.d.ts +28 -0
- package/src/typeGuards.d.ts.map +1 -0
- package/src/types.d.ts +8 -482
- package/src/types.d.ts.map +1 -0
- package/src/types.ts +10 -0
- package/src/utils/address.d.ts +11 -0
- package/src/utils/address.d.ts.map +1 -0
- package/src/utils/address.js +0 -1
- package/src/utils/orc.d.ts +14 -0
- package/src/utils/orc.d.ts.map +1 -0
- package/src/utils/orc.js +0 -1
- package/src/utils/packet.d.ts +52 -0
- package/src/utils/packet.d.ts.map +1 -0
- package/src/utils/packet.js +0 -1
- package/src/vat-orchestration.d.ts +36 -0
- package/src/vat-orchestration.d.ts.map +1 -0
- package/src/vat-orchestration.js +0 -1
- package/src/types.js +0 -6
package/src/types.d.ts
CHANGED
|
@@ -1,484 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
import type { AnyJson } from '@agoric/cosmic-proto';
|
|
6
|
-
import type {
|
|
7
|
-
Delegation,
|
|
8
|
-
Redelegation,
|
|
9
|
-
UnbondingDelegation,
|
|
10
|
-
} from '@agoric/cosmic-proto/cosmos/staking/v1beta1/staking.js';
|
|
11
|
-
import type { TxBody } from '@agoric/cosmic-proto/cosmos/tx/v1beta1/tx.js';
|
|
12
|
-
import type {
|
|
13
|
-
LocalIbcAddress,
|
|
14
|
-
RemoteIbcAddress,
|
|
15
|
-
} from '@agoric/vats/tools/ibc-utils.js';
|
|
16
|
-
import type { Port } from '@agoric/network';
|
|
17
|
-
import { MsgTransferResponse } from '@agoric/cosmic-proto/ibc/applications/transfer/v1/tx.js';
|
|
18
|
-
import type { IBCConnectionID } from '@agoric/vats';
|
|
19
|
-
import type { ICQConnection } from './exos/icqConnectionKit.js';
|
|
20
|
-
|
|
21
|
-
export type * from './service.js';
|
|
22
|
-
export type * from './vat-orchestration.js';
|
|
1
|
+
/** @file Rollup of all type definitions in the package, for local import and external export */
|
|
2
|
+
export type * from './chain-info.js';
|
|
3
|
+
export type * from './cosmos-api.js';
|
|
4
|
+
export type * from './ethereum-api.js';
|
|
23
5
|
export type * from './exos/chainAccountKit.js';
|
|
24
6
|
export type * from './exos/icqConnectionKit.js';
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
*
|
|
28
|
-
|
|
29
|
-
*/
|
|
30
|
-
export type KnownChains = {
|
|
31
|
-
stride: {
|
|
32
|
-
info: CosmosChainInfo;
|
|
33
|
-
methods: {
|
|
34
|
-
liquidStake: (amount: AmountArg) => Promise<void>;
|
|
35
|
-
};
|
|
36
|
-
};
|
|
37
|
-
cosmos: { info: CosmosChainInfo; methods: {} };
|
|
38
|
-
agoric: {
|
|
39
|
-
info: Omit<CosmosChainInfo, 'ibcConnectionInfo'>;
|
|
40
|
-
methods: {
|
|
41
|
-
// TODO reference type from #8624 `packages/vats/src/localchain.js`
|
|
42
|
-
/**
|
|
43
|
-
* Register a hook to intercept an incoming IBC Transfer and handle it.
|
|
44
|
-
* Calling without arguments will unregister the hook.
|
|
45
|
-
*/
|
|
46
|
-
interceptTransfer: (tap?: {
|
|
47
|
-
upcall: (args: any) => Promise<any>;
|
|
48
|
-
}) => Promise<void>;
|
|
49
|
-
};
|
|
50
|
-
};
|
|
51
|
-
celestia: { info: CosmosChainInfo; methods: {} };
|
|
52
|
-
osmosis: { info: CosmosChainInfo; methods: {} };
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
/** A helper type for type extensions. */
|
|
56
|
-
export type TypeUrl = string;
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* A denom that designates a token type on some blockchain.
|
|
60
|
-
*
|
|
61
|
-
* Multiple denoms may designate the same underlying base denom (e.g., `uist`,
|
|
62
|
-
* `uatom`) on different Chains or on the same Chain via different paths. On
|
|
63
|
-
* Cosmos chains, all but the base denom are IBC style denoms, but that may vary
|
|
64
|
-
* across other chains. All the denoms that designate the same underlying base
|
|
65
|
-
* denom form an equivalence class, along with the unique Brand on the local
|
|
66
|
-
* Chain. Some operations accept any member of the equivalence class to
|
|
67
|
-
* effectively designate the corresponding token type on the target chain.
|
|
68
|
-
*/
|
|
69
|
-
export type Denom = string; // ibc/... or uist
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* In many cases, either a denom string or a local Brand can be used to
|
|
73
|
-
* designate a remote token type.
|
|
74
|
-
*/
|
|
75
|
-
export type DenomArg = Brand | Denom;
|
|
76
|
-
|
|
77
|
-
export type Proto3JSONMsg = {
|
|
78
|
-
'@type': TypeUrl;
|
|
79
|
-
value: Record<string, unknown>;
|
|
80
|
-
};
|
|
81
|
-
/** An address on some blockchain, e.g., cosmos, eth, etc. */
|
|
82
|
-
export type ChainAddress = {
|
|
83
|
-
/** e.g. 1 for Ethereum, agoric-3 for Agoric, cosmoshub-4 for Cosmos */
|
|
84
|
-
chainId: string;
|
|
85
|
-
address: string;
|
|
86
|
-
// TODO what's the right way to scope the address? it's not chainId
|
|
87
|
-
addressEncoding: 'bech32' | 'ethereum';
|
|
88
|
-
};
|
|
89
|
-
|
|
90
|
-
/** An address for a validator on some blockchain, e.g., cosmos, eth, etc. */
|
|
91
|
-
export type CosmosValidatorAddress = ChainAddress & {
|
|
92
|
-
// TODO document why this is the format
|
|
93
|
-
address: `${string}valoper${string}`;
|
|
94
|
-
addressEncoding: 'bech32';
|
|
95
|
-
};
|
|
96
|
-
|
|
97
|
-
/** Details for setup will be determined in the implementation. */
|
|
98
|
-
export interface OrchestrationGovernor {
|
|
99
|
-
registerChain: (
|
|
100
|
-
chainName: string,
|
|
101
|
-
info: ChainInfo,
|
|
102
|
-
methods?: Record<string, any>,
|
|
103
|
-
) => Promise<void>;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
/** Description for an amount of some fungible currency */
|
|
107
|
-
export type ChainAmount = {
|
|
108
|
-
denom: Denom;
|
|
109
|
-
value: bigint; // Nat
|
|
110
|
-
};
|
|
111
|
-
|
|
112
|
-
/** Amounts can be provided as pure data using denoms or as native Amounts */
|
|
113
|
-
export type AmountArg = ChainAmount | Amount;
|
|
114
|
-
|
|
115
|
-
// chainName: managed like agoricNames. API consumers can make/provide their own
|
|
116
|
-
export interface Orchestrator {
|
|
117
|
-
getChain: <C extends keyof KnownChains>(chainName: C) => Promise<Chain<C>>;
|
|
118
|
-
|
|
119
|
-
makeLocalAccount: () => Promise<LocalChainAccount>;
|
|
120
|
-
/** Send queries to ibc chains unknown to KnownChains */
|
|
121
|
-
provideICQConnection: (
|
|
122
|
-
controllerConnectionId: IBCConnectionID,
|
|
123
|
-
) => ICQConnection;
|
|
124
|
-
|
|
125
|
-
/**
|
|
126
|
-
* For a denom, return information about a denom including the equivalent
|
|
127
|
-
* local Brand, the Chain on which the denom is held, and the Chain that
|
|
128
|
-
* issues the corresponding asset.
|
|
129
|
-
* @param denom
|
|
130
|
-
*/
|
|
131
|
-
getBrandInfo: <
|
|
132
|
-
HoldingChain extends keyof KnownChains,
|
|
133
|
-
IssuingChain extends keyof KnownChains,
|
|
134
|
-
>(
|
|
135
|
-
denom: Denom,
|
|
136
|
-
) => {
|
|
137
|
-
/** The well-known Brand on Agoric for the direct asset */
|
|
138
|
-
brand?: Brand;
|
|
139
|
-
/** The Chain at which the argument `denom` exists (where the asset is currently held) */
|
|
140
|
-
chain: Chain<HoldingChain>;
|
|
141
|
-
/** The Chain that is the issuer of the underlying asset */
|
|
142
|
-
base: Chain<IssuingChain>;
|
|
143
|
-
/** the Denom for the underlying asset on its issuer chain */
|
|
144
|
-
baseDenom: Denom;
|
|
145
|
-
};
|
|
146
|
-
/**
|
|
147
|
-
* Convert an amount described in native data to a local, structured Amount.
|
|
148
|
-
* @param amount - the described amount
|
|
149
|
-
* @returns the Amount in local structuerd format
|
|
150
|
-
*/
|
|
151
|
-
asAmount: (amount: ChainAmount) => Amount;
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
// orchestrate('LSTTia', { zcf }, async (orch, { zcf }, seat, offerArgs) => {...})
|
|
155
|
-
// export type OrchestrationHandlerMaker<Context> =
|
|
156
|
-
// TODO @turadg add typed so that the ctx object and args are consistently typed
|
|
157
|
-
export type OrchestrationHandlerMaker = <C extends object>(
|
|
158
|
-
durableName: string,
|
|
159
|
-
ctx: C,
|
|
160
|
-
fn: (orc: Orchestrator, ctx2: C, ...args) => object,
|
|
161
|
-
) => (...args) => object;
|
|
162
|
-
|
|
163
|
-
/**
|
|
164
|
-
* Info for an Ethereum-based chain.
|
|
165
|
-
*/
|
|
166
|
-
export type EthChainInfo = {
|
|
167
|
-
chainId: string;
|
|
168
|
-
allegedName: string;
|
|
169
|
-
};
|
|
170
|
-
|
|
171
|
-
/**
|
|
172
|
-
* Info for a Cosmos-based chain.
|
|
173
|
-
*/
|
|
174
|
-
export type CosmosChainInfo = {
|
|
175
|
-
chainId: string;
|
|
176
|
-
ibcConnectionInfo: {
|
|
177
|
-
id: string; // e.g. connection-0
|
|
178
|
-
client_id: string; // '07-tendermint-0'
|
|
179
|
-
state: 'OPEN' | 'TRYOPEN' | 'INIT' | 'CLOSED';
|
|
180
|
-
counterparty: {
|
|
181
|
-
client_id: string;
|
|
182
|
-
connection_id: string;
|
|
183
|
-
prefix: {
|
|
184
|
-
key_prefix: string;
|
|
185
|
-
};
|
|
186
|
-
};
|
|
187
|
-
versions: { identifier: string; features: string[] }[];
|
|
188
|
-
delay_period: bigint;
|
|
189
|
-
};
|
|
190
|
-
icaEnabled: boolean;
|
|
191
|
-
icqEnabled: boolean;
|
|
192
|
-
pfmEnabled: boolean;
|
|
193
|
-
ibcHooksEnabled: boolean;
|
|
194
|
-
/**
|
|
195
|
-
*
|
|
196
|
-
*/
|
|
197
|
-
allowedMessages: TypeUrl[];
|
|
198
|
-
allowedQueries: TypeUrl[];
|
|
199
|
-
};
|
|
200
|
-
|
|
201
|
-
export type ChainInfo = CosmosChainInfo | EthChainInfo;
|
|
202
|
-
|
|
203
|
-
// marker interface
|
|
204
|
-
interface QueryResult {}
|
|
205
|
-
|
|
206
|
-
/**
|
|
207
|
-
* An object for access the core functions of a remote chain.
|
|
208
|
-
*
|
|
209
|
-
* Note that "remote" can mean the local chain; it's just that
|
|
210
|
-
* accounts are treated as remote/arms length for consistency.
|
|
211
|
-
*/
|
|
212
|
-
export interface Chain<C extends keyof KnownChains> {
|
|
213
|
-
getChainInfo: () => Promise<KnownChains[C]['info']>;
|
|
214
|
-
|
|
215
|
-
// "makeAccount" suggests an operation within a vat
|
|
216
|
-
/**
|
|
217
|
-
* Creates a new account on the remote chain.
|
|
218
|
-
* @returns an object that controls a new remote account on Chain
|
|
219
|
-
*/
|
|
220
|
-
makeAccount: () => Promise<OrchestrationAccount<C>>;
|
|
221
|
-
// FUTURE supply optional port object; also fetch port object
|
|
222
|
-
|
|
223
|
-
/**
|
|
224
|
-
* Low level operation to query external chain state (e.g., governance params)
|
|
225
|
-
* @param queries
|
|
226
|
-
* @returns
|
|
227
|
-
*
|
|
228
|
-
*/
|
|
229
|
-
query: (queries: Proto3JSONMsg[]) => Promise<Iterable<QueryResult>>;
|
|
230
|
-
|
|
231
|
-
/**
|
|
232
|
-
* Get the Denom on this Chain corresponding to the denom or Brand on
|
|
233
|
-
* this or another Chain.
|
|
234
|
-
* @param denom
|
|
235
|
-
* @returns
|
|
236
|
-
*/
|
|
237
|
-
getLocalDenom: (denom: DenomArg) => Promise<Denom>;
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
/**
|
|
241
|
-
* Low level object that supports queries and operations for an account on a remote chain.
|
|
242
|
-
*/
|
|
243
|
-
export interface ChainAccount {
|
|
244
|
-
/**
|
|
245
|
-
* @returns the address of the account on the remote chain
|
|
246
|
-
*/
|
|
247
|
-
getAddress: () => ChainAddress;
|
|
248
|
-
/**
|
|
249
|
-
* Submit a transaction on behalf of the remote account for execution on the remote chain.
|
|
250
|
-
* @param msgs - records for the transaction
|
|
251
|
-
* @returns acknowledgement string
|
|
252
|
-
*/
|
|
253
|
-
executeTx: (msgs: Proto3JSONMsg[]) => Promise<string>;
|
|
254
|
-
/**
|
|
255
|
-
* Submit a transaction on behalf of the remote account for execution on the remote chain.
|
|
256
|
-
* @param {AnyJson[]} msgs - records for the transaction
|
|
257
|
-
* @param {Partial<Omit<TxBody, 'messages'>>} [opts] - optional parameters for the Tx, like `timeoutHeight` and `memo`
|
|
258
|
-
* @returns acknowledgement string
|
|
259
|
-
*/
|
|
260
|
-
executeEncodedTx: (
|
|
261
|
-
msgs: AnyJson[],
|
|
262
|
-
opts?: Partial<Omit<TxBody, 'messages'>>,
|
|
263
|
-
) => Promise<string>;
|
|
264
|
-
/** deposit payment from zoe to the account*/
|
|
265
|
-
deposit: (payment: Payment) => Promise<void>;
|
|
266
|
-
/** get Purse for a brand to .withdraw() a Payment from the account */
|
|
267
|
-
getPurse: (brand: Brand) => Promise<Purse>;
|
|
268
|
-
/**
|
|
269
|
-
* Close the remote account
|
|
270
|
-
*/
|
|
271
|
-
close: () => Promise<void>;
|
|
272
|
-
/* transfer account to new holder */
|
|
273
|
-
prepareTransfer: () => Promise<Invitation>;
|
|
274
|
-
/** @returns the address of the remote channel */
|
|
275
|
-
getRemoteAddress: () => RemoteIbcAddress;
|
|
276
|
-
/** @returns the address of the local channel */
|
|
277
|
-
getLocalAddress: () => LocalIbcAddress;
|
|
278
|
-
/** @returns the port the ICA channel is bound to */
|
|
279
|
-
getPort: () => Port;
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
export interface StakingAccountQueries {
|
|
283
|
-
/**
|
|
284
|
-
* @returns all active delegations from the account to any validator (or [] if none)
|
|
285
|
-
*/
|
|
286
|
-
getDelegations: () => Promise<Delegation[]>;
|
|
287
|
-
|
|
288
|
-
/**
|
|
289
|
-
* @returns the active delegation from the account to a specific validator. Return an
|
|
290
|
-
* empty Delegation if there is no delegation.
|
|
291
|
-
*/
|
|
292
|
-
getDelegation: (validator: CosmosValidatorAddress) => Promise<Delegation>;
|
|
293
|
-
|
|
294
|
-
/**
|
|
295
|
-
* @returns the unbonding delegations from the account to any validator (or [] if none)
|
|
296
|
-
*/
|
|
297
|
-
getUnbondingDelegations: () => Promise<UnbondingDelegation[]>;
|
|
298
|
-
|
|
299
|
-
/**
|
|
300
|
-
* @returns the unbonding delegations from the account to a specific validator (or [] if none)
|
|
301
|
-
*/
|
|
302
|
-
getUnbondingDelegation: (
|
|
303
|
-
validator: CosmosValidatorAddress,
|
|
304
|
-
) => Promise<UnbondingDelegation>;
|
|
305
|
-
|
|
306
|
-
getRedelegations: () => Promise<Redelegation[]>;
|
|
307
|
-
|
|
308
|
-
getRedelegation: (
|
|
309
|
-
srcValidator: CosmosValidatorAddress,
|
|
310
|
-
dstValidator?: CosmosValidatorAddress,
|
|
311
|
-
) => Promise<Redelegation>;
|
|
312
|
-
|
|
313
|
-
/**
|
|
314
|
-
* Get the pending rewards for the account.
|
|
315
|
-
* @returns the amounts of the account's rewards pending from all validators
|
|
316
|
-
*/
|
|
317
|
-
getRewards: () => Promise<ChainAmount[]>;
|
|
318
|
-
|
|
319
|
-
/**
|
|
320
|
-
* Get the rewards pending with a specific validator.
|
|
321
|
-
* @param validator - the validator address to query for
|
|
322
|
-
* @returns the amount of the account's rewards pending from a specific validator
|
|
323
|
-
*/
|
|
324
|
-
getReward: (validator: CosmosValidatorAddress) => Promise<ChainAmount[]>;
|
|
325
|
-
}
|
|
326
|
-
export interface StakingAccountActions {
|
|
327
|
-
/**
|
|
328
|
-
* Delegate an amount to a validator. The promise settles when the delegation is complete.
|
|
329
|
-
* @param validator - the validator to delegate to
|
|
330
|
-
* @param amount - the amount to delegate
|
|
331
|
-
* @returns void
|
|
332
|
-
*/
|
|
333
|
-
delegate: (
|
|
334
|
-
validator: CosmosValidatorAddress,
|
|
335
|
-
amount: AmountArg,
|
|
336
|
-
) => Promise<void>;
|
|
337
|
-
|
|
338
|
-
/**
|
|
339
|
-
* Redelegate from one delegator to another.
|
|
340
|
-
* Settles when the redelegation is established, not 21 days later.
|
|
341
|
-
* @param srcValidator - the current validator for the delegation.
|
|
342
|
-
* @param dstValidator - the validator that will receive the delegation.
|
|
343
|
-
* @param amount - how much to redelegate.
|
|
344
|
-
* @returns
|
|
345
|
-
*/
|
|
346
|
-
redelegate: (
|
|
347
|
-
srcValidator: CosmosValidatorAddress,
|
|
348
|
-
dstValidator: CosmosValidatorAddress,
|
|
349
|
-
amount: AmountArg,
|
|
350
|
-
) => Promise<void>;
|
|
351
|
-
|
|
352
|
-
/**
|
|
353
|
-
* Undelegate multiple delegations (concurrently). To delegate independently, pass an array with one item.
|
|
354
|
-
* Resolves when the undelegation is complete and the tokens are no longer bonded. Note it may take weeks.
|
|
355
|
-
* The unbonding time is padded by 10 minutes to account for clock skew.
|
|
356
|
-
* @param {Delegation[]} delegations - the delegation to undelegate
|
|
357
|
-
*/
|
|
358
|
-
undelegate: (delegations: Delegation[]) => Promise<void>;
|
|
359
|
-
|
|
360
|
-
/**
|
|
361
|
-
* Withdraw rewards from all validators. The promise settles when the rewards are withdrawn.
|
|
362
|
-
* @returns The total amounts of rewards withdrawn
|
|
363
|
-
*/
|
|
364
|
-
withdrawRewards: () => Promise<ChainAmount[]>;
|
|
365
|
-
|
|
366
|
-
/**
|
|
367
|
-
* Withdraw rewards from a specific validator. The promise settles when the rewards are withdrawn.
|
|
368
|
-
* @param validator - the validator to withdraw rewards from
|
|
369
|
-
* @returns
|
|
370
|
-
*/
|
|
371
|
-
withdrawReward: (validator: CosmosValidatorAddress) => Promise<ChainAmount[]>;
|
|
372
|
-
}
|
|
373
|
-
|
|
374
|
-
/**
|
|
375
|
-
* An object that supports high-level operations for an account on a remote chain.
|
|
376
|
-
*/
|
|
377
|
-
export interface BaseOrchestrationAccount
|
|
378
|
-
extends StakingAccountQueries,
|
|
379
|
-
StakingAccountActions {
|
|
380
|
-
/** @returns the underlying low-level operation object. */
|
|
381
|
-
getChainAcccount: () => Promise<ChainAccount>;
|
|
382
|
-
|
|
383
|
-
/**
|
|
384
|
-
* @returns the address of the account on the remote chain
|
|
385
|
-
*/
|
|
386
|
-
getAddress: () => ChainAddress;
|
|
387
|
-
|
|
388
|
-
/** @returns an array of amounts for every balance in the account. */
|
|
389
|
-
getBalances: () => Promise<ChainAmount[]>;
|
|
390
|
-
|
|
391
|
-
/** @returns the balance of a specific denom for the account. */
|
|
392
|
-
getBalance: (denom: DenomArg) => Promise<ChainAmount>;
|
|
393
|
-
|
|
394
|
-
getDenomTrace: (
|
|
395
|
-
denom: string,
|
|
396
|
-
) => Promise<{ path: string; base_denom: string }>;
|
|
397
|
-
|
|
398
|
-
/**
|
|
399
|
-
* Transfer amount to another account on the same chain. The promise settles when the transfer is complete.
|
|
400
|
-
* @param toAccount - the account to send the amount to. MUST be on the same chain
|
|
401
|
-
* @param amount - the amount to send
|
|
402
|
-
* @returns void
|
|
403
|
-
*/
|
|
404
|
-
send: (toAccount: ChainAddress, amount: AmountArg) => Promise<void>;
|
|
405
|
-
|
|
406
|
-
/**
|
|
407
|
-
* Transfer an amount to another account, typically on another chain.
|
|
408
|
-
* The promise settles when the transfer is complete.
|
|
409
|
-
* @param amount - the amount to transfer.
|
|
410
|
-
* @param destination - the account to transfer the amount to.
|
|
411
|
-
* @param memo - an optional memo to include with the transfer, which could drive custom PFM behavior
|
|
412
|
-
* @returns void
|
|
413
|
-
*
|
|
414
|
-
* TODO document the mapping from the address to the destination chain.
|
|
415
|
-
*/
|
|
416
|
-
transfer: (
|
|
417
|
-
amount: AmountArg,
|
|
418
|
-
destination: ChainAddress,
|
|
419
|
-
memo?: string,
|
|
420
|
-
) => Promise<MsgTransferResponse>;
|
|
421
|
-
|
|
422
|
-
/**
|
|
423
|
-
* Transfer an amount to another account in multiple steps. The promise settles when
|
|
424
|
-
* the entire path of the transfer is complete.
|
|
425
|
-
* @param amount - the amount to transfer
|
|
426
|
-
* @param msg - the transfer message, including follow-up steps
|
|
427
|
-
* @returns void
|
|
428
|
-
*/
|
|
429
|
-
transferSteps: (
|
|
430
|
-
amount: AmountArg,
|
|
431
|
-
msg: TransferMsg,
|
|
432
|
-
) => Promise<MsgTransferResponse>;
|
|
433
|
-
/**
|
|
434
|
-
* deposit payment from zoe to the account. For remote accounts,
|
|
435
|
-
* an IBC Transfer will be executed to transfer funds there.
|
|
436
|
-
*/
|
|
437
|
-
deposit: (payment: Payment) => Promise<void>;
|
|
438
|
-
}
|
|
439
|
-
|
|
440
|
-
export type OrchestrationAccount<C extends keyof KnownChains> =
|
|
441
|
-
BaseOrchestrationAccount & KnownChains[C]['methods'];
|
|
442
|
-
|
|
443
|
-
/**
|
|
444
|
-
* Internal structure for TransferMsgs.
|
|
445
|
-
*
|
|
446
|
-
* NOTE Expected to change, so consider an opaque structure.
|
|
447
|
-
*/
|
|
448
|
-
export type TransferMsg = {
|
|
449
|
-
toAccount: ChainAddress;
|
|
450
|
-
timeout?: Timestamp;
|
|
451
|
-
next?: TransferMsg;
|
|
452
|
-
data?: object;
|
|
453
|
-
};
|
|
454
|
-
|
|
455
|
-
/**
|
|
456
|
-
* @param pool - Required. Pool number
|
|
457
|
-
* @example
|
|
458
|
-
* await icaNoble.transferSteps(usdcAmt,
|
|
459
|
-
* osmosisSwap(tiaBrand, { pool: 1224, slippage: 0.05 }, icaCel.getAddress()));
|
|
460
|
-
*/
|
|
461
|
-
export type OsmoSwapOptions = {
|
|
462
|
-
pool: string;
|
|
463
|
-
slippage?: Number;
|
|
464
|
-
};
|
|
465
|
-
|
|
466
|
-
/**
|
|
467
|
-
* Make a TransferMsg for a swap operation.
|
|
468
|
-
* @param denom - the currency to swap to
|
|
469
|
-
* @param options
|
|
470
|
-
* @param slippage - the maximum acceptable slippage
|
|
471
|
-
*/
|
|
472
|
-
export type OsmoSwapFn = (
|
|
473
|
-
denom: DenomArg,
|
|
474
|
-
options: Partial<OsmoSwapOptions>,
|
|
475
|
-
next: TransferMsg | ChainAddress,
|
|
476
|
-
) => TransferMsg;
|
|
477
|
-
|
|
478
|
-
export type AfterAction = { destChain: string; destAddress: ChainAddress };
|
|
479
|
-
export type SwapExact = { amountIn: Amount; amountOut: Amount };
|
|
480
|
-
export type SwapMaxSlippage = {
|
|
481
|
-
amountIn: Amount;
|
|
482
|
-
brandOut: Brand;
|
|
483
|
-
slippage: number;
|
|
484
|
-
};
|
|
7
|
+
export type * from './orchestration-api.js';
|
|
8
|
+
export type * from './service.js';
|
|
9
|
+
export type * from './vat-orchestration.js';
|
|
10
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["types.ts"],"names":[],"mappings":"AAAA,gGAAgG;AAEhG,mBAAmB,iBAAiB,CAAC;AACrC,mBAAmB,iBAAiB,CAAC;AACrC,mBAAmB,mBAAmB,CAAC;AACvC,mBAAmB,2BAA2B,CAAC;AAC/C,mBAAmB,4BAA4B,CAAC;AAChD,mBAAmB,wBAAwB,CAAC;AAC5C,mBAAmB,cAAc,CAAC;AAClC,mBAAmB,wBAAwB,CAAC"}
|
package/src/types.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** @file Rollup of all type definitions in the package, for local import and external export */
|
|
2
|
+
|
|
3
|
+
export type * from './chain-info.js';
|
|
4
|
+
export type * from './cosmos-api.js';
|
|
5
|
+
export type * from './ethereum-api.js';
|
|
6
|
+
export type * from './exos/chainAccountKit.js';
|
|
7
|
+
export type * from './exos/icqConnectionKit.js';
|
|
8
|
+
export type * from './orchestration-api.js';
|
|
9
|
+
export type * from './service.js';
|
|
10
|
+
export type * from './vat-orchestration.js';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export function makeICAChannelAddress(hostConnectionId: `connection-${number}`, controllerConnectionId: `connection-${number}`, { version, encoding, ordering, txType, }?: {
|
|
2
|
+
encoding?: string | undefined;
|
|
3
|
+
ordering?: "ordered" | "unordered" | undefined;
|
|
4
|
+
txType?: string | undefined;
|
|
5
|
+
version?: string | undefined;
|
|
6
|
+
} | undefined): `/${string}ibc-port/${string}/ordered/${string}` | `/${string}ibc-port/${string}/unordered/${string}`;
|
|
7
|
+
export function makeICQChannelAddress(controllerConnectionId: `connection-${number}`, { version }?: {
|
|
8
|
+
version?: string;
|
|
9
|
+
} | undefined): `/${string}ibc-port/${string}/ordered/${string}` | `/${string}ibc-port/${string}/unordered/${string}`;
|
|
10
|
+
export function findAddressField(remoteAddressString: `/${string}ibc-port/${string}/ordered/${string}` | `/${string}ibc-port/${string}/unordered/${string}`): string | undefined;
|
|
11
|
+
//# sourceMappingURL=address.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"address.d.ts","sourceRoot":"","sources":["address.js"],"names":[],"mappings":"AAkBO;;;;;sHAqBN;AAQM;cAHgB,MAAM;sHAS5B;AAUM,iLASN"}
|
package/src/utils/address.js
CHANGED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export namespace orcUtils {
|
|
2
|
+
function makeTransferMsg(_args: Omit<TransferMsg, "memo">): TransferMsg;
|
|
3
|
+
/**
|
|
4
|
+
* SwapExact or SwapMaxSlippage, with optional AfterAction
|
|
5
|
+
* @param { (SwapExact | SwapMaxSlippage) &
|
|
6
|
+
(AfterAction | Record<string, never>)} _args
|
|
7
|
+
* @returns {TransferMsg}
|
|
8
|
+
*/
|
|
9
|
+
function makeOsmosisSwap(_args: (SwapExact | SwapMaxSlippage) & (AfterAction | Record<string, never>)): TransferMsg;
|
|
10
|
+
}
|
|
11
|
+
import type { TransferMsg } from '../types.js';
|
|
12
|
+
import type { SwapMaxSlippage } from '../types.js';
|
|
13
|
+
import type { AfterAction } from '../types.js';
|
|
14
|
+
//# sourceMappingURL=orc.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"orc.d.ts","sourceRoot":"","sources":["orc.js"],"names":[],"mappings":";IASmB,wEAShB;IACD;;;;;OAKG;IACH,oHASC;;iCAlC0D,aAAa;qCAAb,aAAa;iCAAb,aAAa"}
|
package/src/utils/orc.js
CHANGED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @import {AnyJson, RequestQueryJson, Base64Any} from '@agoric/cosmic-proto';
|
|
3
|
+
* @import {ResponseQuery} from '@agoric/cosmic-proto/tendermint/abci/types.js';
|
|
4
|
+
* @import {InterchainAccountPacketData} from '@agoric/cosmic-proto/ibc/applications/interchain_accounts/v1/packet.js';
|
|
5
|
+
* @import {InterchainQueryPacketData} from '@agoric/cosmic-proto/icq/v1/packet.js';
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Makes an IBC transaction packet from an array of messages. Expects the `value` of each message
|
|
9
|
+
* to be base64 encoded bytes.
|
|
10
|
+
* Skips checks for malformed messages in favor of interface guards.
|
|
11
|
+
* @param {AnyJson[]} msgs
|
|
12
|
+
* @param {Partial<Omit<TxBody, 'messages'>>} [opts]
|
|
13
|
+
* @returns {string} stringified InterchainAccountPacketData
|
|
14
|
+
* @throws {Error} if malformed messages are provided
|
|
15
|
+
*/
|
|
16
|
+
export function makeTxPacket(msgs: AnyJson[], opts?: Partial<Omit<TxBody, "messages">> | undefined): string;
|
|
17
|
+
/**
|
|
18
|
+
* Makes an IBC query packet from an array of query messages. Expects the `data` of each message
|
|
19
|
+
* to be base64 encoded bytes.
|
|
20
|
+
* Skips checks for malformed messages in favor of interface guards.
|
|
21
|
+
* @param {RequestQueryJson[]} msgs
|
|
22
|
+
* @returns {string} stringified InterchainQueryPacketData
|
|
23
|
+
* @throws {Error} if malformed messages are provided
|
|
24
|
+
*/
|
|
25
|
+
export function makeQueryPacket(msgs: import("@agoric/cosmic-proto").JsonSafe<RequestQuery>[]): string;
|
|
26
|
+
/**
|
|
27
|
+
* Looks for a result or error key in the response string, and returns
|
|
28
|
+
* a Base64Bytes string. This string can be decoded using the corresponding
|
|
29
|
+
* Msg*Response object.
|
|
30
|
+
* Error strings seem to be plain text and do not need decoding.
|
|
31
|
+
* @param {string} response
|
|
32
|
+
* @returns {string} - base64 encoded bytes string
|
|
33
|
+
* @throws {Error} if error key is detected in response string, or result key is not found
|
|
34
|
+
*/
|
|
35
|
+
export function parseTxPacket(response: string): string;
|
|
36
|
+
/**
|
|
37
|
+
* Looks for a result or error key in the response string. If a result is found,
|
|
38
|
+
* `responses` is decoded via `CosmosResponse`. The `key` and `value` fields on the
|
|
39
|
+
* resulting entries are base64 encoded for inter-vat communication. These can be
|
|
40
|
+
* decoded using the corresponding Query*Response objects.
|
|
41
|
+
* Error strings seem to be plain text and do not need decoding.
|
|
42
|
+
* @param {string} response
|
|
43
|
+
* @returns {Base64Any<ResponseQuery>[]}
|
|
44
|
+
* @throws {Error} if error key is detected in response string, or result key is not found
|
|
45
|
+
*/
|
|
46
|
+
export function parseQueryPacket(response: string): Base64Any<ResponseQuery>[];
|
|
47
|
+
import type { AnyJson } from '@agoric/cosmic-proto';
|
|
48
|
+
import { TxBody } from '@agoric/cosmic-proto/cosmos/tx/v1beta1/tx.js';
|
|
49
|
+
import { RequestQuery } from '@agoric/cosmic-proto/tendermint/abci/types.js';
|
|
50
|
+
import type { ResponseQuery } from '@agoric/cosmic-proto/tendermint/abci/types.js';
|
|
51
|
+
import type { Base64Any } from '@agoric/cosmic-proto';
|
|
52
|
+
//# sourceMappingURL=packet.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"packet.d.ts","sourceRoot":"","sources":["packet.js"],"names":[],"mappings":"AAUA;;;;;GAKG;AAEH;;;;;;;;GAQG;AACH,qGAHa,MAAM,CAmBlB;AAGD;;;;;;;GAOG;AACH,gGAHa,MAAM,CAgBlB;AAGD;;;;;;;;GAQG;AACH,wCAJW,MAAM,GACJ,MAAM,CAQlB;AAGD;;;;;;;;;GASG;AACH,2CAJW,MAAM,8BAehB;6BAhGsD,sBAAsB;uBAXtD,8CAA8C;6BAExC,+CAA+C;mCAU5C,+CAA+C;+BADxB,sBAAsB"}
|
package/src/utils/packet.js
CHANGED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export function buildRootObject(_vatPowers: any, _args: any, baggage: any): {
|
|
2
|
+
/** @param {Partial<OrchestrationPowers>} [initialPowers] */
|
|
3
|
+
makeOrchestrationKit(initialPowers?: Partial<OrchestrationPowers> | undefined): import("@endo/exo").GuardedKit<{
|
|
4
|
+
self: {
|
|
5
|
+
allocateICAControllerPort(): Promise<any>;
|
|
6
|
+
allocateICQControllerPort(): Promise<any>;
|
|
7
|
+
};
|
|
8
|
+
public: {
|
|
9
|
+
makeAccount(hostConnectionId: `connection-${number}`, controllerConnectionId: `connection-${number}`): Promise<import("./cosmos-api.js").IcaAccount>;
|
|
10
|
+
provideICQConnection(controllerConnectionId: `connection-${number}`): Promise<import("@endo/exo").Guarded<{
|
|
11
|
+
getLocalAddress(): `/ibc-port/${string}`;
|
|
12
|
+
getRemoteAddress(): `/${string}ibc-port/${string}/ordered/${string}` | `/${string}ibc-port/${string}/unordered/${string}`;
|
|
13
|
+
query(msgs: import("@agoric/cosmic-proto").JsonSafe<import("@agoric/cosmic-proto/tendermint/abci/types.js").RequestQuery>[]): Promise<import("@agoric/cosmic-proto").Base64Any<import("@agoric/cosmic-proto/tendermint/abci/types.js").ResponseQuery>[]>;
|
|
14
|
+
}>>;
|
|
15
|
+
};
|
|
16
|
+
}>;
|
|
17
|
+
} & import("@endo/pass-style").RemotableObject<`Alleged: ${string}`> & import("@endo/eventual-send").RemotableBrand<{}, {
|
|
18
|
+
/** @param {Partial<OrchestrationPowers>} [initialPowers] */
|
|
19
|
+
makeOrchestrationKit(initialPowers?: Partial<OrchestrationPowers> | undefined): import("@endo/exo").GuardedKit<{
|
|
20
|
+
self: {
|
|
21
|
+
allocateICAControllerPort(): Promise<any>;
|
|
22
|
+
allocateICQControllerPort(): Promise<any>;
|
|
23
|
+
};
|
|
24
|
+
public: {
|
|
25
|
+
makeAccount(hostConnectionId: `connection-${number}`, controllerConnectionId: `connection-${number}`): Promise<import("./cosmos-api.js").IcaAccount>;
|
|
26
|
+
provideICQConnection(controllerConnectionId: `connection-${number}`): Promise<import("@endo/exo").Guarded<{
|
|
27
|
+
getLocalAddress(): `/ibc-port/${string}`;
|
|
28
|
+
getRemoteAddress(): `/${string}ibc-port/${string}/ordered/${string}` | `/${string}ibc-port/${string}/unordered/${string}`;
|
|
29
|
+
query(msgs: import("@agoric/cosmic-proto").JsonSafe<import("@agoric/cosmic-proto/tendermint/abci/types.js").RequestQuery>[]): Promise<import("@agoric/cosmic-proto").Base64Any<import("@agoric/cosmic-proto/tendermint/abci/types.js").ResponseQuery>[]>;
|
|
30
|
+
}>>;
|
|
31
|
+
};
|
|
32
|
+
}>;
|
|
33
|
+
}>;
|
|
34
|
+
export type OrchestrationVat = ReturnType<typeof buildRootObject>;
|
|
35
|
+
import type { OrchestrationPowers } from './service.js';
|
|
36
|
+
//# sourceMappingURL=vat-orchestration.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vat-orchestration.d.ts","sourceRoot":"","sources":["vat-orchestration.js"],"names":[],"mappings":"AAMO;IAOH,4DAA4D;;;;;;;;;;;;;;;;IAA5D,4DAA4D;;;;;;;;;;;;;;;GAK/D;+BAEa,UAAU,CAAC,OAAO,eAAe,CAAC;yCAhBP,cAAc"}
|
package/src/vat-orchestration.js
CHANGED