@agoric/orchestration 0.2.0-upgrade-20-dev-ef71cfd.0 → 0.2.0-upgrade-19-devnet-dev-5428c4d.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +27 -29
- package/src/chain-capabilities.d.ts +12 -7
- package/src/chain-capabilities.d.ts.map +1 -1
- package/src/chain-capabilities.js +21 -46
- package/src/chain-info.d.ts +97 -839
- package/src/chain-info.d.ts.map +1 -1
- package/src/chain-info.js +12 -38
- package/src/cosmos-api.d.ts +13 -41
- package/src/cosmos-api.d.ts.map +1 -1
- package/src/cosmos-api.ts +16 -52
- package/src/ethereum-api.d.ts +5 -6
- package/src/ethereum-api.d.ts.map +1 -1
- package/src/ethereum-api.ts +5 -7
- package/src/examples/auto-stake-it-tap-kit.d.ts +4 -4
- package/src/examples/auto-stake-it-tap-kit.d.ts.map +1 -1
- package/src/examples/auto-stake-it-tap-kit.js +8 -8
- package/src/examples/auto-stake-it.contract.d.ts +23 -5
- package/src/examples/auto-stake-it.contract.d.ts.map +1 -1
- package/src/examples/auto-stake-it.contract.js +0 -1
- package/src/examples/basic-flows.contract.d.ts +13 -5
- package/src/examples/basic-flows.contract.d.ts.map +1 -1
- package/src/examples/basic-flows.contract.js +0 -1
- package/src/examples/send-anywhere.contract.d.ts +27 -7
- package/src/examples/send-anywhere.contract.d.ts.map +1 -1
- package/src/examples/send-anywhere.contract.js +12 -40
- package/src/examples/send-anywhere.flows.d.ts +3 -563
- package/src/examples/send-anywhere.flows.d.ts.map +1 -1
- package/src/examples/send-anywhere.flows.js +31 -112
- package/src/examples/stake-bld.contract.d.ts +7 -8
- package/src/examples/stake-bld.contract.d.ts.map +1 -1
- package/src/examples/stake-bld.contract.js +1 -3
- package/src/examples/stake-ica.contract.d.ts +13 -82
- package/src/examples/stake-ica.contract.d.ts.map +1 -1
- package/src/examples/stake-ica.contract.js +0 -1
- package/src/examples/staking-combinations.contract.d.ts +11 -3
- package/src/examples/staking-combinations.contract.d.ts.map +1 -1
- package/src/examples/staking-combinations.contract.js +4 -5
- package/src/examples/staking-combinations.flows.d.ts +2 -2
- package/src/examples/staking-combinations.flows.d.ts.map +1 -1
- package/src/examples/staking-combinations.flows.js +4 -4
- package/src/examples/swap.contract.d.ts +13 -4
- package/src/examples/swap.contract.d.ts.map +1 -1
- package/src/examples/swap.contract.js +2 -2
- package/src/examples/unbond.contract.d.ts +2 -2
- package/src/exos/README.md +0 -1
- package/src/exos/chain-hub-admin.d.ts +9 -9
- package/src/exos/chain-hub-admin.d.ts.map +1 -1
- package/src/exos/chain-hub-admin.js +17 -17
- package/src/exos/chain-hub.d.ts +17 -69
- package/src/exos/chain-hub.d.ts.map +1 -1
- package/src/exos/chain-hub.js +55 -289
- package/src/exos/cosmos-orchestration-account.d.ts +17 -86
- package/src/exos/cosmos-orchestration-account.d.ts.map +1 -1
- package/src/exos/cosmos-orchestration-account.js +26 -111
- package/src/exos/ibc-packet.d.ts +0 -1
- package/src/exos/ibc-packet.d.ts.map +1 -1
- package/src/exos/ibc-packet.js +1 -8
- package/src/exos/ica-account-kit.d.ts +4 -8
- package/src/exos/ica-account-kit.d.ts.map +1 -1
- package/src/exos/ica-account-kit.js +5 -8
- package/src/exos/local-chain-facade.d.ts +23 -3
- package/src/exos/local-chain-facade.d.ts.map +1 -1
- package/src/exos/local-chain-facade.js +3 -3
- package/src/exos/local-orchestration-account.d.ts +12 -16
- package/src/exos/local-orchestration-account.d.ts.map +1 -1
- package/src/exos/local-orchestration-account.js +8 -13
- package/src/exos/orchestrator.d.ts +15 -5
- package/src/exos/orchestrator.d.ts.map +1 -1
- package/src/exos/orchestrator.js +10 -9
- package/src/exos/packet-tools.d.ts +1 -1
- package/src/exos/packet-tools.d.ts.map +1 -1
- package/src/exos/packet-tools.js +12 -17
- package/src/exos/portfolio-holder-kit.d.ts +0 -1
- package/src/exos/portfolio-holder-kit.d.ts.map +1 -1
- package/src/exos/portfolio-holder-kit.js +0 -1
- package/src/exos/remote-chain-facade.d.ts +15 -5
- package/src/exos/remote-chain-facade.d.ts.map +1 -1
- package/src/exos/remote-chain-facade.js +13 -23
- package/src/facade.js +1 -1
- package/src/fetched-chain-info.d.ts +86 -676
- package/src/fetched-chain-info.js +41 -553
- package/src/fixtures/query-flows.contract.d.ts +4 -5
- package/src/fixtures/query-flows.contract.d.ts.map +1 -1
- package/src/fixtures/query-flows.contract.js +0 -1
- package/src/orchestration-api.d.ts +16 -73
- package/src/orchestration-api.d.ts.map +1 -1
- package/src/orchestration-api.ts +19 -89
- package/src/proposals/start-send-anywhere.js +0 -4
- package/src/typeGuards.d.ts +4 -20
- package/src/typeGuards.d.ts.map +1 -1
- package/src/typeGuards.js +13 -52
- package/src/types.d.ts +1 -1
- package/src/types.d.ts.map +1 -1
- package/src/types.ts +1 -2
- package/src/utils/address.d.ts +3 -13
- package/src/utils/address.d.ts.map +1 -1
- package/src/utils/address.js +5 -97
- package/src/utils/chain-hub-helper.d.ts +2 -2
- package/src/utils/chain-hub-helper.d.ts.map +1 -1
- package/src/utils/chain-hub-helper.js +5 -9
- package/src/utils/cosmos.d.ts +1 -1
- package/src/utils/cosmos.d.ts.map +1 -1
- package/src/utils/cosmos.js +2 -2
- package/src/utils/orchestrationAccount.js +5 -6
- package/src/utils/registry.d.ts +12 -2
- package/src/utils/registry.d.ts.map +1 -1
- package/src/utils/registry.js +2 -4
- package/src/utils/start-helper.d.ts +6 -20
- package/src/utils/start-helper.d.ts.map +1 -1
- package/src/utils/start-helper.js +2 -13
- package/src/utils/zoe-tools.d.ts +2 -2
- package/src/utils/zoe-tools.d.ts.map +1 -1
- package/src/utils/zoe-tools.js +2 -5
- package/tools/ibc-mocks.d.ts +5 -6
- package/tools/ibc-mocks.d.ts.map +1 -1
- package/tools/ibc-mocks.ts +4 -10
- package/tools/make-test-address.d.ts +1 -2
- package/tools/make-test-address.d.ts.map +1 -1
- package/tools/make-test-address.js +2 -6
- package/src/cctp-chain-info.d.ts +0 -65
- package/src/cctp-chain-info.d.ts.map +0 -1
- package/src/cctp-chain-info.js +0 -52
- package/src/utils/chain-info.d.ts +0 -5
- package/src/utils/chain-info.d.ts.map +0 -1
- package/src/utils/chain-info.js +0 -11
|
@@ -2,23 +2,22 @@ export const start: (zcf: ZCF<Record<string, unknown>>, privateArgs: Orchestrati
|
|
|
2
2
|
marshaller: Marshaller;
|
|
3
3
|
}, baggage: import("@agoric/vat-data").Baggage) => Promise<{
|
|
4
4
|
publicFacet: import("@endo/exo").Guarded<{
|
|
5
|
-
makeSendICQQueryInvitation(): Promise<
|
|
5
|
+
makeSendICQQueryInvitation(): Promise<Invitation<import("@agoric/vow").Vow<string>, {
|
|
6
6
|
chainName: string;
|
|
7
7
|
msgs: Parameters<import("../cosmos-api.js").ICQQueryFunction>[0];
|
|
8
8
|
}>>;
|
|
9
|
-
makeAccountAndGetBalanceQueryInvitation(): Promise<
|
|
9
|
+
makeAccountAndGetBalanceQueryInvitation(): Promise<Invitation<import("@agoric/vow").Vow<string>, {
|
|
10
10
|
chainName: string;
|
|
11
11
|
denom: import("../orchestration-api.js").DenomArg;
|
|
12
12
|
}>>;
|
|
13
|
-
makeAccountAndGetBalancesQueryInvitation(): Promise<
|
|
13
|
+
makeAccountAndGetBalancesQueryInvitation(): Promise<Invitation<import("@agoric/vow").Vow<string>, {
|
|
14
14
|
chainName: string;
|
|
15
15
|
}>>;
|
|
16
|
-
makeSendLocalQueryInvitation(): Promise<
|
|
16
|
+
makeSendLocalQueryInvitation(): Promise<Invitation<import("@agoric/vow").Vow<string>, {
|
|
17
17
|
msgs: Parameters<import("@agoric/vats/src/localchain.js").QueryManyFn>[0];
|
|
18
18
|
}>>;
|
|
19
19
|
}>;
|
|
20
20
|
}>;
|
|
21
21
|
export type QueryFlowsSF = typeof start;
|
|
22
|
-
import type { ZCF } from '@agoric/zoe';
|
|
23
22
|
import type { OrchestrationPowers } from '..//utils/start-helper.js';
|
|
24
23
|
//# sourceMappingURL=query-flows.contract.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"query-flows.contract.d.ts","sourceRoot":"","sources":["query-flows.contract.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"query-flows.contract.d.ts","sourceRoot":"","sources":["query-flows.contract.js"],"names":[],"mappings":"AAkEA;gBAjDiB,UAAU;;;;;;;;;;;;;;;;;;GAiDoD;2BAGjE,OAAO,KAAK;yCA3DY,2BAA2B"}
|
|
@@ -7,7 +7,6 @@ import { withOrchestration } from '../utils/start-helper.js';
|
|
|
7
7
|
import * as flows from './query-flows.flows.js';
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
|
-
* @import {ZCF} from '@agoric/zoe';
|
|
11
10
|
* @import {Zone} from '@agoric/zone';
|
|
12
11
|
* @import {OrchestrationPowers} from '..//utils/start-helper.js';
|
|
13
12
|
* @import {OrchestrationTools} from '../utils/start-helper.js';
|
|
@@ -8,7 +8,7 @@ import type { Timestamp } from '@agoric/time';
|
|
|
8
8
|
import type { QueryManyFn } from '@agoric/vats/src/localchain.js';
|
|
9
9
|
import type { ResolvedPublicTopic } from '@agoric/zoe/src/contractSupport/topics.js';
|
|
10
10
|
import type { Passable } from '@endo/marshal';
|
|
11
|
-
import type { AgoricChainMethods, CosmosChainAccountMethods, CosmosChainInfo, IBCMsgTransferOptions, KnownChains, LocalAccountMethods, ICQQueryFunction
|
|
11
|
+
import type { AgoricChainMethods, ChainInfo, CosmosChainAccountMethods, CosmosChainInfo, IBCMsgTransferOptions, KnownChains, LocalAccountMethods, ICQQueryFunction } from './types.js';
|
|
12
12
|
import type { ResolvedContinuingOfferResult } from './utils/zoe-tools.js';
|
|
13
13
|
/**
|
|
14
14
|
* A denom that designates a path to a token type on some blockchain.
|
|
@@ -38,93 +38,36 @@ export type DenomAmount = {
|
|
|
38
38
|
};
|
|
39
39
|
/** Amounts can be provided as pure data using denoms or as ERTP Amounts */
|
|
40
40
|
export type AmountArg = DenomAmount | Amount<'nat'>;
|
|
41
|
-
/**
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
* and they use `chain_id`/`chainId` for what CAIP-2 calls the `reference`. We
|
|
45
|
-
* qualify the term here to avoid confusion.
|
|
46
|
-
*
|
|
47
|
-
* @see {@link https://chainagnostic.org/CAIPs/caip-2}
|
|
48
|
-
*/
|
|
49
|
-
export type CaipChainId = `${string}:${string}`;
|
|
50
|
-
/**
|
|
51
|
-
* à la CAIP-10
|
|
52
|
-
*
|
|
53
|
-
* account_id: chain_id + ":" + account_address
|
|
54
|
-
* chain_id: [-a-z0-9]{3,8}:[-_a-zA-Z0-9]{1,32} (See [CAIP-2][])
|
|
55
|
-
* account_address: [-.%a-zA-Z0-9]{1,128}
|
|
56
|
-
*
|
|
57
|
-
* @see {@link https://chainagnostic.org/CAIPs/caip-10}
|
|
58
|
-
*/
|
|
59
|
-
export type AccountId = `${CaipChainId}:${string}`;
|
|
60
|
-
/**
|
|
61
|
-
* Specific to Cosmos chains
|
|
62
|
-
* @see {AccountId} for universal account identifier
|
|
63
|
-
*/
|
|
64
|
-
export type CosmosChainAddress = {
|
|
65
|
-
/** Within the Cosmos ecosystem. e.g. `agoric-3' or 'cosmoshub-4' */
|
|
41
|
+
/** An address on some blockchain, e.g., cosmos, eth, etc. */
|
|
42
|
+
export type ChainAddress = {
|
|
43
|
+
/** e.g. 1 for Ethereum, agoric-3 for Agoric, cosmoshub-4 for Cosmos */
|
|
66
44
|
chainId: string;
|
|
67
45
|
/** The address value used on-chain */
|
|
68
|
-
value:
|
|
69
|
-
encoding: 'bech32';
|
|
70
|
-
};
|
|
71
|
-
/**
|
|
72
|
-
* Info used to identify blockchains across ecosystems
|
|
73
|
-
* @see {@link https://chainagnostic.org/CAIPs/caip-2}
|
|
74
|
-
*/
|
|
75
|
-
export interface BaseChainInfo<N extends KnownNamespace = KnownNamespace> {
|
|
76
|
-
/** CAIP-2 namespace, e.g. 'cosmos', 'eip155' */
|
|
77
|
-
namespace: N;
|
|
78
|
-
/** CAIP-2 reference, `e.g. `1`, `agoric-3` */
|
|
79
|
-
reference: N extends 'eip155' ? `${number}` : string;
|
|
80
|
-
/**
|
|
81
|
-
* Circle CCTP Destination Domain
|
|
82
|
-
* @see {@link https://developers.circle.com/stablecoins/supported-domains}
|
|
83
|
-
*/
|
|
84
|
-
cctpDestinationDomain?: number;
|
|
85
|
-
}
|
|
86
|
-
/**
|
|
87
|
-
* Shape that `ChainHub` is expecting
|
|
88
|
-
*/
|
|
89
|
-
export type ChainInfo<N extends KnownNamespace = KnownNamespace> = N extends 'cosmos' ? CosmosChainInfo : BaseChainInfo<N>;
|
|
90
|
-
/**
|
|
91
|
-
* A value that can be converted mechanically to an AccountId.
|
|
92
|
-
* @see {@link ChainHub.resolveAccountId}
|
|
93
|
-
*/
|
|
94
|
-
export type AccountIdArg = AccountId | CosmosChainAddress;
|
|
95
|
-
export type Caip10Record = {
|
|
96
|
-
namespace: string;
|
|
97
|
-
reference: string;
|
|
98
|
-
accountAddress: string;
|
|
46
|
+
value: string;
|
|
47
|
+
encoding: 'bech32' | 'ethereum';
|
|
99
48
|
};
|
|
100
49
|
/**
|
|
101
50
|
* Object that controls an account on a particular chain.
|
|
102
51
|
*
|
|
103
52
|
* The methods available depend on the chain and its capabilities.
|
|
104
53
|
*/
|
|
105
|
-
export type OrchestrationAccount<CI extends
|
|
106
|
-
chainId: string;
|
|
107
|
-
} ? CI['chainId'] extends `agoric${string}` ? LocalAccountMethods : CI['chainId'] extends `noble${string}` ? CosmosChainAccountMethods<CI> & NobleMethods : CosmosChainAccountMethods<CI> : object);
|
|
54
|
+
export type OrchestrationAccount<CI extends ChainInfo> = OrchestrationAccountCommon & (CI extends CosmosChainInfo ? CI['chainId'] extends `agoric${string}` ? LocalAccountMethods : CosmosChainAccountMethods<CI> : object);
|
|
108
55
|
/**
|
|
109
56
|
* An object for access the core functions of a remote chain.
|
|
110
57
|
*
|
|
111
58
|
* Note that "remote" can mean the local chain; it's just that
|
|
112
59
|
* accounts are treated as remote/arms length for consistency.
|
|
113
60
|
*/
|
|
114
|
-
export interface Chain<CI extends
|
|
61
|
+
export interface Chain<CI extends ChainInfo> {
|
|
115
62
|
getChainInfo: () => Promise<CI>;
|
|
116
63
|
/**
|
|
117
64
|
* Creates a new Orchestration Account on the current Chain.
|
|
118
65
|
* @returns an object that controls the account
|
|
119
66
|
*/
|
|
120
|
-
makeAccount: () => CI
|
|
121
|
-
chainId: string;
|
|
122
|
-
} ? Promise<OrchestrationAccount<CI>> : never;
|
|
67
|
+
makeAccount: () => Promise<OrchestrationAccount<CI>>;
|
|
123
68
|
query: CI extends {
|
|
124
69
|
icqEnabled: true;
|
|
125
|
-
} ? ICQQueryFunction : CI extends {
|
|
126
|
-
chainId: string;
|
|
127
|
-
} ? CI['chainId'] extends `agoric${string}` ? QueryManyFn : never : never;
|
|
70
|
+
} ? ICQQueryFunction : CI['chainId'] extends `agoric${string}` ? QueryManyFn : never;
|
|
128
71
|
}
|
|
129
72
|
/**
|
|
130
73
|
* Used with `orch.getDenomInfo('ibc/1234')`. See {@link Orchestrator.getDenomInfo}
|
|
@@ -170,7 +113,7 @@ export interface OrchestrationAccountCommon {
|
|
|
170
113
|
/**
|
|
171
114
|
* @returns the address of the account on the remote chain
|
|
172
115
|
*/
|
|
173
|
-
getAddress: () =>
|
|
116
|
+
getAddress: () => ChainAddress;
|
|
174
117
|
/** @returns an array of amounts for every balance in the account. */
|
|
175
118
|
getBalances: () => Promise<DenomAmount[]>;
|
|
176
119
|
/** @returns the balance of a specific denom for the account. */
|
|
@@ -181,14 +124,14 @@ export interface OrchestrationAccountCommon {
|
|
|
181
124
|
* @param amount - the amount to send
|
|
182
125
|
* @returns void
|
|
183
126
|
*/
|
|
184
|
-
send: (toAccount:
|
|
127
|
+
send: (toAccount: ChainAddress, amount: AmountArg) => Promise<void>;
|
|
185
128
|
/**
|
|
186
129
|
* Transfer multiple amounts to another account on the same chain. The promise settles when the transfer is complete.
|
|
187
130
|
* @param toAccount - the account to send the amount to. MUST be on the same chain
|
|
188
131
|
* @param amounts - the amounts to send
|
|
189
132
|
* @returns void
|
|
190
133
|
*/
|
|
191
|
-
sendAll: (toAccount:
|
|
134
|
+
sendAll: (toAccount: ChainAddress, amounts: AmountArg[]) => Promise<void>;
|
|
192
135
|
/**
|
|
193
136
|
* Transfer an amount to another account, typically on another chain.
|
|
194
137
|
* The promise settles when the transfer is complete.
|
|
@@ -199,7 +142,7 @@ export interface OrchestrationAccountCommon {
|
|
|
199
142
|
* @throws {Error} if route is not determinable, asset is not recognized, or
|
|
200
143
|
* the transfer is rejected (insufficient funds, timeout)
|
|
201
144
|
*/
|
|
202
|
-
transfer: (destination:
|
|
145
|
+
transfer: (destination: ChainAddress, amount: AmountArg, opts?: IBCMsgTransferOptions) => Promise<void>;
|
|
203
146
|
/**
|
|
204
147
|
* Transfer an amount to another account in multiple steps. The promise settles when
|
|
205
148
|
* the entire path of the transfer is complete.
|
|
@@ -253,7 +196,7 @@ export interface OrchestrationFlow<CT = unknown> {
|
|
|
253
196
|
* @internal
|
|
254
197
|
*/
|
|
255
198
|
export interface TransferMsg {
|
|
256
|
-
toAccount:
|
|
199
|
+
toAccount: ChainAddress;
|
|
257
200
|
timeout?: Timestamp;
|
|
258
201
|
next?: TransferMsg;
|
|
259
202
|
data?: object;
|
|
@@ -261,7 +204,7 @@ export interface TransferMsg {
|
|
|
261
204
|
/** @alpha */
|
|
262
205
|
export interface AfterAction {
|
|
263
206
|
destChain: string;
|
|
264
|
-
destAddress:
|
|
207
|
+
destAddress: ChainAddress;
|
|
265
208
|
}
|
|
266
209
|
/** @alpha */
|
|
267
210
|
export interface SwapExact {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"orchestration-api.d.ts","sourceRoot":"","sources":["orchestration-api.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAE1E,OAAO,KAAK,EAAE,SAAS,EA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AE,CAAC,MAAM,EAAE,SAAS,EAAE,GAAG,EAAE,WAAW,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAEtE;;;;OAIG;IACH,iBAAiB,EAAE,MAAM,OAAO,CAAC,6BAA6B,CAAC,CAAC;IAEhE;;;;;OAKG;IACH,eAAe,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;CAC9E;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,WAAW,iBAAiB,CAAC,EAAE,GAAG,OAAO;IAC7C,CAAC,GAAG,EAAE,YAAY,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,IAAI,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CACrE;AAED;;;;;;GAMG;AACH,MAAM,WAAW,WAAW;IAC1B,SAAS,EAAE,YAAY,CAAC;IACxB,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,aAAa;AACb,MAAM,WAAW,WAAW;IAC1B,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,YAAY,CAAC;CAC3B;AACD,aAAa;AACb,MAAM,WAAW,SAAS;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;CACnB;AACD,aAAa;AACb,MAAM,WAAW,eAAe;IAC9B,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,KAAK,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;CAClB"}
|
package/src/orchestration-api.ts
CHANGED
|
@@ -11,15 +11,13 @@ import type { ResolvedPublicTopic } from '@agoric/zoe/src/contractSupport/topics
|
|
|
11
11
|
import type { Passable } from '@endo/marshal';
|
|
12
12
|
import type {
|
|
13
13
|
AgoricChainMethods,
|
|
14
|
+
ChainInfo,
|
|
14
15
|
CosmosChainAccountMethods,
|
|
15
16
|
CosmosChainInfo,
|
|
16
17
|
IBCMsgTransferOptions,
|
|
17
18
|
KnownChains,
|
|
18
19
|
LocalAccountMethods,
|
|
19
20
|
ICQQueryFunction,
|
|
20
|
-
KnownNamespace,
|
|
21
|
-
NobleMethods,
|
|
22
|
-
Bech32Address,
|
|
23
21
|
} from './types.js';
|
|
24
22
|
import type { ResolvedContinuingOfferResult } from './utils/zoe-tools.js';
|
|
25
23
|
|
|
@@ -57,71 +55,13 @@ export type DenomAmount = {
|
|
|
57
55
|
/** Amounts can be provided as pure data using denoms or as ERTP Amounts */
|
|
58
56
|
export type AmountArg = DenomAmount | Amount<'nat'>;
|
|
59
57
|
|
|
60
|
-
/**
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
* and they use `chain_id`/`chainId` for what CAIP-2 calls the `reference`. We
|
|
64
|
-
* qualify the term here to avoid confusion.
|
|
65
|
-
*
|
|
66
|
-
* @see {@link https://chainagnostic.org/CAIPs/caip-2}
|
|
67
|
-
*/
|
|
68
|
-
export type CaipChainId = `${string}:${string}`;
|
|
69
|
-
|
|
70
|
-
/**
|
|
71
|
-
* à la CAIP-10
|
|
72
|
-
*
|
|
73
|
-
* account_id: chain_id + ":" + account_address
|
|
74
|
-
* chain_id: [-a-z0-9]{3,8}:[-_a-zA-Z0-9]{1,32} (See [CAIP-2][])
|
|
75
|
-
* account_address: [-.%a-zA-Z0-9]{1,128}
|
|
76
|
-
*
|
|
77
|
-
* @see {@link https://chainagnostic.org/CAIPs/caip-10}
|
|
78
|
-
*/
|
|
79
|
-
export type AccountId = `${CaipChainId}:${string}`;
|
|
80
|
-
|
|
81
|
-
/**
|
|
82
|
-
* Specific to Cosmos chains
|
|
83
|
-
* @see {AccountId} for universal account identifier
|
|
84
|
-
*/
|
|
85
|
-
export type CosmosChainAddress = {
|
|
86
|
-
/** Within the Cosmos ecosystem. e.g. `agoric-3' or 'cosmoshub-4' */
|
|
58
|
+
/** An address on some blockchain, e.g., cosmos, eth, etc. */
|
|
59
|
+
export type ChainAddress = {
|
|
60
|
+
/** e.g. 1 for Ethereum, agoric-3 for Agoric, cosmoshub-4 for Cosmos */
|
|
87
61
|
chainId: string;
|
|
88
62
|
/** The address value used on-chain */
|
|
89
|
-
value:
|
|
90
|
-
encoding: 'bech32';
|
|
91
|
-
};
|
|
92
|
-
|
|
93
|
-
/**
|
|
94
|
-
* Info used to identify blockchains across ecosystems
|
|
95
|
-
* @see {@link https://chainagnostic.org/CAIPs/caip-2}
|
|
96
|
-
*/
|
|
97
|
-
export interface BaseChainInfo<N extends KnownNamespace = KnownNamespace> {
|
|
98
|
-
/** CAIP-2 namespace, e.g. 'cosmos', 'eip155' */
|
|
99
|
-
namespace: N;
|
|
100
|
-
/** CAIP-2 reference, `e.g. `1`, `agoric-3` */
|
|
101
|
-
reference: N extends 'eip155' ? `${number}` : string;
|
|
102
|
-
/**
|
|
103
|
-
* Circle CCTP Destination Domain
|
|
104
|
-
* @see {@link https://developers.circle.com/stablecoins/supported-domains}
|
|
105
|
-
*/
|
|
106
|
-
cctpDestinationDomain?: number;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
/**
|
|
110
|
-
* Shape that `ChainHub` is expecting
|
|
111
|
-
*/
|
|
112
|
-
export type ChainInfo<N extends KnownNamespace = KnownNamespace> =
|
|
113
|
-
N extends 'cosmos' ? CosmosChainInfo : BaseChainInfo<N>;
|
|
114
|
-
|
|
115
|
-
/**
|
|
116
|
-
* A value that can be converted mechanically to an AccountId.
|
|
117
|
-
* @see {@link ChainHub.resolveAccountId}
|
|
118
|
-
*/
|
|
119
|
-
export type AccountIdArg = AccountId | CosmosChainAddress;
|
|
120
|
-
|
|
121
|
-
export type Caip10Record = {
|
|
122
|
-
namespace: string;
|
|
123
|
-
reference: string;
|
|
124
|
-
accountAddress: string;
|
|
63
|
+
value: string;
|
|
64
|
+
encoding: 'bech32' | 'ethereum';
|
|
125
65
|
};
|
|
126
66
|
|
|
127
67
|
/**
|
|
@@ -129,14 +69,12 @@ export type Caip10Record = {
|
|
|
129
69
|
*
|
|
130
70
|
* The methods available depend on the chain and its capabilities.
|
|
131
71
|
*/
|
|
132
|
-
export type OrchestrationAccount<CI extends
|
|
72
|
+
export type OrchestrationAccount<CI extends ChainInfo> =
|
|
133
73
|
OrchestrationAccountCommon &
|
|
134
|
-
(CI extends
|
|
74
|
+
(CI extends CosmosChainInfo
|
|
135
75
|
? CI['chainId'] extends `agoric${string}`
|
|
136
76
|
? LocalAccountMethods
|
|
137
|
-
: CI
|
|
138
|
-
? CosmosChainAccountMethods<CI> & NobleMethods
|
|
139
|
-
: CosmosChainAccountMethods<CI>
|
|
77
|
+
: CosmosChainAccountMethods<CI>
|
|
140
78
|
: object);
|
|
141
79
|
|
|
142
80
|
/**
|
|
@@ -145,26 +83,21 @@ export type OrchestrationAccount<CI extends Partial<ChainInfo>> =
|
|
|
145
83
|
* Note that "remote" can mean the local chain; it's just that
|
|
146
84
|
* accounts are treated as remote/arms length for consistency.
|
|
147
85
|
*/
|
|
148
|
-
export interface Chain<CI extends
|
|
86
|
+
export interface Chain<CI extends ChainInfo> {
|
|
149
87
|
getChainInfo: () => Promise<CI>;
|
|
150
88
|
|
|
151
89
|
// "makeAccount" suggests an operation within a vat
|
|
152
|
-
// TODO: scope to { icaEnabled: true }. Currently, only scoped to `namespace: 'cosmos'` chains
|
|
153
90
|
/**
|
|
154
91
|
* Creates a new Orchestration Account on the current Chain.
|
|
155
92
|
* @returns an object that controls the account
|
|
156
93
|
*/
|
|
157
|
-
makeAccount: () => CI
|
|
158
|
-
? Promise<OrchestrationAccount<CI>>
|
|
159
|
-
: never;
|
|
94
|
+
makeAccount: () => Promise<OrchestrationAccount<CI>>;
|
|
160
95
|
// FUTURE supply optional port object; also fetch port object
|
|
161
96
|
|
|
162
97
|
query: CI extends { icqEnabled: true }
|
|
163
98
|
? ICQQueryFunction
|
|
164
|
-
: CI extends {
|
|
165
|
-
?
|
|
166
|
-
? QueryManyFn
|
|
167
|
-
: never
|
|
99
|
+
: CI['chainId'] extends `agoric${string}`
|
|
100
|
+
? QueryManyFn
|
|
168
101
|
: never;
|
|
169
102
|
|
|
170
103
|
// TODO provide a way to get the local denom/brand/whatever for this chain
|
|
@@ -232,7 +165,7 @@ export interface OrchestrationAccountCommon {
|
|
|
232
165
|
/**
|
|
233
166
|
* @returns the address of the account on the remote chain
|
|
234
167
|
*/
|
|
235
|
-
getAddress: () =>
|
|
168
|
+
getAddress: () => ChainAddress;
|
|
236
169
|
|
|
237
170
|
/** @returns an array of amounts for every balance in the account. */
|
|
238
171
|
getBalances: () => Promise<DenomAmount[]>;
|
|
@@ -246,7 +179,7 @@ export interface OrchestrationAccountCommon {
|
|
|
246
179
|
* @param amount - the amount to send
|
|
247
180
|
* @returns void
|
|
248
181
|
*/
|
|
249
|
-
send: (toAccount:
|
|
182
|
+
send: (toAccount: ChainAddress, amount: AmountArg) => Promise<void>;
|
|
250
183
|
|
|
251
184
|
/**
|
|
252
185
|
* Transfer multiple amounts to another account on the same chain. The promise settles when the transfer is complete.
|
|
@@ -254,10 +187,7 @@ export interface OrchestrationAccountCommon {
|
|
|
254
187
|
* @param amounts - the amounts to send
|
|
255
188
|
* @returns void
|
|
256
189
|
*/
|
|
257
|
-
sendAll: (
|
|
258
|
-
toAccount: CosmosChainAddress,
|
|
259
|
-
amounts: AmountArg[],
|
|
260
|
-
) => Promise<void>;
|
|
190
|
+
sendAll: (toAccount: ChainAddress, amounts: AmountArg[]) => Promise<void>;
|
|
261
191
|
|
|
262
192
|
/**
|
|
263
193
|
* Transfer an amount to another account, typically on another chain.
|
|
@@ -270,7 +200,7 @@ export interface OrchestrationAccountCommon {
|
|
|
270
200
|
* the transfer is rejected (insufficient funds, timeout)
|
|
271
201
|
*/
|
|
272
202
|
transfer: (
|
|
273
|
-
destination:
|
|
203
|
+
destination: ChainAddress,
|
|
274
204
|
amount: AmountArg,
|
|
275
205
|
opts?: IBCMsgTransferOptions,
|
|
276
206
|
) => Promise<void>;
|
|
@@ -332,7 +262,7 @@ export interface OrchestrationFlow<CT = unknown> {
|
|
|
332
262
|
* @internal
|
|
333
263
|
*/
|
|
334
264
|
export interface TransferMsg {
|
|
335
|
-
toAccount:
|
|
265
|
+
toAccount: ChainAddress;
|
|
336
266
|
timeout?: Timestamp;
|
|
337
267
|
next?: TransferMsg;
|
|
338
268
|
data?: object;
|
|
@@ -341,7 +271,7 @@ export interface TransferMsg {
|
|
|
341
271
|
/** @alpha */
|
|
342
272
|
export interface AfterAction {
|
|
343
273
|
destChain: string;
|
|
344
|
-
destAddress:
|
|
274
|
+
destAddress: ChainAddress;
|
|
345
275
|
}
|
|
346
276
|
/** @alpha */
|
|
347
277
|
export interface SwapExact {
|
|
@@ -97,16 +97,12 @@ export const startSendAnywhere = async (
|
|
|
97
97
|
const osmoIssuer = await safeFulfill(() =>
|
|
98
98
|
E(agoricNames).lookup('issuer', 'OSMO'),
|
|
99
99
|
);
|
|
100
|
-
const USDCIssuer = await safeFulfill(() =>
|
|
101
|
-
E(agoricNames).lookup('issuer', 'USDC'),
|
|
102
|
-
);
|
|
103
100
|
|
|
104
101
|
const issuerKeywordRecord = harden({
|
|
105
102
|
BLD: await BLD,
|
|
106
103
|
IST: await IST,
|
|
107
104
|
...(atomIssuer && { ATOM: atomIssuer }),
|
|
108
105
|
...(osmoIssuer && { OSMO: osmoIssuer }),
|
|
109
|
-
...(USDCIssuer && { USDC: USDCIssuer }),
|
|
110
106
|
});
|
|
111
107
|
trace('issuerKeywordRecord', issuerKeywordRecord);
|
|
112
108
|
|
package/src/typeGuards.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @import {TypedPattern} from '@agoric/internal';
|
|
3
|
-
* @import {CosmosAssetInfo, CosmosChainInfo, DenomAmount, DenomInfo, AmountArg, CosmosValidatorAddress, OrchestrationPowers, ForwardInfo, IBCMsgTransferOptions
|
|
3
|
+
* @import {ChainAddress, CosmosAssetInfo, Chain, ChainInfo, CosmosChainInfo, DenomAmount, DenomInfo, AmountArg, CosmosValidatorAddress, OrchestrationPowers, ForwardInfo, IBCMsgTransferOptions} from './types.js';
|
|
4
4
|
* @import {Any as Proto3Msg} from '@agoric/cosmic-proto/google/protobuf/any.js';
|
|
5
5
|
* @import {TxBody} from '@agoric/cosmic-proto/cosmos/tx/v1beta1/tx.js';
|
|
6
6
|
* @import {Coin} from '@agoric/cosmic-proto/cosmos/base/v1beta1/coin.js';
|
|
@@ -16,20 +16,8 @@ export const OutboundConnectionHandlerI: import("@endo/patterns").InterfaceGuard
|
|
|
16
16
|
onOpen: import("@endo/patterns").MethodGuard;
|
|
17
17
|
onClose: import("@endo/patterns").MethodGuard;
|
|
18
18
|
}>;
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
let encoding: import("@endo/patterns").Matcher;
|
|
22
|
-
let value: import("@endo/patterns").Matcher;
|
|
23
|
-
}
|
|
24
|
-
/** @type {TypedPattern<Caip10Record>} */
|
|
25
|
-
export const Caip10RecordShape: TypedPattern<Caip10Record>;
|
|
26
|
-
export namespace ChainAddressShape { }
|
|
27
|
-
/**
|
|
28
|
-
* NB: For the AccountId case does not fully verify it is CAIP-10 (only string)
|
|
29
|
-
*
|
|
30
|
-
* @type {TypedPattern<AccountIdArg>}
|
|
31
|
-
*/
|
|
32
|
-
export const AccountIdArgShape: TypedPattern<AccountIdArg>;
|
|
19
|
+
/** @type {TypedPattern<ChainAddress>} */
|
|
20
|
+
export const ChainAddressShape: TypedPattern<ChainAddress>;
|
|
33
21
|
/** @type {TypedPattern<Proto3Msg>} */
|
|
34
22
|
export const Proto3Shape: TypedPattern<Proto3Msg>;
|
|
35
23
|
/** @internal */
|
|
@@ -42,8 +30,6 @@ export const IBCConnectionIDShape: import("@endo/patterns").Matcher;
|
|
|
42
30
|
export const IBCConnectionInfoShape: import("@endo/patterns").Matcher;
|
|
43
31
|
/** @type {TypedPattern<CosmosAssetInfo>} */
|
|
44
32
|
export const CosmosAssetInfoShape: TypedPattern<CosmosAssetInfo>;
|
|
45
|
-
/** @type {TypedPattern<BaseChainInfo>} */
|
|
46
|
-
export const BaseChainInfoShape: TypedPattern<BaseChainInfo>;
|
|
47
33
|
/** @type {TypedPattern<CosmosChainInfo>} */
|
|
48
34
|
export const CosmosChainInfoShape: TypedPattern<CosmosChainInfo>;
|
|
49
35
|
/** @type {TypedPattern<ChainInfo>} */
|
|
@@ -109,12 +95,10 @@ export const ForwardOptsShape: TypedPattern<IBCMsgTransferOptions["forwardOpts"]
|
|
|
109
95
|
* @internal
|
|
110
96
|
*/
|
|
111
97
|
export const IBCTransferOptionsShape: TypedPattern<IBCMsgTransferOptions>;
|
|
112
|
-
import type {
|
|
98
|
+
import type { ChainAddress } from './types.js';
|
|
113
99
|
import type { TypedPattern } from '@agoric/internal';
|
|
114
|
-
import type { AccountIdArg } from './types.js';
|
|
115
100
|
import type { Any as Proto3Msg } from '@agoric/cosmic-proto/google/protobuf/any.js';
|
|
116
101
|
import type { CosmosAssetInfo } from './types.js';
|
|
117
|
-
import type { BaseChainInfo } from './types.js';
|
|
118
102
|
import type { CosmosChainInfo } from './types.js';
|
|
119
103
|
import type { ChainInfo } from './types.js';
|
|
120
104
|
import type { Coin } from '@agoric/cosmic-proto/cosmos/base/v1beta1/coin.js';
|
package/src/typeGuards.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typeGuards.d.ts","sourceRoot":"","sources":["typeGuards.js"],"names":[],"mappings":"AAIA;;;;;;;;GAQG;AAEH;;;;GAIG;AACH;;;GAQE
|
|
1
|
+
{"version":3,"file":"typeGuards.d.ts","sourceRoot":"","sources":["typeGuards.js"],"names":[],"mappings":"AAIA;;;;;;;;GAQG;AAEH;;;;GAIG;AACH;;;GAQE;AAEF,yCAAyC;AACzC,gCADW,aAAa,YAAY,CAAC,CAKnC;AAGF,sCAAsC;AACtC,0BADW,aAAa,SAAS,CAAC,CACoC;AAGtE,gBAAgB;AAChB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rL,qBAAqB;iCALoJ,YAAY;+BAAZ,YAAY;4CAAZ,YAAY;+BAIvL,sBAAsB;yCAJqJ,YAAY;iCAAZ,YAAY;2CAAZ,YAAY"}
|
package/src/typeGuards.js
CHANGED
|
@@ -4,7 +4,7 @@ import { M } from '@endo/patterns';
|
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* @import {TypedPattern} from '@agoric/internal';
|
|
7
|
-
* @import {CosmosAssetInfo, CosmosChainInfo, DenomAmount, DenomInfo, AmountArg, CosmosValidatorAddress, OrchestrationPowers, ForwardInfo, IBCMsgTransferOptions
|
|
7
|
+
* @import {ChainAddress, CosmosAssetInfo, Chain, ChainInfo, CosmosChainInfo, DenomAmount, DenomInfo, AmountArg, CosmosValidatorAddress, OrchestrationPowers, ForwardInfo, IBCMsgTransferOptions} from './types.js';
|
|
8
8
|
* @import {Any as Proto3Msg} from '@agoric/cosmic-proto/google/protobuf/any.js';
|
|
9
9
|
* @import {TxBody} from '@agoric/cosmic-proto/cosmos/tx/v1beta1/tx.js';
|
|
10
10
|
* @import {Coin} from '@agoric/cosmic-proto/cosmos/base/v1beta1/coin.js';
|
|
@@ -27,37 +27,17 @@ export const OutboundConnectionHandlerI = M.interface(
|
|
|
27
27
|
},
|
|
28
28
|
);
|
|
29
29
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
export const CosmosChainAddressShape = {
|
|
30
|
+
/** @type {TypedPattern<ChainAddress>} */
|
|
31
|
+
export const ChainAddressShape = {
|
|
33
32
|
chainId: M.string(),
|
|
34
|
-
// Ignored but maintained for backwards compatibility
|
|
35
33
|
encoding: M.string(),
|
|
36
34
|
value: M.string(),
|
|
37
35
|
};
|
|
38
|
-
harden(
|
|
39
|
-
|
|
40
|
-
/** @type {TypedPattern<Caip10Record>} */
|
|
41
|
-
export const Caip10RecordShape = {
|
|
42
|
-
namespace: M.string(),
|
|
43
|
-
reference: M.string(),
|
|
44
|
-
accountAddress: M.string(),
|
|
45
|
-
};
|
|
46
|
-
harden(Caip10RecordShape);
|
|
47
|
-
|
|
48
|
-
/** @deprecated use CosmosChainAddressShape */
|
|
49
|
-
export const ChainAddressShape = CosmosChainAddressShape;
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* NB: For the AccountId case does not fully verify it is CAIP-10 (only string)
|
|
53
|
-
*
|
|
54
|
-
* @type {TypedPattern<AccountIdArg>}
|
|
55
|
-
*/
|
|
56
|
-
export const AccountIdArgShape = M.or(M.string(), CosmosChainAddressShape);
|
|
36
|
+
harden(ChainAddressShape);
|
|
57
37
|
|
|
58
38
|
/** @type {TypedPattern<Proto3Msg>} */
|
|
59
39
|
export const Proto3Shape = { typeUrl: M.string(), value: M.string() };
|
|
60
|
-
harden(
|
|
40
|
+
harden(ChainAddressShape);
|
|
61
41
|
|
|
62
42
|
/** @internal */
|
|
63
43
|
export const IBCChannelIDShape = M.string();
|
|
@@ -99,44 +79,25 @@ export const CosmosAssetInfoShape = M.splitRecord({
|
|
|
99
79
|
),
|
|
100
80
|
});
|
|
101
81
|
|
|
102
|
-
const ChainInfoRequiredShape = {
|
|
103
|
-
namespace: M.string(),
|
|
104
|
-
reference: M.string(),
|
|
105
|
-
};
|
|
106
|
-
|
|
107
|
-
const ChainInfoOptionalShape = {
|
|
108
|
-
cctpDestinationDomain: M.number(),
|
|
109
|
-
};
|
|
110
|
-
|
|
111
|
-
/** @type {TypedPattern<BaseChainInfo>} */
|
|
112
|
-
export const BaseChainInfoShape = M.splitRecord(
|
|
113
|
-
ChainInfoRequiredShape,
|
|
114
|
-
ChainInfoOptionalShape,
|
|
115
|
-
);
|
|
116
|
-
harden(BaseChainInfoShape);
|
|
117
|
-
|
|
118
82
|
/** @type {TypedPattern<CosmosChainInfo>} */
|
|
119
83
|
export const CosmosChainInfoShape = M.splitRecord(
|
|
120
84
|
{
|
|
121
85
|
chainId: M.string(),
|
|
122
|
-
bech32Prefix: M.string(),
|
|
123
|
-
...ChainInfoRequiredShape,
|
|
124
86
|
},
|
|
125
87
|
{
|
|
88
|
+
bech32Prefix: M.string(),
|
|
126
89
|
connections: M.record(),
|
|
90
|
+
stakingTokens: M.arrayOf({ denom: M.string() }),
|
|
127
91
|
// UNTIL https://github.com/Agoric/agoric-sdk/issues/9326
|
|
128
92
|
icqEnabled: M.boolean(),
|
|
129
93
|
pfmEnabled: M.boolean(),
|
|
130
|
-
stakingTokens: M.arrayOf({ denom: M.string() }),
|
|
131
|
-
...ChainInfoOptionalShape,
|
|
132
94
|
},
|
|
133
95
|
);
|
|
134
|
-
harden(CosmosChainInfoShape);
|
|
135
96
|
|
|
136
97
|
/** @type {TypedPattern<ChainInfo>} */
|
|
137
|
-
export const ChainInfoShape = M.
|
|
138
|
-
|
|
139
|
-
|
|
98
|
+
export const ChainInfoShape = M.splitRecord({
|
|
99
|
+
chainId: M.string(),
|
|
100
|
+
});
|
|
140
101
|
export const DenomShape = M.string();
|
|
141
102
|
|
|
142
103
|
/** @type {TypedPattern<Coin>} */
|
|
@@ -185,10 +146,10 @@ export const AmountArgShape = M.or(AnyNatAmountShape, DenomAmountShape);
|
|
|
185
146
|
*/
|
|
186
147
|
export const DelegationShape = M.splitRecord(
|
|
187
148
|
{
|
|
188
|
-
validator:
|
|
149
|
+
validator: ChainAddressShape,
|
|
189
150
|
amount: AmountArgShape,
|
|
190
151
|
},
|
|
191
|
-
{ delegator:
|
|
152
|
+
{ delegator: ChainAddressShape },
|
|
192
153
|
);
|
|
193
154
|
|
|
194
155
|
/** Approximately @see RequestQuery */
|
|
@@ -284,7 +245,7 @@ export const ForwardOptsShape = M.splitRecord(
|
|
|
284
245
|
{
|
|
285
246
|
timeout: M.string(),
|
|
286
247
|
retries: M.number(),
|
|
287
|
-
intermediateRecipient:
|
|
248
|
+
intermediateRecipient: ChainAddressShape,
|
|
288
249
|
},
|
|
289
250
|
{},
|
|
290
251
|
);
|
package/src/types.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/** @file Rollup of all type definitions in the package, for local import and external export */
|
|
2
|
-
import type { ZCF } from '@agoric/zoe';
|
|
3
2
|
export type * from './chain-info.js';
|
|
4
3
|
export type * from './cosmos-api.js';
|
|
4
|
+
export type * from './ethereum-api.js';
|
|
5
5
|
export type * from './exos/chain-hub.js';
|
|
6
6
|
export type * from './exos/combine-invitation-makers.js';
|
|
7
7
|
export type * from './exos/cosmos-interchain-service.js';
|
package/src/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["types.ts"],"names":[],"mappings":"AAAA,gGAAgG;AAEhG,
|
|
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,qBAAqB,CAAC;AACzC,mBAAmB,qCAAqC,CAAC;AACzD,mBAAmB,qCAAqC,CAAC;AACzD,mBAAmB,0BAA0B,CAAC;AAC9C,mBAAmB,2BAA2B,CAAC;AAC/C,mBAAmB,8BAA8B,CAAC;AAClD,mBAAmB,8BAA8B,CAAC;AAClD,mBAAmB,gCAAgC,CAAC;AACpD,mBAAmB,wBAAwB,CAAC;AAC5C,mBAAmB,wBAAwB,CAAC;AAC5C,mBAAmB,yBAAyB,CAAC;AAE7C;;GAEG;AACH,MAAM,WAAW,QAAQ;IACvB,mBAAmB,EAAE,GAAG,CAAC,qBAAqB,CAAC,CAAC;IAChD,eAAe,EAAE,GAAG,CAAC,iBAAiB,CAAC,CAAC;IACxC,cAAc,EAAE,GAAG,CAAC,gBAAgB,CAAC,CAAC;CACvC"}
|
package/src/types.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
/** @file Rollup of all type definitions in the package, for local import and external export */
|
|
2
2
|
|
|
3
|
-
import type { ZCF } from '@agoric/zoe';
|
|
4
|
-
|
|
5
3
|
export type * from './chain-info.js';
|
|
6
4
|
export type * from './cosmos-api.js';
|
|
5
|
+
export type * from './ethereum-api.js';
|
|
7
6
|
export type * from './exos/chain-hub.js';
|
|
8
7
|
export type * from './exos/combine-invitation-makers.js';
|
|
9
8
|
export type * from './exos/cosmos-interchain-service.js';
|