@agoric/orchestration 0.2.0-upgrade-17-dev-ec448b0.0 → 0.2.0-upgrade-18-dev-b9b8db4.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,10 +1,13 @@
|
|
|
1
1
|
import { NonNullish } from '@agoric/internal';
|
|
2
|
+
import { makeError, q } from '@endo/errors';
|
|
2
3
|
import { M, mustMatch } from '@endo/patterns';
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
|
-
* @import {GuestOf} from '@agoric/async-flow';
|
|
6
|
+
* @import {GuestInterface, GuestOf} from '@agoric/async-flow';
|
|
7
|
+
* @import {Vow} from '@agoric/vow';
|
|
8
|
+
* @import {LocalOrchestrationAccountKit} from '../exos/local-orchestration-account.js';
|
|
6
9
|
* @import {ZoeTools} from '../utils/zoe-tools.js';
|
|
7
|
-
* @import {Orchestrator,
|
|
10
|
+
* @import {Orchestrator, OrchestrationFlow, LocalAccountMethods} from '../types.js';
|
|
8
11
|
*/
|
|
9
12
|
|
|
10
13
|
const { entries } = Object;
|
|
@@ -16,14 +19,15 @@ const { entries } = Object;
|
|
|
16
19
|
* @satisfies {OrchestrationFlow}
|
|
17
20
|
* @param {Orchestrator} orch
|
|
18
21
|
* @param {object} ctx
|
|
19
|
-
* @param {
|
|
20
|
-
* @param {
|
|
22
|
+
* @param {Promise<GuestInterface<LocalOrchestrationAccountKit['holder']>>} ctx.sharedLocalAccountP
|
|
23
|
+
* @param {GuestInterface<ZoeTools>} ctx.zoeTools
|
|
24
|
+
* @param {GuestOf<(msg: string) => Vow<void>>} ctx.log
|
|
21
25
|
* @param {ZCFSeat} seat
|
|
22
26
|
* @param {{ chainName: string; destAddr: string }} offerArgs
|
|
23
27
|
*/
|
|
24
28
|
export const sendIt = async (
|
|
25
29
|
orch,
|
|
26
|
-
{
|
|
30
|
+
{ sharedLocalAccountP, log, zoeTools: { localTransfer, withdrawToSeat } },
|
|
27
31
|
seat,
|
|
28
32
|
offerArgs,
|
|
29
33
|
) => {
|
|
@@ -32,33 +36,49 @@ export const sendIt = async (
|
|
|
32
36
|
// NOTE the proposal shape ensures that the `give` is a single asset
|
|
33
37
|
const { give } = seat.getProposal();
|
|
34
38
|
const [[_kw, amt]] = entries(give);
|
|
39
|
+
void log(`sending {${amt.value}} from ${chainName} to ${destAddr}`);
|
|
35
40
|
const agoric = await orch.getChain('agoric');
|
|
36
41
|
const assets = await agoric.getVBankAssetInfo();
|
|
42
|
+
void log(`got info for denoms: ${assets.map(a => a.denom).join(', ')}`);
|
|
37
43
|
const { denom } = NonNullish(
|
|
38
44
|
assets.find(a => a.brand === amt.brand),
|
|
39
45
|
`${amt.brand} not registered in vbank`,
|
|
40
46
|
);
|
|
41
|
-
const chain = await orch.getChain(chainName);
|
|
42
|
-
|
|
43
|
-
if (!contractState.localAccount) {
|
|
44
|
-
const agoricChain = await orch.getChain('agoric');
|
|
45
|
-
contractState.localAccount = await agoricChain.makeAccount();
|
|
46
|
-
}
|
|
47
47
|
|
|
48
|
+
const chain = await orch.getChain(chainName);
|
|
48
49
|
const info = await chain.getChainInfo();
|
|
49
50
|
const { chainId } = info;
|
|
50
51
|
assert(typeof chainId === 'string', 'bad chainId');
|
|
52
|
+
void log(`got info for chain: ${chainName} ${chainId}`);
|
|
51
53
|
|
|
52
|
-
|
|
54
|
+
/**
|
|
55
|
+
* @type {any} XXX methods returning vows
|
|
56
|
+
* https://github.com/Agoric/agoric-sdk/issues/9822
|
|
57
|
+
*/
|
|
58
|
+
const sharedLocalAccount = await sharedLocalAccountP;
|
|
59
|
+
await localTransfer(seat, sharedLocalAccount, give);
|
|
60
|
+
|
|
61
|
+
void log(`completed transfer to localAccount`);
|
|
62
|
+
|
|
63
|
+
try {
|
|
64
|
+
await sharedLocalAccount.transfer(
|
|
65
|
+
{
|
|
66
|
+
value: destAddr,
|
|
67
|
+
encoding: 'bech32',
|
|
68
|
+
chainId,
|
|
69
|
+
},
|
|
70
|
+
{ denom, value: amt.value },
|
|
71
|
+
);
|
|
72
|
+
void log(`completed transfer to ${destAddr}`);
|
|
73
|
+
} catch (e) {
|
|
74
|
+
await withdrawToSeat(sharedLocalAccount, seat, give);
|
|
75
|
+
const errorMsg = `IBC Transfer failed ${q(e)}`;
|
|
76
|
+
void log(`ERROR: ${errorMsg}`);
|
|
77
|
+
seat.exit(errorMsg);
|
|
78
|
+
throw makeError(errorMsg);
|
|
79
|
+
}
|
|
53
80
|
|
|
54
|
-
await contractState.localAccount.transfer(
|
|
55
|
-
{ denom, value: amt.value },
|
|
56
|
-
{
|
|
57
|
-
value: destAddr,
|
|
58
|
-
encoding: 'bech32',
|
|
59
|
-
chainId,
|
|
60
|
-
},
|
|
61
|
-
);
|
|
62
81
|
seat.exit();
|
|
82
|
+
void log(`transfer complete, seat exited`);
|
|
63
83
|
};
|
|
64
84
|
harden(sendIt);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shared.flows.d.ts","sourceRoot":"","sources":["shared.flows.js"],"names":[],"mappings":"AAgBO,uCAHI,YAAY,GACV,OAAO,CAAC,mBAAmB,CAAC,CAKxC;kCAXsE,aAAa;yCAAb,aAAa"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file Flows shared by multiple examples
|
|
3
|
+
*
|
|
4
|
+
* A module with flows can be used be reused across multiple contracts. They are
|
|
5
|
+
* bound to a particular contract's context via orchestrateAll. See
|
|
6
|
+
* ./send-anywhere.contract.js for example usage.
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* @import {Orchestrator, OrchestrationFlow, LocalAccountMethods} from '../types.js';
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* @satisfies {OrchestrationFlow}
|
|
14
|
+
* @param {Orchestrator} orch
|
|
15
|
+
* @returns {Promise<LocalAccountMethods>}
|
|
16
|
+
*/
|
|
17
|
+
export const makeLocalAccount = async orch => {
|
|
18
|
+
const agoricChain = await orch.getChain('agoric');
|
|
19
|
+
return agoricChain.makeAccount();
|
|
20
|
+
};
|
|
21
|
+
harden(makeLocalAccount);
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
export function start(zcf: ZCF, privateArgs: {
|
|
2
|
+
agoricNames: Remote<NameHub>;
|
|
3
|
+
localchain: Remote<LocalChain>;
|
|
4
|
+
marshaller: Marshaller;
|
|
5
|
+
storageNode: StorageNode;
|
|
6
|
+
timerService: TimerService;
|
|
7
|
+
}, baggage: import("@agoric/vat-data").Baggage): Promise<{
|
|
8
|
+
publicFacet: import("@endo/exo").Guarded<{
|
|
9
|
+
/**
|
|
10
|
+
* Invitation to make an account, initialized with the give's BLD
|
|
11
|
+
*/
|
|
12
|
+
makeStakeBldInvitation(): Promise<Invitation<import("@agoric/vow").Vow<import("@agoric/async-flow").HostInterface<import("../utils/zoe-tools.js").ResolvedContinuingOfferResult>>, undefined>>;
|
|
13
|
+
makeAccount(): Promise<import("@endo/exo").Guarded<{
|
|
14
|
+
asContinuingOffer(): import("@agoric/vow").Vow<import("@agoric/async-flow").HostInterface<import("../utils/zoe-tools.js").ResolvedContinuingOfferResult>>;
|
|
15
|
+
getBalance(denom: import("../orchestration-api.js").DenomArg): import("@agoric/vow").Vow<import("../orchestration-api.js").DenomAmount>;
|
|
16
|
+
getBalances(): import("@agoric/vow").Vow<import("../orchestration-api.js").DenomAmount[]>;
|
|
17
|
+
getPublicTopics(): import("@agoric/vow").Vow<import("@agoric/async-flow").HostInterface<Record<string, import("@agoric/zoe/src/contractSupport/topics.js").ResolvedPublicTopic<unknown>>>>;
|
|
18
|
+
delegate(validatorAddress: string, ertpAmount: Amount<"nat">): import("@agoric/vow").Vow<Record<unknown, unknown>>;
|
|
19
|
+
undelegate(validatorAddress: string, ertpAmount: Amount<"nat">): import("@agoric/vow").Vow<void | import("@agoric/time").TimestampRecord>;
|
|
20
|
+
deposit(payment: globalThis.Payment<"nat">): import("@agoric/vow").Vow<void>;
|
|
21
|
+
withdraw(amount: import("@agoric/ertp").NatAmount): import("@agoric/vow").Vow<globalThis.Payment<"nat">>;
|
|
22
|
+
executeTx(messages: {
|
|
23
|
+
'@type': string;
|
|
24
|
+
}[]): import("@agoric/vow").Vow<{
|
|
25
|
+
'@type': string;
|
|
26
|
+
}[]>;
|
|
27
|
+
getAddress(): import("../orchestration-api.js").ChainAddress;
|
|
28
|
+
send(toAccount: import("../orchestration-api.js").ChainAddress, amounts: import("../orchestration-api.js").AmountArg): import("@agoric/vow").Vow<void>;
|
|
29
|
+
sendAll(toAccount: import("../orchestration-api.js").ChainAddress, amounts: import("../orchestration-api.js").AmountArg[]): import("@agoric/vow").Vow<void>;
|
|
30
|
+
transfer(destination: import("../orchestration-api.js").ChainAddress, amount: import("../orchestration-api.js").AmountArg, opts?: import("../cosmos-api.js").IBCMsgTransferOptions | undefined): import("@agoric/vow").Vow<any>;
|
|
31
|
+
transferSteps(amount: import("../orchestration-api.js").AmountArg, msg: import("../orchestration-api.js").TransferMsg): import("@agoric/vow").Vow<void>;
|
|
32
|
+
sendThenWaitForAck(packetSender: Remote<import("../exos/packet-tools.js").PacketSender>, opts?: import("../exos/packet-tools.js").PacketOptions | undefined): import("@agoric/async-flow").HostInterface<import("@agoric/vow").Vow<any>>;
|
|
33
|
+
matchFirstPacket(args_0?: import("@agoric/vow").EVow<globalThis.Pattern>): import("@agoric/async-flow").HostInterface<import("@agoric/vow").Vow<{
|
|
34
|
+
resolver: import("@agoric/vow").VowResolver<any>;
|
|
35
|
+
match: import("@agoric/vow").Vow<any>;
|
|
36
|
+
}>>;
|
|
37
|
+
monitorTransfers(tap: import("@agoric/vats/src/bridge-target.js").TargetApp): import("@agoric/vow").Vow<import("@agoric/async-flow").HostInterface<import("@agoric/vats/src/bridge-target.js").TargetRegistration>>;
|
|
38
|
+
}>>;
|
|
39
|
+
/**
|
|
40
|
+
* Invitation to make an account, without any funds
|
|
41
|
+
*/
|
|
42
|
+
makeAccountInvitationMaker(): Promise<Invitation<import("@agoric/vow").Vow<import("@agoric/async-flow").HostInterface<import("../utils/zoe-tools.js").ResolvedContinuingOfferResult>>, undefined>>;
|
|
43
|
+
}>;
|
|
44
|
+
}>;
|
|
45
|
+
import type { NameHub } from '@agoric/vats';
|
|
46
|
+
import type { Remote } from '@agoric/internal';
|
|
47
|
+
import type { LocalChain } from '@agoric/vats/src/localchain.js';
|
|
48
|
+
import type { TimerService } from '@agoric/time';
|
|
49
|
+
//# sourceMappingURL=stake-bld.contract.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stake-bld.contract.d.ts","sourceRoot":"","sources":["stake-bld.contract.js"],"names":[],"mappings":"AAoCO,2BAVI,GAAG,eACH;IACN,WAAW,EAAE,OAAO,OAAO,CAAC,CAAC;IAC7B,UAAU,EAAE,OAAO,UAAU,CAAC,CAAC;IAC/B,UAAU,EAAE,UAAU,CAAC;IACvB,WAAW,EAAE,WAAW,CAAC;IACzB,YAAY,EAAE,YAAY,CAAC;CAC5B,WACO,OAAO,kBAAkB,EAAE,OAAO;;QAsEvC;;WAEG;;;;;;;;;;;;;;;;;;;;;;;;;;;;QA4BH;;WAEG;;;GAaR;6BApIyB,cAAc;4BACf,kBAAkB;gCAEd,gCAAgC;kCAD9B,cAAc"}
|
|
@@ -12,6 +12,7 @@ import { M } from '@endo/patterns';
|
|
|
12
12
|
import { makeChainHub } from '../exos/chain-hub.js';
|
|
13
13
|
import { prepareLocalOrchestrationAccountKit } from '../exos/local-orchestration-account.js';
|
|
14
14
|
import fetchedChainInfo from '../fetched-chain-info.js';
|
|
15
|
+
import { makeZoeTools } from '../utils/zoe-tools.js';
|
|
15
16
|
|
|
16
17
|
/**
|
|
17
18
|
* @import {NameHub} from '@agoric/vats';
|
|
@@ -42,7 +43,12 @@ export const start = async (zcf, privateArgs, baggage) => {
|
|
|
42
43
|
);
|
|
43
44
|
const vowTools = prepareVowTools(zone.subZone('vows'));
|
|
44
45
|
|
|
45
|
-
const chainHub = makeChainHub(
|
|
46
|
+
const chainHub = makeChainHub(
|
|
47
|
+
zone.subZone('chainHub'),
|
|
48
|
+
privateArgs.agoricNames,
|
|
49
|
+
vowTools,
|
|
50
|
+
);
|
|
51
|
+
const zoeTools = makeZoeTools(zcf, vowTools);
|
|
46
52
|
|
|
47
53
|
const { localchain, timerService } = privateArgs;
|
|
48
54
|
const makeLocalOrchestrationAccountKit = prepareLocalOrchestrationAccountKit(
|
|
@@ -54,6 +60,7 @@ export const start = async (zcf, privateArgs, baggage) => {
|
|
|
54
60
|
vowTools,
|
|
55
61
|
chainHub,
|
|
56
62
|
localchain,
|
|
63
|
+
zoeTools,
|
|
57
64
|
},
|
|
58
65
|
);
|
|
59
66
|
|
|
@@ -104,6 +111,8 @@ export const start = async (zcf, privateArgs, baggage) => {
|
|
|
104
111
|
const { give } = seat.getProposal();
|
|
105
112
|
trace('makeStakeBldInvitation', give);
|
|
106
113
|
const { holder } = await makeLocalAccountKit();
|
|
114
|
+
/** @type {Record<string, Payment<'nat'>>} */
|
|
115
|
+
// @ts-expect-error XXX PaymentPKeywordRecord throught deeplyFulfilled will be a PaymnentKeywordRecord
|
|
107
116
|
const { In } = await deeplyFulfilled(
|
|
108
117
|
withdrawFromSeat(zcf, seat, give),
|
|
109
118
|
);
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @import {Baggage} from '@agoric/vat-data';
|
|
3
|
+
* @import {Remote} from '@agoric/internal';
|
|
4
|
+
* @import {IBCConnectionID, NameHub} from '@agoric/vats';
|
|
5
|
+
* @import {TimerService} from '@agoric/time';
|
|
6
|
+
* @import {ResolvedContinuingOfferResult} from '../utils/zoe-tools.js';
|
|
7
|
+
* @import {ICQConnection, CosmosInterchainService, ChainHub} from '../types.js';
|
|
8
|
+
*/
|
|
9
|
+
/** @type {ContractMeta<typeof start>} */
|
|
10
|
+
export const meta: ContractMeta<typeof start>;
|
|
11
|
+
export const privateArgsShape: {
|
|
12
|
+
agoricNames: globalThis.Pattern;
|
|
13
|
+
cosmosInterchainService: globalThis.Pattern;
|
|
14
|
+
storageNode: globalThis.Pattern;
|
|
15
|
+
marshaller: globalThis.Pattern;
|
|
16
|
+
timer: globalThis.Pattern;
|
|
17
|
+
} | undefined;
|
|
18
|
+
export function start(zcf: ZCF<StakeIcaTerms>, privateArgs: {
|
|
19
|
+
agoricNames: Remote<NameHub>;
|
|
20
|
+
cosmosInterchainService: CosmosInterchainService;
|
|
21
|
+
storageNode: StorageNode;
|
|
22
|
+
marshaller: Marshaller;
|
|
23
|
+
timer: TimerService;
|
|
24
|
+
}, baggage: Baggage): Promise<{
|
|
25
|
+
publicFacet: import("@endo/exo").Guarded<{
|
|
26
|
+
makeAccount(): Promise<import("@endo/exo").Guarded<{
|
|
27
|
+
asContinuingOffer(): import("@agoric/vow").Vow<import("@agoric/async-flow").HostInterface<ResolvedContinuingOfferResult>>;
|
|
28
|
+
getPublicTopics(): import("@agoric/vow").Vow<import("@agoric/async-flow").HostInterface<Record<string, import("@agoric/zoe/src/contractSupport/topics.js").ResolvedPublicTopic<unknown>>>>;
|
|
29
|
+
getAddress(): import("@agoric/async-flow").HostInterface<import("../orchestration-api.js").ChainAddress>;
|
|
30
|
+
delegate(validator: import("../cosmos-api.js").CosmosValidatorAddress, amount: import("../orchestration-api.js").AmountArg): import("@agoric/vow").Vow<void>;
|
|
31
|
+
redelegate(srcValidator: import("../cosmos-api.js").CosmosValidatorAddress, dstValidator: import("../cosmos-api.js").CosmosValidatorAddress, amount: import("../orchestration-api.js").AmountArg): import("@agoric/vow").Vow<void>;
|
|
32
|
+
withdrawReward(validator: import("../cosmos-api.js").CosmosValidatorAddress): import("@agoric/vow").Vow<import("../orchestration-api.js").DenomAmount[]>;
|
|
33
|
+
getBalance(denom: import("../orchestration-api.js").DenomArg): import("@agoric/vow").Vow<import("../orchestration-api.js").DenomAmount>;
|
|
34
|
+
getBalances(): import("@agoric/vow").Vow<import("../orchestration-api.js").DenomAmount[]>;
|
|
35
|
+
send(toAccount: import("../orchestration-api.js").ChainAddress, amounts: import("../orchestration-api.js").AmountArg): import("@agoric/vow").Vow<void>;
|
|
36
|
+
sendAll(toAccount: import("../orchestration-api.js").ChainAddress, amounts: import("../orchestration-api.js").AmountArg[]): import("@agoric/vow").Vow<void>;
|
|
37
|
+
transfer(destination: import("../orchestration-api.js").ChainAddress, amount: import("../orchestration-api.js").AmountArg, opts?: import("../cosmos-api.js").IBCMsgTransferOptions | undefined): import("@agoric/vow").Vow<void>;
|
|
38
|
+
transferSteps(amount: import("../orchestration-api.js").AmountArg, msg: import("../orchestration-api.js").TransferMsg): import("@agoric/vow").Vow<void>;
|
|
39
|
+
withdrawRewards(): import("@agoric/vow").Vow<import("../orchestration-api.js").DenomAmount[]>;
|
|
40
|
+
undelegate(delegations: {
|
|
41
|
+
amount: import("../orchestration-api.js").AmountArg;
|
|
42
|
+
delegator?: import("../orchestration-api.js").ChainAddress;
|
|
43
|
+
validator: import("../cosmos-api.js").CosmosValidatorAddress;
|
|
44
|
+
}[]): import("@agoric/vow").Vow<void>;
|
|
45
|
+
deactivate(): import("@agoric/vow").Vow<void>;
|
|
46
|
+
reactivate(): import("@agoric/vow").Vow<void>;
|
|
47
|
+
getDelegation(validator: import("../cosmos-api.js").CosmosValidatorAddress): import("@agoric/vow").Vow<import("@agoric/async-flow").HostInterface<import("../cosmos-api.js").CosmosDelegationResponse>>;
|
|
48
|
+
getDelegations(): import("@agoric/vow").Vow<{
|
|
49
|
+
delegator: {
|
|
50
|
+
chainId: string;
|
|
51
|
+
value: string;
|
|
52
|
+
encoding: "bech32" | "ethereum";
|
|
53
|
+
};
|
|
54
|
+
validator: {
|
|
55
|
+
chainId: string;
|
|
56
|
+
value: `${string}valoper${string}`;
|
|
57
|
+
encoding: "bech32";
|
|
58
|
+
};
|
|
59
|
+
amount: {
|
|
60
|
+
denom: import("../orchestration-api.js").Denom;
|
|
61
|
+
value: bigint;
|
|
62
|
+
};
|
|
63
|
+
}[]>;
|
|
64
|
+
getUnbondingDelegation(validator: import("../cosmos-api.js").CosmosValidatorAddress): import("@agoric/vow").Vow<import("@agoric/async-flow").HostInterface<import("@agoric/cosmic-proto/cosmos/staking/v1beta1/staking.js").UnbondingDelegation>>;
|
|
65
|
+
getUnbondingDelegations(): import("@agoric/vow").Vow<{
|
|
66
|
+
delegatorAddress: string;
|
|
67
|
+
validatorAddress: string;
|
|
68
|
+
entries: {
|
|
69
|
+
creationHeight: bigint;
|
|
70
|
+
completionTime: {
|
|
71
|
+
seconds: bigint;
|
|
72
|
+
nanos: number;
|
|
73
|
+
};
|
|
74
|
+
initialBalance: string;
|
|
75
|
+
balance: string;
|
|
76
|
+
}[];
|
|
77
|
+
}[]>;
|
|
78
|
+
getRedelegations(): import("@agoric/vow").Vow<{
|
|
79
|
+
redelegation: {
|
|
80
|
+
delegatorAddress: string;
|
|
81
|
+
validatorSrcAddress: string;
|
|
82
|
+
validatorDstAddress: string;
|
|
83
|
+
entries: {
|
|
84
|
+
creationHeight: bigint;
|
|
85
|
+
completionTime: {
|
|
86
|
+
seconds: bigint;
|
|
87
|
+
nanos: number;
|
|
88
|
+
};
|
|
89
|
+
initialBalance: string;
|
|
90
|
+
sharesDst: string;
|
|
91
|
+
}[];
|
|
92
|
+
};
|
|
93
|
+
entries: {
|
|
94
|
+
redelegationEntry: {
|
|
95
|
+
creationHeight: bigint;
|
|
96
|
+
completionTime: {
|
|
97
|
+
seconds: bigint;
|
|
98
|
+
nanos: number;
|
|
99
|
+
};
|
|
100
|
+
initialBalance: string;
|
|
101
|
+
sharesDst: string;
|
|
102
|
+
};
|
|
103
|
+
balance: string;
|
|
104
|
+
}[];
|
|
105
|
+
}[]>;
|
|
106
|
+
getReward(validator: import("../cosmos-api.js").CosmosValidatorAddress): import("@agoric/vow").Vow<import("../orchestration-api.js").DenomAmount[]>;
|
|
107
|
+
getRewards(): import("@agoric/vow").Vow<import("@agoric/async-flow").HostInterface<import("../cosmos-api.js").CosmosRewardsResponse>>;
|
|
108
|
+
}>>;
|
|
109
|
+
makeAccountInvitationMaker(): Promise<Invitation<ResolvedContinuingOfferResult, undefined>>;
|
|
110
|
+
}>;
|
|
111
|
+
}>;
|
|
112
|
+
export type StakeIcaTerms = {
|
|
113
|
+
chainId: string;
|
|
114
|
+
hostConnectionId: IBCConnectionID;
|
|
115
|
+
controllerConnectionId: IBCConnectionID;
|
|
116
|
+
icqEnabled: boolean;
|
|
117
|
+
};
|
|
118
|
+
export type StakeIcaSF = typeof start;
|
|
119
|
+
import type { NameHub } from '@agoric/vats';
|
|
120
|
+
import type { Remote } from '@agoric/internal';
|
|
121
|
+
import type { CosmosInterchainService } from '../types.js';
|
|
122
|
+
import type { TimerService } from '@agoric/time';
|
|
123
|
+
import type { Baggage } from '@agoric/vat-data';
|
|
124
|
+
import type { ResolvedContinuingOfferResult } from '../utils/zoe-tools.js';
|
|
125
|
+
import type { IBCConnectionID } from '@agoric/vats';
|
|
126
|
+
//# sourceMappingURL=stake-ica.contract.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stake-ica.contract.d.ts","sourceRoot":"","sources":["stake-ica.contract.js"],"names":[],"mappings":"AAgBA;;;;;;;GAOG;AAEH,yCAAyC;AACzC,mBADW,YAAY,CAAC,OAAO,KAAK,CAAC,CAelC;AAEH;;;;;;cAAsD;AAuB/C,2BAVI,GAAG,CAAC,aAAa,CAAC,eAClB;IACN,WAAW,EAAE,OAAO,OAAO,CAAC,CAAC;IAC7B,uBAAuB,EAAE,uBAAuB,CAAC;IACjD,WAAW,EAAE,WAAW,CAAC;IACzB,UAAU,EAAE,UAAU,CAAC;IACvB,KAAK,EAAE,YAAY,CAAC;CACrB,WACO,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyGjB;4BA1HY;IACR,OAAO,EAAE,MAAM,CAAC;IAChB,gBAAgB,EAAE,eAAe,CAAC;IAClC,sBAAsB,EAAE,eAAe,CAAC;IACxC,UAAU,EAAE,OAAO,CAAC;CACrB;yBAwHU,OAAO,KAAK;6BAxJiB,cAAc;4BADhC,kBAAkB;6CAIwB,aAAa;kCAFjD,cAAc;6BAHnB,kBAAkB;mDAII,uBAAuB;qCAF5B,cAAc"}
|
|
@@ -6,7 +6,7 @@ import { heapVowE as E, prepareVowTools } from '@agoric/vow/vat.js';
|
|
|
6
6
|
import {
|
|
7
7
|
prepareRecorderKitMakers,
|
|
8
8
|
provideAll,
|
|
9
|
-
} from '@agoric/zoe/src/contractSupport';
|
|
9
|
+
} from '@agoric/zoe/src/contractSupport/index.js';
|
|
10
10
|
import { InvitationShape } from '@agoric/zoe/src/typeGuards.js';
|
|
11
11
|
import { makeDurableZone } from '@agoric/zone/durable.js';
|
|
12
12
|
import { M } from '@endo/patterns';
|
|
@@ -84,7 +84,11 @@ export const start = async (zcf, privateArgs, baggage) => {
|
|
|
84
84
|
|
|
85
85
|
const vowTools = prepareVowTools(zone.subZone('vows'));
|
|
86
86
|
|
|
87
|
-
const chainHub = makeChainHub(
|
|
87
|
+
const chainHub = makeChainHub(
|
|
88
|
+
zone.subZone('chainHub'),
|
|
89
|
+
agoricNames,
|
|
90
|
+
vowTools,
|
|
91
|
+
);
|
|
88
92
|
|
|
89
93
|
const makeCosmosOrchestrationAccount = prepareCosmosOrchestrationAccount(
|
|
90
94
|
zone,
|
|
@@ -2,7 +2,7 @@ export const start: (zcf: ZCF<Record<string, unknown>>, privateArgs: Orchestrati
|
|
|
2
2
|
marshaller: Marshaller;
|
|
3
3
|
}, baggage: import("@agoric/vat-data").Baggage) => Promise<{
|
|
4
4
|
publicFacet: import("@endo/exo").Guarded<{
|
|
5
|
-
makeAccount(): Promise<Invitation<import("@agoric/vow").Vow<import("
|
|
5
|
+
makeAccount(): Promise<Invitation<import("@agoric/vow").Vow<import("../utils/zoe-tools.js").ResolvedContinuingOfferResult>, {
|
|
6
6
|
chainName: string;
|
|
7
7
|
}>>;
|
|
8
8
|
}>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"staking-combinations.contract.d.ts","sourceRoot":"","sources":["staking-combinations.contract.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"staking-combinations.contract.d.ts","sourceRoot":"","sources":["staking-combinations.contract.js"],"names":[],"mappings":"AAkKA;gBA7HiB,UAAU;;;;;;;;;;;;;;;;;;GA6HsB;yCA9IS,0BAA0B"}
|
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
* The primary offer result is a power for invitation makers that can perform
|
|
6
6
|
* actions with an ICA account.
|
|
7
7
|
*/
|
|
8
|
-
import { makeSharedStateRecord } from '@agoric/async-flow';
|
|
9
8
|
import { AmountShape } from '@agoric/ertp';
|
|
10
9
|
import { M } from '@endo/patterns';
|
|
11
10
|
import { prepareCombineInvitationMakers } from '../exos/combine-invitation-makers.js';
|
|
@@ -13,6 +12,7 @@ import { CosmosOrchestrationInvitationMakersI } from '../exos/cosmos-orchestrati
|
|
|
13
12
|
import { ChainAddressShape, DelegationShape } from '../typeGuards.js';
|
|
14
13
|
import { withOrchestration } from '../utils/start-helper.js';
|
|
15
14
|
import * as flows from './staking-combinations.flows.js';
|
|
15
|
+
import * as sharedFlows from './shared.flows.js';
|
|
16
16
|
import { prepareChainHubAdmin } from '../exos/chain-hub-admin.js';
|
|
17
17
|
|
|
18
18
|
/**
|
|
@@ -46,16 +46,6 @@ const contract = async (
|
|
|
46
46
|
zone,
|
|
47
47
|
{ orchestrateAll, zoeTools, chainHub },
|
|
48
48
|
) => {
|
|
49
|
-
const contractState = makeSharedStateRecord(
|
|
50
|
-
/**
|
|
51
|
-
* @type {{
|
|
52
|
-
* account: (OrchestrationAccount<any> & LocalAccountMethods) | undefined;
|
|
53
|
-
* }}
|
|
54
|
-
*/ {
|
|
55
|
-
localAccount: undefined,
|
|
56
|
-
},
|
|
57
|
-
);
|
|
58
|
-
|
|
59
49
|
const StakingCombinationsInvitationMakersI = M.interface(
|
|
60
50
|
'StakingCombinationsInvitationMakersI',
|
|
61
51
|
{
|
|
@@ -128,12 +118,25 @@ const contract = async (
|
|
|
128
118
|
StakingCombinationsInvitationMakersI,
|
|
129
119
|
);
|
|
130
120
|
|
|
121
|
+
const { makeLocalAccount } = orchestrateAll(sharedFlows, {});
|
|
122
|
+
/**
|
|
123
|
+
* Setup a shared local account for use in async-flow functions. Typically,
|
|
124
|
+
* exo initState functions need to resolve synchronously, but `makeOnce`
|
|
125
|
+
* allows us to provide a Promise. When using this inside a flow, we must
|
|
126
|
+
* await it to ensure the account is available for use.
|
|
127
|
+
*
|
|
128
|
+
* @type {any} sharedLocalAccountP expects a Promise but this is a vow
|
|
129
|
+
* https://github.com/Agoric/agoric-sdk/issues/9822
|
|
130
|
+
*/
|
|
131
|
+
const sharedLocalAccountP = zone.makeOnce('localAccount', () =>
|
|
132
|
+
makeLocalAccount(),
|
|
133
|
+
);
|
|
134
|
+
|
|
131
135
|
const orchFns = orchestrateAll(flows, {
|
|
132
|
-
|
|
136
|
+
sharedLocalAccountP,
|
|
133
137
|
makeCombineInvitationMakers,
|
|
134
138
|
makeExtraInvitationMaker,
|
|
135
139
|
flows,
|
|
136
|
-
zcf,
|
|
137
140
|
zoeTools,
|
|
138
141
|
});
|
|
139
142
|
|
|
@@ -3,11 +3,9 @@ export function makeAccount(orch: Orchestrator, ctx: {
|
|
|
3
3
|
makeExtraInvitationMaker: (account: any) => InvitationMakers;
|
|
4
4
|
}, _seat: ZCFSeat, { chainName }: {
|
|
5
5
|
chainName: string;
|
|
6
|
-
}): Promise<
|
|
7
|
-
export function depositAndDelegate(orch: Orchestrator, {
|
|
8
|
-
|
|
9
|
-
localAccount?: OrchestrationAccountI & LocalAccountMethods;
|
|
10
|
-
};
|
|
6
|
+
}): Promise<ResolvedContinuingOfferResult>;
|
|
7
|
+
export function depositAndDelegate(orch: Orchestrator, { sharedLocalAccountP, zoeTools }: {
|
|
8
|
+
sharedLocalAccountP: Promise<GuestInterface<LocalOrchestrationAccountKit["holder"]>>;
|
|
11
9
|
zoeTools: GuestInterface<ZoeTools>;
|
|
12
10
|
}, account: GuestInterface<CosmosOrchestrationAccount>, seat: ZCFSeat, validator: CosmosValidatorAddress): Promise<void>;
|
|
13
11
|
export function undelegateAndTransfer(orch: Orchestrator, ctx: object, account: GuestInterface<CosmosOrchestrationAccount>, { delegations, destination }: {
|
|
@@ -20,11 +18,10 @@ export function undelegateAndTransfer(orch: Orchestrator, ctx: object, account:
|
|
|
20
18
|
import type { Orchestrator } from '../types.js';
|
|
21
19
|
import type { MakeCombineInvitationMakers } from '../exos/combine-invitation-makers.js';
|
|
22
20
|
import type { InvitationMakers } from '@agoric/smart-wallet/src/types.js';
|
|
23
|
-
import type {
|
|
24
|
-
import type {
|
|
25
|
-
import type { LocalAccountMethods } from '../types.js';
|
|
26
|
-
import type { ZoeTools } from '../utils/zoe-tools.js';
|
|
21
|
+
import type { ResolvedContinuingOfferResult } from '../utils/zoe-tools.js';
|
|
22
|
+
import type { LocalOrchestrationAccountKit } from '../exos/local-orchestration-account.js';
|
|
27
23
|
import type { GuestInterface } from '@agoric/async-flow';
|
|
24
|
+
import type { ZoeTools } from '../utils/zoe-tools.js';
|
|
28
25
|
import type { CosmosOrchestrationAccount } from '../exos/cosmos-orchestration-account.js';
|
|
29
26
|
import type { CosmosValidatorAddress } from '../types.js';
|
|
30
27
|
import type { AmountArg } from '../types.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"staking-combinations.flows.d.ts","sourceRoot":"","sources":["staking-combinations.flows.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"staking-combinations.flows.d.ts","sourceRoot":"","sources":["staking-combinations.flows.js"],"names":[],"mappings":"AA4BO,kCATI,YAAY,OACZ;IACN,2BAA2B,EAAE,2BAA2B,CAAC;IACzD,wBAAwB,EAAE,CAAC,OAAO,EAAE,GAAG,KAAK,gBAAgB,CAAC;CAC9D,SACO,OAAO,iBACP;IAAE,SAAS,EAAE,MAAM,CAAA;CAAE,GACnB,OAAO,CAAC,6BAA6B,CAAC,CAiBlD;AAcM,yCATI,YAAY,qCAEpB;IAA6E,mBAAmB,EAAxF,OAAO,CAAC,eAAe,4BAA4B,CAAC,QAAQ,CAAC,CAAC,CAAC;IACjC,QAAQ,EAAtC,eAAe,QAAQ,CAAC;CAChC,WAAQ,eAAe,0BAA0B,CAAC,QAC1C,OAAO,aACP,sBAAsB,GACpB,OAAO,CAAC,IAAI,CAAC,CAgCzB;AAcM,4CATI,YAAY,OACZ,MAAM,WACN,eAAe,0BAA0B,CAAC,gCAC1C;IACN,WAAW,EAAE;QAAE,MAAM,EAAE,SAAS,CAAC;QAAC,SAAS,EAAE,sBAAsB,CAAA;KAAE,EAAE,CAAC;IACxE,WAAW,EAAE,YAAY,CAAC;CAC3B,GACS,OAAO,CAAC,IAAI,CAAC,CAYzB;kCA7G8I,aAAa;iDAG9G,sCAAsC;sCAF1B,mCAAmC;mDAInC,uBAAuB;kDAHlC,wCAAwC;oCAHtD,oBAAoB;8BAMK,uBAAuB;gDADpC,yCAAyC;4CAJyD,aAAa;+BAAb,aAAa;kCAAb,aAAa"}
|
|
@@ -2,13 +2,14 @@
|
|
|
2
2
|
* @import {GuestInterface} from '@agoric/async-flow';
|
|
3
3
|
* @import {Orchestrator, OrchestrationFlow, AmountArg, CosmosValidatorAddress, ChainAddress, LocalAccountMethods, OrchestrationAccountI} from '../types.js'
|
|
4
4
|
* @import {ContinuingOfferResult, InvitationMakers} from '@agoric/smart-wallet/src/types.js';
|
|
5
|
+
* @import {LocalOrchestrationAccountKit} from '../exos/local-orchestration-account.js';
|
|
5
6
|
* @import {MakeCombineInvitationMakers} from '../exos/combine-invitation-makers.js';
|
|
6
7
|
* @import {CosmosOrchestrationAccount} from '../exos/cosmos-orchestration-account.js';
|
|
7
|
-
* @import {ZoeTools} from '../utils/zoe-tools.js';
|
|
8
|
+
* @import {ResolvedContinuingOfferResult, ZoeTools} from '../utils/zoe-tools.js';
|
|
8
9
|
*/
|
|
9
10
|
|
|
10
11
|
import { mustMatch } from '@endo/patterns';
|
|
11
|
-
import { makeError } from '@endo/errors';
|
|
12
|
+
import { makeError, q } from '@endo/errors';
|
|
12
13
|
import { makeTracer } from '@agoric/internal';
|
|
13
14
|
import { ChainAddressShape } from '../typeGuards.js';
|
|
14
15
|
|
|
@@ -23,7 +24,7 @@ const trace = makeTracer('StakingCombinationsFlows');
|
|
|
23
24
|
* }} ctx
|
|
24
25
|
* @param {ZCFSeat} _seat
|
|
25
26
|
* @param {{ chainName: string }} offerArgs
|
|
26
|
-
* @returns {Promise<
|
|
27
|
+
* @returns {Promise<ResolvedContinuingOfferResult>}
|
|
27
28
|
*/
|
|
28
29
|
export const makeAccount = async (orch, ctx, _seat, { chainName }) => {
|
|
29
30
|
const chain = await orch.getChain(chainName);
|
|
@@ -31,7 +32,6 @@ export const makeAccount = async (orch, ctx, _seat, { chainName }) => {
|
|
|
31
32
|
|
|
32
33
|
const extraMakers = ctx.makeExtraInvitationMaker(account);
|
|
33
34
|
|
|
34
|
-
/** @type {ContinuingOfferResult} */
|
|
35
35
|
const result = await account.asContinuingOffer();
|
|
36
36
|
|
|
37
37
|
return {
|
|
@@ -48,7 +48,7 @@ harden(makeAccount);
|
|
|
48
48
|
* @satisfies {OrchestrationFlow}
|
|
49
49
|
* @param {Orchestrator} orch
|
|
50
50
|
* @param {object} ctx
|
|
51
|
-
* @param {
|
|
51
|
+
* @param {Promise<GuestInterface<LocalOrchestrationAccountKit['holder']>>} ctx.sharedLocalAccountP
|
|
52
52
|
* @param {GuestInterface<ZoeTools>} ctx.zoeTools
|
|
53
53
|
* @param {GuestInterface<CosmosOrchestrationAccount>} account
|
|
54
54
|
* @param {ZCFSeat} seat
|
|
@@ -57,7 +57,7 @@ harden(makeAccount);
|
|
|
57
57
|
*/
|
|
58
58
|
export const depositAndDelegate = async (
|
|
59
59
|
orch,
|
|
60
|
-
{
|
|
60
|
+
{ sharedLocalAccountP, zoeTools },
|
|
61
61
|
account,
|
|
62
62
|
seat,
|
|
63
63
|
validator,
|
|
@@ -65,20 +65,23 @@ export const depositAndDelegate = async (
|
|
|
65
65
|
await null;
|
|
66
66
|
trace('depositAndDelegate', account, seat, validator);
|
|
67
67
|
mustMatch(validator, ChainAddressShape);
|
|
68
|
-
|
|
69
|
-
const agoricChain = await orch.getChain('agoric');
|
|
70
|
-
contractState.localAccount = await agoricChain.makeAccount();
|
|
71
|
-
}
|
|
68
|
+
|
|
72
69
|
const { give } = seat.getProposal();
|
|
73
|
-
|
|
70
|
+
/**
|
|
71
|
+
* @type {any} XXX methods returning vows
|
|
72
|
+
* https://github.com/Agoric/agoric-sdk/issues/9822
|
|
73
|
+
*/
|
|
74
|
+
const sharedLocalAccount = await sharedLocalAccountP;
|
|
75
|
+
await zoeTools.localTransfer(seat, sharedLocalAccount, give);
|
|
74
76
|
|
|
75
77
|
const address = account.getAddress();
|
|
76
78
|
try {
|
|
77
|
-
await
|
|
79
|
+
await sharedLocalAccount.transfer(address, give.Stake);
|
|
78
80
|
} catch (cause) {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
81
|
+
await zoeTools.withdrawToSeat(sharedLocalAccount, seat, give);
|
|
82
|
+
const errMsg = makeError(`ibc transfer failed ${q(cause)}`);
|
|
83
|
+
seat.exit(errMsg);
|
|
84
|
+
throw errMsg;
|
|
82
85
|
}
|
|
83
86
|
seat.exit();
|
|
84
87
|
await account.delegate(validator, give.Stake);
|
|
@@ -104,7 +107,7 @@ export const undelegateAndTransfer = async (
|
|
|
104
107
|
) => {
|
|
105
108
|
await account.undelegate(delegations);
|
|
106
109
|
for (const { amount } of delegations) {
|
|
107
|
-
await account.transfer(
|
|
110
|
+
await account.transfer(destination, amount);
|
|
108
111
|
}
|
|
109
112
|
};
|
|
110
113
|
harden(undelegateAndTransfer);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"swap.contract.d.ts","sourceRoot":"","sources":["swap.contract.js"],"names":[],"mappings":"AAMA;;;;;;;;GAQG;AAEH,yCAAyC;AACzC,mBADW,YAAY,CAAC,OAAO,KAAK,CAAC,CAWnC;AASK,0CAHI,KAAK;;;EAIsC;
|
|
1
|
+
{"version":3,"file":"swap.contract.d.ts","sourceRoot":"","sources":["swap.contract.js"],"names":[],"mappings":"AAMA;;;;;;;;GAQG;AAEH,yCAAyC;AACzC,mBADW,YAAY,CAAC,OAAO,KAAK,CAAC,CAWnC;AASK,0CAHI,KAAK;;;EAIsC;AAgDtD;iBAxCkB,OAAO,OAAO,CAAC;gBAChB,OAAO,UAAU,CAAC;0BACR,OAAO,uBAAuB,CAAC;iBACxC,OAAO,WAAW,CAAC;kBAClB,OAAO,YAAY,CAAC;gBACtB,UAAU;;;;;;;;GAmCsB;6BA1EvB,cAAc;4BAFf,kBAAkB;gCADd,gCAAgC;6CAEnB,2BAA2B;kCAHtC,cAAc"}
|
|
@@ -7,7 +7,7 @@ export const start: (zcf: ZCF<Record<string, unknown>>, privateArgs: {
|
|
|
7
7
|
timerService: Remote<TimerService>;
|
|
8
8
|
}, baggage: import("@agoric/vat-data").Baggage) => Promise<{
|
|
9
9
|
publicFacet: import("@endo/exo").Guarded<{
|
|
10
|
-
|
|
10
|
+
makeUnbondAndTransferInvitation(): Promise<Invitation<import("@agoric/vow").Vow<void>, undefined>>;
|
|
11
11
|
}>;
|
|
12
12
|
}>;
|
|
13
13
|
import type { NameHub } from '@agoric/vats';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unbond.contract.d.ts","sourceRoot":"","sources":["unbond.contract.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"unbond.contract.d.ts","sourceRoot":"","sources":["unbond.contract.js"],"names":[],"mappings":"AAwDA;iBArCkB,OAAO,OAAO,CAAC;gBAChB,OAAO,UAAU,CAAC;0BACR,OAAO,uBAAuB,CAAC;iBACxC,OAAO,WAAW,CAAC;gBACpB,UAAU;kBACR,OAAO,YAAY,CAAC;;;;;GAgCU;6BAjDvB,cAAc;4BACf,kBAAkB;gCAFd,gCAAgC;6CAInB,2BAA2B;kCALtC,cAAc"}
|
|
@@ -27,14 +27,19 @@ import * as flows from './unbond.flows.js';
|
|
|
27
27
|
* @param {Zone} zone
|
|
28
28
|
* @param {OrchestrationTools} tools
|
|
29
29
|
*/
|
|
30
|
-
const contract = async (
|
|
31
|
-
|
|
30
|
+
const contract = async (
|
|
31
|
+
zcf,
|
|
32
|
+
privateArgs,
|
|
33
|
+
zone,
|
|
34
|
+
{ orchestrateAll, zcfTools },
|
|
35
|
+
) => {
|
|
36
|
+
const { unbondAndTransfer } = orchestrateAll(flows, { zcfTools });
|
|
32
37
|
|
|
33
38
|
const publicFacet = zone.exo('publicFacet', undefined, {
|
|
34
|
-
|
|
39
|
+
makeUnbondAndTransferInvitation() {
|
|
35
40
|
return zcf.makeInvitation(
|
|
36
|
-
|
|
37
|
-
'Unbond and
|
|
41
|
+
unbondAndTransfer,
|
|
42
|
+
'Unbond and transfer',
|
|
38
43
|
undefined,
|
|
39
44
|
harden({
|
|
40
45
|
// Nothing to give; the funds come from undelegating
|