@agoric/orchestration 0.1.1-calypso-dev-84eb287.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/LICENSE +201 -0
- package/README.md +5 -0
- package/index.d.ts +4 -0
- package/index.js +7 -0
- package/package.json +95 -0
- package/src/chain-info.d.ts +2318 -0
- package/src/chain-info.d.ts.map +1 -0
- package/src/chain-info.js +114 -0
- package/src/cosmos-api.d.ts +174 -0
- package/src/cosmos-api.d.ts.map +1 -0
- package/src/cosmos-api.ts +231 -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/sendAnywhere.contract.d.ts +31 -0
- package/src/examples/sendAnywhere.contract.d.ts.map +1 -0
- package/src/examples/sendAnywhere.contract.js +171 -0
- package/src/examples/stakeBld.contract.d.ts +121 -0
- package/src/examples/stakeBld.contract.d.ts.map +1 -0
- package/src/examples/stakeBld.contract.js +133 -0
- package/src/examples/stakeIca.contract.d.ts +93 -0
- package/src/examples/stakeIca.contract.d.ts.map +1 -0
- package/src/examples/stakeIca.contract.js +143 -0
- package/src/examples/swapExample.contract.d.ts +34 -0
- package/src/examples/swapExample.contract.d.ts.map +1 -0
- package/src/examples/swapExample.contract.js +155 -0
- package/src/examples/unbondExample.contract.d.ts +21 -0
- package/src/examples/unbondExample.contract.d.ts.map +1 -0
- package/src/examples/unbondExample.contract.js +105 -0
- package/src/exos/README.md +56 -0
- package/src/exos/agoric-names-tools.d.ts +27 -0
- package/src/exos/agoric-names-tools.d.ts.map +1 -0
- package/src/exos/agoric-names-tools.js +109 -0
- package/src/exos/chain-account-kit.d.ts +88 -0
- package/src/exos/chain-account-kit.d.ts.map +1 -0
- package/src/exos/chain-account-kit.js +210 -0
- package/src/exos/chain-hub.d.ts +77 -0
- package/src/exos/chain-hub.d.ts.map +1 -0
- package/src/exos/chain-hub.js +214 -0
- package/src/exos/cosmos-orchestration-account.d.ts +207 -0
- package/src/exos/cosmos-orchestration-account.d.ts.map +1 -0
- package/src/exos/cosmos-orchestration-account.js +536 -0
- package/src/exos/icq-connection-kit.d.ts +50 -0
- package/src/exos/icq-connection-kit.d.ts.map +1 -0
- package/src/exos/icq-connection-kit.js +135 -0
- package/src/exos/local-chain-facade.d.ts +81 -0
- package/src/exos/local-chain-facade.d.ts.map +1 -0
- package/src/exos/local-chain-facade.js +113 -0
- package/src/exos/local-orchestration-account.d.ts +176 -0
- package/src/exos/local-orchestration-account.d.ts.map +1 -0
- package/src/exos/local-orchestration-account.js +446 -0
- package/src/exos/orchestrator.d.ts +91 -0
- package/src/exos/orchestrator.d.ts.map +1 -0
- package/src/exos/orchestrator.js +141 -0
- package/src/exos/remote-chain-facade.d.ts +144 -0
- package/src/exos/remote-chain-facade.d.ts.map +1 -0
- package/src/exos/remote-chain-facade.js +145 -0
- package/src/facade.d.ts +57 -0
- package/src/facade.d.ts.map +1 -0
- package/src/facade.js +132 -0
- package/src/fetched-chain-info.d.ts +2311 -0
- package/src/fetched-chain-info.d.ts.map +1 -0
- package/src/fetched-chain-info.js +2288 -0
- package/src/internal.d.ts +13 -0
- package/src/internal.d.ts.map +1 -0
- package/src/internal.ts +20 -0
- package/src/orchestration-api.d.ts +158 -0
- package/src/orchestration-api.d.ts.map +1 -0
- package/src/orchestration-api.ts +201 -0
- package/src/proposals/orchestration-proposal.d.ts +53 -0
- package/src/proposals/orchestration-proposal.d.ts.map +1 -0
- package/src/proposals/orchestration-proposal.js +179 -0
- package/src/proposals/revise-chain-info.d.ts +21 -0
- package/src/proposals/revise-chain-info.d.ts.map +1 -0
- package/src/proposals/revise-chain-info.js +44 -0
- package/src/proposals/start-stakeAtom.d.ts +109 -0
- package/src/proposals/start-stakeAtom.d.ts.map +1 -0
- package/src/proposals/start-stakeAtom.js +105 -0
- package/src/proposals/start-stakeBld.d.ts +154 -0
- package/src/proposals/start-stakeBld.d.ts.map +1 -0
- package/src/proposals/start-stakeBld.js +103 -0
- package/src/proposals/start-stakeOsmo.d.ts +108 -0
- package/src/proposals/start-stakeOsmo.d.ts.map +1 -0
- package/src/proposals/start-stakeOsmo.js +106 -0
- package/src/service.d.ts +97 -0
- package/src/service.d.ts.map +1 -0
- package/src/service.js +259 -0
- package/src/typeGuards.d.ts +55 -0
- package/src/typeGuards.d.ts.map +1 -0
- package/src/typeGuards.js +104 -0
- package/src/types.d.ts +11 -0
- package/src/types.d.ts.map +1 -0
- package/src/types.ts +11 -0
- package/src/utils/address.d.ts +14 -0
- package/src/utils/address.d.ts.map +1 -0
- package/src/utils/address.js +79 -0
- package/src/utils/cosmos.d.ts +9 -0
- package/src/utils/cosmos.d.ts.map +1 -0
- package/src/utils/cosmos.js +36 -0
- package/src/utils/orc.d.ts +17 -0
- package/src/utils/orc.d.ts.map +1 -0
- package/src/utils/orc.js +38 -0
- package/src/utils/orchestrationAccount.d.ts +10 -0
- package/src/utils/orchestrationAccount.d.ts.map +1 -0
- package/src/utils/orchestrationAccount.js +22 -0
- package/src/utils/packet.d.ts +57 -0
- package/src/utils/packet.d.ts.map +1 -0
- package/src/utils/packet.js +112 -0
- package/src/utils/registry.d.ts +13 -0
- package/src/utils/registry.d.ts.map +1 -0
- package/src/utils/registry.js +131 -0
- package/src/utils/start-helper.d.ts +51 -0
- package/src/utils/start-helper.d.ts.map +1 -0
- package/src/utils/start-helper.js +109 -0
- package/src/utils/time.d.ts +31 -0
- package/src/utils/time.d.ts.map +1 -0
- package/src/utils/time.js +63 -0
- package/src/vat-orchestration.d.ts +58 -0
- package/src/vat-orchestration.d.ts.map +1 -0
- package/src/vat-orchestration.js +24 -0
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Vow } from '@agoric/vow';
|
|
2
|
+
/**
|
|
3
|
+
* Converts a function type that returns a Promise to a function type that
|
|
4
|
+
* returns a Vow. If the input is not a function returning a Promise, it
|
|
5
|
+
* preserves the original type.
|
|
6
|
+
*
|
|
7
|
+
* @template T - The type to transform
|
|
8
|
+
*/
|
|
9
|
+
export type PromiseToVow<T> = T extends (...args: infer Args) => Promise<infer R> ? (...args: Args) => Vow<R> : T extends (...args: infer Args) => infer R ? (...args: Args) => R : T;
|
|
10
|
+
export type VowifyAll<T> = {
|
|
11
|
+
[K in keyof T]: PromiseToVow<T[K]>;
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=internal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["internal.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAEvC;;;;;;GAMG;AACH,MAAM,MAAM,YAAY,CAAC,CAAC,IAAI,CAAC,SAAS,CACtC,GAAG,IAAI,EAAE,MAAM,IAAI,KAChB,OAAO,CAAC,MAAM,CAAC,CAAC,GACjB,CAAC,GAAG,IAAI,EAAE,IAAI,KAAK,GAAG,CAAC,CAAC,CAAC,GACzB,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,MAAM,IAAI,KAAK,MAAM,CAAC,GACxC,CAAC,GAAG,IAAI,EAAE,IAAI,KAAK,CAAC,GACpB,CAAC,CAAC;AAER,MAAM,MAAM,SAAS,CAAC,CAAC,IAAI;KACxB,CAAC,IAAI,MAAM,CAAC,GAAG,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CACnC,CAAC"}
|
package/src/internal.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { Vow } from '@agoric/vow';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Converts a function type that returns a Promise to a function type that
|
|
5
|
+
* returns a Vow. If the input is not a function returning a Promise, it
|
|
6
|
+
* preserves the original type.
|
|
7
|
+
*
|
|
8
|
+
* @template T - The type to transform
|
|
9
|
+
*/
|
|
10
|
+
export type PromiseToVow<T> = T extends (
|
|
11
|
+
...args: infer Args
|
|
12
|
+
) => Promise<infer R>
|
|
13
|
+
? (...args: Args) => Vow<R>
|
|
14
|
+
: T extends (...args: infer Args) => infer R
|
|
15
|
+
? (...args: Args) => R
|
|
16
|
+
: T;
|
|
17
|
+
|
|
18
|
+
export type VowifyAll<T> = {
|
|
19
|
+
[K in keyof T]: PromiseToVow<T[K]>;
|
|
20
|
+
};
|
|
@@ -0,0 +1,158 @@
|
|
|
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, Payment } from '@agoric/ertp/src/types.js';
|
|
7
|
+
import type { LocalChainAccount } from '@agoric/vats/src/localchain.js';
|
|
8
|
+
import type { Timestamp } from '@agoric/time';
|
|
9
|
+
import type { ChainInfo, CosmosChainAccountMethods, CosmosChainInfo, IBCMsgTransferOptions, KnownChains } from './types.js';
|
|
10
|
+
/**
|
|
11
|
+
* A denom that designates a path to a token type on some blockchain.
|
|
12
|
+
*
|
|
13
|
+
* Multiple denoms may designate the same underlying base denom (e.g., `uist`,
|
|
14
|
+
* `uatom`) on different Chains or on the same Chain via different paths. On
|
|
15
|
+
* Cosmos chains, all but the base denom are IBC style denoms, but that may vary
|
|
16
|
+
* across other chains. All the denoms that designate the same underlying base
|
|
17
|
+
* denom form an equivalence class, along with the unique Brand on the local
|
|
18
|
+
* Chain. Some operations accept any member of the equivalence class to
|
|
19
|
+
* effectively designate the corresponding token type on the target chain.
|
|
20
|
+
*/
|
|
21
|
+
export type Denom = string;
|
|
22
|
+
/**
|
|
23
|
+
* In many cases, either a denom string or a local Brand can be used to
|
|
24
|
+
* designate a remote token type.
|
|
25
|
+
*/
|
|
26
|
+
export type DenomArg = Denom | Brand;
|
|
27
|
+
/**
|
|
28
|
+
* Count of some fungible token on some blockchain.
|
|
29
|
+
*
|
|
30
|
+
* @see {@link Orchestrator.asAmount} to convert to an Amount surjectively
|
|
31
|
+
*/
|
|
32
|
+
export type DenomAmount = {
|
|
33
|
+
denom: Denom;
|
|
34
|
+
value: bigint;
|
|
35
|
+
};
|
|
36
|
+
/** Amounts can be provided as pure data using denoms or as ERTP Amounts */
|
|
37
|
+
export type AmountArg = DenomAmount | Amount;
|
|
38
|
+
/** An address on some blockchain, e.g., cosmos, eth, etc. */
|
|
39
|
+
export type ChainAddress = {
|
|
40
|
+
/** e.g. 1 for Ethereum, agoric-3 for Agoric, cosmoshub-4 for Cosmos */
|
|
41
|
+
chainId: string;
|
|
42
|
+
address: string;
|
|
43
|
+
addressEncoding: 'bech32' | 'ethereum';
|
|
44
|
+
};
|
|
45
|
+
export type OrchestrationAccount<CI extends ChainInfo> = OrchestrationAccountI & (CI extends CosmosChainInfo ? CosmosChainAccountMethods<CI> : never);
|
|
46
|
+
/**
|
|
47
|
+
* An object for access the core functions of a remote chain.
|
|
48
|
+
*
|
|
49
|
+
* Note that "remote" can mean the local chain; it's just that
|
|
50
|
+
* accounts are treated as remote/arms length for consistency.
|
|
51
|
+
*/
|
|
52
|
+
export interface Chain<CI extends ChainInfo> {
|
|
53
|
+
getChainInfo: () => Promise<CI>;
|
|
54
|
+
/**
|
|
55
|
+
* Creates a new account on the remote chain.
|
|
56
|
+
* @returns an object that controls a new remote account on Chain
|
|
57
|
+
*/
|
|
58
|
+
makeAccount: () => Promise<OrchestrationAccount<CI>>;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Provided in the callback to `orchestrate()`.
|
|
62
|
+
*/
|
|
63
|
+
export interface Orchestrator {
|
|
64
|
+
getChain: <C extends string>(chainName: C) => Promise<Chain<C extends keyof KnownChains ? KnownChains[C] : any>>;
|
|
65
|
+
makeLocalAccount: () => Promise<LocalChainAccount>;
|
|
66
|
+
/**
|
|
67
|
+
* For a denom, return information about a denom including the equivalent
|
|
68
|
+
* local Brand, the Chain on which the denom is held, and the Chain that
|
|
69
|
+
* issues the corresponding asset.
|
|
70
|
+
* @param denom
|
|
71
|
+
*/
|
|
72
|
+
getBrandInfo: <HoldingChain extends keyof KnownChains, IssuingChain extends keyof KnownChains>(denom: Denom) => {
|
|
73
|
+
/** The well-known Brand on Agoric for the direct asset */
|
|
74
|
+
brand?: Brand;
|
|
75
|
+
/** The Chain at which the argument `denom` exists (where the asset is currently held) */
|
|
76
|
+
chain: Chain<KnownChains[HoldingChain]>;
|
|
77
|
+
/** The Chain that is the issuer of the underlying asset */
|
|
78
|
+
base: Chain<KnownChains[IssuingChain]>;
|
|
79
|
+
/** the Denom for the underlying asset on its issuer chain */
|
|
80
|
+
baseDenom: Denom;
|
|
81
|
+
};
|
|
82
|
+
/**
|
|
83
|
+
* Convert an amount described in native data to a local, structured Amount.
|
|
84
|
+
* @param amount - the described amount
|
|
85
|
+
* @returns the Amount in local structuerd format
|
|
86
|
+
*/
|
|
87
|
+
asAmount: (amount: DenomAmount) => NatAmount;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* An object that supports high-level operations for an account on a remote chain.
|
|
91
|
+
*/
|
|
92
|
+
export interface OrchestrationAccountI {
|
|
93
|
+
/**
|
|
94
|
+
* @returns the address of the account on the remote chain
|
|
95
|
+
*/
|
|
96
|
+
getAddress: () => ChainAddress;
|
|
97
|
+
/** @returns an array of amounts for every balance in the account. */
|
|
98
|
+
getBalances: () => Promise<DenomAmount[]>;
|
|
99
|
+
/** @returns the balance of a specific denom for the account. */
|
|
100
|
+
getBalance: (denom: DenomArg) => Promise<DenomAmount>;
|
|
101
|
+
/**
|
|
102
|
+
* Transfer amount to another account on the same chain. The promise settles when the transfer is complete.
|
|
103
|
+
* @param toAccount - the account to send the amount to. MUST be on the same chain
|
|
104
|
+
* @param amount - the amount to send
|
|
105
|
+
* @returns void
|
|
106
|
+
*/
|
|
107
|
+
send: (toAccount: ChainAddress, amount: AmountArg) => Promise<void>;
|
|
108
|
+
/**
|
|
109
|
+
* Transfer an amount to another account, typically on another chain.
|
|
110
|
+
* The promise settles when the transfer is complete.
|
|
111
|
+
* @param amount - the amount to transfer. Can be provided as pure data using denoms or as ERTP Amounts.
|
|
112
|
+
* @param destination - the account to transfer the amount to.
|
|
113
|
+
* @param [opts] - an optional memo to include with the transfer, which could drive custom PFM behavior, and timeout parameters
|
|
114
|
+
* @returns void
|
|
115
|
+
*
|
|
116
|
+
* TODO document the mapping from the address to the destination chain.
|
|
117
|
+
*/
|
|
118
|
+
transfer: (amount: AmountArg, destination: ChainAddress, opts?: IBCMsgTransferOptions) => Promise<void>;
|
|
119
|
+
/**
|
|
120
|
+
* Transfer an amount to another account in multiple steps. The promise settles when
|
|
121
|
+
* the entire path of the transfer is complete.
|
|
122
|
+
* @param amount - the amount to transfer
|
|
123
|
+
* @param msg - the transfer message, including follow-up steps
|
|
124
|
+
* @returns void
|
|
125
|
+
*/
|
|
126
|
+
transferSteps: (amount: AmountArg, msg: TransferMsg) => Promise<void>;
|
|
127
|
+
/**
|
|
128
|
+
* deposit payment from zoe to the account. For remote accounts,
|
|
129
|
+
* an IBC Transfer will be executed to transfer funds there.
|
|
130
|
+
*/
|
|
131
|
+
deposit: (payment: Payment<'nat'>) => Promise<void>;
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Internal structure for TransferMsgs.
|
|
135
|
+
* The type must be able to express transfers across different chains and transports.
|
|
136
|
+
*
|
|
137
|
+
* NOTE Expected to change, so consider an opaque structure.
|
|
138
|
+
*/
|
|
139
|
+
export type TransferMsg = {
|
|
140
|
+
toAccount: ChainAddress;
|
|
141
|
+
timeout?: Timestamp;
|
|
142
|
+
next?: TransferMsg;
|
|
143
|
+
data?: object;
|
|
144
|
+
};
|
|
145
|
+
export type AfterAction = {
|
|
146
|
+
destChain: string;
|
|
147
|
+
destAddress: ChainAddress;
|
|
148
|
+
};
|
|
149
|
+
export type SwapExact = {
|
|
150
|
+
amountIn: Amount;
|
|
151
|
+
amountOut: Amount;
|
|
152
|
+
};
|
|
153
|
+
export type SwapMaxSlippage = {
|
|
154
|
+
amountIn: Amount;
|
|
155
|
+
brandOut: Brand;
|
|
156
|
+
slippage: number;
|
|
157
|
+
};
|
|
158
|
+
//# sourceMappingURL=orchestration-api.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"orchestration-api.d.ts","sourceRoot":"","sources":["orchestration-api.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
/* eslint-disable no-use-before-define */
|
|
2
|
+
/**
|
|
3
|
+
* @file General API of orchestration
|
|
4
|
+
* - must not have chain-specific types without runtime narrowing by chain id
|
|
5
|
+
* - should remain relatively stable.
|
|
6
|
+
*/
|
|
7
|
+
import type {
|
|
8
|
+
Amount,
|
|
9
|
+
Brand,
|
|
10
|
+
NatAmount,
|
|
11
|
+
Payment,
|
|
12
|
+
} from '@agoric/ertp/src/types.js';
|
|
13
|
+
import type { LocalChainAccount } from '@agoric/vats/src/localchain.js';
|
|
14
|
+
import type { Timestamp } from '@agoric/time';
|
|
15
|
+
import type {
|
|
16
|
+
ChainInfo,
|
|
17
|
+
CosmosChainAccountMethods,
|
|
18
|
+
CosmosChainInfo,
|
|
19
|
+
IBCMsgTransferOptions,
|
|
20
|
+
KnownChains,
|
|
21
|
+
} from './types.js';
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* A denom that designates a path to a token type on some blockchain.
|
|
25
|
+
*
|
|
26
|
+
* Multiple denoms may designate the same underlying base denom (e.g., `uist`,
|
|
27
|
+
* `uatom`) on different Chains or on the same Chain via different paths. On
|
|
28
|
+
* Cosmos chains, all but the base denom are IBC style denoms, but that may vary
|
|
29
|
+
* across other chains. All the denoms that designate the same underlying base
|
|
30
|
+
* denom form an equivalence class, along with the unique Brand on the local
|
|
31
|
+
* Chain. Some operations accept any member of the equivalence class to
|
|
32
|
+
* effectively designate the corresponding token type on the target chain.
|
|
33
|
+
*/
|
|
34
|
+
export type Denom = string; // ibc/... or uist
|
|
35
|
+
|
|
36
|
+
// ??? when multiple Denoms provide paths to the same remote token type,
|
|
37
|
+
// should the brand be 1:1 with that equivalence class or each Denom?
|
|
38
|
+
/**
|
|
39
|
+
* In many cases, either a denom string or a local Brand can be used to
|
|
40
|
+
* designate a remote token type.
|
|
41
|
+
*/
|
|
42
|
+
export type DenomArg = Denom | Brand;
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Count of some fungible token on some blockchain.
|
|
46
|
+
*
|
|
47
|
+
* @see {@link Orchestrator.asAmount} to convert to an Amount surjectively
|
|
48
|
+
*/
|
|
49
|
+
export type DenomAmount = {
|
|
50
|
+
denom: Denom;
|
|
51
|
+
value: bigint; // Nat
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
/** Amounts can be provided as pure data using denoms or as ERTP Amounts */
|
|
55
|
+
export type AmountArg = DenomAmount | Amount;
|
|
56
|
+
|
|
57
|
+
/** An address on some blockchain, e.g., cosmos, eth, etc. */
|
|
58
|
+
export type ChainAddress = {
|
|
59
|
+
/** e.g. 1 for Ethereum, agoric-3 for Agoric, cosmoshub-4 for Cosmos */
|
|
60
|
+
chainId: string;
|
|
61
|
+
address: string;
|
|
62
|
+
// TODO what's the right way to scope the address? it's not chainId
|
|
63
|
+
addressEncoding: 'bech32' | 'ethereum';
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
export type OrchestrationAccount<CI extends ChainInfo> = OrchestrationAccountI &
|
|
67
|
+
(CI extends CosmosChainInfo ? CosmosChainAccountMethods<CI> : never);
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* An object for access the core functions of a remote chain.
|
|
71
|
+
*
|
|
72
|
+
* Note that "remote" can mean the local chain; it's just that
|
|
73
|
+
* accounts are treated as remote/arms length for consistency.
|
|
74
|
+
*/
|
|
75
|
+
export interface Chain<CI extends ChainInfo> {
|
|
76
|
+
getChainInfo: () => Promise<CI>;
|
|
77
|
+
|
|
78
|
+
// "makeAccount" suggests an operation within a vat
|
|
79
|
+
/**
|
|
80
|
+
* Creates a new account on the remote chain.
|
|
81
|
+
* @returns an object that controls a new remote account on Chain
|
|
82
|
+
*/
|
|
83
|
+
makeAccount: () => Promise<OrchestrationAccount<CI>>;
|
|
84
|
+
// FUTURE supply optional port object; also fetch port object
|
|
85
|
+
|
|
86
|
+
// TODO provide a way to get the local denom/brand/whatever for this chain
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Provided in the callback to `orchestrate()`.
|
|
91
|
+
*/
|
|
92
|
+
export interface Orchestrator {
|
|
93
|
+
getChain: <C extends string>(
|
|
94
|
+
chainName: C,
|
|
95
|
+
) => Promise<Chain<C extends keyof KnownChains ? KnownChains[C] : any>>;
|
|
96
|
+
|
|
97
|
+
makeLocalAccount: () => Promise<LocalChainAccount>;
|
|
98
|
+
/**
|
|
99
|
+
* For a denom, return information about a denom including the equivalent
|
|
100
|
+
* local Brand, the Chain on which the denom is held, and the Chain that
|
|
101
|
+
* issues the corresponding asset.
|
|
102
|
+
* @param denom
|
|
103
|
+
*/
|
|
104
|
+
getBrandInfo: <
|
|
105
|
+
HoldingChain extends keyof KnownChains,
|
|
106
|
+
IssuingChain extends keyof KnownChains,
|
|
107
|
+
>(
|
|
108
|
+
denom: Denom,
|
|
109
|
+
) => {
|
|
110
|
+
/** The well-known Brand on Agoric for the direct asset */
|
|
111
|
+
brand?: Brand;
|
|
112
|
+
/** The Chain at which the argument `denom` exists (where the asset is currently held) */
|
|
113
|
+
chain: Chain<KnownChains[HoldingChain]>;
|
|
114
|
+
/** The Chain that is the issuer of the underlying asset */
|
|
115
|
+
base: Chain<KnownChains[IssuingChain]>;
|
|
116
|
+
/** the Denom for the underlying asset on its issuer chain */
|
|
117
|
+
baseDenom: Denom;
|
|
118
|
+
};
|
|
119
|
+
// TODO preload the mapping so this can be synchronous
|
|
120
|
+
/**
|
|
121
|
+
* Convert an amount described in native data to a local, structured Amount.
|
|
122
|
+
* @param amount - the described amount
|
|
123
|
+
* @returns the Amount in local structuerd format
|
|
124
|
+
*/
|
|
125
|
+
asAmount: (amount: DenomAmount) => NatAmount;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* An object that supports high-level operations for an account on a remote chain.
|
|
130
|
+
*/
|
|
131
|
+
export interface OrchestrationAccountI {
|
|
132
|
+
/**
|
|
133
|
+
* @returns the address of the account on the remote chain
|
|
134
|
+
*/
|
|
135
|
+
getAddress: () => ChainAddress;
|
|
136
|
+
|
|
137
|
+
/** @returns an array of amounts for every balance in the account. */
|
|
138
|
+
getBalances: () => Promise<DenomAmount[]>;
|
|
139
|
+
|
|
140
|
+
/** @returns the balance of a specific denom for the account. */
|
|
141
|
+
getBalance: (denom: DenomArg) => Promise<DenomAmount>;
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* Transfer amount to another account on the same chain. The promise settles when the transfer is complete.
|
|
145
|
+
* @param toAccount - the account to send the amount to. MUST be on the same chain
|
|
146
|
+
* @param amount - the amount to send
|
|
147
|
+
* @returns void
|
|
148
|
+
*/
|
|
149
|
+
send: (toAccount: ChainAddress, amount: AmountArg) => Promise<void>;
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* Transfer an amount to another account, typically on another chain.
|
|
153
|
+
* The promise settles when the transfer is complete.
|
|
154
|
+
* @param amount - the amount to transfer. Can be provided as pure data using denoms or as ERTP Amounts.
|
|
155
|
+
* @param destination - the account to transfer the amount to.
|
|
156
|
+
* @param [opts] - an optional memo to include with the transfer, which could drive custom PFM behavior, and timeout parameters
|
|
157
|
+
* @returns void
|
|
158
|
+
*
|
|
159
|
+
* TODO document the mapping from the address to the destination chain.
|
|
160
|
+
*/
|
|
161
|
+
transfer: (
|
|
162
|
+
amount: AmountArg,
|
|
163
|
+
destination: ChainAddress,
|
|
164
|
+
opts?: IBCMsgTransferOptions,
|
|
165
|
+
) => Promise<void>;
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* Transfer an amount to another account in multiple steps. The promise settles when
|
|
169
|
+
* the entire path of the transfer is complete.
|
|
170
|
+
* @param amount - the amount to transfer
|
|
171
|
+
* @param msg - the transfer message, including follow-up steps
|
|
172
|
+
* @returns void
|
|
173
|
+
*/
|
|
174
|
+
transferSteps: (amount: AmountArg, msg: TransferMsg) => Promise<void>;
|
|
175
|
+
/**
|
|
176
|
+
* deposit payment from zoe to the account. For remote accounts,
|
|
177
|
+
* an IBC Transfer will be executed to transfer funds there.
|
|
178
|
+
*/
|
|
179
|
+
deposit: (payment: Payment<'nat'>) => Promise<void>;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* Internal structure for TransferMsgs.
|
|
184
|
+
* The type must be able to express transfers across different chains and transports.
|
|
185
|
+
*
|
|
186
|
+
* NOTE Expected to change, so consider an opaque structure.
|
|
187
|
+
*/
|
|
188
|
+
export type TransferMsg = {
|
|
189
|
+
toAccount: ChainAddress;
|
|
190
|
+
timeout?: Timestamp;
|
|
191
|
+
next?: TransferMsg;
|
|
192
|
+
data?: object;
|
|
193
|
+
};
|
|
194
|
+
|
|
195
|
+
export type AfterAction = { destChain: string; destAddress: ChainAddress };
|
|
196
|
+
export type SwapExact = { amountIn: Amount; amountOut: Amount };
|
|
197
|
+
export type SwapMaxSlippage = {
|
|
198
|
+
amountIn: Amount;
|
|
199
|
+
brandOut: Brand;
|
|
200
|
+
slippage: number;
|
|
201
|
+
};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
export function setupOrchestrationVat({ consume: { loadCriticalVat, portAllocator: portAllocatorP }, produce: { orchestrationVat, orchestration, orchestrationKit: orchestrationKitP, }, }: BootstrapPowers & {
|
|
2
|
+
consume: {
|
|
3
|
+
portAllocator: PortAllocator;
|
|
4
|
+
};
|
|
5
|
+
produce: {
|
|
6
|
+
orchestration: Producer<any>;
|
|
7
|
+
orchestrationKit: Producer<any>;
|
|
8
|
+
orchestrationVat: Producer<any>;
|
|
9
|
+
};
|
|
10
|
+
}, options: {
|
|
11
|
+
options: {
|
|
12
|
+
orchestrationRef: VatSourceRef;
|
|
13
|
+
};
|
|
14
|
+
}): Promise<void>;
|
|
15
|
+
export function initChainInfo({ consume: { agoricNamesAdmin, chainStorage: chainStorageP }, }: BootstrapPowers): Promise<void>;
|
|
16
|
+
export function addOrchestrationToClient({ consume: { client, orchestration } }: BootstrapPowers & {
|
|
17
|
+
consume: {
|
|
18
|
+
orchestration: OrchestrationService;
|
|
19
|
+
};
|
|
20
|
+
}, _options: object): Promise<void>;
|
|
21
|
+
export function getManifestForOrchestration(_powers: any, { orchestrationRef }: {
|
|
22
|
+
orchestrationRef: any;
|
|
23
|
+
}): {
|
|
24
|
+
manifest: {
|
|
25
|
+
[x: string]: {
|
|
26
|
+
consume: {
|
|
27
|
+
loadCriticalVat: boolean;
|
|
28
|
+
portAllocator: string;
|
|
29
|
+
agoricNamesAdmin?: undefined;
|
|
30
|
+
chainStorage?: undefined;
|
|
31
|
+
};
|
|
32
|
+
produce: {
|
|
33
|
+
orchestration: string;
|
|
34
|
+
orchestrationKit: string;
|
|
35
|
+
orchestrationVat: string;
|
|
36
|
+
};
|
|
37
|
+
} | {
|
|
38
|
+
consume: {
|
|
39
|
+
agoricNamesAdmin: boolean;
|
|
40
|
+
chainStorage: boolean;
|
|
41
|
+
loadCriticalVat?: undefined;
|
|
42
|
+
portAllocator?: undefined;
|
|
43
|
+
};
|
|
44
|
+
produce?: undefined;
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
options: {
|
|
48
|
+
orchestrationRef: any;
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
import type { PortAllocator } from '@agoric/network';
|
|
52
|
+
import type { OrchestrationService } from '../service.js';
|
|
53
|
+
//# sourceMappingURL=orchestration-proposal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"orchestration-proposal.d.ts","sourceRoot":"","sources":["orchestration-proposal.js"],"names":[],"mappings":"AA4BO,4LAZI,eAAe,GAAG;IAC5B,OAAW,EAAE;QACb,aAAmB,EAAE,aAAa,CAAC;KAC9B,CAAC;IACN,OAAW,EAAE;QACb,aAAmB,EAAE,QAAQ,CAAC,GAAG,CAAC,CAAC;QACnC,gBAAsB,EAAE,QAAQ,CAAC,GAAG,CAAC,CAAC;QACtC,gBAAsB,EAAE,QAAQ,CAAC,GAAG,CAAC,CAAC;KACjC,CAAC;CACH,WACO;IAAE,OAAO,EAAE;QAAE,gBAAgB,EAAE,YAAY,CAAA;KAAE,CAAA;CAAE,iBAiCzD;AAoEM,+FAFI,eAAe,iBAYzB;AAWM,iFAPI,eAAe,GAAG;IAC5B,OAAW,EAAE;QACb,aAAmB,EAAE,oBAAoB,CAAC;KACrC,CAAC;CACH,YACO,MAAM,iBAOhB;AAEM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAuBL;mCAxK8B,iBAAiB;0CACV,eAAe"}
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import { makeTracer } from '@agoric/internal';
|
|
2
|
+
import { E, Far } from '@endo/far';
|
|
3
|
+
import { makeMarshal } from '@endo/marshal';
|
|
4
|
+
import { Fail } from '@agoric/assert';
|
|
5
|
+
import { registerChainNamespace } from '../chain-info.js';
|
|
6
|
+
import { CHAIN_KEY, CONNECTIONS_KEY } from '../exos/chain-hub.js';
|
|
7
|
+
|
|
8
|
+
const trace = makeTracer('CoreEvalOrchestration', true);
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* @import {PortAllocator} from '@agoric/network';
|
|
12
|
+
* @import {OrchestrationService} from '../service.js'
|
|
13
|
+
* @import {OrchestrationVat} from '../vat-orchestration.js'
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* @param {BootstrapPowers & {
|
|
18
|
+
* consume: {
|
|
19
|
+
* portAllocator: PortAllocator;
|
|
20
|
+
* };
|
|
21
|
+
* produce: {
|
|
22
|
+
* orchestration: Producer<any>;
|
|
23
|
+
* orchestrationKit: Producer<any>;
|
|
24
|
+
* orchestrationVat: Producer<any>;
|
|
25
|
+
* };
|
|
26
|
+
* }} powers
|
|
27
|
+
* @param {{ options: { orchestrationRef: VatSourceRef } }} options
|
|
28
|
+
*/
|
|
29
|
+
export const setupOrchestrationVat = async (
|
|
30
|
+
{
|
|
31
|
+
consume: { loadCriticalVat, portAllocator: portAllocatorP },
|
|
32
|
+
produce: {
|
|
33
|
+
orchestrationVat,
|
|
34
|
+
orchestration,
|
|
35
|
+
orchestrationKit: orchestrationKitP,
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
options,
|
|
39
|
+
) => {
|
|
40
|
+
const { orchestrationRef } = options.options;
|
|
41
|
+
const vats = {
|
|
42
|
+
orchestration: E(loadCriticalVat)('orchestration', orchestrationRef),
|
|
43
|
+
};
|
|
44
|
+
// don't proceed if loadCriticalVat fails
|
|
45
|
+
await Promise.all(Object.values(vats));
|
|
46
|
+
|
|
47
|
+
orchestrationVat.reset();
|
|
48
|
+
orchestrationVat.resolve(vats.orchestration);
|
|
49
|
+
|
|
50
|
+
const portAllocator = await portAllocatorP;
|
|
51
|
+
|
|
52
|
+
const newOrchestrationKit = await E(vats.orchestration).makeOrchestrationKit({
|
|
53
|
+
portAllocator,
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
orchestration.reset();
|
|
57
|
+
orchestration.resolve(newOrchestrationKit.public);
|
|
58
|
+
orchestrationKitP.reset();
|
|
59
|
+
orchestrationKitP.resolve(newOrchestrationKit);
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Similar to publishAgoricNamesToChainStorage but publishes a node per chain
|
|
64
|
+
* instead of one list of entries
|
|
65
|
+
*/
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* @param {ERef<import('@agoric/vats').NameHubKit['nameAdmin']>} agoricNamesAdmin
|
|
69
|
+
* @param {ERef<StorageNode | null>} chainStorageP
|
|
70
|
+
*/
|
|
71
|
+
const publishChainInfoToChainStorage = async (
|
|
72
|
+
agoricNamesAdmin,
|
|
73
|
+
chainStorageP,
|
|
74
|
+
) => {
|
|
75
|
+
const chainStorage = await chainStorageP;
|
|
76
|
+
if (!chainStorage) {
|
|
77
|
+
console.warn('no chain storage, not registering chain info');
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
const agoricNamesNode = await E(chainStorage).makeChildNode('agoricNames');
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* @param {string} subpath
|
|
85
|
+
*/
|
|
86
|
+
const echoNameUpdates = async subpath => {
|
|
87
|
+
const chainNamesNode = E(agoricNamesNode).makeChildNode(subpath);
|
|
88
|
+
const { nameAdmin } = await E(agoricNamesAdmin).provideChild(subpath);
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Previous entries, to prevent redundant updates
|
|
92
|
+
*
|
|
93
|
+
* @type {Record<string, string>} chainName => stringified chainInfo
|
|
94
|
+
*/
|
|
95
|
+
const prev = {};
|
|
96
|
+
|
|
97
|
+
// XXX cannot be changed until we upgrade vat-agoricNames to allow it
|
|
98
|
+
await E(nameAdmin).onUpdate(
|
|
99
|
+
// XXX will live on the heap in the bootstrap vat. When we upgrade or kill
|
|
100
|
+
// that this handler will sever and vat-agoricNames will need to be upgraded
|
|
101
|
+
// to allow changing the handler, or to use pubsub mechanics instead.
|
|
102
|
+
Far('chain info writer', {
|
|
103
|
+
write(entries) {
|
|
104
|
+
// chainInfo has no cap data but we need to marshal bigints
|
|
105
|
+
const marshalData = makeMarshal(_val => Fail`data only`);
|
|
106
|
+
for (const [chainName, info] of entries) {
|
|
107
|
+
const value = JSON.stringify(marshalData.toCapData(info));
|
|
108
|
+
if (prev[chainName] === value) {
|
|
109
|
+
continue;
|
|
110
|
+
}
|
|
111
|
+
const chainNode = E(chainNamesNode).makeChildNode(chainName);
|
|
112
|
+
prev[chainName] = value;
|
|
113
|
+
void E(chainNode)
|
|
114
|
+
.setValue(value)
|
|
115
|
+
.catch(() => delete prev[chainName]);
|
|
116
|
+
}
|
|
117
|
+
},
|
|
118
|
+
}),
|
|
119
|
+
);
|
|
120
|
+
};
|
|
121
|
+
await echoNameUpdates(CHAIN_KEY);
|
|
122
|
+
await echoNameUpdates(CONNECTIONS_KEY);
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* @param {BootstrapPowers} powers
|
|
127
|
+
*/
|
|
128
|
+
export const initChainInfo = async ({
|
|
129
|
+
consume: { agoricNamesAdmin, chainStorage: chainStorageP },
|
|
130
|
+
}) => {
|
|
131
|
+
trace('init-chainInfo');
|
|
132
|
+
|
|
133
|
+
// First set up callback to write updates to vstorage
|
|
134
|
+
await publishChainInfoToChainStorage(agoricNamesAdmin, chainStorageP);
|
|
135
|
+
|
|
136
|
+
// Now register the names
|
|
137
|
+
await registerChainNamespace(agoricNamesAdmin, trace);
|
|
138
|
+
};
|
|
139
|
+
harden(initChainInfo);
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* @param {BootstrapPowers & {
|
|
143
|
+
* consume: {
|
|
144
|
+
* orchestration: OrchestrationService;
|
|
145
|
+
* };
|
|
146
|
+
* }} powers
|
|
147
|
+
* @param {object} _options
|
|
148
|
+
*/
|
|
149
|
+
export const addOrchestrationToClient = async (
|
|
150
|
+
{ consume: { client, orchestration } },
|
|
151
|
+
_options,
|
|
152
|
+
) => {
|
|
153
|
+
return E(client).assignBundle([_a => ({ orchestration })]);
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
export const getManifestForOrchestration = (_powers, { orchestrationRef }) => ({
|
|
157
|
+
manifest: {
|
|
158
|
+
[setupOrchestrationVat.name]: {
|
|
159
|
+
consume: {
|
|
160
|
+
loadCriticalVat: true,
|
|
161
|
+
portAllocator: 'portAllocator',
|
|
162
|
+
},
|
|
163
|
+
produce: {
|
|
164
|
+
orchestration: 'orchestration',
|
|
165
|
+
orchestrationKit: 'orchestrationKit',
|
|
166
|
+
orchestrationVat: 'orchestrationVat',
|
|
167
|
+
},
|
|
168
|
+
},
|
|
169
|
+
[initChainInfo.name]: {
|
|
170
|
+
consume: {
|
|
171
|
+
agoricNamesAdmin: true,
|
|
172
|
+
chainStorage: true,
|
|
173
|
+
},
|
|
174
|
+
},
|
|
175
|
+
},
|
|
176
|
+
options: {
|
|
177
|
+
orchestrationRef,
|
|
178
|
+
},
|
|
179
|
+
});
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export function reviseChainInfo({ consume: { agoricNamesAdmin } }: BootstrapPowers, { options: { chainInfo } }: {
|
|
2
|
+
options: {
|
|
3
|
+
chainInfo: Record<string, CosmosChainInfo>;
|
|
4
|
+
};
|
|
5
|
+
}): Promise<void>;
|
|
6
|
+
export function getManifestForReviseChains(_powers: any, { chainInfo }: {
|
|
7
|
+
chainInfo: any;
|
|
8
|
+
}): {
|
|
9
|
+
manifest: {
|
|
10
|
+
[x: string]: {
|
|
11
|
+
consume: {
|
|
12
|
+
agoricNamesAdmin: boolean;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
options: {
|
|
17
|
+
chainInfo: any;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
import type { CosmosChainInfo } from '../types.js';
|
|
21
|
+
//# sourceMappingURL=revise-chain-info.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"revise-chain-info.d.ts","sourceRoot":"","sources":["revise-chain-info.js"],"names":[],"mappings":"AAeO,mEAHI,eAAe,8BACf;IAAE,OAAO,EAAE;QAAE,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAA;KAAE,CAAA;CAAE,iBAgBrE;AAGM;;;;;;;;;;;;;EAWL;qCAtCiC,aAAa"}
|