@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 @@
|
|
|
1
|
+
{"version":3,"file":"chain-info.d.ts","sourceRoot":"","sources":["chain-info.js"],"names":[],"mappings":"AAyEO,gDALI,IAAI,CAAC,OAAO,cAAc,EAAE,UAAU,CAAC,WAAW,CAAC,CAAC,QACpD,MAAM,aACN,eAAe,uBACD,MAAM,EAAE,KAAK,IA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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAqDE"}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { E } from '@endo/far';
|
|
2
|
+
import { mustMatch } from '@endo/patterns';
|
|
3
|
+
import { connectionKey } from './exos/chain-hub.js';
|
|
4
|
+
import fetchedChainInfo from './fetched-chain-info.js'; // Refresh with scripts/refresh-chain-info.ts
|
|
5
|
+
import { CosmosChainInfoShape } from './typeGuards.js';
|
|
6
|
+
|
|
7
|
+
/** @import {CosmosChainInfo, EthChainInfo} from './types.js'; */
|
|
8
|
+
|
|
9
|
+
/** @typedef {CosmosChainInfo | EthChainInfo} ChainInfo */
|
|
10
|
+
|
|
11
|
+
const knownChains = /** @satisfies {Record<string, ChainInfo>} */ (
|
|
12
|
+
harden({
|
|
13
|
+
...fetchedChainInfo,
|
|
14
|
+
// FIXME does not have useful connections
|
|
15
|
+
// UNTIL https://github.com/Agoric/agoric-sdk/issues/9492
|
|
16
|
+
agoriclocal: {
|
|
17
|
+
chainId: 'agoriclocal',
|
|
18
|
+
connections: {
|
|
19
|
+
'cosmoshub-4': {
|
|
20
|
+
id: 'connection-1',
|
|
21
|
+
client_id: '07-tendermint-3',
|
|
22
|
+
counterparty: {
|
|
23
|
+
client_id: '07-tendermint-2',
|
|
24
|
+
connection_id: 'connection-1',
|
|
25
|
+
prefix: {
|
|
26
|
+
key_prefix: '',
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
state: 3 /* IBCConnectionState.STATE_OPEN */,
|
|
30
|
+
transferChannel: {
|
|
31
|
+
portId: 'transfer',
|
|
32
|
+
channelId: 'channel-1',
|
|
33
|
+
counterPartyChannelId: 'channel-1',
|
|
34
|
+
counterPartyPortId: 'transfer',
|
|
35
|
+
ordering: 1 /* Order.ORDER_UNORDERED */,
|
|
36
|
+
state: 3 /* IBCConnectionState.STATE_OPEN */,
|
|
37
|
+
version: 'ics20-1',
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
osmosislocal: {
|
|
41
|
+
id: 'connection-0',
|
|
42
|
+
client_id: '07-tendermint-2',
|
|
43
|
+
counterparty: {
|
|
44
|
+
client_id: '07-tendermint-2',
|
|
45
|
+
connection_id: 'connection-1',
|
|
46
|
+
prefix: {
|
|
47
|
+
key_prefix: '',
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
state: 3 /* IBCConnectionState.STATE_OPEN */,
|
|
51
|
+
transferChannel: {
|
|
52
|
+
portId: 'transfer',
|
|
53
|
+
channelId: 'channel-0',
|
|
54
|
+
counterPartyChannelId: 'channel-1',
|
|
55
|
+
counterPartyPortId: 'transfer',
|
|
56
|
+
ordering: 1 /* Order.ORDER_UNORDERED */,
|
|
57
|
+
state: 3 /* IBCConnectionState.STATE_OPEN */,
|
|
58
|
+
version: 'ics20-1',
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
})
|
|
64
|
+
);
|
|
65
|
+
|
|
66
|
+
/** @typedef {typeof knownChains} KnownChains */
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* @param {ERef<import('@agoric/vats').NameHubKit['nameAdmin']>} agoricNamesAdmin
|
|
70
|
+
* @param {string} name
|
|
71
|
+
* @param {CosmosChainInfo} chainInfo
|
|
72
|
+
* @param {(...messages: string[]) => void} [log]
|
|
73
|
+
*/
|
|
74
|
+
export const registerChain = async (
|
|
75
|
+
agoricNamesAdmin,
|
|
76
|
+
name,
|
|
77
|
+
chainInfo,
|
|
78
|
+
log = () => {},
|
|
79
|
+
) => {
|
|
80
|
+
const { nameAdmin } = await E(agoricNamesAdmin).provideChild('chain');
|
|
81
|
+
const { nameAdmin: connAdmin } =
|
|
82
|
+
await E(agoricNamesAdmin).provideChild('chainConnection');
|
|
83
|
+
|
|
84
|
+
mustMatch(chainInfo, CosmosChainInfoShape);
|
|
85
|
+
const { connections = {}, ...vertex } = chainInfo;
|
|
86
|
+
|
|
87
|
+
const promises = [
|
|
88
|
+
E(nameAdmin)
|
|
89
|
+
.update(name, vertex)
|
|
90
|
+
.then(() => log(`registered agoricNames chain.${name}`)),
|
|
91
|
+
];
|
|
92
|
+
|
|
93
|
+
// FIXME updates redundantly, twice per edge
|
|
94
|
+
for (const [counterChainId, connInfo] of Object.entries(connections)) {
|
|
95
|
+
const key = connectionKey(chainInfo.chainId, counterChainId);
|
|
96
|
+
promises.push(
|
|
97
|
+
E(connAdmin)
|
|
98
|
+
.update(key, connInfo)
|
|
99
|
+
.then(() => log(`registering agoricNames chainConnection.${key}`)),
|
|
100
|
+
);
|
|
101
|
+
}
|
|
102
|
+
// Bundle to pipeline IO
|
|
103
|
+
await Promise.all(promises);
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* @param {ERef<import('@agoric/vats').NameHubKit['nameAdmin']>} agoricNamesAdmin
|
|
108
|
+
* @param {(...messages: string[]) => void} [log]
|
|
109
|
+
*/
|
|
110
|
+
export const registerChainNamespace = async (agoricNamesAdmin, log) => {
|
|
111
|
+
for await (const [name, info] of Object.entries(knownChains)) {
|
|
112
|
+
await registerChain(agoricNamesAdmin, name, info, log);
|
|
113
|
+
}
|
|
114
|
+
};
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import type { AnyJson } from '@agoric/cosmic-proto';
|
|
2
|
+
import type { Delegation, Redelegation, UnbondingDelegation } from '@agoric/cosmic-proto/cosmos/staking/v1beta1/staking.js';
|
|
3
|
+
import type { TxBody } from '@agoric/cosmic-proto/cosmos/tx/v1beta1/tx.js';
|
|
4
|
+
import { MsgTransfer } from '@agoric/cosmic-proto/ibc/applications/transfer/v1/tx.js';
|
|
5
|
+
import type { State as IBCChannelState, Order } from '@agoric/cosmic-proto/ibc/core/channel/v1/channel.js';
|
|
6
|
+
import type { State as IBCConnectionState } from '@agoric/cosmic-proto/ibc/core/connection/v1/connection.js';
|
|
7
|
+
import type { Brand, Purse } from '@agoric/ertp/src/types.js';
|
|
8
|
+
import type { Port } from '@agoric/network';
|
|
9
|
+
import { IBCChannelID, type IBCConnectionID } from '@agoric/vats';
|
|
10
|
+
import type { LocalIbcAddress, RemoteIbcAddress } from '@agoric/vats/tools/ibc-utils.js';
|
|
11
|
+
import type { AmountArg, ChainAddress, DenomAmount } from './types.js';
|
|
12
|
+
/** A helper type for type extensions. */
|
|
13
|
+
export type TypeUrl = string;
|
|
14
|
+
export type Proto3JSONMsg = {
|
|
15
|
+
'@type': TypeUrl;
|
|
16
|
+
value: Record<string, unknown>;
|
|
17
|
+
};
|
|
18
|
+
/** An address for a validator on some blockchain, e.g., cosmos, eth, etc. */
|
|
19
|
+
export type CosmosValidatorAddress = ChainAddress & {
|
|
20
|
+
address: `${string}valoper${string}`;
|
|
21
|
+
addressEncoding: 'bech32';
|
|
22
|
+
};
|
|
23
|
+
/** Represents an IBC Connection between two chains, which can contain multiple Channels. */
|
|
24
|
+
export type IBCConnectionInfo = {
|
|
25
|
+
id: IBCConnectionID;
|
|
26
|
+
client_id: string;
|
|
27
|
+
state: IBCConnectionState;
|
|
28
|
+
counterparty: {
|
|
29
|
+
client_id: string;
|
|
30
|
+
connection_id: IBCConnectionID;
|
|
31
|
+
prefix: {
|
|
32
|
+
key_prefix: string;
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
transferChannel: {
|
|
36
|
+
portId: string;
|
|
37
|
+
channelId: IBCChannelID;
|
|
38
|
+
counterPartyPortId: string;
|
|
39
|
+
counterPartyChannelId: IBCChannelID;
|
|
40
|
+
ordering: Order;
|
|
41
|
+
state: IBCChannelState;
|
|
42
|
+
version: string;
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* Info for a Cosmos-based chain.
|
|
47
|
+
*/
|
|
48
|
+
export type CosmosChainInfo = Readonly<{
|
|
49
|
+
chainId: string;
|
|
50
|
+
connections?: Record<string, IBCConnectionInfo>;
|
|
51
|
+
icqEnabled?: boolean;
|
|
52
|
+
/**
|
|
53
|
+
* cf https://github.com/cosmos/chain-registry/blob/master/chain.schema.json#L117
|
|
54
|
+
*/
|
|
55
|
+
stakingTokens?: Readonly<Array<{
|
|
56
|
+
denom: string;
|
|
57
|
+
}>>;
|
|
58
|
+
}>;
|
|
59
|
+
export interface StakingAccountQueries {
|
|
60
|
+
/**
|
|
61
|
+
* @returns all active delegations from the account to any validator (or [] if none)
|
|
62
|
+
*/
|
|
63
|
+
getDelegations: () => Promise<Delegation[]>;
|
|
64
|
+
/**
|
|
65
|
+
* @returns the active delegation from the account to a specific validator. Return an
|
|
66
|
+
* empty Delegation if there is no delegation.
|
|
67
|
+
*/
|
|
68
|
+
getDelegation: (validator: CosmosValidatorAddress) => Promise<Delegation>;
|
|
69
|
+
/**
|
|
70
|
+
* @returns the unbonding delegations from the account to any validator (or [] if none)
|
|
71
|
+
*/
|
|
72
|
+
getUnbondingDelegations: () => Promise<UnbondingDelegation[]>;
|
|
73
|
+
/**
|
|
74
|
+
* @returns the unbonding delegations from the account to a specific validator (or [] if none)
|
|
75
|
+
*/
|
|
76
|
+
getUnbondingDelegation: (validator: CosmosValidatorAddress) => Promise<UnbondingDelegation>;
|
|
77
|
+
getRedelegations: () => Promise<Redelegation[]>;
|
|
78
|
+
getRedelegation: (srcValidator: CosmosValidatorAddress, dstValidator?: CosmosValidatorAddress) => Promise<Redelegation>;
|
|
79
|
+
/**
|
|
80
|
+
* Get the pending rewards for the account.
|
|
81
|
+
* @returns the amounts of the account's rewards pending from all validators
|
|
82
|
+
*/
|
|
83
|
+
getRewards: () => Promise<DenomAmount[]>;
|
|
84
|
+
/**
|
|
85
|
+
* Get the rewards pending with a specific validator.
|
|
86
|
+
* @param validator - the validator address to query for
|
|
87
|
+
* @returns the amount of the account's rewards pending from a specific validator
|
|
88
|
+
*/
|
|
89
|
+
getReward: (validator: CosmosValidatorAddress) => Promise<DenomAmount[]>;
|
|
90
|
+
}
|
|
91
|
+
export interface StakingAccountActions {
|
|
92
|
+
/**
|
|
93
|
+
* Delegate an amount to a validator. The promise settles when the delegation is complete.
|
|
94
|
+
* @param validator - the validator to delegate to
|
|
95
|
+
* @param amount - the amount to delegate
|
|
96
|
+
* @returns void
|
|
97
|
+
*/
|
|
98
|
+
delegate: (validator: CosmosValidatorAddress, amount: AmountArg) => Promise<void>;
|
|
99
|
+
/**
|
|
100
|
+
* Redelegate from one delegator to another.
|
|
101
|
+
* Settles when the redelegation is established, not 21 days later.
|
|
102
|
+
* @param srcValidator - the current validator for the delegation.
|
|
103
|
+
* @param dstValidator - the validator that will receive the delegation.
|
|
104
|
+
* @param amount - how much to redelegate.
|
|
105
|
+
* @returns
|
|
106
|
+
*/
|
|
107
|
+
redelegate: (srcValidator: CosmosValidatorAddress, dstValidator: CosmosValidatorAddress, amount: AmountArg) => Promise<void>;
|
|
108
|
+
/**
|
|
109
|
+
* Undelegate multiple delegations (concurrently). To delegate independently, pass an array with one item.
|
|
110
|
+
* Resolves when the undelegation is complete and the tokens are no longer bonded. Note it may take weeks.
|
|
111
|
+
* The unbonding time is padded by 10 minutes to account for clock skew.
|
|
112
|
+
* @param delegations - the delegation to undelegate
|
|
113
|
+
*/
|
|
114
|
+
undelegate: (delegations: Omit<Delegation, 'delegatorAddress'>[]) => Promise<void>;
|
|
115
|
+
/**
|
|
116
|
+
* Withdraw rewards from all validators. The promise settles when the rewards are withdrawn.
|
|
117
|
+
* @returns The total amounts of rewards withdrawn
|
|
118
|
+
*/
|
|
119
|
+
withdrawRewards: () => Promise<DenomAmount[]>;
|
|
120
|
+
/**
|
|
121
|
+
* Withdraw rewards from a specific validator. The promise settles when the rewards are withdrawn.
|
|
122
|
+
* @param validator - the validator to withdraw rewards from
|
|
123
|
+
* @returns
|
|
124
|
+
*/
|
|
125
|
+
withdrawReward: (validator: CosmosValidatorAddress) => Promise<DenomAmount[]>;
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Low level object that supports queries and operations for an account on a remote chain.
|
|
129
|
+
*/
|
|
130
|
+
export interface IcaAccount {
|
|
131
|
+
/**
|
|
132
|
+
* @returns the address of the account on the remote chain
|
|
133
|
+
*/
|
|
134
|
+
getAddress: () => ChainAddress;
|
|
135
|
+
/**
|
|
136
|
+
* Submit a transaction on behalf of the remote account for execution on the remote chain.
|
|
137
|
+
* @param msgs - records for the transaction
|
|
138
|
+
* @returns acknowledgement string
|
|
139
|
+
*/
|
|
140
|
+
executeTx: (msgs: Proto3JSONMsg[]) => Promise<string>;
|
|
141
|
+
/**
|
|
142
|
+
* Submit a transaction on behalf of the remote account for execution on the remote chain.
|
|
143
|
+
* @param msgs - records for the transaction
|
|
144
|
+
* @param [opts] - optional parameters for the Tx, like `timeoutHeight` and `memo`
|
|
145
|
+
* @returns acknowledgement string
|
|
146
|
+
*/
|
|
147
|
+
executeEncodedTx: (msgs: AnyJson[], opts?: Partial<Omit<TxBody, 'messages'>>) => Promise<string>;
|
|
148
|
+
/** get Purse for a brand to .withdraw() a Payment from the account */
|
|
149
|
+
getPurse: (brand: Brand) => Promise<Purse>;
|
|
150
|
+
/**
|
|
151
|
+
* Close the remote account
|
|
152
|
+
*/
|
|
153
|
+
close: () => Promise<void>;
|
|
154
|
+
/** @returns the address of the remote channel */
|
|
155
|
+
getRemoteAddress: () => RemoteIbcAddress;
|
|
156
|
+
/** @returns the address of the local channel */
|
|
157
|
+
getLocalAddress: () => LocalIbcAddress;
|
|
158
|
+
/** @returns the port the ICA channel is bound to */
|
|
159
|
+
getPort: () => Port;
|
|
160
|
+
}
|
|
161
|
+
export type LiquidStakingMethods = {
|
|
162
|
+
liquidStake: (amount: AmountArg) => Promise<void>;
|
|
163
|
+
};
|
|
164
|
+
export type IBCMsgTransferOptions = {
|
|
165
|
+
timeoutHeight?: MsgTransfer['timeoutHeight'];
|
|
166
|
+
timeoutTimestamp?: MsgTransfer['timeoutTimestamp'];
|
|
167
|
+
memo?: string;
|
|
168
|
+
};
|
|
169
|
+
export type CosmosChainAccountMethods<CCI extends CosmosChainInfo> = (CCI extends {
|
|
170
|
+
icaEnabled: true;
|
|
171
|
+
} ? IcaAccount : {}) & CCI extends {
|
|
172
|
+
stakingTokens: {};
|
|
173
|
+
} ? StakingAccountActions : {};
|
|
174
|
+
//# sourceMappingURL=cosmos-api.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cosmos-api.d.ts","sourceRoot":"","sources":["cosmos-api.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,KAAK,EACV,UAAU,EACV,YAAY,EACZ,mBAAmB,EACpB,MAAM,wDAAwD,CAAC;AAChE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,8CAA8C,CAAC;AAC3E,OAAO,EAAE,WAAW,EAAE,MAAM,yDAAyD,CAAC;AACtF,OAAO,KAAK,EACV,KAAK,IAAI,eAAe,EACxB,KAAK,EACN,MAAM,qDAAqD,CAAC;AAC7D,OAAO,KAAK,EAAE,KAAK,IAAI,kBAAkB,EAAE,MAAM,2DAA2D,CAAC;AAC7G,OAAO,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,K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AC,eAAe,CAAC,CAAC;IAC7C,gBAAgB,CAAC,EAAE,WAAW,CAAC,kBAAkB,CAAC,CAAC;IACnD,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,yBAAyB,CAAC,GAAG,SAAS,eAAe,IAC/D,CAAC,GAAG,SAAS;IACX,UAAU,EAAE,IAAI,CAAC;CAClB,GACG,UAAU,GACV,EAAE,CAAC,GACL,GAAG,SAAS;IACZ,aAAa,EAAE,EAAE,CAAC;CACnB,GACG,qBAAqB,GACrB,EAAE,CAAC"}
|
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
import type { AnyJson } from '@agoric/cosmic-proto';
|
|
2
|
+
import type {
|
|
3
|
+
Delegation,
|
|
4
|
+
Redelegation,
|
|
5
|
+
UnbondingDelegation,
|
|
6
|
+
} from '@agoric/cosmic-proto/cosmos/staking/v1beta1/staking.js';
|
|
7
|
+
import type { TxBody } from '@agoric/cosmic-proto/cosmos/tx/v1beta1/tx.js';
|
|
8
|
+
import { MsgTransfer } from '@agoric/cosmic-proto/ibc/applications/transfer/v1/tx.js';
|
|
9
|
+
import type {
|
|
10
|
+
State as IBCChannelState,
|
|
11
|
+
Order,
|
|
12
|
+
} from '@agoric/cosmic-proto/ibc/core/channel/v1/channel.js';
|
|
13
|
+
import type { State as IBCConnectionState } from '@agoric/cosmic-proto/ibc/core/connection/v1/connection.js';
|
|
14
|
+
import type { Brand, Purse } from '@agoric/ertp/src/types.js';
|
|
15
|
+
import type { Port } from '@agoric/network';
|
|
16
|
+
import { IBCChannelID, type IBCConnectionID } from '@agoric/vats';
|
|
17
|
+
import type {
|
|
18
|
+
LocalIbcAddress,
|
|
19
|
+
RemoteIbcAddress,
|
|
20
|
+
} from '@agoric/vats/tools/ibc-utils.js';
|
|
21
|
+
import type { AmountArg, ChainAddress, DenomAmount } from './types.js';
|
|
22
|
+
|
|
23
|
+
/** A helper type for type extensions. */
|
|
24
|
+
export type TypeUrl = string;
|
|
25
|
+
|
|
26
|
+
// TODO move into cosmic-proto
|
|
27
|
+
export type Proto3JSONMsg = {
|
|
28
|
+
'@type': TypeUrl;
|
|
29
|
+
value: Record<string, unknown>;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
/** An address for a validator on some blockchain, e.g., cosmos, eth, etc. */
|
|
33
|
+
export type CosmosValidatorAddress = ChainAddress & {
|
|
34
|
+
// TODO document why this is the format
|
|
35
|
+
address: `${string}valoper${string}`;
|
|
36
|
+
addressEncoding: 'bech32';
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
/** Represents an IBC Connection between two chains, which can contain multiple Channels. */
|
|
40
|
+
export type IBCConnectionInfo = {
|
|
41
|
+
id: IBCConnectionID; // e.g. connection-0
|
|
42
|
+
client_id: string; // '07-tendermint-0'
|
|
43
|
+
state: IBCConnectionState;
|
|
44
|
+
counterparty: {
|
|
45
|
+
client_id: string;
|
|
46
|
+
connection_id: IBCConnectionID;
|
|
47
|
+
prefix: {
|
|
48
|
+
key_prefix: string;
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
transferChannel: {
|
|
52
|
+
portId: string;
|
|
53
|
+
channelId: IBCChannelID;
|
|
54
|
+
counterPartyPortId: string;
|
|
55
|
+
counterPartyChannelId: IBCChannelID;
|
|
56
|
+
ordering: Order;
|
|
57
|
+
state: IBCChannelState;
|
|
58
|
+
version: string; // e.eg. 'ics20-1'
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Info for a Cosmos-based chain.
|
|
64
|
+
*/
|
|
65
|
+
export type CosmosChainInfo = Readonly<{
|
|
66
|
+
chainId: string;
|
|
67
|
+
|
|
68
|
+
connections?: Record<string, IBCConnectionInfo>; // chainId or wellKnownName
|
|
69
|
+
// UNTIL https://github.com/Agoric/agoric-sdk/issues/9326
|
|
70
|
+
icqEnabled?: boolean;
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* cf https://github.com/cosmos/chain-registry/blob/master/chain.schema.json#L117
|
|
74
|
+
*/
|
|
75
|
+
stakingTokens?: Readonly<Array<{ denom: string }>>;
|
|
76
|
+
}>;
|
|
77
|
+
|
|
78
|
+
export interface StakingAccountQueries {
|
|
79
|
+
/**
|
|
80
|
+
* @returns all active delegations from the account to any validator (or [] if none)
|
|
81
|
+
*/
|
|
82
|
+
getDelegations: () => Promise<Delegation[]>;
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* @returns the active delegation from the account to a specific validator. Return an
|
|
86
|
+
* empty Delegation if there is no delegation.
|
|
87
|
+
*/
|
|
88
|
+
getDelegation: (validator: CosmosValidatorAddress) => Promise<Delegation>;
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* @returns the unbonding delegations from the account to any validator (or [] if none)
|
|
92
|
+
*/
|
|
93
|
+
getUnbondingDelegations: () => Promise<UnbondingDelegation[]>;
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* @returns the unbonding delegations from the account to a specific validator (or [] if none)
|
|
97
|
+
*/
|
|
98
|
+
getUnbondingDelegation: (
|
|
99
|
+
validator: CosmosValidatorAddress,
|
|
100
|
+
) => Promise<UnbondingDelegation>;
|
|
101
|
+
|
|
102
|
+
getRedelegations: () => Promise<Redelegation[]>;
|
|
103
|
+
|
|
104
|
+
getRedelegation: (
|
|
105
|
+
srcValidator: CosmosValidatorAddress,
|
|
106
|
+
dstValidator?: CosmosValidatorAddress,
|
|
107
|
+
) => Promise<Redelegation>;
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Get the pending rewards for the account.
|
|
111
|
+
* @returns the amounts of the account's rewards pending from all validators
|
|
112
|
+
*/
|
|
113
|
+
getRewards: () => Promise<DenomAmount[]>;
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Get the rewards pending with a specific validator.
|
|
117
|
+
* @param validator - the validator address to query for
|
|
118
|
+
* @returns the amount of the account's rewards pending from a specific validator
|
|
119
|
+
*/
|
|
120
|
+
getReward: (validator: CosmosValidatorAddress) => Promise<DenomAmount[]>;
|
|
121
|
+
}
|
|
122
|
+
export interface StakingAccountActions {
|
|
123
|
+
/**
|
|
124
|
+
* Delegate an amount to a validator. The promise settles when the delegation is complete.
|
|
125
|
+
* @param validator - the validator to delegate to
|
|
126
|
+
* @param amount - the amount to delegate
|
|
127
|
+
* @returns void
|
|
128
|
+
*/
|
|
129
|
+
delegate: (
|
|
130
|
+
validator: CosmosValidatorAddress,
|
|
131
|
+
amount: AmountArg,
|
|
132
|
+
) => Promise<void>;
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* Redelegate from one delegator to another.
|
|
136
|
+
* Settles when the redelegation is established, not 21 days later.
|
|
137
|
+
* @param srcValidator - the current validator for the delegation.
|
|
138
|
+
* @param dstValidator - the validator that will receive the delegation.
|
|
139
|
+
* @param amount - how much to redelegate.
|
|
140
|
+
* @returns
|
|
141
|
+
*/
|
|
142
|
+
redelegate: (
|
|
143
|
+
srcValidator: CosmosValidatorAddress,
|
|
144
|
+
dstValidator: CosmosValidatorAddress,
|
|
145
|
+
amount: AmountArg,
|
|
146
|
+
) => Promise<void>;
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* Undelegate multiple delegations (concurrently). To delegate independently, pass an array with one item.
|
|
150
|
+
* Resolves when the undelegation is complete and the tokens are no longer bonded. Note it may take weeks.
|
|
151
|
+
* The unbonding time is padded by 10 minutes to account for clock skew.
|
|
152
|
+
* @param delegations - the delegation to undelegate
|
|
153
|
+
*/
|
|
154
|
+
undelegate: (
|
|
155
|
+
delegations: Omit<Delegation, 'delegatorAddress'>[],
|
|
156
|
+
) => Promise<void>;
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* Withdraw rewards from all validators. The promise settles when the rewards are withdrawn.
|
|
160
|
+
* @returns The total amounts of rewards withdrawn
|
|
161
|
+
*/
|
|
162
|
+
withdrawRewards: () => Promise<DenomAmount[]>;
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* Withdraw rewards from a specific validator. The promise settles when the rewards are withdrawn.
|
|
166
|
+
* @param validator - the validator to withdraw rewards from
|
|
167
|
+
* @returns
|
|
168
|
+
*/
|
|
169
|
+
withdrawReward: (validator: CosmosValidatorAddress) => Promise<DenomAmount[]>;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* Low level object that supports queries and operations for an account on a remote chain.
|
|
174
|
+
*/
|
|
175
|
+
export interface IcaAccount {
|
|
176
|
+
/**
|
|
177
|
+
* @returns the address of the account on the remote chain
|
|
178
|
+
*/
|
|
179
|
+
getAddress: () => ChainAddress;
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* Submit a transaction on behalf of the remote account for execution on the remote chain.
|
|
183
|
+
* @param msgs - records for the transaction
|
|
184
|
+
* @returns acknowledgement string
|
|
185
|
+
*/
|
|
186
|
+
executeTx: (msgs: Proto3JSONMsg[]) => Promise<string>;
|
|
187
|
+
/**
|
|
188
|
+
* Submit a transaction on behalf of the remote account for execution on the remote chain.
|
|
189
|
+
* @param msgs - records for the transaction
|
|
190
|
+
* @param [opts] - optional parameters for the Tx, like `timeoutHeight` and `memo`
|
|
191
|
+
* @returns acknowledgement string
|
|
192
|
+
*/
|
|
193
|
+
executeEncodedTx: (
|
|
194
|
+
msgs: AnyJson[],
|
|
195
|
+
opts?: Partial<Omit<TxBody, 'messages'>>,
|
|
196
|
+
) => Promise<string>;
|
|
197
|
+
/** get Purse for a brand to .withdraw() a Payment from the account */
|
|
198
|
+
getPurse: (brand: Brand) => Promise<Purse>;
|
|
199
|
+
/**
|
|
200
|
+
* Close the remote account
|
|
201
|
+
*/
|
|
202
|
+
close: () => Promise<void>;
|
|
203
|
+
/** @returns the address of the remote channel */
|
|
204
|
+
getRemoteAddress: () => RemoteIbcAddress;
|
|
205
|
+
/** @returns the address of the local channel */
|
|
206
|
+
getLocalAddress: () => LocalIbcAddress;
|
|
207
|
+
/** @returns the port the ICA channel is bound to */
|
|
208
|
+
getPort: () => Port;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
export type LiquidStakingMethods = {
|
|
212
|
+
liquidStake: (amount: AmountArg) => Promise<void>;
|
|
213
|
+
};
|
|
214
|
+
|
|
215
|
+
export type IBCMsgTransferOptions = {
|
|
216
|
+
timeoutHeight?: MsgTransfer['timeoutHeight'];
|
|
217
|
+
timeoutTimestamp?: MsgTransfer['timeoutTimestamp'];
|
|
218
|
+
memo?: string;
|
|
219
|
+
};
|
|
220
|
+
|
|
221
|
+
export type CosmosChainAccountMethods<CCI extends CosmosChainInfo> =
|
|
222
|
+
(CCI extends {
|
|
223
|
+
icaEnabled: true;
|
|
224
|
+
}
|
|
225
|
+
? IcaAccount
|
|
226
|
+
: {}) &
|
|
227
|
+
CCI extends {
|
|
228
|
+
stakingTokens: {};
|
|
229
|
+
}
|
|
230
|
+
? StakingAccountActions
|
|
231
|
+
: {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ethereum-api.d.ts","sourceRoot":"","sources":["ethereum-api.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,QAAQ,CAAC;IAClC,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export const SingleAmountRecord: import("@endo/patterns").Matcher;
|
|
2
|
+
export function start(zcf: ZCF, privateArgs: OrchestrationPowers & {
|
|
3
|
+
marshaller: Marshaller;
|
|
4
|
+
}, baggage: Baggage): Promise<{
|
|
5
|
+
publicFacet: import("@endo/exo").Guarded<{
|
|
6
|
+
makeSendInvitation(): Promise<Invitation<unknown, never>>;
|
|
7
|
+
}>;
|
|
8
|
+
creatorFacet: import("@endo/exo").Guarded<{
|
|
9
|
+
/**
|
|
10
|
+
* @param {CosmosChainInfo} chainInfo
|
|
11
|
+
* @param {IBCConnectionInfo} connectionInfo
|
|
12
|
+
*/
|
|
13
|
+
addChain(chainInfo: CosmosChainInfo, connectionInfo: IBCConnectionInfo): Promise<string>;
|
|
14
|
+
}>;
|
|
15
|
+
}>;
|
|
16
|
+
export type OrchestrationPowers = {
|
|
17
|
+
localchain: Remote<LocalChain>;
|
|
18
|
+
orchestrationService: Remote<OrchestrationService>;
|
|
19
|
+
storageNode: Remote<StorageNode>;
|
|
20
|
+
timerService: Remote<TimerService>;
|
|
21
|
+
agoricNames: Remote<NameHub>;
|
|
22
|
+
};
|
|
23
|
+
import type { Baggage } from '@agoric/vat-data';
|
|
24
|
+
import type { CosmosChainInfo } from '../cosmos-api';
|
|
25
|
+
import type { IBCConnectionInfo } from '../cosmos-api';
|
|
26
|
+
import type { LocalChain } from '@agoric/vats/src/localchain.js';
|
|
27
|
+
import type { Remote } from '@agoric/vow';
|
|
28
|
+
import type { OrchestrationService } from '../service.js';
|
|
29
|
+
import type { TimerService } from '@agoric/time';
|
|
30
|
+
import type { NameHub } from '@agoric/vats';
|
|
31
|
+
//# sourceMappingURL=sendAnywhere.contract.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sendAnywhere.contract.d.ts","sourceRoot":"","sources":["sendAnywhere.contract.js"],"names":[],"mappings":"AAiFA,kEAKE;AASK,2BANI,GAAG,eACH,mBAAmB,GAAG;IAChC,UAAc,EAAE,UAAU,CAAC;CACxB,WACO,OAAO;;;;;QAsDZ;;;WAGG;4BAFQ,eAAe,kBACf,iBAAiB;;GAqBjC;kCAhJY;IACZ,UAAc,EAAE,OAAO,UAAU,CAAC,CAAC;IACnC,oBAAwB,EAAE,OAAO,oBAAoB,CAAC,CAAC;IACvD,WAAe,EAAE,OAAO,WAAW,CAAC,CAAC;IACrC,YAAgB,EAAE,OAAO,YAAY,CAAC,CAAC;IACvC,WAAe,EAAE,OAAO,OAAO,CAAC,CAAC;CAC9B;6BAlBsB,kBAAkB;qCAKS,eAAe;uCAAf,eAAe;gCAHvC,gCAAgC;4BAEpC,aAAa;0CAEC,eAAe;kCALvB,cAAc;6BAEnB,cAAc"}
|