@agoric/orchestration 0.1.1-dev-6b5e706.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.
- package/index.d.ts +4 -0
- package/index.js +0 -1
- package/package.json +17 -15
- package/src/chain-info.d.ts +37 -0
- package/src/chain-info.d.ts.map +1 -0
- package/src/chain-info.ts +64 -0
- package/src/cosmos-api.d.ts +159 -0
- package/src/cosmos-api.d.ts.map +1 -0
- package/src/cosmos-api.ts +199 -0
- package/src/ethereum-api.d.ts +8 -0
- package/src/ethereum-api.d.ts.map +1 -0
- package/src/ethereum-api.ts +7 -0
- package/src/examples/stakeAtom.contract.d.ts +84 -0
- package/src/examples/stakeAtom.contract.d.ts.map +1 -0
- package/src/examples/stakeAtom.contract.js +0 -1
- package/src/examples/stakeBld.contract.d.ts +39 -0
- package/src/examples/stakeBld.contract.d.ts.map +1 -0
- package/src/examples/stakeBld.contract.js +0 -1
- package/src/examples/swapExample.contract.d.ts +31 -0
- package/src/examples/swapExample.contract.d.ts.map +1 -0
- package/src/examples/swapExample.contract.js +2 -3
- package/src/examples/unbondExample.contract.d.ts +24 -0
- package/src/examples/unbondExample.contract.d.ts.map +1 -0
- package/src/examples/unbondExample.contract.js +1 -2
- package/src/exos/chainAccountKit.d.ts +71 -0
- package/src/exos/chainAccountKit.d.ts.map +1 -0
- package/src/exos/chainAccountKit.js +0 -1
- package/src/exos/icqConnectionKit.d.ts +43 -0
- package/src/exos/icqConnectionKit.d.ts.map +1 -0
- package/src/exos/icqConnectionKit.js +0 -1
- package/src/exos/localchainAccountKit.d.ts +68 -0
- package/src/exos/localchainAccountKit.d.ts.map +1 -0
- package/src/exos/localchainAccountKit.js +0 -1
- package/src/exos/stakingAccountKit.d.ts +146 -0
- package/src/exos/stakingAccountKit.d.ts.map +1 -0
- package/src/exos/stakingAccountKit.js +12 -13
- package/src/facade.d.ts +29 -0
- package/src/facade.d.ts.map +1 -0
- package/src/facade.js +7 -3
- package/src/orchestration-api.d.ts +158 -0
- package/src/orchestration-api.d.ts.map +1 -0
- package/src/orchestration-api.ts +195 -0
- package/src/proposals/orchestration-proposal.d.ts +629 -0
- package/src/proposals/orchestration-proposal.d.ts.map +1 -0
- package/src/proposals/orchestration-proposal.js +0 -1
- package/src/proposals/start-stakeAtom.d.ts +115 -0
- package/src/proposals/start-stakeAtom.d.ts.map +1 -0
- package/src/proposals/start-stakeAtom.js +0 -1
- package/src/proposals/start-stakeBld.d.ts +80 -0
- package/src/proposals/start-stakeBld.d.ts.map +1 -0
- package/src/proposals/start-stakeBld.js +2 -2
- package/src/service.d.ts +67 -0
- package/src/service.d.ts.map +1 -0
- package/src/service.js +2 -3
- package/src/typeGuards.d.ts +28 -0
- package/src/typeGuards.d.ts.map +1 -0
- package/src/types.d.ts +8 -482
- package/src/types.d.ts.map +1 -0
- package/src/types.ts +10 -0
- package/src/utils/address.d.ts +11 -0
- package/src/utils/address.d.ts.map +1 -0
- package/src/utils/address.js +0 -1
- package/src/utils/orc.d.ts +14 -0
- package/src/utils/orc.d.ts.map +1 -0
- package/src/utils/orc.js +0 -1
- package/src/utils/packet.d.ts +52 -0
- package/src/utils/packet.d.ts.map +1 -0
- package/src/utils/packet.js +0 -1
- package/src/vat-orchestration.d.ts +36 -0
- package/src/vat-orchestration.d.ts.map +1 -0
- package/src/vat-orchestration.js +0 -1
- package/src/types.js +0 -6
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
export function start(zcf: ZCF, privateArgs: {
|
|
2
|
+
localchain: import("@agoric/vats/src/localchain.js").LocalChain;
|
|
3
|
+
marshaller: Marshaller;
|
|
4
|
+
storageNode: StorageNode;
|
|
5
|
+
}, baggage: import("@agoric/vat-data").Baggage): Promise<{
|
|
6
|
+
publicFacet: import("@endo/exo").Guarded<{
|
|
7
|
+
makeStakeBldInvitation(): Promise<Invitation<{
|
|
8
|
+
publicSubscribers: {
|
|
9
|
+
account: {
|
|
10
|
+
description: string;
|
|
11
|
+
subscriber: globalThis.Subscriber<import("../exos/localchainAccountKit.js").LocalChainAccountNotification>;
|
|
12
|
+
storagePath: Promise<string>;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
invitationMakers: import("@endo/exo").Guarded<{
|
|
16
|
+
Delegate(validatorAddress: any, amount: any): Promise<Invitation<(import("@agoric/cosmic-proto/cosmos/staking/v1beta1/tx.js").MsgDelegateResponse & {
|
|
17
|
+
'@type': "/cosmos.staking.v1beta1.MsgDelegateResponse";
|
|
18
|
+
})[], undefined>>;
|
|
19
|
+
CloseAccount(): never;
|
|
20
|
+
TransferAccount(): never;
|
|
21
|
+
}>;
|
|
22
|
+
account: import("@endo/exo").Guarded<{
|
|
23
|
+
getPublicTopics(): {
|
|
24
|
+
account: {
|
|
25
|
+
description: string;
|
|
26
|
+
subscriber: globalThis.Subscriber<import("../exos/localchainAccountKit.js").LocalChainAccountNotification>;
|
|
27
|
+
storagePath: Promise<string>;
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
makeDelegateInvitation(validatorAddress: string, ertpAmount: Amount<"nat">): Promise<Invitation<(import("@agoric/cosmic-proto/cosmos/staking/v1beta1/tx.js").MsgDelegateResponse & {
|
|
31
|
+
'@type': "/cosmos.staking.v1beta1.MsgDelegateResponse";
|
|
32
|
+
})[], undefined>>;
|
|
33
|
+
makeCloseAccountInvitation(): never;
|
|
34
|
+
makeTransferAccountInvitation(): never;
|
|
35
|
+
}>;
|
|
36
|
+
}, undefined>>;
|
|
37
|
+
}>;
|
|
38
|
+
}>;
|
|
39
|
+
//# sourceMappingURL=stakeBld.contract.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stakeBld.contract.d.ts","sourceRoot":"","sources":["stakeBld.contract.js"],"names":[],"mappings":"AAyBO,2BARI,GAAG,eACH;IACV,UAAc,EAAE,OAAO,gCAAgC,EAAE,UAAU,CAAC;IACpE,UAAc,EAAE,UAAU,CAAC;IAC3B,WAAe,EAAE,WAAW,CAAC;CAC1B,WACO,OAAO,kBAAkB,EAAE,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;6EA0DyqC,OAAO,KAAK,CAAC;;;;;;;;GADluC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export function start(zcf: ZCF, privateArgs: {
|
|
2
|
+
orchestrationService: ERef<import("@endo/exo").Guarded<{
|
|
3
|
+
makeAccount(hostConnectionId: `connection-${number}`, controllerConnectionId: `connection-${number}`): Promise<IcaAccount>;
|
|
4
|
+
provideICQConnection(controllerConnectionId: `connection-${number}`): Promise<import("@endo/exo").Guarded<{
|
|
5
|
+
getLocalAddress(): `/ibc-port/${string}`;
|
|
6
|
+
getRemoteAddress(): `/${string}ibc-port/${string}/ordered/${string}` | `/${string}ibc-port/${string}/unordered/${string}`;
|
|
7
|
+
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>[]>;
|
|
8
|
+
}>>;
|
|
9
|
+
}>>;
|
|
10
|
+
storageNode: ERef<globalThis.StorageNode>;
|
|
11
|
+
timerService: ERef<TimerService>;
|
|
12
|
+
zone: Zone;
|
|
13
|
+
}): Promise<{
|
|
14
|
+
publicFacet: {
|
|
15
|
+
makeSwapAndStakeInvitation: () => Promise<Invitation<unknown, {
|
|
16
|
+
staked: Amount<"nat">;
|
|
17
|
+
validator: CosmosValidatorAddress;
|
|
18
|
+
}>>;
|
|
19
|
+
} & import("@endo/pass-style").RemotableObject<`Alleged: ${string}`> & import("@endo/eventual-send").RemotableBrand<{}, {
|
|
20
|
+
makeSwapAndStakeInvitation: () => Promise<Invitation<unknown, {
|
|
21
|
+
staked: Amount<"nat">;
|
|
22
|
+
validator: CosmosValidatorAddress;
|
|
23
|
+
}>>;
|
|
24
|
+
}>;
|
|
25
|
+
}>;
|
|
26
|
+
import type { IcaAccount } from '../types.js';
|
|
27
|
+
import type { ERef } from '@endo/far';
|
|
28
|
+
import type { TimerService } from '@agoric/time';
|
|
29
|
+
import type { Zone } from '@agoric/zone';
|
|
30
|
+
import type { CosmosValidatorAddress } from '../types.js';
|
|
31
|
+
//# sourceMappingURL=swapExample.contract.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"swapExample.contract.d.ts","sourceRoot":"","sources":["swapExample.contract.js"],"names":[],"mappings":"AAwBO,2BARI,GAAG;;;;;;;;;;;;;;;oBAoB8B,MAAM,CAAC,KAAK,CAAC;;;;;oBAAb,MAAM,CAAC,KAAK,CAAC;;;;GAgExD;gCA5FkE,aAAa;0BAEzD,WAAW;kCADH,cAAc;0BAGtB,cAAc;4CAJ8B,aAAa"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
// @ts-check
|
|
2
1
|
import { Fail } from '@agoric/assert';
|
|
3
2
|
import { AmountMath, AmountShape } from '@agoric/ertp';
|
|
4
3
|
import { E, Far } from '@endo/far';
|
|
@@ -7,7 +6,7 @@ import { makeOrchestrationFacade } from '../facade.js';
|
|
|
7
6
|
import { orcUtils } from '../utils/orc.js';
|
|
8
7
|
|
|
9
8
|
/**
|
|
10
|
-
* @import {Orchestrator,
|
|
9
|
+
* @import {Orchestrator, IcaAccount, CosmosValidatorAddress} from '../types.js'
|
|
11
10
|
* @import {TimerService} from '@agoric/time';
|
|
12
11
|
* @import {ERef} from '@endo/far'
|
|
13
12
|
* @import {OrchestrationService} from '../service.js';
|
|
@@ -35,7 +34,7 @@ export const start = async (zcf, privateArgs) => {
|
|
|
35
34
|
});
|
|
36
35
|
|
|
37
36
|
/** deprecated historical example */
|
|
38
|
-
/** @type {OfferHandler} */
|
|
37
|
+
/** @type {OfferHandler<unknown, {staked: Amount<'nat'>, validator: CosmosValidatorAddress}>} */
|
|
39
38
|
const swapAndStakeHandler = orchestrate(
|
|
40
39
|
'LSTTia',
|
|
41
40
|
{ zcf },
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export function start(zcf: ZCF, privateArgs: {
|
|
2
|
+
orchestrationService: ERef<import("@endo/exo").Guarded<{
|
|
3
|
+
makeAccount(hostConnectionId: `connection-${number}`, controllerConnectionId: `connection-${number}`): Promise<IcaAccount>;
|
|
4
|
+
provideICQConnection(controllerConnectionId: `connection-${number}`): Promise<import("@endo/exo").Guarded<{
|
|
5
|
+
getLocalAddress(): `/ibc-port/${string}`;
|
|
6
|
+
getRemoteAddress(): `/${string}ibc-port/${string}/ordered/${string}` | `/${string}ibc-port/${string}/unordered/${string}`;
|
|
7
|
+
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>[]>;
|
|
8
|
+
}>>;
|
|
9
|
+
}>>;
|
|
10
|
+
storageNode: ERef<globalThis.StorageNode>;
|
|
11
|
+
timerService: ERef<TimerService>;
|
|
12
|
+
zone: Zone;
|
|
13
|
+
}): Promise<{
|
|
14
|
+
publicFacet: {
|
|
15
|
+
makeUnbondAndLiquidStakeInvitation: () => Promise<Invitation<unknown, never>>;
|
|
16
|
+
} & import("@endo/pass-style").RemotableObject<`Alleged: ${string}`> & import("@endo/eventual-send").RemotableBrand<{}, {
|
|
17
|
+
makeUnbondAndLiquidStakeInvitation: () => Promise<Invitation<unknown, never>>;
|
|
18
|
+
}>;
|
|
19
|
+
}>;
|
|
20
|
+
import type { IcaAccount } from '../types.js';
|
|
21
|
+
import type { ERef } from '@endo/far';
|
|
22
|
+
import type { TimerService } from '@agoric/time';
|
|
23
|
+
import type { Zone } from '@agoric/zone';
|
|
24
|
+
//# sourceMappingURL=unbondExample.contract.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unbondExample.contract.d.ts","sourceRoot":"","sources":["unbondExample.contract.js"],"names":[],"mappings":"AAuBO,2BARI,GAAG;;;;;;;;;;;;;;;;;;GAoEb;gCA5EkE,aAAa;0BAEzD,WAAW;kCADH,cAAc;0BAGtB,cAAc"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
// @ts-check
|
|
2
1
|
import { Fail } from '@agoric/assert';
|
|
3
2
|
import { AmountMath, AmountShape } from '@agoric/ertp';
|
|
4
3
|
import { Far } from '@endo/far';
|
|
@@ -6,7 +5,7 @@ import { M } from '@endo/patterns';
|
|
|
6
5
|
import { makeOrchestrationFacade } from '../facade.js';
|
|
7
6
|
|
|
8
7
|
/**
|
|
9
|
-
* @import {Orchestrator,
|
|
8
|
+
* @import {Orchestrator, IcaAccount, CosmosValidatorAddress} from '../types.js'
|
|
10
9
|
* @import {TimerService} from '@agoric/time';
|
|
11
10
|
* @import {ERef} from '@endo/far'
|
|
12
11
|
* @import {OrchestrationService} from '../service.js';
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
export const ChainAccountI: import("@endo/patterns").InterfaceGuard<{
|
|
2
|
+
getAddress: import("@endo/patterns").MethodGuard;
|
|
3
|
+
getLocalAddress: import("@endo/patterns").MethodGuard;
|
|
4
|
+
getRemoteAddress: import("@endo/patterns").MethodGuard;
|
|
5
|
+
getPort: import("@endo/patterns").MethodGuard;
|
|
6
|
+
executeTx: import("@endo/patterns").MethodGuard;
|
|
7
|
+
executeEncodedTx: import("@endo/patterns").MethodGuard;
|
|
8
|
+
close: import("@endo/patterns").MethodGuard;
|
|
9
|
+
deposit: import("@endo/patterns").MethodGuard;
|
|
10
|
+
getPurse: import("@endo/patterns").MethodGuard;
|
|
11
|
+
prepareTransfer: import("@endo/patterns").MethodGuard;
|
|
12
|
+
}>;
|
|
13
|
+
export function prepareChainAccountKit(zone: Zone): (port: Port, requestedRemoteAddress: string) => import("@endo/exo").GuardedKit<{
|
|
14
|
+
account: {
|
|
15
|
+
/**
|
|
16
|
+
* @returns {ChainAddress}
|
|
17
|
+
*/
|
|
18
|
+
getAddress(): ChainAddress;
|
|
19
|
+
getLocalAddress(): `/ibc-port/${string}`;
|
|
20
|
+
getRemoteAddress(): `/${string}ibc-port/${string}/ordered/${string}` | `/${string}ibc-port/${string}/unordered/${string}`;
|
|
21
|
+
getPort(): Port;
|
|
22
|
+
executeTx(): never;
|
|
23
|
+
/**
|
|
24
|
+
* Submit a transaction on behalf of the remote account for execution on the remote chain.
|
|
25
|
+
* @param {AnyJson[]} msgs
|
|
26
|
+
* @param {Omit<TxBody, 'messages'>} [opts]
|
|
27
|
+
* @returns {Promise<string>} - base64 encoded bytes string. Can be decoded using the corresponding `Msg*Response` object.
|
|
28
|
+
* @throws {Error} if packet fails to send or an error is returned
|
|
29
|
+
*/
|
|
30
|
+
executeEncodedTx(msgs: AnyJson[], opts?: Omit<TxBody, "messages"> | undefined): Promise<string>;
|
|
31
|
+
/**
|
|
32
|
+
* Close the remote account
|
|
33
|
+
*/
|
|
34
|
+
close(): Promise<void>;
|
|
35
|
+
deposit(payment: any): Promise<never>;
|
|
36
|
+
/**
|
|
37
|
+
* get Purse for a brand to .withdraw() a Payment from the account
|
|
38
|
+
* @param {Brand} brand
|
|
39
|
+
*/
|
|
40
|
+
getPurse(brand: Brand): Promise<never>;
|
|
41
|
+
prepareTransfer(): Promise<never>;
|
|
42
|
+
};
|
|
43
|
+
connectionHandler: {
|
|
44
|
+
/**
|
|
45
|
+
* @param {Remote<Connection>} connection
|
|
46
|
+
* @param {LocalIbcAddress} localAddr
|
|
47
|
+
* @param {RemoteIbcAddress} remoteAddr
|
|
48
|
+
*/
|
|
49
|
+
onOpen(connection: Remote<Connection>, localAddr: `/ibc-port/${string}`, remoteAddr: `/${string}ibc-port/${string}/ordered/${string}` | `/${string}ibc-port/${string}/unordered/${string}`): Promise<void>;
|
|
50
|
+
onClose(_connection: any, reason: any): Promise<void>;
|
|
51
|
+
onReceive(connection: any, bytes: any): Promise<string>;
|
|
52
|
+
};
|
|
53
|
+
}>;
|
|
54
|
+
export type UnparsableChainAddress = "UNPARSABLE_CHAIN_ADDRESS";
|
|
55
|
+
export type State = {
|
|
56
|
+
port: Port;
|
|
57
|
+
connection: Remote<Connection> | undefined;
|
|
58
|
+
localAddress: `/ibc-port/${string}` | undefined;
|
|
59
|
+
requestedRemoteAddress: string;
|
|
60
|
+
remoteAddress: `/${string}ibc-port/${string}/ordered/${string}` | `/${string}ibc-port/${string}/unordered/${string}` | undefined;
|
|
61
|
+
chainAddress: ChainAddress | undefined;
|
|
62
|
+
};
|
|
63
|
+
export type ChainAccountKit = ReturnType<ReturnType<typeof prepareChainAccountKit>>;
|
|
64
|
+
import type { Zone } from '@agoric/base-zone';
|
|
65
|
+
import type { Port } from '@agoric/network';
|
|
66
|
+
import type { ChainAddress } from '../types.js';
|
|
67
|
+
import type { AnyJson } from '@agoric/cosmic-proto';
|
|
68
|
+
import type { TxBody } from '@agoric/cosmic-proto/cosmos/tx/v1beta1/tx.js';
|
|
69
|
+
import type { Connection } from '@agoric/network';
|
|
70
|
+
import type { Remote } from '@agoric/vow';
|
|
71
|
+
//# sourceMappingURL=chainAccountKit.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chainAccountKit.d.ts","sourceRoot":"","sources":["chainAccountKit.js"],"names":[],"mappings":"AAmCA;;;;;;;;;;;GAaG;AAcI;;QAqBC;;WAEG;;;;;;QAyBH;;;;;;WAMG;wFAFU,OAAO,CAAC,MAAM,CAAC;QAY5B;;WAEG;;;QAaH;;;WAGG;wBADQ,KAAK;;;;QAahB;;;;WAIG;;;;;GAyBR;qCAzJW,0BAA0B;;;;;4BAuBX,MAAM;;;;8BAoIrB,UAAU,CAAC,UAAU,CAAC,OAAO,sBAAsB,CAAC,CAAC;0BAvK1C,mBAAmB;0BACP,iBAAiB;kCAKrB,aAAa;6BAHlB,sBAAsB;4BACvB,8CAA8C;gCAHpC,iBAAiB;4BAC3B,aAAa"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
export const ICQMsgShape: import("@endo/patterns").Matcher;
|
|
2
|
+
export const ICQConnectionI: import("@endo/patterns").InterfaceGuard<{
|
|
3
|
+
getLocalAddress: import("@endo/patterns").MethodGuard;
|
|
4
|
+
getRemoteAddress: import("@endo/patterns").MethodGuard;
|
|
5
|
+
query: import("@endo/patterns").MethodGuard;
|
|
6
|
+
}>;
|
|
7
|
+
export function prepareICQConnectionKit(zone: Zone): (port: Port) => import("@endo/exo").GuardedKit<{
|
|
8
|
+
connection: {
|
|
9
|
+
getLocalAddress(): `/ibc-port/${string}`;
|
|
10
|
+
getRemoteAddress(): `/${string}ibc-port/${string}/ordered/${string}` | `/${string}ibc-port/${string}/unordered/${string}`;
|
|
11
|
+
/**
|
|
12
|
+
* @param {RequestQueryJson[]} msgs
|
|
13
|
+
* @returns {Promise<Base64Any<ResponseQuery>[]>}
|
|
14
|
+
* @throws {Error} if packet fails to send or an error is returned
|
|
15
|
+
*/
|
|
16
|
+
query(msgs: import("@agoric/cosmic-proto").JsonSafe<import("@agoric/cosmic-proto/tendermint/abci/types.js").RequestQuery>[]): Promise<Base64Any<ResponseQuery>[]>;
|
|
17
|
+
};
|
|
18
|
+
connectionHandler: {
|
|
19
|
+
/**
|
|
20
|
+
* @param {Remote<Connection>} connection
|
|
21
|
+
* @param {LocalIbcAddress} localAddr
|
|
22
|
+
* @param {RemoteIbcAddress} remoteAddr
|
|
23
|
+
*/
|
|
24
|
+
onOpen(connection: Remote<Connection>, localAddr: `/ibc-port/${string}`, remoteAddr: `/${string}ibc-port/${string}/ordered/${string}` | `/${string}ibc-port/${string}/unordered/${string}`): Promise<void>;
|
|
25
|
+
onClose(_connection: any, reason: any): Promise<void>;
|
|
26
|
+
onReceive(connection: any, bytes: any): Promise<string>;
|
|
27
|
+
};
|
|
28
|
+
}>;
|
|
29
|
+
export type ICQConnectionKitState = {
|
|
30
|
+
port: Port;
|
|
31
|
+
connection: Remote<Connection> | undefined;
|
|
32
|
+
localAddress: `/ibc-port/${string}` | undefined;
|
|
33
|
+
remoteAddress: `/${string}ibc-port/${string}/ordered/${string}` | `/${string}ibc-port/${string}/unordered/${string}` | undefined;
|
|
34
|
+
};
|
|
35
|
+
export type ICQConnectionKit = ReturnType<ReturnType<typeof prepareICQConnectionKit>>;
|
|
36
|
+
export type ICQConnection = ICQConnectionKit["connection"];
|
|
37
|
+
import type { Zone } from '@agoric/base-zone';
|
|
38
|
+
import type { Port } from '@agoric/network';
|
|
39
|
+
import type { ResponseQuery } from '@agoric/cosmic-proto/tendermint/abci/types.js';
|
|
40
|
+
import type { Base64Any } from '@agoric/cosmic-proto';
|
|
41
|
+
import type { Connection } from '@agoric/network';
|
|
42
|
+
import type { Remote } from '@agoric/vow';
|
|
43
|
+
//# sourceMappingURL=icqConnectionKit.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"icqConnectionKit.d.ts","sourceRoot":"","sources":["icqConnectionKit.js"],"names":[],"mappings":"AAoBA,2DAGE;AAEF;;;;GAIG;AAyBI;;;;QA8BC;;;;WAIG;;;;QAYH;;;;WAIG;;;;;GAgBR;;;;;;;+BAEW,UAAU,CAAC,UAAU,CAAC,OAAO,uBAAuB,CAAC,CAAC;4BACtD,gBAAgB,CAAC,YAAY,CAAC;0BAlHrB,mBAAmB;0BACP,iBAAiB;mCAGpB,+CAA+C;+BADjC,sBAAsB;gCAFjC,iBAAiB;4BAC3B,aAAa"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
export function prepareLocalchainAccountKit(baggage: import("@agoric/swingset-liveslots").Baggage, makeRecorderKit: import("@agoric/zoe/src/contractSupport/recorder.js").MakeRecorderKit, zcf: ZCF): (account: import("@endo/exo").Guarded<{
|
|
2
|
+
getAddress(): Promise<string>;
|
|
3
|
+
/**
|
|
4
|
+
* @param {import('@agoric/swingset-liveslots').Baggage} baggage
|
|
5
|
+
* @param {import('@agoric/zoe/src/contractSupport/recorder.js').MakeRecorderKit} makeRecorderKit
|
|
6
|
+
* @param {ZCF} zcf
|
|
7
|
+
*/
|
|
8
|
+
deposit(payment: Payment): Promise<import("@agoric/ertp/exported.js").NatAmount | import("@agoric/ertp/exported.js").CopySetAmount<import("@endo/patterns").Key> | import("@agoric/ertp/exported.js").SetAmount<import("@endo/patterns").Key> | import("@agoric/ertp/exported.js").CopyBagAmount<import("@endo/patterns").Key>>;
|
|
9
|
+
executeTx<MT extends {
|
|
10
|
+
'@type': string;
|
|
11
|
+
}[]>(messages: MT): Promise<{ [K in keyof MT]: import("@agoric/cosmic-proto/vatsafe").ResponseTo<MT[K]>; }>;
|
|
12
|
+
}>, storageNode: globalThis.StorageNode) => import("@endo/exo").GuardedKit<{
|
|
13
|
+
helper: {
|
|
14
|
+
/** @throws if this holder no longer owns the account */
|
|
15
|
+
owned(): import("@endo/exo").Guarded<{
|
|
16
|
+
getAddress(): Promise<string>;
|
|
17
|
+
/**
|
|
18
|
+
* @param {import('@agoric/swingset-liveslots').Baggage} baggage
|
|
19
|
+
* @param {import('@agoric/zoe/src/contractSupport/recorder.js').MakeRecorderKit} makeRecorderKit
|
|
20
|
+
* @param {ZCF} zcf
|
|
21
|
+
*/
|
|
22
|
+
deposit(payment: Payment): Promise<import("@agoric/ertp/exported.js").NatAmount | import("@agoric/ertp/exported.js").CopySetAmount<import("@endo/patterns").Key> | import("@agoric/ertp/exported.js").SetAmount<import("@endo/patterns").Key> | import("@agoric/ertp/exported.js").CopyBagAmount<import("@endo/patterns").Key>>;
|
|
23
|
+
executeTx<MT extends {
|
|
24
|
+
'@type': string;
|
|
25
|
+
}[]>(messages: MT): Promise<{ [K in keyof MT]: import("@agoric/cosmic-proto/vatsafe").ResponseTo<MT[K]>; }>;
|
|
26
|
+
}>;
|
|
27
|
+
getUpdater(): import("@agoric/zoe/src/contractSupport/recorder.js").Recorder<LocalChainAccountNotification>;
|
|
28
|
+
};
|
|
29
|
+
invitationMakers: {
|
|
30
|
+
Delegate(validatorAddress: any, amount: any): Promise<Invitation<(import("@agoric/cosmic-proto/cosmos/staking/v1beta1/tx.js").MsgDelegateResponse & {
|
|
31
|
+
'@type': "/cosmos.staking.v1beta1.MsgDelegateResponse";
|
|
32
|
+
})[], undefined>>;
|
|
33
|
+
CloseAccount(): never;
|
|
34
|
+
TransferAccount(): never;
|
|
35
|
+
};
|
|
36
|
+
holder: {
|
|
37
|
+
getPublicTopics(): {
|
|
38
|
+
account: {
|
|
39
|
+
description: string;
|
|
40
|
+
subscriber: globalThis.Subscriber<LocalChainAccountNotification>;
|
|
41
|
+
storagePath: Promise<string>;
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
*
|
|
46
|
+
* @param {string} validatorAddress
|
|
47
|
+
* @param {Amount<'nat'>} ertpAmount
|
|
48
|
+
*/
|
|
49
|
+
makeDelegateInvitation(validatorAddress: string, ertpAmount: Amount<"nat">): Promise<Invitation<(import("@agoric/cosmic-proto/cosmos/staking/v1beta1/tx.js").MsgDelegateResponse & {
|
|
50
|
+
'@type': "/cosmos.staking.v1beta1.MsgDelegateResponse";
|
|
51
|
+
})[], undefined>>;
|
|
52
|
+
makeCloseAccountInvitation(): never;
|
|
53
|
+
/**
|
|
54
|
+
* Starting a transfer revokes the account holder. The associated updater
|
|
55
|
+
* will get a special notification that the account is being transferred.
|
|
56
|
+
*/
|
|
57
|
+
makeTransferAccountInvitation(): never;
|
|
58
|
+
};
|
|
59
|
+
}>;
|
|
60
|
+
export type LocalChainAccountNotification = {
|
|
61
|
+
address: string;
|
|
62
|
+
};
|
|
63
|
+
export type State = {
|
|
64
|
+
topicKit: import("@agoric/zoe/src/contractSupport/recorder.js").RecorderKit<LocalChainAccountNotification>;
|
|
65
|
+
account: import("@agoric/vats/src/localchain.js").LocalChainAccount | null;
|
|
66
|
+
};
|
|
67
|
+
export type LocalchainAccountKit = ReturnType<ReturnType<typeof prepareLocalchainAccountKit>>;
|
|
68
|
+
//# sourceMappingURL=localchainAccountKit.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"localchainAccountKit.d.ts","sourceRoot":"","sources":["localchainAccountKit.js"],"names":[],"mappings":"AAyCO,qDAJI,OAAO,4BAA4B,EAAE,OAAO,mBAC5C,OAAO,6CAA6C,EAAE,eAAe,OACrE,GAAG;;IAHd;;;;OAIG;qBACwE,OACzE;;;mBAeG,EAAA;;;QAYG,wDAAwD;;;YAjChE;;;;eAIG;6BACwE,OACzE;;;2BAeG,EAAA;;;;;;;;;;;;;;;;;;;QAiDG;;;;WAIG;iDAFQ,MAAM,cACN,MAAM,CAAC,KAAK,CAAC;;;;QAiCxB;;;WAGG;;;GAQV;;aA3Ia,MAAM;;oBAIP;IACZ,QAAY,EAAE,OAAO,6CAA6C,EAAE,WAAW,CAAC,6BAA6B,CAAC,CAAC;IAC/G,OAAW,EAAE,OAAO,gCAAgC,EAAE,iBAAiB,GAAG,IAAI,CAAC;CAC5E;mCAqIU,UAAU,CAAC,UAAU,CAAC,OAAO,2BAA2B,CAAC,CAAC"}
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
/** maximum clock skew, in seconds, for unbonding time reported from other chain */
|
|
2
|
+
export const maxClockSkew: bigint;
|
|
3
|
+
/**
|
|
4
|
+
* @typedef {object} StakingAccountNotification
|
|
5
|
+
* @property {ChainAddress} chainAddress
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* @typedef {{
|
|
9
|
+
* topicKit: RecorderKit<StakingAccountNotification>;
|
|
10
|
+
* account: IcaAccount;
|
|
11
|
+
* chainAddress: ChainAddress;
|
|
12
|
+
* icqConnection: ICQConnection;
|
|
13
|
+
* bondDenom: string;
|
|
14
|
+
* timer: TimerService;
|
|
15
|
+
* }} State
|
|
16
|
+
*/
|
|
17
|
+
export const IcaAccountHolderI: import("@endo/patterns").InterfaceGuard<{
|
|
18
|
+
getPublicTopics: import("@endo/patterns").MethodGuard;
|
|
19
|
+
getAddress: import("@endo/patterns").MethodGuard;
|
|
20
|
+
getBalance: import("@endo/patterns").MethodGuard;
|
|
21
|
+
delegate: import("@endo/patterns").MethodGuard;
|
|
22
|
+
redelegate: import("@endo/patterns").MethodGuard;
|
|
23
|
+
withdrawReward: import("@endo/patterns").MethodGuard;
|
|
24
|
+
withdrawRewards: import("@endo/patterns").MethodGuard;
|
|
25
|
+
undelegate: import("@endo/patterns").MethodGuard;
|
|
26
|
+
}>;
|
|
27
|
+
export function encodeTxResponse(response: any, toProtoMsg: any): string;
|
|
28
|
+
export const trivialDelegateResponse: string;
|
|
29
|
+
export function tryDecodeResponse<T>(ackStr: string, fromProtoMsg: (p: {
|
|
30
|
+
typeUrl: string;
|
|
31
|
+
value: Uint8Array;
|
|
32
|
+
}) => T): T;
|
|
33
|
+
export function prepareStakingAccountKit(baggage: Baggage, makeRecorderKit: <T>(storageNode: StorageNode | Awaited<import("@endo/far").FarRef<StorageNode>>, valueShape?: import("@agoric/zoe/src/contractSupport/recorder.js").TypedMatcher<T> | undefined) => RecorderKit<T>, zcf: ZCF): (chainAddress: ChainAddress, bondDenom: string, io: {
|
|
34
|
+
account: IcaAccount;
|
|
35
|
+
storageNode: StorageNode;
|
|
36
|
+
icqConnection: import("@endo/exo").Guarded<{
|
|
37
|
+
getLocalAddress(): `/ibc-port/${string}`;
|
|
38
|
+
getRemoteAddress(): `/${string}ibc-port/${string}/ordered/${string}` | `/${string}ibc-port/${string}/unordered/${string}`;
|
|
39
|
+
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>[]>;
|
|
40
|
+
}>;
|
|
41
|
+
timer: TimerService;
|
|
42
|
+
}) => import("@endo/exo").GuardedKit<{
|
|
43
|
+
helper: {
|
|
44
|
+
/** @throws if this holder no longer owns the account */
|
|
45
|
+
owned(): IcaAccount;
|
|
46
|
+
getUpdater(): import("@agoric/zoe/src/contractSupport/recorder.js").Recorder<StakingAccountNotification>;
|
|
47
|
+
/**
|
|
48
|
+
* @param {AmountArg} amount
|
|
49
|
+
* @returns {Coin}
|
|
50
|
+
*/
|
|
51
|
+
amountToCoin(amount: AmountArg): Coin;
|
|
52
|
+
};
|
|
53
|
+
invitationMakers: {
|
|
54
|
+
/**
|
|
55
|
+
*
|
|
56
|
+
* @param {CosmosValidatorAddress} validator
|
|
57
|
+
* @param {Amount<'nat'>} amount
|
|
58
|
+
*/
|
|
59
|
+
Delegate(validator: CosmosValidatorAddress, amount: Amount<"nat">): Promise<Invitation<void, undefined>>;
|
|
60
|
+
/**
|
|
61
|
+
* @param {CosmosValidatorAddress} srcValidator
|
|
62
|
+
* @param {CosmosValidatorAddress} dstValidator
|
|
63
|
+
* @param {AmountArg} amount
|
|
64
|
+
*/
|
|
65
|
+
Redelegate(srcValidator: CosmosValidatorAddress, dstValidator: CosmosValidatorAddress, amount: AmountArg): Promise<Invitation<void, undefined>>;
|
|
66
|
+
/** @param {CosmosValidatorAddress} validator */
|
|
67
|
+
WithdrawReward(validator: CosmosValidatorAddress): Promise<Invitation<DenomAmount[], undefined>>;
|
|
68
|
+
/**
|
|
69
|
+
* @param {Delegation[]} delegations
|
|
70
|
+
*/
|
|
71
|
+
Undelegate(delegations: Delegation[]): Promise<Invitation<void, undefined>>;
|
|
72
|
+
CloseAccount(): never;
|
|
73
|
+
/**
|
|
74
|
+
* Starting a transfer revokes the account holder. The associated updater
|
|
75
|
+
* will get a special notification that the account is being transferred.
|
|
76
|
+
*/
|
|
77
|
+
TransferAccount(): never;
|
|
78
|
+
};
|
|
79
|
+
holder: {
|
|
80
|
+
getPublicTopics(): {
|
|
81
|
+
account: {
|
|
82
|
+
description: string;
|
|
83
|
+
subscriber: globalThis.Subscriber<StakingAccountNotification>;
|
|
84
|
+
storagePath: Promise<string>;
|
|
85
|
+
};
|
|
86
|
+
};
|
|
87
|
+
/** @returns {ChainAddress} */
|
|
88
|
+
getAddress(): ChainAddress;
|
|
89
|
+
/**
|
|
90
|
+
* _Assumes users has already sent funds to their ICA, until #9193
|
|
91
|
+
* @param {CosmosValidatorAddress} validator
|
|
92
|
+
* @param {AmountArg} amount
|
|
93
|
+
*/
|
|
94
|
+
delegate(validator: CosmosValidatorAddress, amount: AmountArg): Promise<void>;
|
|
95
|
+
/**
|
|
96
|
+
* _Assumes users has already sent funds to their ICA, until #9193
|
|
97
|
+
* @param {CosmosValidatorAddress} srcValidator
|
|
98
|
+
* @param {CosmosValidatorAddress} dstValidator
|
|
99
|
+
* @param {AmountArg} amount
|
|
100
|
+
*/
|
|
101
|
+
redelegate(srcValidator: CosmosValidatorAddress, dstValidator: CosmosValidatorAddress, amount: AmountArg): Promise<void>;
|
|
102
|
+
/**
|
|
103
|
+
* @param {CosmosValidatorAddress} validator
|
|
104
|
+
* @returns {Promise<DenomAmount[]>}
|
|
105
|
+
*/
|
|
106
|
+
withdrawReward(validator: CosmosValidatorAddress): Promise<DenomAmount[]>;
|
|
107
|
+
/**
|
|
108
|
+
* @param {DenomAmount['denom']} [denom] - defaults to bondDenom
|
|
109
|
+
* @returns {Promise<DenomAmount>}
|
|
110
|
+
*/
|
|
111
|
+
getBalance(denom?: string | undefined): Promise<DenomAmount>;
|
|
112
|
+
withdrawRewards(): never;
|
|
113
|
+
/**
|
|
114
|
+
* @param {Delegation[]} delegations
|
|
115
|
+
*/
|
|
116
|
+
undelegate(delegations: Delegation[]): Promise<void>;
|
|
117
|
+
};
|
|
118
|
+
}>;
|
|
119
|
+
export type StakingAccountNotification = {
|
|
120
|
+
chainAddress: ChainAddress;
|
|
121
|
+
};
|
|
122
|
+
export type State = {
|
|
123
|
+
topicKit: RecorderKit<StakingAccountNotification>;
|
|
124
|
+
account: IcaAccount;
|
|
125
|
+
chainAddress: ChainAddress;
|
|
126
|
+
icqConnection: import("@endo/exo").Guarded<{
|
|
127
|
+
getLocalAddress(): `/ibc-port/${string}`;
|
|
128
|
+
getRemoteAddress(): `/${string}ibc-port/${string}/ordered/${string}` | `/${string}ibc-port/${string}/unordered/${string}`;
|
|
129
|
+
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>[]>;
|
|
130
|
+
}>;
|
|
131
|
+
bondDenom: string;
|
|
132
|
+
timer: TimerService;
|
|
133
|
+
};
|
|
134
|
+
export type StakingAccountKit = ReturnType<ReturnType<typeof prepareStakingAccountKit>>;
|
|
135
|
+
export type StakingAccounHolder = StakingAccountKit["holder"];
|
|
136
|
+
import type { Baggage } from '@agoric/swingset-liveslots';
|
|
137
|
+
import type { RecorderKit } from '@agoric/zoe/src/contractSupport/recorder.js';
|
|
138
|
+
import type { ChainAddress } from '../types.js';
|
|
139
|
+
import type { IcaAccount } from '../types.js';
|
|
140
|
+
import type { TimerService } from '@agoric/time';
|
|
141
|
+
import type { AmountArg } from '../types.js';
|
|
142
|
+
import type { Coin } from '@agoric/cosmic-proto/cosmos/base/v1beta1/coin.js';
|
|
143
|
+
import type { CosmosValidatorAddress } from '../types.js';
|
|
144
|
+
import type { DenomAmount } from '../types.js';
|
|
145
|
+
import type { Delegation } from '@agoric/cosmic-proto/cosmos/staking/v1beta1/staking.js';
|
|
146
|
+
//# sourceMappingURL=stakingAccountKit.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stakingAccountKit.d.ts","sourceRoot":"","sources":["stakingAccountKit.js"],"names":[],"mappings":"AAiCA,mFAAmF;AACnF,kCAAsC;AAetC;;;GAGG;AAEH;;;;;;;;;GASG;AAEH;;;;;;;;;GAeG;AAcI,yEAMN;AAED,6CAGE;AAaK,kCAFiD,CAAC,UAD9C,MAAM,gBACN,CAAC,CAAC,EAAE;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,UAAU,CAAA;CAAC,KAAK,CAAC,KAYxD;AAUM,6FAQ8C,WACpD,GAAK,QACA,OAAG,WAAW,EAAE,MAAM,CAAC,WACtB,CAAC,CAAC,0HAbE,GAAG;;iBAmCC,WAAW;;;;;;;;;QAelB,wDAAwD;;;QAWxD;;;WAGG;;;;QAgBH;;;;WAIG;4DADQ,MAAM,CAAC,KAAK,CAAC;QAUxB;;;;WAIG;;QAaH,gDAAgD;;QAShD;;WAEG;;;QAYH;;;WAGG;;;;;;;;;;;QAmBH,8BAA8B;;QAI9B;;;;WAIG;;QAkBH;;;;;WAKG;;QAmBH;;;WAGG;;QAmBH;;;WAGG;;;QA0BH;;WAEG;;;GA2CV;;;;;;;;;;;;;eAzXc,MAAM;;;gCA2XP,UAAU,CAAC,UAAU,CAAC,OAAO,wBAAwB,CAAC,CAAC;kCACvD,iBAAiB,CAAC,QAAQ,CAAC;6BAjZf,4BAA4B;iCADP,6CAA6C;kCADkD,aAAa;gCAAb,aAAa;kCAM5H,cAAc;+BANiG,aAAa;0BAIlI,kDAAkD;4CAJmE,aAAa;iCAAb,aAAa;gCAK5H,wDAAwD"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
// @ts-check
|
|
2
1
|
/** @file Use-object for the owner of a staking account */
|
|
3
2
|
import {
|
|
4
3
|
MsgWithdrawDelegatorReward,
|
|
@@ -36,7 +35,7 @@ import {
|
|
|
36
35
|
export const maxClockSkew = 10n * 60n;
|
|
37
36
|
|
|
38
37
|
/**
|
|
39
|
-
* @import {AmountArg,
|
|
38
|
+
* @import {AmountArg, IcaAccount, ChainAddress, ChainAmount, CosmosValidatorAddress, ICQConnection, StakingAccountActions, DenomAmount} from '../types.js';
|
|
40
39
|
* @import {RecorderKit, MakeRecorderKit} from '@agoric/zoe/src/contractSupport/recorder.js';
|
|
41
40
|
* @import {Baggage} from '@agoric/swingset-liveslots';
|
|
42
41
|
* @import {AnyJson} from '@agoric/cosmic-proto';
|
|
@@ -56,7 +55,7 @@ const { Fail } = assert;
|
|
|
56
55
|
/**
|
|
57
56
|
* @typedef {{
|
|
58
57
|
* topicKit: RecorderKit<StakingAccountNotification>;
|
|
59
|
-
* account:
|
|
58
|
+
* account: IcaAccount;
|
|
60
59
|
* chainAddress: ChainAddress;
|
|
61
60
|
* icqConnection: ICQConnection;
|
|
62
61
|
* bondDenom: string;
|
|
@@ -64,7 +63,7 @@ const { Fail } = assert;
|
|
|
64
63
|
* }} State
|
|
65
64
|
*/
|
|
66
65
|
|
|
67
|
-
export const
|
|
66
|
+
export const IcaAccountHolderI = M.interface('IcaAccountHolder', {
|
|
68
67
|
getPublicTopics: M.call().returns(TopicsRecordShape),
|
|
69
68
|
getAddress: M.call().returns(ChainAddressShape),
|
|
70
69
|
getBalance: M.callWhen().optional(M.string()).returns(CoinShape),
|
|
@@ -129,8 +128,8 @@ export const tryDecodeResponse = (ackStr, fromProtoMsg) => {
|
|
|
129
128
|
}
|
|
130
129
|
};
|
|
131
130
|
|
|
132
|
-
/** @type {(c: { denom: string, amount: string }) =>
|
|
133
|
-
const
|
|
131
|
+
/** @type {(c: { denom: string, amount: string }) => DenomAmount} */
|
|
132
|
+
const toDenomAmount = c => ({ denom: c.denom, value: BigInt(c.amount) });
|
|
134
133
|
|
|
135
134
|
/**
|
|
136
135
|
* @param {Baggage} baggage
|
|
@@ -147,7 +146,7 @@ export const prepareStakingAccountKit = (baggage, makeRecorderKit, zcf) => {
|
|
|
147
146
|
getUpdater: M.call().returns(M.remotable()),
|
|
148
147
|
amountToCoin: M.call(AmountShape).returns(M.record()),
|
|
149
148
|
}),
|
|
150
|
-
holder:
|
|
149
|
+
holder: IcaAccountHolderI,
|
|
151
150
|
invitationMakers: M.interface('invitationMakers', {
|
|
152
151
|
Delegate: M.callWhen(ChainAddressShape, AmountShape).returns(
|
|
153
152
|
InvitationShape,
|
|
@@ -169,7 +168,7 @@ export const prepareStakingAccountKit = (baggage, makeRecorderKit, zcf) => {
|
|
|
169
168
|
* @param {ChainAddress} chainAddress
|
|
170
169
|
* @param {string} bondDenom e.g. 'uatom'
|
|
171
170
|
* @param {object} io
|
|
172
|
-
* @param {
|
|
171
|
+
* @param {IcaAccount} io.account
|
|
173
172
|
* @param {StorageNode} io.storageNode
|
|
174
173
|
* @param {ICQConnection} io.icqConnection
|
|
175
174
|
* @param {TimerService} io.timer
|
|
@@ -342,7 +341,7 @@ export const prepareStakingAccountKit = (baggage, makeRecorderKit, zcf) => {
|
|
|
342
341
|
|
|
343
342
|
/**
|
|
344
343
|
* @param {CosmosValidatorAddress} validator
|
|
345
|
-
* @returns {Promise<
|
|
344
|
+
* @returns {Promise<DenomAmount[]>}
|
|
346
345
|
*/
|
|
347
346
|
async withdrawReward(validator) {
|
|
348
347
|
trace('withdrawReward', validator);
|
|
@@ -360,11 +359,11 @@ export const prepareStakingAccountKit = (baggage, makeRecorderKit, zcf) => {
|
|
|
360
359
|
);
|
|
361
360
|
trace('withdrawReward response', response);
|
|
362
361
|
const { amount: coins } = response;
|
|
363
|
-
return harden(coins.map(
|
|
362
|
+
return harden(coins.map(toDenomAmount));
|
|
364
363
|
},
|
|
365
364
|
/**
|
|
366
|
-
* @param {
|
|
367
|
-
* @returns {Promise<
|
|
365
|
+
* @param {DenomAmount['denom']} [denom] - defaults to bondDenom
|
|
366
|
+
* @returns {Promise<DenomAmount>}
|
|
368
367
|
*/
|
|
369
368
|
async getBalance(denom) {
|
|
370
369
|
const { chainAddress, icqConnection, bondDenom } = this.state;
|
|
@@ -384,7 +383,7 @@ export const prepareStakingAccountKit = (baggage, makeRecorderKit, zcf) => {
|
|
|
384
383
|
decodeBase64(result.key),
|
|
385
384
|
);
|
|
386
385
|
if (!balance) throw Fail`Result lacked balance key: ${result}`;
|
|
387
|
-
return harden(
|
|
386
|
+
return harden(toDenomAmount(balance));
|
|
388
387
|
},
|
|
389
388
|
|
|
390
389
|
withdrawRewards() {
|
package/src/facade.d.ts
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export function makeOrchestrationFacade({ zone, timerService, zcf, storageNode, orchestrationService, }: {
|
|
2
|
+
zone: Zone;
|
|
3
|
+
timerService: globalThis.ERef<TimerService>;
|
|
4
|
+
zcf: ERef<ZCF>;
|
|
5
|
+
storageNode: ERef<StorageNode>;
|
|
6
|
+
orchestrationService: globalThis.ERef<import("@endo/exo").Guarded<{
|
|
7
|
+
makeAccount(hostConnectionId: `connection-${number}`, controllerConnectionId: `connection-${number}`): Promise<import("./cosmos-api.js").IcaAccount>;
|
|
8
|
+
provideICQConnection(controllerConnectionId: `connection-${number}`): Promise<import("@endo/exo").Guarded<{
|
|
9
|
+
getLocalAddress(): `/ibc-port/${string}`;
|
|
10
|
+
getRemoteAddress(): `/${string}ibc-port/${string}/ordered/${string}` | `/${string}ibc-port/${string}/unordered/${string}`;
|
|
11
|
+
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>[]>;
|
|
12
|
+
}>>;
|
|
13
|
+
}>>;
|
|
14
|
+
}): {
|
|
15
|
+
/**
|
|
16
|
+
* @template Context
|
|
17
|
+
* @template {any[]} Args
|
|
18
|
+
* @param {string} durableName
|
|
19
|
+
* @param {Context} ctx
|
|
20
|
+
* @param {(orc: Orchestrator, ctx2: Context, ...args: Args) => object} fn
|
|
21
|
+
* @returns {(...args: Args) => Promise<unknown>}
|
|
22
|
+
*/
|
|
23
|
+
orchestrate<Context, Args extends any[]>(durableName: string, ctx: Context, fn: (orc: Orchestrator, ctx2: Context, ...args: Args) => object): (...args: Args) => Promise<unknown>;
|
|
24
|
+
};
|
|
25
|
+
export type OrchestrationFacade = ReturnType<typeof makeOrchestrationFacade>;
|
|
26
|
+
import type { Zone } from '@agoric/zone';
|
|
27
|
+
import type { TimerService } from '@agoric/time';
|
|
28
|
+
import type { Orchestrator } from './types.js';
|
|
29
|
+
//# sourceMappingURL=facade.d.ts.map
|