@agoric/orchestration 0.1.1-dev-b31bd09.0 → 0.1.1-dev-1976c50.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 +16 -16
- package/src/examples/staking-combinations.contract.d.ts +22 -0
- package/src/examples/staking-combinations.contract.d.ts.map +1 -0
- package/src/examples/staking-combinations.contract.js +138 -0
- package/src/examples/staking-combinations.flows.d.ts +18 -0
- package/src/examples/staking-combinations.flows.d.ts.map +1 -0
- package/src/examples/staking-combinations.flows.js +83 -0
- package/src/exos/combine-invitation-makers.d.ts +5 -0
- package/src/exos/combine-invitation-makers.d.ts.map +1 -0
- package/src/exos/combine-invitation-makers.js +53 -0
- package/src/exos/cosmos-orchestration-account.d.ts +12 -0
- package/src/exos/cosmos-orchestration-account.d.ts.map +1 -1
- package/src/exos/cosmos-orchestration-account.js +22 -18
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agoric/orchestration",
|
|
3
|
-
"version": "0.1.1-dev-
|
|
3
|
+
"version": "0.1.1-dev-1976c50.0+1976c50",
|
|
4
4
|
"description": "Chain abstraction for Agoric's orchestration clients",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "index.js",
|
|
@@ -33,19 +33,19 @@
|
|
|
33
33
|
},
|
|
34
34
|
"homepage": "https://github.com/Agoric/agoric-sdk#readme",
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@agoric/async-flow": "0.1.1-dev-
|
|
37
|
-
"@agoric/cosmic-proto": "0.4.1-dev-
|
|
38
|
-
"@agoric/ertp": "0.16.3-dev-
|
|
39
|
-
"@agoric/internal": "0.3.3-dev-
|
|
40
|
-
"@agoric/network": "0.1.1-dev-
|
|
41
|
-
"@agoric/notifier": "0.6.3-dev-
|
|
42
|
-
"@agoric/store": "0.9.3-dev-
|
|
43
|
-
"@agoric/time": "0.3.3-dev-
|
|
44
|
-
"@agoric/vat-data": "0.5.3-dev-
|
|
45
|
-
"@agoric/vats": "0.15.2-dev-
|
|
46
|
-
"@agoric/vow": "0.1.1-dev-
|
|
47
|
-
"@agoric/zoe": "0.26.3-dev-
|
|
48
|
-
"@agoric/zone": "0.2.3-dev-
|
|
36
|
+
"@agoric/async-flow": "0.1.1-dev-1976c50.0+1976c50",
|
|
37
|
+
"@agoric/cosmic-proto": "0.4.1-dev-1976c50.0+1976c50",
|
|
38
|
+
"@agoric/ertp": "0.16.3-dev-1976c50.0+1976c50",
|
|
39
|
+
"@agoric/internal": "0.3.3-dev-1976c50.0+1976c50",
|
|
40
|
+
"@agoric/network": "0.1.1-dev-1976c50.0+1976c50",
|
|
41
|
+
"@agoric/notifier": "0.6.3-dev-1976c50.0+1976c50",
|
|
42
|
+
"@agoric/store": "0.9.3-dev-1976c50.0+1976c50",
|
|
43
|
+
"@agoric/time": "0.3.3-dev-1976c50.0+1976c50",
|
|
44
|
+
"@agoric/vat-data": "0.5.3-dev-1976c50.0+1976c50",
|
|
45
|
+
"@agoric/vats": "0.15.2-dev-1976c50.0+1976c50",
|
|
46
|
+
"@agoric/vow": "0.1.1-dev-1976c50.0+1976c50",
|
|
47
|
+
"@agoric/zoe": "0.26.3-dev-1976c50.0+1976c50",
|
|
48
|
+
"@agoric/zone": "0.2.3-dev-1976c50.0+1976c50",
|
|
49
49
|
"@endo/base64": "^1.0.7",
|
|
50
50
|
"@endo/errors": "^1.2.5",
|
|
51
51
|
"@endo/far": "^1.1.5",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"@noble/hashes": "^1.5.0"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
|
-
"@agoric/swingset-liveslots": "0.10.3-dev-
|
|
57
|
+
"@agoric/swingset-liveslots": "0.10.3-dev-1976c50.0+1976c50",
|
|
58
58
|
"@chain-registry/client": "^1.47.4",
|
|
59
59
|
"@cosmjs/amino": "^0.32.3",
|
|
60
60
|
"@cosmjs/proto-signing": "^0.32.3",
|
|
@@ -94,5 +94,5 @@
|
|
|
94
94
|
"typeCoverage": {
|
|
95
95
|
"atLeast": 98.1
|
|
96
96
|
},
|
|
97
|
-
"gitHead": "
|
|
97
|
+
"gitHead": "1976c502bcaac2e7d21f42b30447671a61053236"
|
|
98
98
|
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export const start: (zcf: ZCF<Record<string, unknown>>, privateArgs: {
|
|
2
|
+
agoricNames: Remote<NameHub>;
|
|
3
|
+
localchain: Remote<LocalChain>;
|
|
4
|
+
orchestrationService: Remote<CosmosInterchainService>;
|
|
5
|
+
storageNode: Remote<StorageNode>;
|
|
6
|
+
marshaller: Marshaller;
|
|
7
|
+
timerService: Remote<TimerService>;
|
|
8
|
+
}, baggage: import("@agoric/vat-data").Baggage) => Promise<{
|
|
9
|
+
publicFacet: import("@endo/exo").Guarded<{
|
|
10
|
+
makeAccount(): Promise<Invitation<Vow<ContinuingOfferResult>, {
|
|
11
|
+
chainName: string;
|
|
12
|
+
}>>;
|
|
13
|
+
}>;
|
|
14
|
+
}>;
|
|
15
|
+
import type { NameHub } from '@agoric/vats';
|
|
16
|
+
import type { Remote } from '@agoric/internal';
|
|
17
|
+
import type { LocalChain } from '@agoric/vats/src/localchain.js';
|
|
18
|
+
import type { CosmosInterchainService } from '../exos/cosmos-interchain-service.js';
|
|
19
|
+
import type { TimerService } from '@agoric/time';
|
|
20
|
+
import type { ContinuingOfferResult } from '@agoric/smart-wallet/src/types.js';
|
|
21
|
+
import type { Vow } from '@agoric/vow';
|
|
22
|
+
//# sourceMappingURL=staking-combinations.contract.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"staking-combinations.contract.d.ts","sourceRoot":"","sources":["staking-combinations.contract.js"],"names":[],"mappings":"AAwIA;iBA9FkB,OAAO,OAAO,CAAC;gBAChB,OAAO,UAAU,CAAC;0BACR,OAAO,uBAAuB,CAAC;iBACxC,OAAO,WAAW,CAAC;gBACpB,UAAU;kBACR,OAAO,YAAY,CAAC;;;;;;;GAyFU;6BAnHvB,cAAc;4BAEf,kBAAkB;gCAHd,gCAAgC;6CAKnB,sCAAsC;kCANjD,cAAc;2CADL,mCAAmC;yBAIrD,aAAa"}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file This contract demonstrates the continuing invitation pattern with async
|
|
3
|
+
* flows.
|
|
4
|
+
*
|
|
5
|
+
* The primary offer result is a power for invitation makers that can perform
|
|
6
|
+
* actions with an ICA account.
|
|
7
|
+
*/
|
|
8
|
+
import { AmountShape } from '@agoric/ertp';
|
|
9
|
+
import { VowShape } from '@agoric/vow';
|
|
10
|
+
import { M } from '@endo/patterns';
|
|
11
|
+
import { prepareCombineInvitationMakers } from '../exos/combine-invitation-makers.js';
|
|
12
|
+
import { CosmosOrchestrationInvitationMakersInterface } from '../exos/cosmos-orchestration-account.js';
|
|
13
|
+
import { withOrchestration } from '../utils/start-helper.js';
|
|
14
|
+
import * as flows from './staking-combinations.flows.js';
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* @import {GuestInterface} from '@agoric/async-flow';
|
|
18
|
+
* @import {Delegation} from '@agoric/cosmic-proto/cosmos/staking/v1beta1/staking.js';
|
|
19
|
+
* @import {ContinuingOfferResult} from '@agoric/smart-wallet/src/types.js';
|
|
20
|
+
* @import {TimerService} from '@agoric/time';
|
|
21
|
+
* @import {LocalChain} from '@agoric/vats/src/localchain.js';
|
|
22
|
+
* @import {NameHub} from '@agoric/vats';
|
|
23
|
+
* @import {Vow} from '@agoric/vow';
|
|
24
|
+
* @import {Remote} from '@agoric/internal';
|
|
25
|
+
* @import {Zone} from '@agoric/zone';
|
|
26
|
+
* @import {CosmosInterchainService} from '../exos/cosmos-interchain-service.js';
|
|
27
|
+
* @import {OrchestrationTools} from '../utils/start-helper.js';
|
|
28
|
+
* @import {CosmosOrchestrationAccount} from '../exos/cosmos-orchestration-account.js';
|
|
29
|
+
*/
|
|
30
|
+
|
|
31
|
+
const emptyOfferShape = harden({
|
|
32
|
+
// Nothing to give; the funds are deposited offline
|
|
33
|
+
give: {},
|
|
34
|
+
want: {}, // UNTIL https://github.com/Agoric/agoric-sdk/issues/2230
|
|
35
|
+
exit: M.any(),
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Orchestration contract to be wrapped by withOrchestration for Zoe.
|
|
40
|
+
*
|
|
41
|
+
* @param {ZCF} zcf
|
|
42
|
+
* @param {{
|
|
43
|
+
* agoricNames: Remote<NameHub>;
|
|
44
|
+
* localchain: Remote<LocalChain>;
|
|
45
|
+
* orchestrationService: Remote<CosmosInterchainService>;
|
|
46
|
+
* storageNode: Remote<StorageNode>;
|
|
47
|
+
* marshaller: Marshaller;
|
|
48
|
+
* timerService: Remote<TimerService>;
|
|
49
|
+
* }} privateArgs
|
|
50
|
+
* @param {Zone} zone
|
|
51
|
+
* @param {OrchestrationTools} tools
|
|
52
|
+
*/
|
|
53
|
+
const contract = async (
|
|
54
|
+
zcf,
|
|
55
|
+
privateArgs,
|
|
56
|
+
zone,
|
|
57
|
+
{ orchestrateAll, vowTools },
|
|
58
|
+
) => {
|
|
59
|
+
const ExtraInvitationMakerInterface = M.interface('', {
|
|
60
|
+
DepositAndDelegate: M.call(M.array()).returns(VowShape),
|
|
61
|
+
UndelegateAndTransfer: M.call(M.array()).returns(VowShape),
|
|
62
|
+
});
|
|
63
|
+
/** @type {any} XXX async membrane */
|
|
64
|
+
const makeExtraInvitationMaker = zone.exoClass(
|
|
65
|
+
'ContinuingInvitationExampleInvitationMakers',
|
|
66
|
+
ExtraInvitationMakerInterface,
|
|
67
|
+
/** @param {GuestInterface<CosmosOrchestrationAccount>} account */
|
|
68
|
+
account => {
|
|
69
|
+
return { account };
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
DepositAndDelegate() {
|
|
73
|
+
const { account } = this.state;
|
|
74
|
+
|
|
75
|
+
const invP = zcf.makeInvitation(
|
|
76
|
+
(seat, validatorAddr, amountArg) =>
|
|
77
|
+
// eslint-disable-next-line no-use-before-define -- defined by orchestrateAll, necessarily after this
|
|
78
|
+
orchFns.depositAndDelegate(account, seat, validatorAddr, amountArg),
|
|
79
|
+
'Deposit and delegate',
|
|
80
|
+
undefined,
|
|
81
|
+
{
|
|
82
|
+
give: {
|
|
83
|
+
Stake: AmountShape,
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
);
|
|
87
|
+
|
|
88
|
+
return vowTools.watch(invP);
|
|
89
|
+
},
|
|
90
|
+
/**
|
|
91
|
+
* @param {Omit<Delegation, 'delegatorAddress'>[]} delegations
|
|
92
|
+
*/
|
|
93
|
+
UndelegateAndTransfer(delegations) {
|
|
94
|
+
const { account } = this.state;
|
|
95
|
+
|
|
96
|
+
const invP = zcf.makeInvitation(
|
|
97
|
+
// eslint-disable-next-line no-use-before-define -- defined by orchestrateAll, necessarily after this
|
|
98
|
+
() => orchFns.undelegateAndTransfer(account, delegations),
|
|
99
|
+
'Undelegate and transfer',
|
|
100
|
+
undefined,
|
|
101
|
+
emptyOfferShape,
|
|
102
|
+
);
|
|
103
|
+
|
|
104
|
+
return vowTools.watch(invP);
|
|
105
|
+
},
|
|
106
|
+
},
|
|
107
|
+
);
|
|
108
|
+
|
|
109
|
+
/** @type {any} XXX async membrane */
|
|
110
|
+
const makeCombineInvitationMakers = prepareCombineInvitationMakers(
|
|
111
|
+
zone,
|
|
112
|
+
CosmosOrchestrationInvitationMakersInterface,
|
|
113
|
+
ExtraInvitationMakerInterface,
|
|
114
|
+
);
|
|
115
|
+
|
|
116
|
+
const orchFns = orchestrateAll(flows, {
|
|
117
|
+
makeCombineInvitationMakers,
|
|
118
|
+
makeExtraInvitationMaker,
|
|
119
|
+
flows,
|
|
120
|
+
zcf,
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
const publicFacet = zone.exo('publicFacet', undefined, {
|
|
124
|
+
makeAccount() {
|
|
125
|
+
return zcf.makeInvitation(
|
|
126
|
+
orchFns.makeAccount,
|
|
127
|
+
'Make an ICA account',
|
|
128
|
+
undefined,
|
|
129
|
+
emptyOfferShape,
|
|
130
|
+
);
|
|
131
|
+
},
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
return harden({ publicFacet });
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
export const start = withOrchestration(contract);
|
|
138
|
+
harden(start);
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export function makeAccount(orch: Orchestrator, ctx: {
|
|
2
|
+
makeCombineInvitationMakers: MakeCombineInvitationMakers;
|
|
3
|
+
makeExtraInvitationMaker: (account: any) => InvitationMakers;
|
|
4
|
+
}, _seat: ZCFSeat, { chainName }: {
|
|
5
|
+
chainName: string;
|
|
6
|
+
}): Promise<ContinuingOfferResult>;
|
|
7
|
+
export function depositAndDelegate(orch: Orchestrator, ctx: object, account: GuestInterface<CosmosOrchestrationAccount>, seat: ZCFSeat, validator: CosmosValidatorAddress, amount: AmountArg): Promise<string>;
|
|
8
|
+
export function undelegateAndTransfer(orch: Orchestrator, ctx: object, account: GuestInterface<CosmosOrchestrationAccount>, delegations: Omit<Delegation, "delegatorAddress">[]): Promise<string>;
|
|
9
|
+
import type { Orchestrator } from '../types.js';
|
|
10
|
+
import type { MakeCombineInvitationMakers } from '../exos/combine-invitation-makers.js';
|
|
11
|
+
import type { InvitationMakers } from '@agoric/smart-wallet/src/types.js';
|
|
12
|
+
import type { ContinuingOfferResult } from '@agoric/smart-wallet/src/types.js';
|
|
13
|
+
import type { CosmosOrchestrationAccount } from '../exos/cosmos-orchestration-account.js';
|
|
14
|
+
import type { GuestInterface } from '@agoric/async-flow';
|
|
15
|
+
import type { CosmosValidatorAddress } from '../types.js';
|
|
16
|
+
import type { AmountArg } from '../types.js';
|
|
17
|
+
import type { Delegation } from '@agoric/cosmic-proto/cosmos/staking/v1beta1/staking.js';
|
|
18
|
+
//# sourceMappingURL=staking-combinations.flows.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"staking-combinations.flows.d.ts","sourceRoot":"","sources":["staking-combinations.flows.js"],"names":[],"mappings":"AAoBO,kCATI,YAAY,OACZ;IACV,2BAA+B,EAAE,2BAA2B,CAAC;IAC7D,wBAA4B,EAAE,CAAC,OAAO,EAAE,GAAG,KAAK,gBAAgB,CAAC;CAC9D,SACO,OAAO,iBACP;IAAE,SAAS,EAAE,MAAM,CAAA;CAAE,GACnB,OAAO,CAAC,qBAAqB,CAAC,CAkB1C;AAaM,yCARI,YAAY,OACZ,MAAM,WACN,eAAe,0BAA0B,CAAC,QAC1C,OAAO,aACP,sBAAsB,UACtB,SAAS,GACP,OAAO,CAAC,MAAM,CAAC,CAc3B;AAWM,4CANI,YAAY,OACZ,MAAM,WACN,eAAe,0BAA0B,CAAC,eAC1C,IAAI,CAAC,UAAU,EAAE,kBAAkB,CAAC,EAAE,GACpC,OAAO,CAAC,MAAM,CAAC,CAW3B;kCA/EwJ,aAAa;iDAExH,sCAAsC;sCAD1B,mCAAmC;2CAAnC,mCAAmC;gDAGhD,yCAAyC;oCALrD,oBAAoB;4CACoG,aAAa;+BAAb,aAAa;gCAGzI,wDAAwD"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @import {GuestInterface} from '@agoric/async-flow';
|
|
3
|
+
* @import {Orchestrator, OrchestrationFlow, OrchestrationAccount, OrchestrationAccountI, StakingAccountActions, AmountArg, CosmosValidatorAddress} from '../types.js'
|
|
4
|
+
* @import {ContinuingOfferResult, InvitationMakers} from '@agoric/smart-wallet/src/types.js';
|
|
5
|
+
* @import {MakeCombineInvitationMakers} from '../exos/combine-invitation-makers.js';
|
|
6
|
+
* @import {Delegation} from '@agoric/cosmic-proto/cosmos/staking/v1beta1/staking.js';
|
|
7
|
+
* @import {CosmosOrchestrationAccount} from '../exos/cosmos-orchestration-account.js';
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* @satisfies {OrchestrationFlow}
|
|
12
|
+
* @param {Orchestrator} orch
|
|
13
|
+
* @param {{
|
|
14
|
+
* makeCombineInvitationMakers: MakeCombineInvitationMakers;
|
|
15
|
+
* makeExtraInvitationMaker: (account: any) => InvitationMakers;
|
|
16
|
+
* }} ctx
|
|
17
|
+
* @param {ZCFSeat} _seat
|
|
18
|
+
* @param {{ chainName: string }} offerArgs
|
|
19
|
+
* @returns {Promise<ContinuingOfferResult>}
|
|
20
|
+
*/
|
|
21
|
+
export const makeAccount = async (orch, ctx, _seat, { chainName }) => {
|
|
22
|
+
const chain = await orch.getChain(chainName);
|
|
23
|
+
const account = await chain.makeAccount();
|
|
24
|
+
|
|
25
|
+
const extraMakers = ctx.makeExtraInvitationMaker(account);
|
|
26
|
+
|
|
27
|
+
/** @type {ContinuingOfferResult} */
|
|
28
|
+
const result = await account.asContinuingOffer();
|
|
29
|
+
|
|
30
|
+
return {
|
|
31
|
+
...result,
|
|
32
|
+
invitationMakers: ctx.makeCombineInvitationMakers(
|
|
33
|
+
extraMakers,
|
|
34
|
+
result.invitationMakers,
|
|
35
|
+
),
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
harden(makeAccount);
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* @satisfies {OrchestrationFlow}
|
|
42
|
+
* @param {Orchestrator} orch
|
|
43
|
+
* @param {object} ctx
|
|
44
|
+
* @param {GuestInterface<CosmosOrchestrationAccount>} account
|
|
45
|
+
* @param {ZCFSeat} seat
|
|
46
|
+
* @param {CosmosValidatorAddress} validator
|
|
47
|
+
* @param {AmountArg} amount
|
|
48
|
+
* @returns {Promise<string>}
|
|
49
|
+
*/
|
|
50
|
+
export const depositAndDelegate = async (
|
|
51
|
+
orch,
|
|
52
|
+
ctx,
|
|
53
|
+
account,
|
|
54
|
+
seat,
|
|
55
|
+
validator,
|
|
56
|
+
amount,
|
|
57
|
+
) => {
|
|
58
|
+
console.log('depositAndDelegate', account, seat, validator, amount);
|
|
59
|
+
// TODO deposit the amount
|
|
60
|
+
await account.delegate(validator, amount);
|
|
61
|
+
return 'guest depositAndDelegate complete';
|
|
62
|
+
};
|
|
63
|
+
harden(depositAndDelegate);
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* @satisfies {OrchestrationFlow}
|
|
67
|
+
* @param {Orchestrator} orch
|
|
68
|
+
* @param {object} ctx
|
|
69
|
+
* @param {GuestInterface<CosmosOrchestrationAccount>} account
|
|
70
|
+
* @param {Omit<Delegation, 'delegatorAddress'>[]} delegations
|
|
71
|
+
* @returns {Promise<string>}
|
|
72
|
+
*/
|
|
73
|
+
export const undelegateAndTransfer = async (
|
|
74
|
+
orch,
|
|
75
|
+
ctx,
|
|
76
|
+
account,
|
|
77
|
+
delegations,
|
|
78
|
+
) => {
|
|
79
|
+
await account.undelegate(delegations);
|
|
80
|
+
// TODO transfer something
|
|
81
|
+
return 'guest undelegateAndTransfer complete';
|
|
82
|
+
};
|
|
83
|
+
harden(undelegateAndTransfer);
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export function prepareCombineInvitationMakers(zone: Zone, ...interfaceGuards: import("@endo/patterns").InterfaceGuard[]): <IM extends InvitationMakers[]>(...invitationMakers: IM) => IM[number];
|
|
2
|
+
export type MakeCombineInvitationMakers = ReturnType<typeof prepareCombineInvitationMakers>;
|
|
3
|
+
import type { Zone } from '@agoric/zone';
|
|
4
|
+
import type { InvitationMakers } from '@agoric/smart-wallet/src/types.js';
|
|
5
|
+
//# sourceMappingURL=combine-invitation-makers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"combine-invitation-makers.d.ts","sourceRoot":"","sources":["combine-invitation-makers.js"],"names":[],"mappings":"AAmBO,qDAHI,IAAI,sBACJ,OAAO,gBAAgB,EAAE,cAAc,EAAE,IAchB,EAAE,SAAtB,gBAAgB,EAAG,uBACtB,EAAE,KACA,EAAE,CAAC,MAAM,CAAC,CAiBxB;0CAEa,UAAU,CAAC,OAAO,8BAA8B,CAAC;0BA3CxC,cAAc;sCADF,mCAAmC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { M } from '@endo/patterns';
|
|
2
|
+
import {
|
|
3
|
+
prepareGuardedAttenuator,
|
|
4
|
+
makeSyncMethodCallback,
|
|
5
|
+
} from '@agoric/internal/src/callback.js';
|
|
6
|
+
import { getMethodNames } from '@agoric/internal';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* @import {InvitationMakers} from '@agoric/smart-wallet/src/types.js';
|
|
10
|
+
* @import {Zone} from '@agoric/zone';
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
// TODO use a helper from Endo https://github.com/endojs/endo/issues/2448
|
|
14
|
+
/**
|
|
15
|
+
* Takes two or more InvitationMaker exos and combines them into a new one.
|
|
16
|
+
*
|
|
17
|
+
* @param {Zone} zone
|
|
18
|
+
* @param {import('@endo/patterns').InterfaceGuard[]} interfaceGuards
|
|
19
|
+
*/
|
|
20
|
+
export const prepareCombineInvitationMakers = (zone, ...interfaceGuards) => {
|
|
21
|
+
const methodGuards = interfaceGuards.map(ig => ig.payload.methodGuards);
|
|
22
|
+
const CombinedInterfaceGuard = M.interface(
|
|
23
|
+
'CombinedInvitationMakers interface',
|
|
24
|
+
Object.assign({}, ...methodGuards),
|
|
25
|
+
);
|
|
26
|
+
|
|
27
|
+
const mixin = prepareGuardedAttenuator(zone, CombinedInterfaceGuard, {
|
|
28
|
+
tag: 'CombinedInvitationMakers',
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* @template {InvitationMakers[]} IM
|
|
33
|
+
* @param {IM} invitationMakers
|
|
34
|
+
* @returns {IM[number]}
|
|
35
|
+
*/
|
|
36
|
+
const combineInvitationMakers = (...invitationMakers) => {
|
|
37
|
+
const overrides = {};
|
|
38
|
+
for (const invMakers of invitationMakers) {
|
|
39
|
+
// remove '__getInterfaceGuard__', '__getMethodNames__'
|
|
40
|
+
const names = getMethodNames(invMakers).filter(n => !n.startsWith('__'));
|
|
41
|
+
for (const key of names) {
|
|
42
|
+
overrides[key] = makeSyncMethodCallback(invMakers, key);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return mixin({
|
|
46
|
+
overrides,
|
|
47
|
+
});
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
return combineInvitationMakers;
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
/** @typedef {ReturnType<typeof prepareCombineInvitationMakers>} MakeCombineInvitationMakers */
|
|
@@ -39,6 +39,18 @@ export const IcaAccountHolderI: import("@endo/patterns").InterfaceGuard<{
|
|
|
39
39
|
asContinuingOffer: import("@endo/patterns").MethodGuard;
|
|
40
40
|
getPublicTopics: import("@endo/patterns").MethodGuard;
|
|
41
41
|
}>;
|
|
42
|
+
export const CosmosOrchestrationInvitationMakersInterface: import("@endo/patterns").InterfaceGuard<{
|
|
43
|
+
Delegate: import("@endo/patterns").MethodGuard;
|
|
44
|
+
Redelegate: import("@endo/patterns").MethodGuard;
|
|
45
|
+
WithdrawReward: import("@endo/patterns").MethodGuard;
|
|
46
|
+
Undelegate: import("@endo/patterns").MethodGuard;
|
|
47
|
+
DeactivateAccount: import("@endo/patterns").MethodGuard;
|
|
48
|
+
ReactivateAccount: import("@endo/patterns").MethodGuard;
|
|
49
|
+
TransferAccount: import("@endo/patterns").MethodGuard;
|
|
50
|
+
Send: import("@endo/patterns").MethodGuard;
|
|
51
|
+
SendAll: import("@endo/patterns").MethodGuard;
|
|
52
|
+
Transfer: import("@endo/patterns").MethodGuard;
|
|
53
|
+
}>;
|
|
42
54
|
export function prepareCosmosOrchestrationAccountKit(zone: Zone, { chainHub, makeRecorderKit, timerService, vowTools: { watch, asVow, when, allVows }, zcf, }: {
|
|
43
55
|
chainHub: ChainHub;
|
|
44
56
|
makeRecorderKit: MakeRecorderKit;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cosmos-orchestration-account.d.ts","sourceRoot":"","sources":["cosmos-orchestration-account.js"],"names":[],"mappings":"AAiEA;;;GAGG;AAEH;;;;;;;;;;;GAWG;AAEH;;;;;GAKG;AAEH,mCAAmC;AACnC;;;;;;;;;;;;;;;;;GAeG;
|
|
1
|
+
{"version":3,"file":"cosmos-orchestration-account.d.ts","sourceRoot":"","sources":["cosmos-orchestration-account.js"],"names":[],"mappings":"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"}
|
|
@@ -111,6 +111,27 @@ const PUBLIC_TOPICS = {
|
|
|
111
111
|
account: ['Staking Account holder status', M.any()],
|
|
112
112
|
};
|
|
113
113
|
|
|
114
|
+
export const CosmosOrchestrationInvitationMakersInterface = M.interface(
|
|
115
|
+
'invitationMakers',
|
|
116
|
+
{
|
|
117
|
+
Delegate: M.call(ChainAddressShape, AmountArgShape).returns(M.promise()),
|
|
118
|
+
Redelegate: M.call(
|
|
119
|
+
ChainAddressShape,
|
|
120
|
+
ChainAddressShape,
|
|
121
|
+
AmountArgShape,
|
|
122
|
+
).returns(M.promise()),
|
|
123
|
+
WithdrawReward: M.call(ChainAddressShape).returns(M.promise()),
|
|
124
|
+
Undelegate: M.call(M.arrayOf(DelegationShape)).returns(M.promise()),
|
|
125
|
+
DeactivateAccount: M.call().returns(M.promise()),
|
|
126
|
+
ReactivateAccount: M.call().returns(M.promise()),
|
|
127
|
+
TransferAccount: M.call().returns(M.promise()),
|
|
128
|
+
Send: M.call().returns(M.promise()),
|
|
129
|
+
SendAll: M.call().returns(M.promise()),
|
|
130
|
+
Transfer: M.call().returns(M.promise()),
|
|
131
|
+
},
|
|
132
|
+
);
|
|
133
|
+
harden(CosmosOrchestrationInvitationMakersInterface);
|
|
134
|
+
|
|
114
135
|
/**
|
|
115
136
|
* @param {Zone} zone
|
|
116
137
|
* @param {object} powers
|
|
@@ -177,24 +198,7 @@ export const prepareCosmosOrchestrationAccountKit = (
|
|
|
177
198
|
.returns(Vow$(M.record())),
|
|
178
199
|
}),
|
|
179
200
|
holder: IcaAccountHolderI,
|
|
180
|
-
invitationMakers:
|
|
181
|
-
Delegate: M.call(ChainAddressShape, AmountArgShape).returns(
|
|
182
|
-
M.promise(),
|
|
183
|
-
),
|
|
184
|
-
Redelegate: M.call(
|
|
185
|
-
ChainAddressShape,
|
|
186
|
-
ChainAddressShape,
|
|
187
|
-
AmountArgShape,
|
|
188
|
-
).returns(M.promise()),
|
|
189
|
-
WithdrawReward: M.call(ChainAddressShape).returns(M.promise()),
|
|
190
|
-
Undelegate: M.call(M.arrayOf(DelegationShape)).returns(M.promise()),
|
|
191
|
-
DeactivateAccount: M.call().returns(M.promise()),
|
|
192
|
-
ReactivateAccount: M.call().returns(M.promise()),
|
|
193
|
-
TransferAccount: M.call().returns(M.promise()),
|
|
194
|
-
Send: M.call().returns(M.promise()),
|
|
195
|
-
SendAll: M.call().returns(M.promise()),
|
|
196
|
-
Transfer: M.call().returns(M.promise()),
|
|
197
|
-
}),
|
|
201
|
+
invitationMakers: CosmosOrchestrationInvitationMakersInterface,
|
|
198
202
|
},
|
|
199
203
|
/**
|
|
200
204
|
* @param {object} info
|