@agoric/orchestration 0.2.0-upgrade-17-dev-a1453b2.0 → 0.2.0-upgrade-18-dev-bf39b10.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/index.d.ts +1 -1
- package/index.js +2 -1
- package/package.json +29 -28
- package/src/chain-info.d.ts +31 -387
- package/src/chain-info.d.ts.map +1 -1
- package/src/chain-info.js +10 -64
- package/src/cosmos-api.d.ts +21 -10
- package/src/cosmos-api.d.ts.map +1 -1
- package/src/cosmos-api.ts +33 -14
- package/src/examples/README.md +3 -4
- package/src/examples/auto-stake-it-tap-kit.d.ts.map +1 -1
- package/src/examples/auto-stake-it-tap-kit.js +4 -7
- package/src/examples/auto-stake-it.contract.d.ts +1 -1
- package/src/examples/auto-stake-it.flows.d.ts +1 -1
- package/src/examples/auto-stake-it.flows.d.ts.map +1 -1
- package/src/examples/basic-flows.contract.d.ts +1 -1
- package/src/examples/basic-flows.flows.d.ts +1 -1
- package/src/examples/send-anywhere.contract.d.ts +20 -2
- package/src/examples/send-anywhere.contract.d.ts.map +1 -1
- package/src/examples/send-anywhere.contract.js +34 -18
- package/src/examples/send-anywhere.flows.d.ts +7 -7
- package/src/examples/send-anywhere.flows.d.ts.map +1 -1
- package/src/examples/send-anywhere.flows.js +40 -20
- package/src/examples/shared.flows.d.ts +4 -0
- package/src/examples/shared.flows.d.ts.map +1 -0
- package/src/examples/shared.flows.js +21 -0
- package/src/examples/stake-bld.contract.d.ts +49 -0
- package/src/examples/stake-bld.contract.d.ts.map +1 -0
- package/src/examples/{stakeBld.contract.js → stake-bld.contract.js} +10 -1
- package/src/examples/stake-ica.contract.d.ts +126 -0
- package/src/examples/stake-ica.contract.d.ts.map +1 -0
- package/src/examples/{stakeIca.contract.js → stake-ica.contract.js} +6 -2
- package/src/examples/staking-combinations.contract.d.ts +1 -1
- package/src/examples/staking-combinations.contract.d.ts.map +1 -1
- package/src/examples/staking-combinations.contract.js +16 -13
- package/src/examples/staking-combinations.flows.d.ts +6 -9
- package/src/examples/staking-combinations.flows.d.ts.map +1 -1
- package/src/examples/staking-combinations.flows.js +19 -16
- package/src/examples/swap.contract.d.ts.map +1 -1
- package/src/examples/swap.contract.js +0 -1
- package/src/examples/unbond.contract.d.ts +1 -1
- package/src/examples/unbond.contract.d.ts.map +1 -1
- package/src/examples/unbond.contract.js +10 -5
- package/src/examples/unbond.flows.d.ts +4 -3
- package/src/examples/unbond.flows.d.ts.map +1 -1
- package/src/examples/unbond.flows.js +23 -31
- package/src/exos/chain-hub.d.ts +12 -4
- package/src/exos/chain-hub.d.ts.map +1 -1
- package/src/exos/chain-hub.js +28 -19
- package/src/exos/combine-invitation-makers.d.ts +1 -0
- package/src/exos/combine-invitation-makers.d.ts.map +1 -1
- package/src/exos/combine-invitation-makers.js +6 -0
- package/src/exos/cosmos-interchain-service.d.ts +20 -70
- package/src/exos/cosmos-interchain-service.d.ts.map +1 -1
- package/src/exos/cosmos-orchestration-account.d.ts +152 -47
- package/src/exos/cosmos-orchestration-account.d.ts.map +1 -1
- package/src/exos/cosmos-orchestration-account.js +355 -13
- package/src/exos/exo-interfaces.d.ts +3 -3
- package/src/exos/exo-interfaces.d.ts.map +1 -1
- package/src/exos/exo-interfaces.ts +3 -3
- package/src/exos/ica-account-kit.d.ts +2 -2
- package/src/exos/ica-account-kit.d.ts.map +1 -1
- package/src/exos/icq-connection-kit.d.ts +17 -1
- package/src/exos/icq-connection-kit.d.ts.map +1 -1
- package/src/exos/local-chain-facade.d.ts +22 -170
- package/src/exos/local-chain-facade.d.ts.map +1 -1
- package/src/exos/local-orchestration-account.d.ts +41 -48
- package/src/exos/local-orchestration-account.d.ts.map +1 -1
- package/src/exos/local-orchestration-account.js +94 -13
- package/src/exos/orchestrator.d.ts +44 -136
- package/src/exos/orchestrator.d.ts.map +1 -1
- package/src/exos/orchestrator.js +42 -44
- package/src/exos/packet-tools.d.ts +21 -81
- package/src/exos/packet-tools.d.ts.map +1 -1
- package/src/exos/portfolio-holder-kit.d.ts +4 -4
- package/src/exos/portfolio-holder-kit.d.ts.map +1 -1
- package/src/exos/portfolio-holder-kit.js +65 -10
- package/src/exos/remote-chain-facade.d.ts +35 -128
- package/src/exos/remote-chain-facade.d.ts.map +1 -1
- package/src/facade.d.ts.map +1 -1
- package/src/facade.js +7 -0
- package/src/fetched-chain-info.d.ts +30 -340
- package/src/fetched-chain-info.js +18 -329
- package/src/fixtures/query-flows.flows.d.ts.map +1 -1
- package/src/orchestration-api.d.ts +4 -8
- package/src/orchestration-api.d.ts.map +1 -1
- package/src/orchestration-api.ts +3 -8
- package/src/proposals/init-chain-info.js +3 -3
- package/src/proposals/orchestration-proposal.d.ts.map +1 -1
- package/src/proposals/start-stakeAtom.d.ts +78 -16
- package/src/proposals/start-stakeAtom.d.ts.map +1 -1
- package/src/proposals/start-stakeAtom.js +9 -4
- package/src/proposals/start-stakeBld.d.ts +13 -39
- package/src/proposals/start-stakeBld.d.ts.map +1 -1
- package/src/proposals/start-stakeBld.js +2 -2
- package/src/proposals/start-stakeOsmo.d.ts +77 -15
- package/src/proposals/start-stakeOsmo.d.ts.map +1 -1
- package/src/proposals/start-stakeOsmo.js +9 -4
- package/src/typeGuards.d.ts +5 -1
- package/src/typeGuards.d.ts.map +1 -1
- package/src/typeGuards.js +21 -9
- package/src/types-index.d.ts +1 -0
- package/src/types-index.js +1 -0
- package/src/types.d.ts +14 -4
- package/src/types.d.ts.map +1 -1
- package/src/types.ts +15 -4
- package/src/utils/cosmos.d.ts +40 -1
- package/src/utils/cosmos.d.ts.map +1 -1
- package/src/utils/cosmos.js +48 -1
- package/src/utils/orchestrationAccount.js +1 -1
- package/src/utils/registry.d.ts.map +1 -1
- package/src/utils/registry.js +0 -3
- package/src/utils/start-helper.d.ts +4 -10
- package/src/utils/start-helper.d.ts.map +1 -1
- package/src/utils/start-helper.js +18 -15
- package/src/utils/zcf-tools.d.ts +5 -0
- package/src/utils/zcf-tools.d.ts.map +1 -0
- package/src/utils/zcf-tools.js +35 -0
- package/src/utils/zoe-tools.d.ts +5 -8
- package/src/utils/zoe-tools.d.ts.map +1 -1
- package/src/utils/zoe-tools.js +136 -33
- package/src/vat-orchestration.d.ts.map +1 -1
- package/src/examples/stakeBld.contract.d.ts +0 -75
- package/src/examples/stakeBld.contract.d.ts.map +0 -1
- package/src/examples/stakeIca.contract.d.ts +0 -64
- package/src/examples/stakeIca.contract.d.ts.map +0 -1
|
@@ -1,16 +1,34 @@
|
|
|
1
1
|
/** @file Use-object for the owner of a staking account */
|
|
2
2
|
import { toRequestQueryJson } from '@agoric/cosmic-proto';
|
|
3
3
|
import {
|
|
4
|
-
QueryBalanceRequest,
|
|
5
|
-
QueryBalanceResponse,
|
|
6
4
|
QueryAllBalancesRequest,
|
|
7
5
|
QueryAllBalancesResponse,
|
|
6
|
+
QueryBalanceRequest,
|
|
7
|
+
QueryBalanceResponse,
|
|
8
8
|
} from '@agoric/cosmic-proto/cosmos/bank/v1beta1/query.js';
|
|
9
9
|
import { MsgSend } from '@agoric/cosmic-proto/cosmos/bank/v1beta1/tx.js';
|
|
10
|
+
import {
|
|
11
|
+
QueryDelegationRewardsRequest,
|
|
12
|
+
QueryDelegationRewardsResponse,
|
|
13
|
+
QueryDelegationTotalRewardsRequest,
|
|
14
|
+
QueryDelegationTotalRewardsResponse,
|
|
15
|
+
} from '@agoric/cosmic-proto/cosmos/distribution/v1beta1/query.js';
|
|
10
16
|
import {
|
|
11
17
|
MsgWithdrawDelegatorReward,
|
|
12
18
|
MsgWithdrawDelegatorRewardResponse,
|
|
13
19
|
} from '@agoric/cosmic-proto/cosmos/distribution/v1beta1/tx.js';
|
|
20
|
+
import {
|
|
21
|
+
QueryDelegationRequest,
|
|
22
|
+
QueryDelegationResponse,
|
|
23
|
+
QueryDelegatorDelegationsRequest,
|
|
24
|
+
QueryDelegatorDelegationsResponse,
|
|
25
|
+
QueryDelegatorUnbondingDelegationsRequest,
|
|
26
|
+
QueryDelegatorUnbondingDelegationsResponse,
|
|
27
|
+
QueryRedelegationsRequest,
|
|
28
|
+
QueryRedelegationsResponse,
|
|
29
|
+
QueryUnbondingDelegationRequest,
|
|
30
|
+
QueryUnbondingDelegationResponse,
|
|
31
|
+
} from '@agoric/cosmic-proto/cosmos/staking/v1beta1/query.js';
|
|
14
32
|
import {
|
|
15
33
|
MsgBeginRedelegate,
|
|
16
34
|
MsgDelegate,
|
|
@@ -36,19 +54,22 @@ import {
|
|
|
36
54
|
import { coerceCoin, coerceDenom } from '../utils/amounts.js';
|
|
37
55
|
import {
|
|
38
56
|
maxClockSkew,
|
|
39
|
-
|
|
57
|
+
toCosmosDelegationResponse,
|
|
58
|
+
toCosmosValidatorAddress,
|
|
40
59
|
toDenomAmount,
|
|
60
|
+
toTruncatedDenomAmount,
|
|
61
|
+
tryDecodeResponse,
|
|
41
62
|
} from '../utils/cosmos.js';
|
|
42
63
|
import { orchestrationAccountMethods } from '../utils/orchestrationAccount.js';
|
|
43
64
|
import { makeTimestampHelper } from '../utils/time.js';
|
|
44
65
|
|
|
45
66
|
/**
|
|
46
67
|
* @import {HostOf} from '@agoric/async-flow';
|
|
47
|
-
* @import {AmountArg, IcaAccount, ChainAddress, CosmosValidatorAddress, ICQConnection, StakingAccountActions,
|
|
68
|
+
* @import {AmountArg, IcaAccount, ChainAddress, CosmosValidatorAddress, ICQConnection, StakingAccountActions, StakingAccountQueries, OrchestrationAccountI, CosmosRewardsResponse, IBCConnectionInfo, IBCMsgTransferOptions, ChainHub, CosmosDelegationResponse} from '../types.js';
|
|
48
69
|
* @import {RecorderKit, MakeRecorderKit} from '@agoric/zoe/src/contractSupport/recorder.js';
|
|
49
70
|
* @import {Coin} from '@agoric/cosmic-proto/cosmos/base/v1beta1/coin.js';
|
|
50
|
-
* @import {Delegation} from '@agoric/cosmic-proto/cosmos/staking/v1beta1/staking.js';
|
|
51
71
|
* @import {Remote} from '@agoric/internal';
|
|
72
|
+
* @import {DelegationResponse} from '@agoric/cosmic-proto/cosmos/staking/v1beta1/staking.js';
|
|
52
73
|
* @import {InvitationMakers} from '@agoric/smart-wallet/src/types.js';
|
|
53
74
|
* @import {TimerService} from '@agoric/time';
|
|
54
75
|
* @import {Vow, VowTools} from '@agoric/vow';
|
|
@@ -89,20 +110,37 @@ const { Vow$ } = NetworkShape; // TODO #9611
|
|
|
89
110
|
* }} CosmosOrchestrationAccountStorageState
|
|
90
111
|
*/
|
|
91
112
|
|
|
92
|
-
/** @see {
|
|
93
|
-
|
|
94
|
-
...orchestrationAccountMethods,
|
|
113
|
+
/** @see {StakingAccountActions} */
|
|
114
|
+
const stakingAccountActionsMethods = {
|
|
95
115
|
delegate: M.call(ChainAddressShape, AmountArgShape).returns(VowShape),
|
|
96
116
|
redelegate: M.call(
|
|
97
117
|
ChainAddressShape,
|
|
98
118
|
ChainAddressShape,
|
|
99
119
|
AmountArgShape,
|
|
100
120
|
).returns(VowShape),
|
|
121
|
+
undelegate: M.call(M.arrayOf(DelegationShape)).returns(VowShape),
|
|
101
122
|
withdrawReward: M.call(ChainAddressShape).returns(
|
|
102
123
|
Vow$(M.arrayOf(DenomAmountShape)),
|
|
103
124
|
),
|
|
104
125
|
withdrawRewards: M.call().returns(Vow$(M.arrayOf(DenomAmountShape))),
|
|
105
|
-
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
/** @see {StakingAccountQueries} */
|
|
129
|
+
const stakingAccountQueriesMethods = {
|
|
130
|
+
getDelegation: M.call(ChainAddressShape).returns(VowShape),
|
|
131
|
+
getDelegations: M.call().returns(VowShape),
|
|
132
|
+
getUnbondingDelegation: M.call(ChainAddressShape).returns(VowShape),
|
|
133
|
+
getUnbondingDelegations: M.call().returns(VowShape),
|
|
134
|
+
getRedelegations: M.call().returns(VowShape),
|
|
135
|
+
getReward: M.call(ChainAddressShape).returns(VowShape),
|
|
136
|
+
getRewards: M.call().returns(VowShape),
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
/** @see {OrchestrationAccountI} */
|
|
140
|
+
export const IcaAccountHolderI = M.interface('IcaAccountHolder', {
|
|
141
|
+
...orchestrationAccountMethods,
|
|
142
|
+
...stakingAccountActionsMethods,
|
|
143
|
+
...stakingAccountQueriesMethods,
|
|
106
144
|
deactivate: M.call().returns(VowShape),
|
|
107
145
|
reactivate: M.call().returns(VowShape),
|
|
108
146
|
});
|
|
@@ -198,6 +236,46 @@ export const prepareCosmosOrchestrationAccountKit = (
|
|
|
198
236
|
})
|
|
199
237
|
.returns(Vow$(M.record())),
|
|
200
238
|
}),
|
|
239
|
+
delegationQueryWatcher: M.interface('delegationQueryWatcher', {
|
|
240
|
+
onFulfilled: M.call(M.arrayOf(M.record())).returns(M.record()),
|
|
241
|
+
}),
|
|
242
|
+
delegationsQueryWatcher: M.interface('delegationsQueryWatcher', {
|
|
243
|
+
onFulfilled: M.call(M.arrayOf(M.record())).returns(
|
|
244
|
+
M.arrayOf(M.record()),
|
|
245
|
+
),
|
|
246
|
+
}),
|
|
247
|
+
unbondingDelegationQueryWatcher: M.interface(
|
|
248
|
+
'unbondingDelegationQueryWatcher',
|
|
249
|
+
{
|
|
250
|
+
onFulfilled: M.call(M.arrayOf(M.record())).returns(M.record()),
|
|
251
|
+
},
|
|
252
|
+
),
|
|
253
|
+
unbondingDelegationsQueryWatcher: M.interface(
|
|
254
|
+
'unbondingDelegationsQueryWatcher',
|
|
255
|
+
{
|
|
256
|
+
onFulfilled: M.call(M.arrayOf(M.record())).returns(
|
|
257
|
+
M.arrayOf(M.record()),
|
|
258
|
+
),
|
|
259
|
+
},
|
|
260
|
+
),
|
|
261
|
+
redelegationQueryWatcher: M.interface('redelegationQueryWatcher', {
|
|
262
|
+
onFulfilled: M.call(M.arrayOf(M.record())).returns(
|
|
263
|
+
M.arrayOf(M.record()),
|
|
264
|
+
),
|
|
265
|
+
}),
|
|
266
|
+
redelegationsQueryWatcher: M.interface('redelegationsQueryWatcher', {
|
|
267
|
+
onFulfilled: M.call(M.arrayOf(M.record())).returns(
|
|
268
|
+
M.arrayOf(M.record()),
|
|
269
|
+
),
|
|
270
|
+
}),
|
|
271
|
+
rewardQueryWatcher: M.interface('rewardQueryWatcher', {
|
|
272
|
+
onFulfilled: M.call(M.arrayOf(M.record())).returns(
|
|
273
|
+
M.arrayOf(M.record()),
|
|
274
|
+
),
|
|
275
|
+
}),
|
|
276
|
+
rewardsQueryWatcher: M.interface('rewardsQueryWatcher', {
|
|
277
|
+
onFulfilled: M.call(M.arrayOf(M.record())).returns(M.record()),
|
|
278
|
+
}),
|
|
201
279
|
holder: IcaAccountHolderI,
|
|
202
280
|
invitationMakers: CosmosOrchestrationInvitationMakersI,
|
|
203
281
|
},
|
|
@@ -273,6 +351,134 @@ export const prepareCosmosOrchestrationAccountKit = (
|
|
|
273
351
|
return harden(toDenomAmount(balance));
|
|
274
352
|
},
|
|
275
353
|
},
|
|
354
|
+
delegationQueryWatcher: {
|
|
355
|
+
/**
|
|
356
|
+
* @param {JsonSafe<ResponseQuery>[]} results
|
|
357
|
+
* @returns {CosmosDelegationResponse}
|
|
358
|
+
*/
|
|
359
|
+
onFulfilled([result]) {
|
|
360
|
+
if (!result?.key) throw Fail`Error parsing result ${result}`;
|
|
361
|
+
const { delegationResponse } = QueryDelegationResponse.decode(
|
|
362
|
+
decodeBase64(result.key),
|
|
363
|
+
);
|
|
364
|
+
if (!delegationResponse)
|
|
365
|
+
throw Fail`Result lacked delegationResponse key: ${result}`;
|
|
366
|
+
const { chainAddress } = this.state;
|
|
367
|
+
return harden(
|
|
368
|
+
toCosmosDelegationResponse(chainAddress, delegationResponse),
|
|
369
|
+
);
|
|
370
|
+
},
|
|
371
|
+
},
|
|
372
|
+
delegationsQueryWatcher: {
|
|
373
|
+
/**
|
|
374
|
+
* @param {JsonSafe<ResponseQuery>[]} results
|
|
375
|
+
* @returns {CosmosDelegationResponse[]}
|
|
376
|
+
*/
|
|
377
|
+
onFulfilled([result]) {
|
|
378
|
+
if (!result?.key) throw Fail`Error parsing result ${result}`;
|
|
379
|
+
const { delegationResponses } =
|
|
380
|
+
QueryDelegatorDelegationsResponse.decode(decodeBase64(result.key));
|
|
381
|
+
if (!delegationResponses)
|
|
382
|
+
throw Fail`Result lacked delegationResponses key: ${result}`;
|
|
383
|
+
const { chainAddress } = this.state;
|
|
384
|
+
return harden(
|
|
385
|
+
delegationResponses.map(r =>
|
|
386
|
+
toCosmosDelegationResponse(chainAddress, r),
|
|
387
|
+
),
|
|
388
|
+
);
|
|
389
|
+
},
|
|
390
|
+
},
|
|
391
|
+
unbondingDelegationQueryWatcher: {
|
|
392
|
+
/**
|
|
393
|
+
* @param {JsonSafe<ResponseQuery>[]} results
|
|
394
|
+
*/
|
|
395
|
+
onFulfilled([result]) {
|
|
396
|
+
if (!result?.key) throw Fail`Error parsing result ${result}`;
|
|
397
|
+
const { unbond } = QueryUnbondingDelegationResponse.decode(
|
|
398
|
+
decodeBase64(result.key),
|
|
399
|
+
);
|
|
400
|
+
if (!unbond) throw Fail`Result lacked unbond key: ${result}`;
|
|
401
|
+
return harden(unbond);
|
|
402
|
+
},
|
|
403
|
+
},
|
|
404
|
+
unbondingDelegationsQueryWatcher: {
|
|
405
|
+
/**
|
|
406
|
+
* @param {JsonSafe<ResponseQuery>[]} results
|
|
407
|
+
*/
|
|
408
|
+
onFulfilled([result]) {
|
|
409
|
+
if (!result?.key) throw Fail`Error parsing result ${result}`;
|
|
410
|
+
const { unbondingResponses } =
|
|
411
|
+
QueryDelegatorUnbondingDelegationsResponse.decode(
|
|
412
|
+
decodeBase64(result.key),
|
|
413
|
+
);
|
|
414
|
+
if (!unbondingResponses)
|
|
415
|
+
throw Fail`Result lacked unbondingResponses key: ${result}`;
|
|
416
|
+
return harden(unbondingResponses);
|
|
417
|
+
},
|
|
418
|
+
},
|
|
419
|
+
redelegationQueryWatcher: {
|
|
420
|
+
/**
|
|
421
|
+
* @param {JsonSafe<ResponseQuery>[]} results
|
|
422
|
+
*/
|
|
423
|
+
onFulfilled([result]) {
|
|
424
|
+
if (!result?.key) throw Fail`Error parsing result ${result}`;
|
|
425
|
+
const { redelegationResponses } = QueryRedelegationsResponse.decode(
|
|
426
|
+
decodeBase64(result.key),
|
|
427
|
+
);
|
|
428
|
+
if (!redelegationResponses)
|
|
429
|
+
throw Fail`Result lacked redelegationResponses key: ${result}`;
|
|
430
|
+
return harden(redelegationResponses);
|
|
431
|
+
},
|
|
432
|
+
},
|
|
433
|
+
redelegationsQueryWatcher: {
|
|
434
|
+
/**
|
|
435
|
+
* @param {JsonSafe<ResponseQuery>[]} results
|
|
436
|
+
*/
|
|
437
|
+
onFulfilled([result]) {
|
|
438
|
+
if (!result?.key) throw Fail`Error parsing result ${result}`;
|
|
439
|
+
const { redelegationResponses } = QueryRedelegationsResponse.decode(
|
|
440
|
+
decodeBase64(result.key),
|
|
441
|
+
);
|
|
442
|
+
if (!redelegationResponses)
|
|
443
|
+
throw Fail`Result lacked redelegationResponses key: ${result}`;
|
|
444
|
+
return harden(redelegationResponses);
|
|
445
|
+
},
|
|
446
|
+
},
|
|
447
|
+
rewardQueryWatcher: {
|
|
448
|
+
/**
|
|
449
|
+
* @param {JsonSafe<ResponseQuery>[]} results
|
|
450
|
+
*/
|
|
451
|
+
onFulfilled([result]) {
|
|
452
|
+
if (!result?.key) throw Fail`Error parsing result ${result}`;
|
|
453
|
+
const { rewards } = QueryDelegationRewardsResponse.decode(
|
|
454
|
+
decodeBase64(result.key),
|
|
455
|
+
);
|
|
456
|
+
if (!rewards) throw Fail`Result lacked rewards key: ${result}`;
|
|
457
|
+
return harden(rewards.map(toTruncatedDenomAmount));
|
|
458
|
+
},
|
|
459
|
+
},
|
|
460
|
+
rewardsQueryWatcher: {
|
|
461
|
+
/**
|
|
462
|
+
* @param {JsonSafe<ResponseQuery>[]} results
|
|
463
|
+
* @returns {CosmosRewardsResponse}
|
|
464
|
+
*/
|
|
465
|
+
onFulfilled([result]) {
|
|
466
|
+
if (!result?.key) throw Fail`Error parsing result ${result}`;
|
|
467
|
+
const { rewards, total } = QueryDelegationTotalRewardsResponse.decode(
|
|
468
|
+
decodeBase64(result.key),
|
|
469
|
+
);
|
|
470
|
+
if (!rewards || !total)
|
|
471
|
+
throw Fail`Result lacked rewards or total key: ${result}`;
|
|
472
|
+
const { chainAddress } = this.state;
|
|
473
|
+
return harden({
|
|
474
|
+
rewards: rewards.map(reward => ({
|
|
475
|
+
validator: toCosmosValidatorAddress(reward, chainAddress.chainId),
|
|
476
|
+
reward: reward.reward.map(toTruncatedDenomAmount),
|
|
477
|
+
})),
|
|
478
|
+
total: total.map(toTruncatedDenomAmount),
|
|
479
|
+
});
|
|
480
|
+
},
|
|
481
|
+
},
|
|
276
482
|
allBalancesQueryWatcher: {
|
|
277
483
|
/**
|
|
278
484
|
* @param {JsonSafe<ResponseQuery>[]} results
|
|
@@ -475,14 +681,14 @@ export const prepareCosmosOrchestrationAccountKit = (
|
|
|
475
681
|
* {
|
|
476
682
|
* amount: AmountArg;
|
|
477
683
|
* destination: ChainAddress;
|
|
478
|
-
* opts
|
|
684
|
+
* opts?: IBCMsgTransferOptions;
|
|
479
685
|
* }
|
|
480
686
|
* >}
|
|
481
687
|
*/
|
|
482
688
|
const offerHandler = (seat, { amount, destination, opts }) => {
|
|
483
689
|
seat.exit();
|
|
484
690
|
return watch(
|
|
485
|
-
this.facets.holder.transfer(
|
|
691
|
+
this.facets.holder.transfer(destination, amount, opts),
|
|
486
692
|
);
|
|
487
693
|
};
|
|
488
694
|
return zcf.makeInvitation(offerHandler, 'Transfer');
|
|
@@ -675,8 +881,8 @@ export const prepareCosmosOrchestrationAccountKit = (
|
|
|
675
881
|
},
|
|
676
882
|
|
|
677
883
|
/** @type {HostOf<OrchestrationAccountI['transfer']>} */
|
|
678
|
-
transfer(
|
|
679
|
-
trace('transfer',
|
|
884
|
+
transfer(destination, amount, opts) {
|
|
885
|
+
trace('transfer', destination, amount, opts);
|
|
680
886
|
return asVow(() => {
|
|
681
887
|
const { helper } = this.facets;
|
|
682
888
|
const token = helper.amountToCoin(amount);
|
|
@@ -726,6 +932,10 @@ export const prepareCosmosOrchestrationAccountKit = (
|
|
|
726
932
|
const { helper } = this.facets;
|
|
727
933
|
const { chainAddress } = this.state;
|
|
728
934
|
|
|
935
|
+
delegations.every(d =>
|
|
936
|
+
d.delegator ? d.delegator.value === chainAddress.value : true,
|
|
937
|
+
) || Fail`Some delegation record is for another delegator`;
|
|
938
|
+
|
|
729
939
|
const undelegateV = watch(
|
|
730
940
|
E(helper.owned()).executeEncodedTx(
|
|
731
941
|
delegations.map(({ validator, amount }) =>
|
|
@@ -751,6 +961,138 @@ export const prepareCosmosOrchestrationAccountKit = (
|
|
|
751
961
|
reactivate() {
|
|
752
962
|
return watch(E(this.facets.helper.owned()).reactivate());
|
|
753
963
|
},
|
|
964
|
+
/** @type {HostOf<StakingAccountQueries['getDelegation']>} */
|
|
965
|
+
getDelegation(validator) {
|
|
966
|
+
return asVow(() => {
|
|
967
|
+
trace('getDelegation', validator);
|
|
968
|
+
const { chainAddress, icqConnection } = this.state;
|
|
969
|
+
if (!icqConnection) {
|
|
970
|
+
throw Fail`Queries not available for chain ${q(chainAddress.chainId)}`;
|
|
971
|
+
}
|
|
972
|
+
const results = E(icqConnection).query([
|
|
973
|
+
toRequestQueryJson(
|
|
974
|
+
QueryDelegationRequest.toProtoMsg({
|
|
975
|
+
delegatorAddr: chainAddress.value,
|
|
976
|
+
validatorAddr: validator.value,
|
|
977
|
+
}),
|
|
978
|
+
),
|
|
979
|
+
]);
|
|
980
|
+
return watch(results, this.facets.delegationQueryWatcher);
|
|
981
|
+
});
|
|
982
|
+
},
|
|
983
|
+
/** @type {HostOf<StakingAccountQueries['getDelegations']>} */
|
|
984
|
+
getDelegations() {
|
|
985
|
+
return asVow(() => {
|
|
986
|
+
trace('getDelegations');
|
|
987
|
+
const { chainAddress, icqConnection } = this.state;
|
|
988
|
+
if (!icqConnection) {
|
|
989
|
+
throw Fail`Queries not available for chain ${q(chainAddress.chainId)}`;
|
|
990
|
+
}
|
|
991
|
+
const results = E(icqConnection).query([
|
|
992
|
+
toRequestQueryJson(
|
|
993
|
+
QueryDelegatorDelegationsRequest.toProtoMsg({
|
|
994
|
+
delegatorAddr: chainAddress.value,
|
|
995
|
+
}),
|
|
996
|
+
),
|
|
997
|
+
]);
|
|
998
|
+
return watch(results, this.facets.delegationsQueryWatcher);
|
|
999
|
+
});
|
|
1000
|
+
},
|
|
1001
|
+
/** @type {HostOf<StakingAccountQueries['getUnbondingDelegation']>} */
|
|
1002
|
+
getUnbondingDelegation(validator) {
|
|
1003
|
+
return asVow(() => {
|
|
1004
|
+
trace('getUnbondingDelegation', validator);
|
|
1005
|
+
const { chainAddress, icqConnection } = this.state;
|
|
1006
|
+
if (!icqConnection) {
|
|
1007
|
+
throw Fail`Queries not available for chain ${q(chainAddress.chainId)}`;
|
|
1008
|
+
}
|
|
1009
|
+
const results = E(icqConnection).query([
|
|
1010
|
+
toRequestQueryJson(
|
|
1011
|
+
QueryUnbondingDelegationRequest.toProtoMsg({
|
|
1012
|
+
delegatorAddr: chainAddress.value,
|
|
1013
|
+
validatorAddr: validator.value,
|
|
1014
|
+
}),
|
|
1015
|
+
),
|
|
1016
|
+
]);
|
|
1017
|
+
return watch(results, this.facets.unbondingDelegationQueryWatcher);
|
|
1018
|
+
});
|
|
1019
|
+
},
|
|
1020
|
+
/** @type {HostOf<StakingAccountQueries['getUnbondingDelegations']>} */
|
|
1021
|
+
getUnbondingDelegations() {
|
|
1022
|
+
return asVow(() => {
|
|
1023
|
+
trace('getUnbondingDelegations');
|
|
1024
|
+
const { chainAddress, icqConnection } = this.state;
|
|
1025
|
+
if (!icqConnection) {
|
|
1026
|
+
throw Fail`Queries not available for chain ${q(chainAddress.chainId)}`;
|
|
1027
|
+
}
|
|
1028
|
+
const results = E(icqConnection).query([
|
|
1029
|
+
toRequestQueryJson(
|
|
1030
|
+
QueryDelegatorUnbondingDelegationsRequest.toProtoMsg({
|
|
1031
|
+
delegatorAddr: chainAddress.value,
|
|
1032
|
+
}),
|
|
1033
|
+
),
|
|
1034
|
+
]);
|
|
1035
|
+
return watch(results, this.facets.unbondingDelegationsQueryWatcher);
|
|
1036
|
+
});
|
|
1037
|
+
},
|
|
1038
|
+
/** @type {HostOf<StakingAccountQueries['getRedelegations']>} */
|
|
1039
|
+
getRedelegations() {
|
|
1040
|
+
return asVow(() => {
|
|
1041
|
+
trace('getRedelegations');
|
|
1042
|
+
const { chainAddress, icqConnection } = this.state;
|
|
1043
|
+
if (!icqConnection) {
|
|
1044
|
+
throw Fail`Queries not available for chain ${q(chainAddress.chainId)}`;
|
|
1045
|
+
}
|
|
1046
|
+
const results = E(icqConnection).query([
|
|
1047
|
+
toRequestQueryJson(
|
|
1048
|
+
QueryRedelegationsRequest.toProtoMsg({
|
|
1049
|
+
delegatorAddr: chainAddress.value,
|
|
1050
|
+
// These are optional but the protobufs require values to be set
|
|
1051
|
+
dstValidatorAddr: '',
|
|
1052
|
+
srcValidatorAddr: '',
|
|
1053
|
+
}),
|
|
1054
|
+
),
|
|
1055
|
+
]);
|
|
1056
|
+
return watch(results, this.facets.redelegationsQueryWatcher);
|
|
1057
|
+
});
|
|
1058
|
+
},
|
|
1059
|
+
/** @type {HostOf<StakingAccountQueries['getReward']>} */
|
|
1060
|
+
getReward(validator) {
|
|
1061
|
+
return asVow(() => {
|
|
1062
|
+
trace('getReward', validator);
|
|
1063
|
+
const { chainAddress, icqConnection } = this.state;
|
|
1064
|
+
if (!icqConnection) {
|
|
1065
|
+
throw Fail`Queries not available for chain ${q(chainAddress.chainId)}`;
|
|
1066
|
+
}
|
|
1067
|
+
const results = E(icqConnection).query([
|
|
1068
|
+
toRequestQueryJson(
|
|
1069
|
+
QueryDelegationRewardsRequest.toProtoMsg({
|
|
1070
|
+
delegatorAddress: chainAddress.value,
|
|
1071
|
+
validatorAddress: validator.value,
|
|
1072
|
+
}),
|
|
1073
|
+
),
|
|
1074
|
+
]);
|
|
1075
|
+
return watch(results, this.facets.rewardQueryWatcher);
|
|
1076
|
+
});
|
|
1077
|
+
},
|
|
1078
|
+
/** @type {HostOf<StakingAccountQueries['getRewards']>} */
|
|
1079
|
+
getRewards() {
|
|
1080
|
+
return asVow(() => {
|
|
1081
|
+
trace('getRewards');
|
|
1082
|
+
const { chainAddress, icqConnection } = this.state;
|
|
1083
|
+
if (!icqConnection) {
|
|
1084
|
+
throw Fail`Queries not available for chain ${q(chainAddress.chainId)}`;
|
|
1085
|
+
}
|
|
1086
|
+
const results = E(icqConnection).query([
|
|
1087
|
+
toRequestQueryJson(
|
|
1088
|
+
QueryDelegationTotalRewardsRequest.toProtoMsg({
|
|
1089
|
+
delegatorAddress: chainAddress.value,
|
|
1090
|
+
}),
|
|
1091
|
+
),
|
|
1092
|
+
]);
|
|
1093
|
+
return watch(results, this.facets.rewardsQueryWatcher);
|
|
1094
|
+
});
|
|
1095
|
+
},
|
|
754
1096
|
},
|
|
755
1097
|
},
|
|
756
1098
|
);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { IBCConnectionID } from '@agoric/vats';
|
|
2
2
|
import type { Vow } from '@agoric/vow';
|
|
3
|
-
import type { IcaAccount } from '../cosmos-api.
|
|
4
|
-
import type { ICAChannelAddressOpts } from '../utils/address';
|
|
5
|
-
import type { ICQConnection } from './icq-connection-kit';
|
|
3
|
+
import type { IcaAccount } from '../cosmos-api.js';
|
|
4
|
+
import type { ICAChannelAddressOpts } from '../utils/address.js';
|
|
5
|
+
import type { ICQConnection } from './icq-connection-kit.js';
|
|
6
6
|
/**
|
|
7
7
|
* Authority to make a Cosmos interchain account or an interchain query connection.
|
|
8
8
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exo-interfaces.d.ts","sourceRoot":"","sources":["exo-interfaces.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"exo-interfaces.d.ts","sourceRoot":"","sources":["exo-interfaces.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AACjE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAE7D;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC;;;;;;;;OAQG;IACH,WAAW,CACT,OAAO,EAAE,MAAM,EACf,gBAAgB,EAAE,eAAe,EACjC,sBAAsB,EAAE,eAAe,EACvC,IAAI,CAAC,EAAE,qBAAqB,GAAG,SAAS,GACvC,GAAG,CAAC,UAAU,CAAC,CAAC;IACnB;;;;OAIG;IACH,oBAAoB,CAClB,sBAAsB,EAAE,eAAe,EACvC,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,GAC3B,GAAG,CAAC,aAAa,CAAC,GAAG,aAAa,CAAC;CACvC"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { IBCConnectionID } from '@agoric/vats';
|
|
2
2
|
import type { Vow } from '@agoric/vow';
|
|
3
|
-
import type { IcaAccount } from '../cosmos-api.
|
|
4
|
-
import type { ICAChannelAddressOpts } from '../utils/address';
|
|
5
|
-
import type { ICQConnection } from './icq-connection-kit';
|
|
3
|
+
import type { IcaAccount } from '../cosmos-api.js';
|
|
4
|
+
import type { ICAChannelAddressOpts } from '../utils/address.js';
|
|
5
|
+
import type { ICQConnection } from './icq-connection-kit.js';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Authority to make a Cosmos interchain account or an interchain query connection.
|
|
@@ -32,9 +32,9 @@ export function prepareIcaAccountKit(zone: Zone, { watch, asVow }: VowTools): (c
|
|
|
32
32
|
*/
|
|
33
33
|
executeEncodedTx(msgs: AnyJson[], opts?: Omit<TxBody, "messages"> | undefined): Vow<string>;
|
|
34
34
|
/** @type {HostOf<IcaAccount['deactivate']>} */
|
|
35
|
-
deactivate(): Vow<void
|
|
35
|
+
deactivate(): Vow<void>;
|
|
36
36
|
/** @type {HostOf<IcaAccount['reactivate']>} */
|
|
37
|
-
reactivate(): Vow<void
|
|
37
|
+
reactivate(): Vow<void>;
|
|
38
38
|
};
|
|
39
39
|
connectionHandler: {
|
|
40
40
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ica-account-kit.d.ts","sourceRoot":"","sources":["ica-account-kit.js"],"names":[],"mappings":"AA8BA;;;;;;;;;GAWG;AA0BI,2CAJI,IAAI,oBACJ,QAAQ;;QAiCX,0BAA0B;yBAAd,MAAM;;;QAMlB,8BAA8B;sBAAhB,YAAY;;;;;QAyB1B;;;;;;;;;WASG;+BALQ,OAAO,EAAE,gDAEP,IAAI,MAAM,CAAC;QAgBxB,+CAA+C;;QAS/C,+CAA+C;;;;QAiB/C;;;;WAIG;2BAHQ,OAAO,UAAU,CAAC,aAClB,eAAe,cACf,gBAAgB;QAiB3B;;;;;;;;;;;;;;;;WAgBG;6BAHQ,OAAO,UAAU,CAAC,UAClB,OAAO;;GAkBvB;;;;oBAtLU;
|
|
1
|
+
{"version":3,"file":"ica-account-kit.d.ts","sourceRoot":"","sources":["ica-account-kit.js"],"names":[],"mappings":"AA8BA;;;;;;;;;GAWG;AA0BI,2CAJI,IAAI,oBACJ,QAAQ;;QAiCX,0BAA0B;yBAAd,MAAM;;;QAMlB,8BAA8B;sBAAhB,YAAY;;;;;QAyB1B;;;;;;;;;WASG;+BALQ,OAAO,EAAE,gDAEP,IAAI,MAAM,CAAC;QAgBxB,+CAA+C;;QAS/C,+CAA+C;;;;QAiB/C;;;;WAIG;2BAHQ,OAAO,UAAU,CAAC,aAClB,eAAe,cACf,gBAAgB;QAiB3B;;;;;;;;;;;;;;;;WAgBG;6BAHQ,OAAO,UAAU,CAAC,UAClB,OAAO;;GAkBvB;;;;oBAtLU;IACR,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,IAAI,CAAC;IACX,UAAU,EAAE,OAAO,UAAU,CAAC,GAAG,SAAS,CAAC;IAC3C,YAAY,EAAE,eAAe,GAAG,SAAS,CAAC;IAC1C,sBAAsB,EAAE,MAAM,CAAC;IAC/B,aAAa,EAAE,gBAAgB,GAAG,SAAS,CAAC;IAC5C,YAAY,EAAE,YAAY,GAAG,SAAS,CAAC;IACvC,iBAAiB,EAAE,OAAO,CAAC;CAC5B;4BA+KU,UAAU,CAAC,UAAU,CAAC,OAAO,oBAAoB,CAAC,CAAC;0BArN1C,mBAAmB;8BAEF,aAAa;0BADlB,iBAAiB;kCAKT,aAAa;yBAJhB,aAAa;6BAC3B,sBAAsB;4BACvB,8CAA8C;gCAHpC,iBAAiB;4BACZ,aAAa;qCAGD,iCAAiC;sCAAjC,iCAAiC"}
|
|
@@ -17,7 +17,23 @@ export function prepareICQConnectionKit(zone: Zone, { watch, asVow }: VowTools):
|
|
|
17
17
|
};
|
|
18
18
|
parseQueryPacketWatcher: {
|
|
19
19
|
/** @param {string} ack packet acknowledgement string */
|
|
20
|
-
onFulfilled(ack: string):
|
|
20
|
+
onFulfilled(ack: string): {
|
|
21
|
+
code: number;
|
|
22
|
+
log: string;
|
|
23
|
+
info: string;
|
|
24
|
+
index: string;
|
|
25
|
+
key: string;
|
|
26
|
+
value: string;
|
|
27
|
+
proofOps?: {
|
|
28
|
+
ops: {
|
|
29
|
+
type: string;
|
|
30
|
+
key: string;
|
|
31
|
+
data: string;
|
|
32
|
+
}[];
|
|
33
|
+
} | undefined;
|
|
34
|
+
height: string;
|
|
35
|
+
codespace: string;
|
|
36
|
+
}[];
|
|
21
37
|
};
|
|
22
38
|
connectionHandler: {
|
|
23
39
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"icq-connection-kit.d.ts","sourceRoot":"","sources":["icq-connection-kit.js"],"names":[],"mappings":"AAoBA;;;;GAIG;AA8BI,8CAJI,IAAI,oBACJ,QAAQ;;;;QAqCX;;;;;WAKG;oBAFQ,SAAS,YAAY,CAAC,EAAE,GACtB,IAAI,SAAS,aAAa,CAAC,EAAE,CAAC;;;QAc3C,wDAAwD;yBAA5C,MAAM
|
|
1
|
+
{"version":3,"file":"icq-connection-kit.d.ts","sourceRoot":"","sources":["icq-connection-kit.js"],"names":[],"mappings":"AAoBA;;;;GAIG;AA8BI,8CAJI,IAAI,oBACJ,QAAQ;;;;QAqCX;;;;;WAKG;oBAFQ,SAAS,YAAY,CAAC,EAAE,GACtB,IAAI,SAAS,aAAa,CAAC,EAAE,CAAC;;;QAc3C,wDAAwD;yBAA5C,MAAM;;;;;;;;;;;;;;;;;;;QAMlB;;;;WAIG;2BAHQ,OAAO,UAAU,CAAC,aAClB,eAAe,cACf,gBAAgB;;;GAahC;oCArGU;IACR,IAAI,EAAE,IAAI,CAAC;IACX,UAAU,EAAE,OAAO,UAAU,CAAC,GAAG,SAAS,CAAC;IAC3C,YAAY,EAAE,eAAe,GAAG,SAAS,CAAC;IAC1C,aAAa,EAAE,gBAAgB,GAAG,SAAS,CAAC;CAC7C;+BAkGU,UAAU,CAAC,UAAU,CAAC,OAAO,uBAAuB,CAAC,CAAC;4BACtD,gBAAgB,CAAC,YAAY,CAAC;0BAzHrB,mBAAmB;8BAEF,aAAa;0BADlB,iBAAiB;kCAGN,+CAA+C;8BADlE,sBAAsB;mCACH,+CAA+C;yBAFrD,aAAa;gCADlB,iBAAiB;4BACZ,aAAa;qCAGD,iCAAiC;sCAAjC,iCAAiC"}
|