@agoric/orchestration 0.1.1-dev-9553675.0 → 0.1.1-dev-2dc53d7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (72) hide show
  1. package/index.d.ts +4 -0
  2. package/index.js +0 -1
  3. package/package.json +17 -15
  4. package/src/chain-info.d.ts +37 -0
  5. package/src/chain-info.d.ts.map +1 -0
  6. package/src/chain-info.ts +64 -0
  7. package/src/cosmos-api.d.ts +159 -0
  8. package/src/cosmos-api.d.ts.map +1 -0
  9. package/src/cosmos-api.ts +199 -0
  10. package/src/ethereum-api.d.ts +8 -0
  11. package/src/ethereum-api.d.ts.map +1 -0
  12. package/src/ethereum-api.ts +7 -0
  13. package/src/examples/stakeAtom.contract.d.ts +84 -0
  14. package/src/examples/stakeAtom.contract.d.ts.map +1 -0
  15. package/src/examples/stakeAtom.contract.js +0 -1
  16. package/src/examples/stakeBld.contract.d.ts +39 -0
  17. package/src/examples/stakeBld.contract.d.ts.map +1 -0
  18. package/src/examples/stakeBld.contract.js +0 -1
  19. package/src/examples/swapExample.contract.d.ts +31 -0
  20. package/src/examples/swapExample.contract.d.ts.map +1 -0
  21. package/src/examples/swapExample.contract.js +2 -3
  22. package/src/examples/unbondExample.contract.d.ts +24 -0
  23. package/src/examples/unbondExample.contract.d.ts.map +1 -0
  24. package/src/examples/unbondExample.contract.js +1 -2
  25. package/src/exos/chainAccountKit.d.ts +71 -0
  26. package/src/exos/chainAccountKit.d.ts.map +1 -0
  27. package/src/exos/chainAccountKit.js +0 -1
  28. package/src/exos/icqConnectionKit.d.ts +43 -0
  29. package/src/exos/icqConnectionKit.d.ts.map +1 -0
  30. package/src/exos/icqConnectionKit.js +0 -1
  31. package/src/exos/localchainAccountKit.d.ts +68 -0
  32. package/src/exos/localchainAccountKit.d.ts.map +1 -0
  33. package/src/exos/localchainAccountKit.js +0 -1
  34. package/src/exos/stakingAccountKit.d.ts +146 -0
  35. package/src/exos/stakingAccountKit.d.ts.map +1 -0
  36. package/src/exos/stakingAccountKit.js +12 -13
  37. package/src/facade.d.ts +29 -0
  38. package/src/facade.d.ts.map +1 -0
  39. package/src/facade.js +7 -3
  40. package/src/orchestration-api.d.ts +158 -0
  41. package/src/orchestration-api.d.ts.map +1 -0
  42. package/src/orchestration-api.ts +195 -0
  43. package/src/proposals/orchestration-proposal.d.ts +629 -0
  44. package/src/proposals/orchestration-proposal.d.ts.map +1 -0
  45. package/src/proposals/orchestration-proposal.js +0 -1
  46. package/src/proposals/start-stakeAtom.d.ts +115 -0
  47. package/src/proposals/start-stakeAtom.d.ts.map +1 -0
  48. package/src/proposals/start-stakeAtom.js +0 -1
  49. package/src/proposals/start-stakeBld.d.ts +80 -0
  50. package/src/proposals/start-stakeBld.d.ts.map +1 -0
  51. package/src/proposals/start-stakeBld.js +2 -2
  52. package/src/service.d.ts +67 -0
  53. package/src/service.d.ts.map +1 -0
  54. package/src/service.js +2 -3
  55. package/src/typeGuards.d.ts +28 -0
  56. package/src/typeGuards.d.ts.map +1 -0
  57. package/src/types.d.ts +8 -482
  58. package/src/types.d.ts.map +1 -0
  59. package/src/types.ts +10 -0
  60. package/src/utils/address.d.ts +11 -0
  61. package/src/utils/address.d.ts.map +1 -0
  62. package/src/utils/address.js +0 -1
  63. package/src/utils/orc.d.ts +14 -0
  64. package/src/utils/orc.d.ts.map +1 -0
  65. package/src/utils/orc.js +0 -1
  66. package/src/utils/packet.d.ts +52 -0
  67. package/src/utils/packet.d.ts.map +1 -0
  68. package/src/utils/packet.js +0 -1
  69. package/src/vat-orchestration.d.ts +36 -0
  70. package/src/vat-orchestration.d.ts.map +1 -0
  71. package/src/vat-orchestration.js +0 -1
  72. package/src/types.js +0 -6
package/index.d.ts ADDED
@@ -0,0 +1,4 @@
1
+ export * from "./src/types.js";
2
+ export * from "./src/service.js";
3
+ export * from "./src/typeGuards.js";
4
+ //# sourceMappingURL=index.d.ts.map
package/index.js CHANGED
@@ -1,4 +1,3 @@
1
- // eslint-disable-next-line import/export
2
1
  export * from './src/types.js';
