@agoric/orchestration 0.1.1-dev-989aa19.0 → 0.1.1-dev-9274bc7.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 +18 -16
- package/src/chain-info.js +1 -1
- package/src/examples/stakeBld.contract.d.ts +10 -20
- package/src/examples/stakeBld.contract.d.ts.map +1 -1
- package/src/examples/stakeBld.contract.js +4 -2
- package/src/examples/stakeIca.contract.d.ts +9 -9
- package/src/examples/stakeIca.contract.d.ts.map +1 -1
- package/src/examples/stakeIca.contract.js +4 -1
- package/src/exos/chain-account-kit.d.ts +10 -1
- package/src/exos/chain-account-kit.d.ts.map +1 -1
- package/src/exos/chain-account-kit.js +35 -13
- package/src/exos/chain-hub.d.ts +2392 -0
- package/src/{utils/chainHub.d.ts.map → exos/chain-hub.d.ts.map} +1 -1
- package/src/{utils/chainHub.js → exos/chain-hub.js} +69 -9
- package/src/exos/cosmos-orchestration-account.d.ts +50 -15
- package/src/exos/cosmos-orchestration-account.d.ts.map +1 -1
- package/src/exos/cosmos-orchestration-account.js +113 -57
- package/src/exos/icq-connection-kit.d.ts +10 -1
- package/src/exos/icq-connection-kit.d.ts.map +1 -1
- package/src/exos/icq-connection-kit.js +27 -11
- package/src/exos/local-chain-facade.d.ts +46 -9
- package/src/exos/local-chain-facade.d.ts.map +1 -1
- package/src/exos/local-chain-facade.js +1 -1
- package/src/exos/local-orchestration-account.d.ts +115 -2343
- package/src/exos/local-orchestration-account.d.ts.map +1 -1
- package/src/exos/local-orchestration-account.js +185 -56
- package/src/exos/orchestrator.d.ts +9 -2313
- package/src/exos/orchestrator.d.ts.map +1 -1
- package/src/exos/orchestrator.js +1 -1
- package/src/exos/remote-chain-facade.d.ts +6 -6
- package/src/facade.d.ts +48 -11
- package/src/facade.d.ts.map +1 -1
- package/src/facade.js +2 -2
- package/src/proposals/orchestration-proposal.d.ts +36 -6
- package/src/proposals/orchestration-proposal.js +1 -1
- package/src/proposals/start-stakeAtom.d.ts +9 -9
- package/src/proposals/start-stakeAtom.d.ts.map +1 -1
- package/src/proposals/start-stakeAtom.js +5 -6
- package/src/proposals/start-stakeBld.d.ts +10 -20
- package/src/proposals/start-stakeBld.d.ts.map +1 -1
- package/src/proposals/start-stakeOsmo.d.ts +9 -9
- package/src/proposals/start-stakeOsmo.d.ts.map +1 -1
- package/src/proposals/start-stakeOsmo.js +5 -6
- package/src/service.d.ts +92 -9
- package/src/service.d.ts.map +1 -1
- package/src/service.js +143 -66
- package/src/utils/start-helper.d.ts +8 -2320
- package/src/utils/start-helper.d.ts.map +1 -1
- package/src/utils/start-helper.js +5 -2
- package/src/utils/time.d.ts +2 -0
- package/src/utils/time.d.ts.map +1 -1
- package/src/utils/time.js +2 -0
- package/src/vat-orchestration.d.ts +36 -6
- package/src/vat-orchestration.d.ts.map +1 -1
- package/src/vat-orchestration.js +3 -0
- package/src/utils/chainHub.d.ts +0 -2404
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"
|
|
1
|
+
{"version":3,"file":"chain-hub.d.ts","sourceRoot":"","sources":["chain-hub.js"],"names":[],"mappings":"AAOA;;;;;;GAMG;AAEH;;;;;GAKG;AAEH,wCAAwC;AACxC,gCAAiC;AACjC,kCAAkC;AAClC,gDAAiD;AAqB1C,wCAHI,MAAM,YACN,MAAM,UAUhB;AAqCM;IAaH;;;;;;;;;;;OAWG;wBAFQ,MAAM;;;;;;;;IAMjB;;;;OAIG;iBADkC,CAAC,4BAAD,CAAC,AAD1B,GACC,OAAO,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC;IAiBxC;;;;OAIG;iCAHQ,MAAM,YACN,MAAM;IAQjB;;;;OAIG;8BAHQ,MAAM,GAAG;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE,UAC5B,MAAM,GAAG;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE;GAsB1C;AASM,gDALI,IAAI,CAAC,OAAO,cAAc,EAAE,UAAU,CAAC,WAAW,CAAC,CAAC,QACpD,MAAM;;;;;;;UAEN,CAAC,GAAG,QAAQ,EAAE,MAAM,EAAE,KAAK,IAAI,iBAgCzC;AAYM,uCAHe,EAAE,iBAAmB,EAAE,2BAJlC,QAAQ,cAIG,EAAE,AAHX,cAG8B,EAAE,AAFhC,0EAiBZ;4BA1NuB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oBA+EvB,kDAAkD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wDA+EpD;;;;;mBAKG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;uBAPW,UAAU,CAAC,OAAO,YAAY,CAAC;6BAtKnB,cAAc;4BAGf,kBAAkB;0BACpB,cAAc;uCAHgB,kBAAkB;+BAC9B,kBAAkB"}
|
|
@@ -13,6 +13,13 @@ const { Fail } = assert;
|
|
|
13
13
|
* @import {Zone} from '@agoric/zone';
|
|
14
14
|
*/
|
|
15
15
|
|
|
16
|
+
/**
|
|
17
|
+
* @template {string} K
|
|
18
|
+
* @typedef {K extends keyof KnownChains
|
|
19
|
+
* ? Omit<KnownChains[K], 'connections'>
|
|
20
|
+
* : ChainInfo} ActualChainInfo
|
|
21
|
+
*/
|
|
22
|
+
|
|
16
23
|
/** agoricNames key for ChainInfo hub */
|
|
17
24
|
export const CHAIN_KEY = 'chain';
|
|
18
25
|
/** namehub for connection info */
|
|
@@ -47,7 +54,38 @@ export const connectionKey = (chainId1, chainId2) => {
|
|
|
47
54
|
return [chainId1, chainId2].sort().join(CHAIN_ID_SEPARATOR);
|
|
48
55
|
};
|
|
49
56
|
|
|
57
|
+
const ChainIdArgShape = M.or(
|
|
58
|
+
M.string(),
|
|
59
|
+
M.splitRecord(
|
|
60
|
+
{
|
|
61
|
+
chainId: M.string(),
|
|
62
|
+
},
|
|
63
|
+
undefined,
|
|
64
|
+
M.any(),
|
|
65
|
+
),
|
|
66
|
+
);
|
|
67
|
+
|
|
68
|
+
const ChainHubI = M.interface('ChainHub', {
|
|
69
|
+
registerChain: M.call(M.string(), CosmosChainInfoShape).returns(),
|
|
70
|
+
getChainInfo: M.callWhen(M.string()).returns(CosmosChainInfoShape),
|
|
71
|
+
registerConnection: M.callWhen(
|
|
72
|
+
M.string(),
|
|
73
|
+
M.string(),
|
|
74
|
+
IBCConnectionInfoShape,
|
|
75
|
+
).returns(),
|
|
76
|
+
getConnectionInfo: M.callWhen(ChainIdArgShape, ChainIdArgShape).returns(
|
|
77
|
+
IBCConnectionInfoShape,
|
|
78
|
+
),
|
|
79
|
+
});
|
|
80
|
+
|
|
50
81
|
/**
|
|
82
|
+
* Make a new ChainHub in the zone (or in the heap if no zone is provided).
|
|
83
|
+
*
|
|
84
|
+
* The resulting object is an Exo singleton. It has no precious state. It's only
|
|
85
|
+
* state is a cache of queries to agoricNames and whatever info was provided in
|
|
86
|
+
* registration calls. When you need a newer version you can simply make a hub
|
|
87
|
+
* hub and repeat the registrations.
|
|
88
|
+
*
|
|
51
89
|
* @param {Remote<NameHub>} agoricNames
|
|
52
90
|
* @param {Zone} [zone]
|
|
53
91
|
*/
|
|
@@ -63,7 +101,7 @@ export const makeChainHub = (agoricNames, zone = makeHeapZone()) => {
|
|
|
63
101
|
valueShape: IBCConnectionInfoShape,
|
|
64
102
|
});
|
|
65
103
|
|
|
66
|
-
const chainHub =
|
|
104
|
+
const chainHub = zone.exo('ChainHub', ChainHubI, {
|
|
67
105
|
/**
|
|
68
106
|
* Register a new chain. The name will override a name in well known chain
|
|
69
107
|
* names.
|
|
@@ -82,11 +120,7 @@ export const makeChainHub = (agoricNames, zone = makeHeapZone()) => {
|
|
|
82
120
|
/**
|
|
83
121
|
* @template {string} K
|
|
84
122
|
* @param {K} chainName
|
|
85
|
-
* @returns {Promise<
|
|
86
|
-
* K extends keyof KnownChains
|
|
87
|
-
* ? Omit<KnownChains[K], 'connections'>
|
|
88
|
-
* : ChainInfo
|
|
89
|
-
* >}
|
|
123
|
+
* @returns {Promise<ActualChainInfo<K>>}
|
|
90
124
|
*/
|
|
91
125
|
async getChainInfo(chainName) {
|
|
92
126
|
// Either from registerChain or memoized remote lookup()
|
|
@@ -114,11 +148,13 @@ export const makeChainHub = (agoricNames, zone = makeHeapZone()) => {
|
|
|
114
148
|
},
|
|
115
149
|
|
|
116
150
|
/**
|
|
117
|
-
* @param {string}
|
|
118
|
-
* @param {string}
|
|
151
|
+
* @param {string | { chainId: string }} chain1
|
|
152
|
+
* @param {string | { chainId: string }} chain2
|
|
119
153
|
* @returns {Promise<IBCConnectionInfo>}
|
|
120
154
|
*/
|
|
121
|
-
async getConnectionInfo(
|
|
155
|
+
async getConnectionInfo(chain1, chain2) {
|
|
156
|
+
const chainId1 = typeof chain1 === 'string' ? chain1 : chain1.chainId;
|
|
157
|
+
const chainId2 = typeof chain2 === 'string' ? chain2 : chain2.chainId;
|
|
122
158
|
const key = connectionKey(chainId1, chainId2);
|
|
123
159
|
if (connectionInfos.has(key)) {
|
|
124
160
|
return connectionInfos.get(key);
|
|
@@ -175,3 +211,27 @@ export const registerChain = async (
|
|
|
175
211
|
// Bundle to pipeline IO
|
|
176
212
|
await Promise.all(promises);
|
|
177
213
|
};
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* @template {string} C1
|
|
217
|
+
* @template {string} C2
|
|
218
|
+
* @param {ChainHub} chainHub
|
|
219
|
+
* @param {C1} chainName1
|
|
220
|
+
* @param {C2} chainName2
|
|
221
|
+
* @returns {Promise<
|
|
222
|
+
* [ActualChainInfo<C1>, ActualChainInfo<C2>, IBCConnectionInfo]
|
|
223
|
+
* >}
|
|
224
|
+
*/
|
|
225
|
+
export const getChainsAndConnection = async (
|
|
226
|
+
chainHub,
|
|
227
|
+
chainName1,
|
|
228
|
+
chainName2,
|
|
229
|
+
) => {
|
|
230
|
+
const [chain1, chain2] = await Promise.all([
|
|
231
|
+
chainHub.getChainInfo(chainName1),
|
|
232
|
+
chainHub.getChainInfo(chainName2),
|
|
233
|
+
]);
|
|
234
|
+
const connectionInfo = await chainHub.getConnectionInfo(chain2, chain1);
|
|
235
|
+
|
|
236
|
+
return [chain1, chain2, connectionInfo];
|
|
237
|
+
};
|
|
@@ -29,14 +29,18 @@ export const IcaAccountHolderI: import("@endo/patterns").InterfaceGuard<{
|
|
|
29
29
|
transferSteps: import("@endo/patterns").MethodGuard;
|
|
30
30
|
deposit: import("@endo/patterns").MethodGuard;
|
|
31
31
|
}>;
|
|
32
|
-
export
|
|
33
|
-
|
|
32
|
+
export function prepareCosmosOrchestrationAccountKit(zone: Zone, makeRecorderKit: <T>(storageNode: StorageNode | Awaited<import("@endo/far").FarRef<StorageNode>>, valueShape?: import("@agoric/zoe/src/contractSupport/recorder.js").TypedMatcher<T> | undefined) => RecorderKit<T>, { when, watch }: {
|
|
33
|
+
when: <T_1, TResult1 = import("@agoric/vow").EUnwrap<T_1>, TResult2 = never>(specimenP: T_1, onFulfilled?: ((value: import("@agoric/vow").EUnwrap<T_1>) => TResult1 | PromiseLike<TResult1>) | undefined, onRejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | undefined) => Promise<TResult1 | TResult2>;
|
|
34
|
+
watch: <T_2 = any, TResult1_1 = T_2, TResult2_1 = never, C = any>(specimenP: import("@agoric/vow").ERef<T_2 | import("@agoric/vow").Vow<T_2>>, watcher?: import("@agoric/vow").Watcher<T_2, TResult1_1, TResult2_1> | undefined, watcherContext?: C | undefined) => import("@agoric/vow").Vow<Exclude<TResult1_1, void> | Exclude<TResult2_1, void> extends never ? TResult1_1 : Exclude<TResult1_1, void> | Exclude<TResult2_1, void>>;
|
|
35
|
+
makeVowKit: <T_3>() => import("@agoric/vow").VowKit<T_3>;
|
|
36
|
+
allVows: (vows: unknown[]) => import("@agoric/vow").Vow<any[]>;
|
|
37
|
+
}, zcf: ZCF): (chainAddress: ChainAddress, bondDenom: string, io: {
|
|
34
38
|
account: IcaAccount;
|
|
35
39
|
storageNode: Remote<globalThis.StorageNode>;
|
|
36
40
|
icqConnection: import("@endo/exo").Guarded<{
|
|
37
41
|
getLocalAddress(): `/ibc-port/${string}`;
|
|
38
42
|
getRemoteAddress(): `/${string}ibc-port/${string}/ordered/${string}` | `/${string}ibc-port/${string}/unordered/${string}`;
|
|
39
|
-
query(msgs:
|
|
43
|
+
query(msgs: JsonSafe<import("@agoric/cosmic-proto/tendermint/abci/types.js").RequestQuery>[]): Promise<JsonSafe<ResponseQuery>[]>;
|
|
40
44
|
}> | undefined;
|
|
41
45
|
timer: Remote<TimerService>;
|
|
42
46
|
}) => import("@endo/exo").GuardedKit<{
|
|
@@ -50,22 +54,46 @@ export function prepareCosmosOrchestrationAccountKit(zone: Zone, makeRecorderKit
|
|
|
50
54
|
*/
|
|
51
55
|
amountToCoin(amount: AmountArg): Coin;
|
|
52
56
|
};
|
|
57
|
+
balanceQueryWatcher: {
|
|
58
|
+
/**
|
|
59
|
+
* @param {JsonSafe<ResponseQuery>[]} results
|
|
60
|
+
*/
|
|
61
|
+
onFulfilled([result]: JsonSafe<ResponseQuery>[]): DenomAmount;
|
|
62
|
+
};
|
|
63
|
+
undelegateWatcher: {
|
|
64
|
+
/**
|
|
65
|
+
* @param {string} result
|
|
66
|
+
*/
|
|
67
|
+
onFulfilled(result: string): Promise<import("@agoric/time").TimestampRecord>;
|
|
68
|
+
};
|
|
69
|
+
/**
|
|
70
|
+
* takes an array of results (from `executeEncodedTx`) and returns void
|
|
71
|
+
* since we are not interested in the result
|
|
72
|
+
*/
|
|
73
|
+
returnVoidWatcher: {
|
|
74
|
+
/** @param {string | Record<string, unknown>} result */
|
|
75
|
+
onFulfilled(result: string | Record<string, unknown>): undefined;
|
|
76
|
+
};
|
|
77
|
+
withdrawRewardWatcher: {
|
|
78
|
+
/** @param {string} result */
|
|
79
|
+
onFulfilled(result: string): DenomAmount[];
|
|
80
|
+
};
|
|
53
81
|
invitationMakers: {
|
|
54
82
|
/**
|
|
55
83
|
* @param {CosmosValidatorAddress} validator
|
|
56
84
|
* @param {AmountArg} amount
|
|
57
85
|
*/
|
|
58
|
-
Delegate(validator: CosmosValidatorAddress, amount: AmountArg): Promise<Invitation<
|
|
86
|
+
Delegate(validator: CosmosValidatorAddress, amount: AmountArg): Promise<Invitation<undefined, undefined>>;
|
|
59
87
|
/**
|
|
60
88
|
* @param {CosmosValidatorAddress} srcValidator
|
|
61
89
|
* @param {CosmosValidatorAddress} dstValidator
|
|
62
90
|
* @param {AmountArg} amount
|
|
63
91
|
*/
|
|
64
|
-
Redelegate(srcValidator: CosmosValidatorAddress, dstValidator: CosmosValidatorAddress, amount: AmountArg): Promise<Invitation<
|
|
92
|
+
Redelegate(srcValidator: CosmosValidatorAddress, dstValidator: CosmosValidatorAddress, amount: AmountArg): Promise<Invitation<undefined, undefined>>;
|
|
65
93
|
/** @param {CosmosValidatorAddress} validator */
|
|
66
94
|
WithdrawReward(validator: CosmosValidatorAddress): Promise<Invitation<DenomAmount[], undefined>>;
|
|
67
95
|
/** @param {Omit<Delegation, 'delegatorAddress'>[]} delegations */
|
|
68
|
-
Undelegate(delegations: Omit<Delegation, "delegatorAddress">[]): Promise<Invitation<
|
|
96
|
+
Undelegate(delegations: Omit<Delegation, "delegatorAddress">[]): Promise<Invitation<undefined, undefined>>;
|
|
69
97
|
CloseAccount(): never;
|
|
70
98
|
/**
|
|
71
99
|
* Starting a transfer revokes the account holder. The associated
|
|
@@ -88,17 +116,17 @@ export function prepareCosmosOrchestrationAccountKit(zone: Zone, makeRecorderKit
|
|
|
88
116
|
* @param {CosmosValidatorAddress} validator
|
|
89
117
|
* @param {AmountArg} amount
|
|
90
118
|
*/
|
|
91
|
-
Delegate(validator: CosmosValidatorAddress, amount: AmountArg): Promise<Invitation<
|
|
119
|
+
Delegate(validator: CosmosValidatorAddress, amount: AmountArg): Promise<Invitation<undefined, undefined>>;
|
|
92
120
|
/**
|
|
93
121
|
* @param {CosmosValidatorAddress} srcValidator
|
|
94
122
|
* @param {CosmosValidatorAddress} dstValidator
|
|
95
123
|
* @param {AmountArg} amount
|
|
96
124
|
*/
|
|
97
|
-
Redelegate(srcValidator: CosmosValidatorAddress, dstValidator: CosmosValidatorAddress, amount: AmountArg): Promise<Invitation<
|
|
125
|
+
Redelegate(srcValidator: CosmosValidatorAddress, dstValidator: CosmosValidatorAddress, amount: AmountArg): Promise<Invitation<undefined, undefined>>;
|
|
98
126
|
/** @param {CosmosValidatorAddress} validator */
|
|
99
127
|
WithdrawReward(validator: CosmosValidatorAddress): Promise<Invitation<DenomAmount[], undefined>>;
|
|
100
128
|
/** @param {Omit<Delegation, 'delegatorAddress'>[]} delegations */
|
|
101
|
-
Undelegate(delegations: Omit<Delegation, "delegatorAddress">[]): Promise<Invitation<
|
|
129
|
+
Undelegate(delegations: Omit<Delegation, "delegatorAddress">[]): Promise<Invitation<undefined, undefined>>;
|
|
102
130
|
CloseAccount(): never;
|
|
103
131
|
/**
|
|
104
132
|
* Starting a transfer revokes the account holder. The associated
|
|
@@ -124,7 +152,7 @@ export function prepareCosmosOrchestrationAccountKit(zone: Zone, makeRecorderKit
|
|
|
124
152
|
* @param {CosmosValidatorAddress} validator
|
|
125
153
|
* @param {AmountArg} amount
|
|
126
154
|
*/
|
|
127
|
-
delegate(validator: CosmosValidatorAddress, amount: AmountArg): Promise<
|
|
155
|
+
delegate(validator: CosmosValidatorAddress, amount: AmountArg): Promise<undefined>;
|
|
128
156
|
deposit(payment: any): Promise<void>;
|
|
129
157
|
getBalances(): Promise<never>;
|
|
130
158
|
/**
|
|
@@ -134,7 +162,7 @@ export function prepareCosmosOrchestrationAccountKit(zone: Zone, makeRecorderKit
|
|
|
134
162
|
* @param {CosmosValidatorAddress} dstValidator
|
|
135
163
|
* @param {AmountArg} amount
|
|
136
164
|
*/
|
|
137
|
-
redelegate(srcValidator: CosmosValidatorAddress, dstValidator: CosmosValidatorAddress, amount: AmountArg): Promise<
|
|
165
|
+
redelegate(srcValidator: CosmosValidatorAddress, dstValidator: CosmosValidatorAddress, amount: AmountArg): Promise<undefined>;
|
|
138
166
|
/**
|
|
139
167
|
* @param {CosmosValidatorAddress} validator
|
|
140
168
|
* @returns {Promise<DenomAmount[]>}
|
|
@@ -150,10 +178,15 @@ export function prepareCosmosOrchestrationAccountKit(zone: Zone, makeRecorderKit
|
|
|
150
178
|
transferSteps(amount: any, msg: any): never;
|
|
151
179
|
withdrawRewards(): never;
|
|
152
180
|
/** @param {Omit<Delegation, 'delegatorAddress'>[]} delegations */
|
|
153
|
-
undelegate(delegations: Omit<Delegation, "delegatorAddress">[]): Promise<
|
|
181
|
+
undelegate(delegations: Omit<Delegation, "delegatorAddress">[]): Promise<undefined>;
|
|
154
182
|
};
|
|
155
183
|
}>;
|
|
156
|
-
export function prepareCosmosOrchestrationAccount(zone: Zone, makeRecorderKit: <T>(storageNode: StorageNode | Awaited<import("@endo/far").FarRef<StorageNode>>, valueShape?: import("@agoric/zoe/src/contractSupport/recorder.js").TypedMatcher<T> | undefined) => RecorderKit<T>,
|
|
184
|
+
export function prepareCosmosOrchestrationAccount(zone: Zone, makeRecorderKit: <T>(storageNode: StorageNode | Awaited<import("@endo/far").FarRef<StorageNode>>, valueShape?: import("@agoric/zoe/src/contractSupport/recorder.js").TypedMatcher<T> | undefined) => RecorderKit<T>, vowTools: {
|
|
185
|
+
when: <T_1, TResult1 = import("@agoric/vow").EUnwrap<T_1>, TResult2 = never>(specimenP: T_1, onFulfilled?: ((value: import("@agoric/vow").EUnwrap<T_1>) => TResult1 | PromiseLike<TResult1>) | undefined, onRejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | undefined) => Promise<TResult1 | TResult2>;
|
|
186
|
+
watch: <T_2 = any, TResult1_1 = T_2, TResult2_1 = never, C = any>(specimenP: import("@agoric/vow").ERef<T_2 | import("@agoric/vow").Vow<T_2>>, watcher?: import("@agoric/vow").Watcher<T_2, TResult1_1, TResult2_1> | undefined, watcherContext?: C | undefined) => import("@agoric/vow").Vow<Exclude<TResult1_1, void> | Exclude<TResult2_1, void> extends never ? TResult1_1 : Exclude<TResult1_1, void> | Exclude<TResult2_1, void>>;
|
|
187
|
+
makeVowKit: <T_3>() => import("@agoric/vow").VowKit<T_3>;
|
|
188
|
+
allVows: (vows: unknown[]) => import("@agoric/vow").Vow<any[]>;
|
|
189
|
+
}, zcf: ZCF): (...args: Parameters<ReturnType<typeof prepareCosmosOrchestrationAccountKit>>) => CosmosOrchestrationAccountKit["holder"];
|
|
157
190
|
export type ComosOrchestrationAccountNotification = {
|
|
158
191
|
chainAddress: ChainAddress;
|
|
159
192
|
};
|
|
@@ -164,7 +197,7 @@ export type State = {
|
|
|
164
197
|
icqConnection: import("@endo/exo").Guarded<{
|
|
165
198
|
getLocalAddress(): `/ibc-port/${string}`;
|
|
166
199
|
getRemoteAddress(): `/${string}ibc-port/${string}/ordered/${string}` | `/${string}ibc-port/${string}/unordered/${string}`;
|
|
167
|
-
query(msgs:
|
|
200
|
+
query(msgs: JsonSafe<import("@agoric/cosmic-proto/tendermint/abci/types.js").RequestQuery>[]): Promise<JsonSafe<ResponseQuery>[]>;
|
|
168
201
|
}> | undefined;
|
|
169
202
|
bondDenom: string;
|
|
170
203
|
timer: Remote<TimerService>;
|
|
@@ -176,11 +209,13 @@ import type { RecorderKit } from '@agoric/zoe/src/contractSupport/recorder.js';
|
|
|
176
209
|
import type { ChainAddress } from '../types.js';
|
|
177
210
|
import type { IcaAccount } from '../types.js';
|
|
178
211
|
import type { Remote } from '@agoric/internal';
|
|
212
|
+
import type { JsonSafe } from '@agoric/cosmic-proto';
|
|
213
|
+
import type { ResponseQuery } from '@agoric/cosmic-proto/tendermint/abci/types.js';
|
|
179
214
|
import type { TimerService } from '@agoric/time';
|
|
180
215
|
import type { AmountArg } from '../types.js';
|
|
181
216
|
import type { Coin } from '@agoric/cosmic-proto/cosmos/base/v1beta1/coin.js';
|
|
182
|
-
import type { CosmosValidatorAddress } from '../types.js';
|
|
183
217
|
import type { DenomAmount } from '../types.js';
|
|
218
|
+
import type { CosmosValidatorAddress } from '../types.js';
|
|
184
219
|
import type { Delegation } from '@agoric/cosmic-proto/cosmos/staking/v1beta1/staking.js';
|
|
185
220
|
import type { DenomArg } from '../types.js';
|
|
186
221
|
//# sourceMappingURL=cosmos-orchestration-account.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cosmos-orchestration-account.d.ts","sourceRoot":"","sources":["cosmos-orchestration-account.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"cosmos-orchestration-account.d.ts","sourceRoot":"","sources":["cosmos-orchestration-account.js"],"names":[],"mappings":"AAkDA;;;GAGG;AAEH;;;;;;;;;GASG;AAEH,mCAAmC;AACnC;;;;;;;;;;;;;;;GAqBG;AAgBI,mGA+BG,WAAE,GAAE,QAAS,OAAO,WAAW,EAAE,MAAM,CAAC,WAAW,CAAC,CAC9D;4FAzHA,GAAC;;;oBAO0B,SACtB;QA+EM,GAAG;;;;;;;;;;;QA4EN,wDAAwD;;;QAWxD;;;WAGG;;;;QAgBH;;WAEG;;;;QAWH;;WAEG;4BADQ,MAAM;;IAenB;;;OAGG;;QAED,uDAAuD;4BAA3C,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;;;QAO5C,6BAA6B;4BAAjB,MAAM;;;QAYlB;;;WAGG;;QASH;;;;WAIG;;QAaH,gDAAgD;;QAShD,kEAAkE;;;QAYlE;;;;WAIG;;;;;;;;;;;;;gBAtDH;;;mBAGG;;gBASH;;;;mBAIG;;gBAaH,gDAAgD;;gBAShD,kEAAkE;;;gBAYlE;;;;mBAIG;;;;;;;;;;;;QA2BH,8BAA8B;;QAI9B;;;;;WAKG;;;;QA0BH;;;;;;WAMG;;QAyBH;;;WAGG;;QAcH;;;WAGG;;;;;;QAuCH,kEAAkE;;;GA2BzE;AAmBM,0IA1XoC,MAAM;;;;;QAmXtC,GAAG,GACD,CACZ,GAAO,IAAI,EAAE,UAAU,CACvB,UAAgB,CAAC,OAAO,oCAAoC,CAAC,CACxD,KACE,6BAA6B,CAAC,QAAQ,CAAC,CAe9C;;;;;;;;;;;;;eAjde,MAAM;;;4CAobT,UAAU,CACtB,UAAc,CAAC,OAAO,oCAAoC,CAAC,CACxD;yCA4BU,6BAA6B,CAAC,QAAQ,CAAC;0BAre9B,cAAc;iCANU,6CAA6C;kCADsE,aAAa;gCAAb,aAAa;4BAItJ,kBAAkB;8BAKhB,sBAAsB;mCADjB,+CAA+C;kCAHhD,cAAc;+BALqH,aAAa;0BAExJ,kDAAkD;iCAFyF,aAAa;4CAAb,aAAa;gCAGlJ,wDAAwD;8BAH6E,aAAa"}
|
|
@@ -11,7 +11,6 @@ import {
|
|
|
11
11
|
import {
|
|
12
12
|
MsgBeginRedelegate,
|
|
13
13
|
MsgDelegate,
|
|
14
|
-
MsgDelegateResponse,
|
|
15
14
|
MsgUndelegate,
|
|
16
15
|
MsgUndelegateResponse,
|
|
17
16
|
} from '@agoric/cosmic-proto/cosmos/staking/v1beta1/tx.js';
|
|
@@ -26,13 +25,10 @@ import {
|
|
|
26
25
|
AmountArgShape,
|
|
27
26
|
ChainAddressShape,
|
|
28
27
|
ChainAmountShape,
|
|
28
|
+
CoinShape,
|
|
29
29
|
DelegationShape,
|
|
30
30
|
} from '../typeGuards.js';
|
|
31
|
-
import {
|
|
32
|
-
encodeTxResponse,
|
|
33
|
-
maxClockSkew,
|
|
34
|
-
tryDecodeResponse,
|
|
35
|
-
} from '../utils/cosmos.js';
|
|
31
|
+
import { maxClockSkew, tryDecodeResponse } from '../utils/cosmos.js';
|
|
36
32
|
import { orchestrationAccountMethods } from '../utils/orchestrationAccount.js';
|
|
37
33
|
import { dateInSeconds } from '../utils/time.js';
|
|
38
34
|
|
|
@@ -43,7 +39,10 @@ import { dateInSeconds } from '../utils/time.js';
|
|
|
43
39
|
* @import {Delegation} from '@agoric/cosmic-proto/cosmos/staking/v1beta1/staking.js';
|
|
44
40
|
* @import {Remote} from '@agoric/internal';
|
|
45
41
|
* @import {TimerService} from '@agoric/time';
|
|
42
|
+
* @import {VowTools} from '@agoric/vow';
|
|
46
43
|
* @import {Zone} from '@agoric/zone';
|
|
44
|
+
* @import {ResponseQuery} from '@agoric/cosmic-proto/tendermint/abci/types.js';
|
|
45
|
+
* @import {JsonSafe} from '@agoric/cosmic-proto';
|
|
47
46
|
*/
|
|
48
47
|
|
|
49
48
|
const trace = makeTracer('ComosOrchestrationAccountHolder');
|
|
@@ -94,28 +93,19 @@ const PUBLIC_TOPICS = {
|
|
|
94
93
|
account: ['Staking Account holder status', M.any()],
|
|
95
94
|
};
|
|
96
95
|
|
|
97
|
-
export const trivialDelegateResponse = encodeTxResponse(
|
|
98
|
-
{},
|
|
99
|
-
MsgDelegateResponse.toProtoMsg,
|
|
100
|
-
);
|
|
101
|
-
|
|
102
|
-
const expect = (actual, expected, message) => {
|
|
103
|
-
if (actual !== expected) {
|
|
104
|
-
console.log(message, { actual, expected });
|
|
105
|
-
}
|
|
106
|
-
};
|
|
107
|
-
|
|
108
96
|
/** @type {(c: { denom: string; amount: string }) => DenomAmount} */
|
|
109
97
|
const toDenomAmount = c => ({ denom: c.denom, value: BigInt(c.amount) });
|
|
110
98
|
|
|
111
99
|
/**
|
|
112
100
|
* @param {Zone} zone
|
|
113
101
|
* @param {MakeRecorderKit} makeRecorderKit
|
|
102
|
+
* @param {VowTools} vowTools
|
|
114
103
|
* @param {ZCF} zcf
|
|
115
104
|
*/
|
|
116
105
|
export const prepareCosmosOrchestrationAccountKit = (
|
|
117
106
|
zone,
|
|
118
107
|
makeRecorderKit,
|
|
108
|
+
{ when, watch },
|
|
119
109
|
zcf,
|
|
120
110
|
) => {
|
|
121
111
|
const makeCosmosOrchestrationAccountKit = zone.exoClassKit(
|
|
@@ -126,6 +116,26 @@ export const prepareCosmosOrchestrationAccountKit = (
|
|
|
126
116
|
getUpdater: M.call().returns(M.remotable()),
|
|
127
117
|
amountToCoin: M.call(AmountArgShape).returns(M.record()),
|
|
128
118
|
}),
|
|
119
|
+
returnVoidWatcher: M.interface('returnVoidWatcher', {
|
|
120
|
+
onFulfilled: M.call(M.or(M.string(), M.record()))
|
|
121
|
+
.optional(M.arrayOf(M.undefined()))
|
|
122
|
+
.returns(M.undefined()),
|
|
123
|
+
}),
|
|
124
|
+
balanceQueryWatcher: M.interface('balanceQueryWatcher', {
|
|
125
|
+
onFulfilled: M.call(M.arrayOf(M.record()))
|
|
126
|
+
.optional(M.arrayOf(M.undefined())) // empty context
|
|
127
|
+
.returns(M.or(M.record(), M.undefined())),
|
|
128
|
+
}),
|
|
129
|
+
undelegateWatcher: M.interface('undelegateWatcher', {
|
|
130
|
+
onFulfilled: M.call(M.string())
|
|
131
|
+
.optional(M.arrayOf(M.undefined())) // empty context
|
|
132
|
+
.returns(M.promise()),
|
|
133
|
+
}),
|
|
134
|
+
withdrawRewardWatcher: M.interface('withdrawRewardWatcher', {
|
|
135
|
+
onFulfilled: M.call(M.string())
|
|
136
|
+
.optional(M.arrayOf(M.undefined())) // empty context
|
|
137
|
+
.returns(M.arrayOf(CoinShape)),
|
|
138
|
+
}),
|
|
129
139
|
holder: IcaAccountHolderI,
|
|
130
140
|
invitationMakers: M.interface('invitationMakers', {
|
|
131
141
|
Delegate: M.callWhen(ChainAddressShape, AmountArgShape).returns(
|
|
@@ -195,6 +205,59 @@ export const prepareCosmosOrchestrationAccountKit = (
|
|
|
195
205
|
});
|
|
196
206
|
},
|
|
197
207
|
},
|
|
208
|
+
balanceQueryWatcher: {
|
|
209
|
+
/**
|
|
210
|
+
* @param {JsonSafe<ResponseQuery>[]} results
|
|
211
|
+
*/
|
|
212
|
+
onFulfilled([result]) {
|
|
213
|
+
if (!result?.key) throw Fail`Error parsing result ${result}`;
|
|
214
|
+
const { balance } = QueryBalanceResponse.decode(
|
|
215
|
+
decodeBase64(result.key),
|
|
216
|
+
);
|
|
217
|
+
if (!balance) throw Fail`Result lacked balance key: ${result}`;
|
|
218
|
+
return harden(toDenomAmount(balance));
|
|
219
|
+
},
|
|
220
|
+
},
|
|
221
|
+
undelegateWatcher: {
|
|
222
|
+
/**
|
|
223
|
+
* @param {string} result
|
|
224
|
+
*/
|
|
225
|
+
onFulfilled(result) {
|
|
226
|
+
const response = tryDecodeResponse(
|
|
227
|
+
result,
|
|
228
|
+
MsgUndelegateResponse.fromProtoMsg,
|
|
229
|
+
);
|
|
230
|
+
trace('undelegate response', response);
|
|
231
|
+
const { completionTime } = response;
|
|
232
|
+
completionTime || Fail`No completion time result ${result}`;
|
|
233
|
+
return E(this.state.timer).wakeAt(
|
|
234
|
+
dateInSeconds(completionTime) + maxClockSkew,
|
|
235
|
+
);
|
|
236
|
+
},
|
|
237
|
+
},
|
|
238
|
+
/**
|
|
239
|
+
* takes an array of results (from `executeEncodedTx`) and returns void
|
|
240
|
+
* since we are not interested in the result
|
|
241
|
+
*/
|
|
242
|
+
returnVoidWatcher: {
|
|
243
|
+
/** @param {string | Record<string, unknown>} result */
|
|
244
|
+
onFulfilled(result) {
|
|
245
|
+
trace('Result', result);
|
|
246
|
+
return undefined;
|
|
247
|
+
},
|
|
248
|
+
},
|
|
249
|
+
withdrawRewardWatcher: {
|
|
250
|
+
/** @param {string} result */
|
|
251
|
+
onFulfilled(result) {
|
|
252
|
+
const response = tryDecodeResponse(
|
|
253
|
+
result,
|
|
254
|
+
MsgWithdrawDelegatorRewardResponse.fromProtoMsg,
|
|
255
|
+
);
|
|
256
|
+
trace('withdrawReward response', response);
|
|
257
|
+
const { amount: coins } = response;
|
|
258
|
+
return harden(coins.map(toDenomAmount));
|
|
259
|
+
},
|
|
260
|
+
},
|
|
198
261
|
invitationMakers: {
|
|
199
262
|
/**
|
|
200
263
|
* @param {CosmosValidatorAddress} validator
|
|
@@ -292,7 +355,7 @@ export const prepareCosmosOrchestrationAccountKit = (
|
|
|
292
355
|
const { helper } = this.facets;
|
|
293
356
|
const { chainAddress } = this.state;
|
|
294
357
|
|
|
295
|
-
const
|
|
358
|
+
const results = E(helper.owned()).executeEncodedTx([
|
|
296
359
|
Any.toJSON(
|
|
297
360
|
MsgDelegate.toProtoMsg({
|
|
298
361
|
delegatorAddress: chainAddress.address,
|
|
@@ -301,8 +364,7 @@ export const prepareCosmosOrchestrationAccountKit = (
|
|
|
301
364
|
}),
|
|
302
365
|
),
|
|
303
366
|
]);
|
|
304
|
-
|
|
305
|
-
expect(result, trivialDelegateResponse, 'MsgDelegateResponse');
|
|
367
|
+
return when(watch(results, this.facets.returnVoidWatcher));
|
|
306
368
|
},
|
|
307
369
|
async deposit(payment) {
|
|
308
370
|
trace('deposit', payment);
|
|
@@ -325,8 +387,7 @@ export const prepareCosmosOrchestrationAccountKit = (
|
|
|
325
387
|
const { helper } = this.facets;
|
|
326
388
|
const { chainAddress } = this.state;
|
|
327
389
|
|
|
328
|
-
|
|
329
|
-
await E(helper.owned()).executeEncodedTx([
|
|
390
|
+
const results = E(helper.owned()).executeEncodedTx([
|
|
330
391
|
Any.toJSON(
|
|
331
392
|
MsgBeginRedelegate.toProtoMsg({
|
|
332
393
|
delegatorAddress: chainAddress.address,
|
|
@@ -336,8 +397,15 @@ export const prepareCosmosOrchestrationAccountKit = (
|
|
|
336
397
|
}),
|
|
337
398
|
),
|
|
338
399
|
]);
|
|
339
|
-
},
|
|
340
400
|
|
|
401
|
+
return when(
|
|
402
|
+
watch(
|
|
403
|
+
results,
|
|
404
|
+
// NOTE: response, including completionTime, is currently discarded.
|
|
405
|
+
this.facets.returnVoidWatcher,
|
|
406
|
+
),
|
|
407
|
+
);
|
|
408
|
+
},
|
|
341
409
|
/**
|
|
342
410
|
* @param {CosmosValidatorAddress} validator
|
|
343
411
|
* @returns {Promise<DenomAmount[]>}
|
|
@@ -351,14 +419,9 @@ export const prepareCosmosOrchestrationAccountKit = (
|
|
|
351
419
|
validatorAddress: validator.address,
|
|
352
420
|
});
|
|
353
421
|
const account = helper.owned();
|
|
354
|
-
|
|
355
|
-
const
|
|
356
|
-
|
|
357
|
-
MsgWithdrawDelegatorRewardResponse.fromProtoMsg,
|
|
358
|
-
);
|
|
359
|
-
trace('withdrawReward response', response);
|
|
360
|
-
const { amount: coins } = response;
|
|
361
|
-
return harden(coins.map(toDenomAmount));
|
|
422
|
+
|
|
423
|
+
const results = E(account).executeEncodedTx([Any.toJSON(msg)]);
|
|
424
|
+
return when(watch(results, this.facets.withdrawRewardWatcher));
|
|
362
425
|
},
|
|
363
426
|
/**
|
|
364
427
|
* @param {DenomArg} denom
|
|
@@ -372,7 +435,7 @@ export const prepareCosmosOrchestrationAccountKit = (
|
|
|
372
435
|
// TODO #9211 lookup denom from brand
|
|
373
436
|
assert.typeof(denom, 'string');
|
|
374
437
|
|
|
375
|
-
const
|
|
438
|
+
const results = E(icqConnection).query([
|
|
376
439
|
toRequestQueryJson(
|
|
377
440
|
QueryBalanceRequest.toProtoMsg({
|
|
378
441
|
address: chainAddress.address,
|
|
@@ -380,12 +443,7 @@ export const prepareCosmosOrchestrationAccountKit = (
|
|
|
380
443
|
}),
|
|
381
444
|
),
|
|
382
445
|
]);
|
|
383
|
-
|
|
384
|
-
const { balance } = QueryBalanceResponse.decode(
|
|
385
|
-
decodeBase64(result.key),
|
|
386
|
-
);
|
|
387
|
-
if (!balance) throw Fail`Result lacked balance key: ${result}`;
|
|
388
|
-
return harden(toDenomAmount(balance));
|
|
446
|
+
return when(watch(results, this.facets.balanceQueryWatcher));
|
|
389
447
|
},
|
|
390
448
|
|
|
391
449
|
send(toAccount, amount) {
|
|
@@ -411,28 +469,23 @@ export const prepareCosmosOrchestrationAccountKit = (
|
|
|
411
469
|
async undelegate(delegations) {
|
|
412
470
|
trace('undelegate', delegations);
|
|
413
471
|
const { helper } = this.facets;
|
|
414
|
-
const { chainAddress, bondDenom
|
|
415
|
-
|
|
416
|
-
const
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
472
|
+
const { chainAddress, bondDenom } = this.state;
|
|
473
|
+
|
|
474
|
+
const undelegateV = watch(
|
|
475
|
+
E(helper.owned()).executeEncodedTx(
|
|
476
|
+
delegations.map(d =>
|
|
477
|
+
Any.toJSON(
|
|
478
|
+
MsgUndelegate.toProtoMsg({
|
|
479
|
+
delegatorAddress: chainAddress.address,
|
|
480
|
+
validatorAddress: d.validatorAddress,
|
|
481
|
+
amount: { denom: bondDenom, amount: d.shares },
|
|
482
|
+
}),
|
|
483
|
+
),
|
|
424
484
|
),
|
|
425
485
|
),
|
|
486
|
+
this.facets.undelegateWatcher,
|
|
426
487
|
);
|
|
427
|
-
|
|
428
|
-
const response = tryDecodeResponse(
|
|
429
|
-
result,
|
|
430
|
-
MsgUndelegateResponse.fromProtoMsg,
|
|
431
|
-
);
|
|
432
|
-
trace('undelegate response', response);
|
|
433
|
-
const { completionTime } = response;
|
|
434
|
-
|
|
435
|
-
await E(timer).wakeAt(dateInSeconds(completionTime) + maxClockSkew);
|
|
488
|
+
return when(watch(undelegateV, this.facets.returnVoidWatcher));
|
|
436
489
|
},
|
|
437
490
|
},
|
|
438
491
|
},
|
|
@@ -450,6 +503,7 @@ export const prepareCosmosOrchestrationAccountKit = (
|
|
|
450
503
|
/**
|
|
451
504
|
* @param {Zone} zone
|
|
452
505
|
* @param {MakeRecorderKit} makeRecorderKit
|
|
506
|
+
* @param {VowTools} vowTools
|
|
453
507
|
* @param {ZCF} zcf
|
|
454
508
|
* @returns {(
|
|
455
509
|
* ...args: Parameters<
|
|
@@ -460,11 +514,13 @@ export const prepareCosmosOrchestrationAccountKit = (
|
|
|
460
514
|
export const prepareCosmosOrchestrationAccount = (
|
|
461
515
|
zone,
|
|
462
516
|
makeRecorderKit,
|
|
517
|
+
vowTools,
|
|
463
518
|
zcf,
|
|
464
519
|
) => {
|
|
465
520
|
const makeKit = prepareCosmosOrchestrationAccountKit(
|
|
466
521
|
zone,
|
|
467
522
|
makeRecorderKit,
|
|
523
|
+
vowTools,
|
|
468
524
|
zcf,
|
|
469
525
|
);
|
|
470
526
|
return (...args) => makeKit(...args).holder;
|
|
@@ -4,7 +4,12 @@ export const ICQConnectionI: import("@endo/patterns").InterfaceGuard<{
|
|
|
4
4
|
getRemoteAddress: import("@endo/patterns").MethodGuard;
|
|
5
5
|
query: import("@endo/patterns").MethodGuard;
|
|
6
6
|
}>;
|
|
7
|
-
export function prepareICQConnectionKit(zone: Zone
|
|
7
|
+
export function prepareICQConnectionKit(zone: Zone, { watch, when }: {
|
|
8
|
+
when: <T, TResult1 = import("@agoric/vow").EUnwrap<T>, TResult2 = never>(specimenP: T, onFulfilled?: ((value: import("@agoric/vow").EUnwrap<T>) => TResult1 | PromiseLike<TResult1>) | undefined, onRejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | undefined) => Promise<TResult1 | TResult2>;
|
|
9
|
+
watch: <T_1 = any, TResult1_1 = T_1, TResult2_1 = never, C = any>(specimenP: import("@agoric/vow").ERef<T_1 | import("@agoric/vow").Vow<T_1>>, watcher?: import("@agoric/vow").Watcher<T_1, TResult1_1, TResult2_1> | undefined, watcherContext?: C | undefined) => import("@agoric/vow").Vow<Exclude<TResult1_1, void> | Exclude<TResult2_1, void> extends never ? TResult1_1 : Exclude<TResult1_1, void> | Exclude<TResult2_1, void>>;
|
|
10
|
+
makeVowKit: <T_2>() => import("@agoric/vow").VowKit<T_2>;
|
|
11
|
+
allVows: (vows: unknown[]) => import("@agoric/vow").Vow<any[]>;
|
|
12
|
+
}): (port: Port) => import("@endo/exo").GuardedKit<{
|
|
8
13
|
connection: {
|
|
9
14
|
getLocalAddress(): `/ibc-port/${string}`;
|
|
10
15
|
getRemoteAddress(): `/${string}ibc-port/${string}/ordered/${string}` | `/${string}ibc-port/${string}/unordered/${string}`;
|
|
@@ -15,6 +20,10 @@ export function prepareICQConnectionKit(zone: Zone): (port: Port) => import("@en
|
|
|
15
20
|
*/
|
|
16
21
|
query(msgs: JsonSafe<RequestQuery>[]): Promise<JsonSafe<ResponseQuery>[]>;
|
|
17
22
|
};
|
|
23
|
+
parseQueryPacketWatcher: {
|
|
24
|
+
/** @param {string} ack packet acknowledgement string */
|
|
25
|
+
onFulfilled(ack: string): JsonSafe<ResponseQuery>[];
|
|
26
|
+
};
|
|
18
27
|
connectionHandler: {
|
|
19
28
|
/**
|
|
20
29
|
* @param {Remote<Connection>} connection
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"icq-connection-kit.d.ts","sourceRoot":"","sources":["icq-connection-kit.js"],"names":[],"mappings":"AAoBA,2DAGE;AAEF;;;;GAIG;
|
|
1
|
+
{"version":3,"file":"icq-connection-kit.d.ts","sourceRoot":"","sources":["icq-connection-kit.js"],"names":[],"mappings":"AAoBA,2DAGE;AAEF;;;;GAIG;AA2BI;wFA7CqC,CAAC;;;oBAW7B,SAAS;;;;;QAoEjB;;;;WAIG;;;;QAeH,wDAAwD;yBAA5C,MAAM;;;QAMlB;;;;WAIG;;;;;GAgBR;;;;;;;+BAEW,UAAU,CAAC,UAAU,CAAC,OAAO,uBAAuB,CAAC,CAAC;4BACtD,gBAAgB,CAAC,YAAY,CAAC;0BAjIrB,mBAAmB;0BACP,iBAAiB;kCAGN,+CAA+C;8BADlE,sBAAsB;mCACH,+CAA+C;gCAH1D,iBAAiB;4BACjB,aAAa"}
|