3
2
  export * from './src/service.js';
4
3
  export * from './src/typeGuards.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agoric/orchestration",
3
- "version": "0.1.1-dev-9553675.0+9553675",
3
+ "version": "0.1.1-dev-2dc53d7.0+2dc53d7",
4
4
  "description": "Chain abstraction for Agoric's orchestration clients",
5
5
  "type": "module",
6
6
  "main": "index.js",
@@ -10,6 +10,8 @@
10
10
  },
11
11
  "scripts": {
12
12
  "build": "exit 0",
13
+ "prepack": "tsc --build tsconfig.build.json",
14
+ "postpack": "git clean -f '*.d.ts*'",
13
15
  "test": "ava",
14
16
  "test:xs": "exit 0",
15
17
  "lint": "run-s --continue-on-error lint:*",
@@ -29,19 +31,19 @@
29
31
  },
30
32
  "homepage": "https://github.com/Agoric/agoric-sdk#readme",
31
33
  "dependencies": {
32
- "@agoric/assert": "0.6.1-dev-9553675.0+9553675",
33
- "@agoric/cosmic-proto": "0.4.1-dev-9553675.0+9553675",
34
- "@agoric/ertp": "0.16.3-dev-9553675.0+9553675",
35
- "@agoric/internal": "0.3.3-dev-9553675.0+9553675",
36
- "@agoric/network": "0.1.1-dev-9553675.0+9553675",
37
- "@agoric/notifier": "0.6.3-dev-9553675.0+9553675",
38
- "@agoric/store": "0.9.3-dev-9553675.0+9553675",
39
- "@agoric/time": "0.3.3-dev-9553675.0+9553675",
40
- "@agoric/vat-data": "0.5.3-dev-9553675.0+9553675",
41
- "@agoric/vats": "0.15.2-dev-9553675.0+9553675",
42
- "@agoric/vow": "0.1.1-dev-9553675.0+9553675",
43
- "@agoric/zoe": "0.26.3-dev-9553675.0+9553675",
44
- "@agoric/zone": "0.2.3-dev-9553675.0+9553675",
34
+ "@agoric/assert": "0.6.1-dev-2dc53d7.0+2dc53d7",
35
+ "@agoric/cosmic-proto": "0.4.1-dev-2dc53d7.0+2dc53d7",
36
+ "@agoric/ertp": "0.16.3-dev-2dc53d7.0+2dc53d7",
37
+ "@agoric/internal": "0.3.3-dev-2dc53d7.0+2dc53d7",
38
+ "@agoric/network": "0.1.1-dev-2dc53d7.0+2dc53d7",
39
+ "@agoric/notifier": "0.6.3-dev-2dc53d7.0+2dc53d7",
40
+ "@agoric/store": "0.9.3-dev-2dc53d7.0+2dc53d7",
41
+ "@agoric/time": "0.3.3-dev-2dc53d7.0+2dc53d7",
42
+ "@agoric/vat-data": "0.5.3-dev-2dc53d7.0+2dc53d7",
43
+ "@agoric/vats": "0.15.2-dev-2dc53d7.0+2dc53d7",
44
+ "@agoric/vow": "0.1.1-dev-2dc53d7.0+2dc53d7",
45
+ "@agoric/zoe": "0.26.3-dev-2dc53d7.0+2dc53d7",
46
+ "@agoric/zone": "0.2.3-dev-2dc53d7.0+2dc53d7",
45
47
  "@endo/base64": "^1.0.5",
46
48
  "@endo/far": "^1.1.2",
47
49
  "@endo/marshal": "^1.5.0",
@@ -83,5 +85,5 @@
83
85
  "typeCoverage": {
84
86
  "atLeast": 96.18
85
87
  },
86
- "gitHead": "9553675cd136d389c427e024fc4da78558344779"
88
+ "gitHead": "2dc53d7552650c5d46319d0cd5341eeec275663a"
87
89
  }
@@ -0,0 +1,37 @@
1
+ /**
2
+ * @file static declaration of known chain types will allow type support for
3
+ * additional chain-specific operations like `liquidStake`
4
+ */
5
+ import type { CosmosChainInfo, EthChainInfo, IcaAccount, ICQConnection, LiquidStakingMethods, StakingAccountActions, StakingAccountQueries } from './types.js';
6
+ export type KnownChains = {
7
+ stride: {
8
+ info: CosmosChainInfo;
9
+ methods: IcaAccount & ICQConnection & StakingAccountActions & StakingAccountQueries & LiquidStakingMethods;
10
+ };
11
+ cosmos: {
12
+ info: CosmosChainInfo;
13
+ methods: IcaAccount & ICQConnection & StakingAccountActions & StakingAccountQueries;
14
+ };
15
+ agoric: {
16
+ info: CosmosChainInfo;
17
+ methods: {
18
+ /**
19
+ * Register a hook to intercept an incoming IBC Transfer and handle it.
20
+ * Calling without arguments will unregister the hook.
21
+ */
22
+ interceptTransfer: (tap?: {
23
+ upcall: (args: any) => Promise<any>;
24
+ }) => Promise<void>;
25
+ };
26
+ };
27
+ celestia: {
28
+ info: CosmosChainInfo;
29
+ methods: IcaAccount & ICQConnection & StakingAccountActions & StakingAccountQueries;
30
+ };
31
+ osmosis: {
32
+ info: CosmosChainInfo;
33
+ methods: IcaAccount & ICQConnection & StakingAccountActions & StakingAccountQueries;
34
+ };
35
+ };
36
+ export type ChainInfo = CosmosChainInfo | EthChainInfo;
37
+ //# sourceMappingURL=chain-info.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chain-info.d.ts","sourceRoot":"","sources":["chain-info.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EACV,eAAe,EACf,YAAY,EACZ,UAAU,EACV,aAAa,EACb,oBAAoB,EACpB,qBAAqB,EACrB,qBAAqB,EACtB,MAAM,YAAY,CAAC;AAKpB,MAAM,MAAM,WAAW,GAAG;IACxB,MAAM,EAAE;QACN,IAAI,EAAE,eAAe,CAAC;QACtB,OAAO,EAAE,UAAU,GACjB,aAAa,GACb,qBAAqB,GACrB,qBAAqB,GACrB,oBAAoB,CAAC;KACxB,CAAC;IACF,MAAM,EAAE;QACN,IAAI,EAAE,eAAe,CAAC;QACtB,OAAO,EAAE,UAAU,GACjB,aAAa,GACb,qBAAqB,GACrB,qBAAqB,CAAC;KACzB,CAAC;IACF,MAAM,EAAE;QACN,IAAI,EAAE,eAAe,CAAC;QACtB,OAAO,EAAE;YAEP;;;eAGG;YACH,iBAAiB,EAAE,CAAC,GAAG,CAAC,EAAE;gBACxB,MAAM,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,OAAO,CAAC,GAAG,CAAC,CAAC;aACrC,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;SACrB,CAAC;KACH,CAAC;IACF,QAAQ,EAAE;QACR,IAAI,EAAE,eAAe,CAAC;QACtB,OAAO,EAAE,UAAU,GACjB,aAAa,GACb,qBAAqB,GACrB,qBAAqB,CAAC;KACzB,CAAC;IACF,OAAO,EAAE;QACP,IAAI,EAAE,eAAe,CAAC;QACtB,OAAO,EAAE,UAAU,GACjB,aAAa,GACb,qBAAqB,GACrB,qBAAqB,CAAC;KACzB,CAAC;CACH,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG,eAAe,GAAG,YAAY,CAAC"}
@@ -0,0 +1,64 @@
1
+ /**
2
+ * @file static declaration of known chain types will allow type support for
3
+ * additional chain-specific operations like `liquidStake`
4
+ */
5
+
6
+ import type {
7
+ CosmosChainInfo,
8
+ EthChainInfo,
9
+ IcaAccount,
10
+ ICQConnection,
11
+ LiquidStakingMethods,
12
+ StakingAccountActions,
13
+ StakingAccountQueries,
14
+ } from './types.js';
15
+
16
+ // TODO generate this automatically with a build script drawing on data sources such as https://github.com/cosmos/chain-registry
17
+
18
+ // XXX methods ad-hoc and not fully accurate
19
+ export type KnownChains = {
20
+ stride: {
21
+ info: CosmosChainInfo;
22
+ methods: IcaAccount &
23
+ ICQConnection &
24
+ StakingAccountActions &
25
+ StakingAccountQueries &
26
+ LiquidStakingMethods;
27
+ };
28
+ cosmos: {
29
+ info: CosmosChainInfo;
30
+ methods: IcaAccount &
31
+ ICQConnection &
32
+ StakingAccountActions &
33
+ StakingAccountQueries;
34
+ };
35
+ agoric: {
36
+ info: CosmosChainInfo;
37
+ methods: {
38
+ // TODO reference type from #8624 `packages/vats/src/localchain.js`
39
+ /**
40
+ * Register a hook to intercept an incoming IBC Transfer and handle it.
41
+ * Calling without arguments will unregister the hook.
42
+ */
43
+ interceptTransfer: (tap?: {
44
+ upcall: (args: any) => Promise<any>;
45
+ }) => Promise<void>;
46
+ };
47
+ };
48
+ celestia: {
49
+ info: CosmosChainInfo;
50
+ methods: IcaAccount &
51
+ ICQConnection &
52
+ StakingAccountActions &
53
+ StakingAccountQueries;
54
+ };
55
+ osmosis: {
56
+ info: CosmosChainInfo;
57
+ methods: IcaAccount &
58
+ ICQConnection &
59
+ StakingAccountActions &
60
+ StakingAccountQueries;
61
+ };
62
+ };
63
+
64
+ export type ChainInfo = CosmosChainInfo | EthChainInfo;
@@ -0,0 +1,159 @@
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 type { Brand, Payment, Purse } from '@agoric/ertp/exported.js';
5
+ import type { Port } from '@agoric/network';
6
+ import type { LocalIbcAddress, RemoteIbcAddress } from '@agoric/vats/tools/ibc-utils.js';
7
+ import type { AmountArg, ChainAddress, DenomAmount } from './types.js';
8
+ /** A helper type for type extensions. */
9
+ export type TypeUrl = string;
10
+ export type Proto3JSONMsg = {
11
+ '@type': TypeUrl;
12
+ value: Record<string, unknown>;
13
+ };
14
+ /** An address for a validator on some blockchain, e.g., cosmos, eth, etc. */
15
+ export type CosmosValidatorAddress = ChainAddress & {
16
+ address: `${string}valoper${string}`;
17
+ addressEncoding: 'bech32';
18
+ };
19
+ /**
20
+ * Info for a Cosmos-based chain.
21
+ */
22
+ export type CosmosChainInfo = {
23
+ chainId: string;
24
+ ibcConnectionInfo: {
25
+ id: string;
26
+ client_id: string;
27
+ state: 'OPEN' | 'TRYOPEN' | 'INIT' | 'CLOSED';
28
+ counterparty: {
29
+ client_id: string;
30
+ connection_id: string;
31
+ prefix: {
32
+ key_prefix: string;
33
+ };
34
+ };
35
+ versions: {
36
+ identifier: string;
37
+ features: string[];
38
+ }[];
39
+ delay_period: bigint;
40
+ };
41
+ icaEnabled: boolean;
42
+ icqEnabled: boolean;
43
+ pfmEnabled: boolean;
44
+ ibcHooksEnabled: boolean;
45
+ /**
46
+ *
47
+ */
48
+ allowedMessages: TypeUrl[];
49
+ allowedQueries: TypeUrl[];
50
+ };
51
+ export interface StakingAccountQueries {
52
+ /**
53
+ * @returns all active delegations from the account to any validator (or [] if none)
54
+ */
55
+ getDelegations: () => Promise<Delegation[]>;
56
+ /**
57
+ * @returns the active delegation from the account to a specific validator. Return an
58
+ * empty Delegation if there is no delegation.
59
+ */
60
+ getDelegation: (validator: CosmosValidatorAddress) => Promise<Delegation>;
61
+ /**
62
+ * @returns the unbonding delegations from the account to any validator (or [] if none)
63
+ */
64
+ getUnbondingDelegations: () => Promise<UnbondingDelegation[]>;
65
+ /**
66
+ * @returns the unbonding delegations from the account to a specific validator (or [] if none)
67
+ */
68
+ getUnbondingDelegation: (validator: CosmosValidatorAddress) => Promise<UnbondingDelegation>;
69
+ getRedelegations: () => Promise<Redelegation[]>;
70
+ getRedelegation: (srcValidator: CosmosValidatorAddress, dstValidator?: CosmosValidatorAddress) => Promise<Redelegation>;
71
+ /**
72
+ * Get the pending rewards for the account.
73
+ * @returns the amounts of the account's rewards pending from all validators
74
+ */
75
+ getRewards: () => Promise<DenomAmount[]>;
76
+ /**
77
+ * Get the rewards pending with a specific validator.
78
+ * @param validator - the validator address to query for
79
+ * @returns the amount of the account's rewards pending from a specific validator
80
+ */
81
+ getReward: (validator: CosmosValidatorAddress) => Promise<DenomAmount[]>;
82
+ }
83
+ export interface StakingAccountActions {
84
+ /**
85
+ * Delegate an amount to a validator. The promise settles when the delegation is complete.
86
+ * @param validator - the validator to delegate to
87
+ * @param amount - the amount to delegate
88
+ * @returns void
89
+ */
90
+ delegate: (validator: CosmosValidatorAddress, amount: AmountArg) => Promise<void>;
91
+ /**
92
+ * Redelegate from one delegator to another.
93
+ * Settles when the redelegation is established, not 21 days later.
94
+ * @param srcValidator - the current validator for the delegation.
95
+ * @param dstValidator - the validator that will receive the delegation.
96
+ * @param amount - how much to redelegate.
97
+ * @returns
98
+ */
99
+ redelegate: (srcValidator: CosmosValidatorAddress, dstValidator: CosmosValidatorAddress, amount: AmountArg) => Promise<void>;
100
+ /**
101
+ * Undelegate multiple delegations (concurrently). To delegate independently, pass an array with one item.
102
+ * Resolves when the undelegation is complete and the tokens are no longer bonded. Note it may take weeks.
103
+ * The unbonding time is padded by 10 minutes to account for clock skew.
104
+ * @param {Delegation[]} delegations - the delegation to undelegate
105
+ */
106
+ undelegate: (delegations: Delegation[]) => Promise<void>;
107
+ /**
108
+ * Withdraw rewards from all validators. The promise settles when the rewards are withdrawn.
109
+ * @returns The total amounts of rewards withdrawn
110
+ */
111
+ withdrawRewards: () => Promise<DenomAmount[]>;
112
+ /**
113
+ * Withdraw rewards from a specific validator. The promise settles when the rewards are withdrawn.
114
+ * @param validator - the validator to withdraw rewards from
115
+ * @returns
116
+ */
117
+ withdrawReward: (validator: CosmosValidatorAddress) => Promise<DenomAmount[]>;
118
+ }
119
+ /**
120
+ * Low level object that supports queries and operations for an account on a remote chain.
121
+ */
122
+ export interface IcaAccount {
123
+ /**
124
+ * @returns the address of the account on the remote chain
125
+ */
126
+ getAddress: () => ChainAddress;
127
+ /**
128
+ * Submit a transaction on behalf of the remote account for execution on the remote chain.
129
+ * @param msgs - records for the transaction
130
+ * @returns acknowledgement string
131
+ */
132
+ executeTx: (msgs: Proto3JSONMsg[]) => Promise<string>;
133
+ /**
134
+ * Submit a transaction on behalf of the remote account for execution on the remote chain.
135
+ * @param {AnyJson[]} msgs - records for the transaction
136
+ * @param {Partial<Omit<TxBody, 'messages'>>} [opts] - optional parameters for the Tx, like `timeoutHeight` and `memo`
137
+ * @returns acknowledgement string
138
+ */
139
+ executeEncodedTx: (msgs: AnyJson[], opts?: Partial<Omit<TxBody, 'messages'>>) => Promise<string>;
140
+ /** deposit payment from zoe to the account*/
141
+ deposit: (payment: Payment) => Promise<void>;
142
+ /** get Purse for a brand to .withdraw() a Payment from the account */
143
+ getPurse: (brand: Brand) => Promise<Purse>;
144
+ /**
145
+ * Close the remote account
146
+ */
147
+ close: () => Promise<void>;
148
+ prepareTransfer: () => Promise<Invitation>;
149
+ /** @returns the address of the remote channel */
150
+ getRemoteAddress: () => RemoteIbcAddress;
151
+ /** @returns the address of the local channel */
152
+ getLocalAddress: () => LocalIbcAddress;
153
+ /** @returns the port the ICA channel is bound to */
154
+ getPort: () => Port;
155
+ }
156
+ export type LiquidStakingMethods = {
157
+ liquidStake: (amount: AmountArg) => Promise<void>;
158
+ };
159
+ //# 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,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAC;AACtE,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,KAAK,EACV,eAAe,EACf,gBAAgB,EACjB,MAAM,iCAAiC,CAAC;AACzC,OAAO,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAEvE,yCAAyC;AACzC,MAAM,MAAM,OAAO,GAAG,MAAM,CAAC;AAG7B,MAAM,MAAM,aAAa,GAAG;IAC1B,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAChC,CAAC;AAEF,6EAA6E;AAC7E,MAAM,MAAM,sBAAsB,GAAG,YAAY,GAAG;IAElD,OAAO,EAAE,GAAG,MAAM,UAAU,MAAM,EAAE,CAAC;IACrC,eAAe,EAAE,QAAQ,CAAC;CAC3B,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,iBAAiB,EAAE;QACjB,EAAE,EAAE,MAAM,CAAC;QACX,SAAS,EAAE,MAAM,CAAC;QAClB,K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,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAE3B,eAAe,EAAE,MAAM,OAAO,CAAC,UAAU,CAAC,CAAC;IAC3C,iDAAiD;IACjD,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;IACzC,gDAAgD;IAChD,eAAe,EAAE,MAAM,eAAe,CAAC;IACvC,oDAAoD;IACpD,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AAED,MAAM,MAAM,oBAAoB,GAAG;IACjC,WAAW,EAAE,CAAC,MAAM,EAAE,SAAS,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CACnD,CAAC"}
@@ -0,0 +1,199 @@
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 type { Brand, Payment, Purse } from '@agoric/ertp/exported.js';
9
+ import type { Port } from '@agoric/network';
10
+ import type {
11
+ LocalIbcAddress,
12
+ RemoteIbcAddress,
13
+ } from '@agoric/vats/tools/ibc-utils.js';
14
+ import type { AmountArg, ChainAddress, DenomAmount } from './types.js';
15
+
16
+ /** A helper type for type extensions. */
17
+ export type TypeUrl = string;
18
+
19
+ // TODO move into cosmic-proto
20
+ export type Proto3JSONMsg = {
21
+ '@type': TypeUrl;
22
+ value: Record<string, unknown>;
23
+ };
24
+
25
+ /** An address for a validator on some blockchain, e.g., cosmos, eth, etc. */
26
+ export type CosmosValidatorAddress = ChainAddress & {
27
+ // TODO document why this is the format
28
+ address: `${string}valoper${string}`;
29
+ addressEncoding: 'bech32';
30
+ };
31
+
32
+ /**
33
+ * Info for a Cosmos-based chain.
34
+ */
35
+ export type CosmosChainInfo = {
36
+ chainId: string;
37
+ ibcConnectionInfo: {
38
+ id: string; // e.g. connection-0
39
+ client_id: string; // '07-tendermint-0'
40
+ state: 'OPEN' | 'TRYOPEN' | 'INIT' | 'CLOSED';
41
+ counterparty: {
42
+ client_id: string;
43
+ connection_id: string;
44
+ prefix: {
45
+ key_prefix: string;
46
+ };
47
+ };
48
+ versions: { identifier: string; features: string[] }[];
49
+ delay_period: bigint;
50
+ };
51
+ icaEnabled: boolean;
52
+ icqEnabled: boolean;
53
+ pfmEnabled: boolean;
54
+ ibcHooksEnabled: boolean;
55
+ /**
56
+ *
57
+ */
58
+ allowedMessages: TypeUrl[];
59
+ allowedQueries: TypeUrl[];
60
+ };
61
+
62
+ export interface StakingAccountQueries {
63
+ /**
64
+ * @returns all active delegations from the account to any validator (or [] if none)
65
+ */
66
+ getDelegations: () => Promise<Delegation[]>;
67
+
68
+ /**
69
+ * @returns the active delegation from the account to a specific validator. Return an
70
+ * empty Delegation if there is no delegation.
71
+ */
72
+ getDelegation: (validator: CosmosValidatorAddress) => Promise<Delegation>;
73
+
74
+ /**
75
+ * @returns the unbonding delegations from the account to any validator (or [] if none)
76
+ */
77
+ getUnbondingDelegations: () => Promise<UnbondingDelegation[]>;
78
+
79
+ /**
80
+ * @returns the unbonding delegations from the account to a specific validator (or [] if none)
81
+ */
82
+ getUnbondingDelegation: (
83
+ validator: CosmosValidatorAddress,
84
+ ) => Promise<UnbondingDelegation>;
85
+
86
+ getRedelegations: () => Promise<Redelegation[]>;
87
+
88
+ getRedelegation: (
89
+ srcValidator: CosmosValidatorAddress,
90
+ dstValidator?: CosmosValidatorAddress,
91
+ ) => Promise<Redelegation>;
92
+
93
+ /**
94
+ * Get the pending rewards for the account.
95
+ * @returns the amounts of the account's rewards pending from all validators
96
+ */
97
+ getRewards: () => Promise<DenomAmount[]>;
98
+
99
+ /**
100
+ * Get the rewards pending with a specific validator.
101
+ * @param validator - the validator address to query for
102
+ * @returns the amount of the account's rewards pending from a specific validator
103
+ */
104
+ getReward: (validator: CosmosValidatorAddress) => Promise<DenomAmount[]>;
105
+ }
106
+ export interface StakingAccountActions {
107
+ /**
108
+ * Delegate an amount to a validator. The promise settles when the delegation is complete.
109
+ * @param validator - the validator to delegate to
110
+ * @param amount - the amount to delegate
111
+ * @returns void
112
+ */
113
+ delegate: (
114
+ validator: CosmosValidatorAddress,
115
+ amount: AmountArg,
116
+ ) => Promise<void>;
117
+
118
+ /**
119
+ * Redelegate from one delegator to another.
120
+ * Settles when the redelegation is established, not 21 days later.
121
+ * @param srcValidator - the current validator for the delegation.
122
+ * @param dstValidator - the validator that will receive the delegation.
123
+ * @param amount - how much to redelegate.
124
+ * @returns
125
+ */
126
+ redelegate: (
127
+ srcValidator: CosmosValidatorAddress,
128
+ dstValidator: CosmosValidatorAddress,
129
+ amount: AmountArg,
130
+ ) => Promise<void>;
131
+
132
+ /**
133
+ * Undelegate multiple delegations (concurrently). To delegate independently, pass an array with one item.
134
+ * Resolves when the undelegation is complete and the tokens are no longer bonded. Note it may take weeks.
135
+ * The unbonding time is padded by 10 minutes to account for clock skew.
136
+ * @param {Delegation[]} delegations - the delegation to undelegate
137
+ */
138
+ undelegate: (delegations: Delegation[]) => Promise<void>;
139
+
140
+ /**
141
+ * Withdraw rewards from all validators. The promise settles when the rewards are withdrawn.
142
+ * @returns The total amounts of rewards withdrawn
143
+ */
144
+ withdrawRewards: () => Promise<DenomAmount[]>;
145
+
146
+ /**
147
+ * Withdraw rewards from a specific validator. The promise settles when the rewards are withdrawn.
148
+ * @param validator - the validator to withdraw rewards from
149
+ * @returns
150
+ */
151
+ withdrawReward: (validator: CosmosValidatorAddress) => Promise<DenomAmount[]>;
152
+ }
153
+
154
+ /**
155
+ * Low level object that supports queries and operations for an account on a remote chain.
156
+ */
157
+ export interface IcaAccount {
158
+ /**
159
+ * @returns the address of the account on the remote chain
160
+ */
161
+ getAddress: () => ChainAddress;
162
+
163
+ /**
164
+ * Submit a transaction on behalf of the remote account for execution on the remote chain.
165
+ * @param msgs - records for the transaction
166
+ * @returns acknowledgement string
167
+ */
168
+ executeTx: (msgs: Proto3JSONMsg[]) => Promise<string>;
169
+ /**
170
+ * Submit a transaction on behalf of the remote account for execution on the remote chain.
171
+ * @param {AnyJson[]} msgs - records for the transaction
172
+ * @param {Partial<Omit<TxBody, 'messages'>>} [opts] - optional parameters for the Tx, like `timeoutHeight` and `memo`
173
+ * @returns acknowledgement string
174
+ */
175
+ executeEncodedTx: (
176
+ msgs: AnyJson[],
177
+ opts?: Partial<Omit<TxBody, 'messages'>>,
178
+ ) => Promise<string>;
179
+ /** deposit payment from zoe to the account*/
180
+ deposit: (payment: Payment) => Promise<void>;
181
+ /** get Purse for a brand to .withdraw() a Payment from the account */
182
+ getPurse: (brand: Brand) => Promise<Purse>;
183
+ /**
184
+ * Close the remote account
185
+ */
186
+ close: () => Promise<void>;
187
+ /* transfer account to new holder */
188
+ prepareTransfer: () => Promise<Invitation>;
189
+ /** @returns the address of the remote channel */
190
+ getRemoteAddress: () => RemoteIbcAddress;
191
+ /** @returns the address of the local channel */
192
+ getLocalAddress: () => LocalIbcAddress;
193
+ /** @returns the port the ICA channel is bound to */
194
+ getPort: () => Port;
195
+ }
196
+
197
+ export type LiquidStakingMethods = {
198
+ liquidStake: (amount: AmountArg) => Promise<void>;
199
+ };
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Info for an Ethereum-based chain.
3
+ */
4
+ export type EthChainInfo = {
5
+ chainId: string;
6
+ allegedName: string;
7
+ };
8
+ //# sourceMappingURL=ethereum-api.d.ts.map
@@ -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;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Info for an Ethereum-based chain.
3
+ */
4
+ export type EthChainInfo = {
5
+ chainId: string;
6
+ allegedName: string;
7
+ };
@@ -0,0 +1,84 @@
1
+ export namespace meta {
2
+ namespace privateArgsShape {
3
+ export let orchestration: import("@endo/patterns").Matcher;
4
+ export { StorageNodeShape as storageNode };
5
+ export let marshaller: import("@endo/patterns").Matcher;
6
+ export let timer: import("@endo/patterns").Matcher;
7
+ }
8
+ }
9
+ export namespace privateArgsShape { }
10
+ export function start(zcf: ZCF<StakeAtomTerms>, privateArgs: {
11
+ orchestration: import("@endo/exo").Guarded<{
12
+ makeAccount(hostConnectionId: `connection-${number}`, controllerConnectionId: `connection-${number}`): Promise<import("../cosmos-api.js").IcaAccount>;
13
+ provideICQConnection(controllerConnectionId: `connection-${number}`): Promise<import("@endo/exo").Guarded<{
14
+ getLocalAddress(): `/ibc-port/${string}`;
15
+ getRemoteAddress(): `/${string}ibc-port/${string}/ordered/${string}` | `/${string}ibc-port/${string}/unordered/${string}`;
16
+ query(msgs: import("@agoric/cosmic-proto").JsonSafe<import("@agoric/cosmic-proto/tendermint/abci/types.js").RequestQuery>[]): Promise<import("@agoric/cosmic-proto").Base64Any<import("@agoric/cosmic-proto/tendermint/abci/types.js").ResponseQuery>[]>;
17
+ }>>;
18
+ }>;
19
+ storageNode: StorageNode;
20
+ marshaller: Marshaller;
21
+ timer: TimerService;
22
+ }, baggage: Baggage): Promise<{
23
+ publicFacet: import("@endo/exo").Guarded<{
24
+ makeAccount(): Promise<import("@endo/exo").Guarded<{
25
+ getPublicTopics(): {
26
+ account: {
27
+ description: string;
28
+ subscriber: globalThis.Subscriber<import("../exos/stakingAccountKit.js").StakingAccountNotification>;
29
+ storagePath: Promise<string>;
30
+ };
31
+ };
32
+ getAddress(): import("../orchestration-api.js").ChainAddress;
33
+ delegate(validator: import("../cosmos-api.js").CosmosValidatorAddress, amount: import("../orchestration-api.js").AmountArg): Promise<void>;
34
+ redelegate(srcValidator: import("../cosmos-api.js").CosmosValidatorAddress, dstValidator: import("../cosmos-api.js").CosmosValidatorAddress, amount: import("../orchestration-api.js").AmountArg): Promise<void>;
35
+ withdrawReward(validator: import("../cosmos-api.js").CosmosValidatorAddress): Promise<import("../orchestration-api.js").DenomAmount[]>;
36
+ getBalance(denom?: string | undefined): Promise<import("../orchestration-api.js").DenomAmount>;
37
+ withdrawRewards(): never;
38
+ undelegate(delegations: import("@agoric/cosmic-proto/cosmos/staking/v1beta1/staking.js").Delegation[]): Promise<void>;
39
+ }>>;
40
+ makeAcountInvitationMaker(): Promise<Invitation<{
41
+ publicSubscribers: {
42
+ account: {
43
+ description: string;
44
+ subscriber: globalThis.Subscriber<import("../exos/stakingAccountKit.js").StakingAccountNotification>;
45
+ storagePath: Promise<string>;
46
+ };
47
+ };
48
+ invitationMakers: import("@endo/exo").Guarded<{
49
+ Delegate(validator: import("../cosmos-api.js").CosmosValidatorAddress, amount: Amount<"nat">): Promise<Invitation<void, undefined>>;
50
+ Redelegate(srcValidator: import("../cosmos-api.js").CosmosValidatorAddress, dstValidator: import("../cosmos-api.js").CosmosValidatorAddress, amount: import("../orchestration-api.js").AmountArg): Promise<Invitation<void, undefined>>;
51
+ WithdrawReward(validator: import("../cosmos-api.js").CosmosValidatorAddress): Promise<Invitation<import("../orchestration-api.js").DenomAmount[], undefined>>;
52
+ Undelegate(delegations: import("@agoric/cosmic-proto/cosmos/staking/v1beta1/staking.js").Delegation[]): Promise<Invitation<void, undefined>>;
53
+ CloseAccount(): never;
54
+ TransferAccount(): never;
55
+ }>;
56
+ account: import("@endo/exo").Guarded<{
57
+ getPublicTopics(): {
58
+ account: {
59
+ description: string;
60
+ subscriber: globalThis.Subscriber<import("../exos/stakingAccountKit.js").StakingAccountNotification>;
61
+ storagePath: Promise<string>;
62
+ };
63
+ };
64
+ getAddress(): import("../orchestration-api.js").ChainAddress;
65
+ delegate(validator: import("../cosmos-api.js").CosmosValidatorAddress, amount: import("../orchestration-api.js").AmountArg): Promise<void>;
66
+ redelegate(srcValidator: import("../cosmos-api.js").CosmosValidatorAddress, dstValidator: import("../cosmos-api.js").CosmosValidatorAddress, amount: import("../orchestration-api.js").AmountArg): Promise<void>;
67
+ withdrawReward(validator: import("../cosmos-api.js").CosmosValidatorAddress): Promise<import("../orchestration-api.js").DenomAmount[]>;
68
+ getBalance(denom?: string | undefined): Promise<import("../orchestration-api.js").DenomAmount>;
69
+ withdrawRewards(): never;
70
+ undelegate(delegations: import("@agoric/cosmic-proto/cosmos/staking/v1beta1/staking.js").Delegation[]): Promise<void>;
71
+ }>;
72
+ }, undefined>>;
73
+ }>;
74
+ }>;
75
+ export type StakeAtomTerms = {
76
+ hostConnectionId: `connection-${number}`;
77
+ controllerConnectionId: `connection-${number}`;
78
+ bondDenom: string;
79
+ };
80
+ export type StakeAtomSF = typeof start;
81
+ import { StorageNodeShape } from '@agoric/internal';
82
+ import type { TimerService } from '@agoric/time';
83
+ import type { Baggage } from '@agoric/vat-data';
84
+ //# sourceMappingURL=stakeAtom.contract.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stakeAtom.contract.d.ts","sourceRoot":"","sources":["stakeAtom.contract.js"],"names":[],"mappings":";;;;;;;;;AA+CO,2BATI,GAAG,CAAC,cAAc,CAAC;;;;;;;;;iBAGb,WAAW;gBACZ,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;+FAgFooH,OAAO,KAAK,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;GAH1qH;;;;eAvFc,MAAM;;0BAyFP,OAAO,KAAK;iCAtHmB,kBAAkB;kCAW9B,cAAc;6BAFnB,kBAAkB"}
@@ -1,4 +1,3 @@
1
- // @ts-check
2
1
  /**
3
2
  * @file Example contract that uses orchestration
4
3
  */