@agoric/orchestration 0.1.1-dev-a035bbe.0 → 0.1.1-dev-37ec151.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/exos/local-chain-account-kit.d.ts +2 -1
- package/src/exos/local-chain-account-kit.d.ts.map +1 -1
- package/src/exos/local-chain-account-kit.js +2 -1
- package/src/exos/orchestrator.d.ts +4778 -0
- package/src/exos/orchestrator.d.ts.map +1 -0
- package/src/exos/orchestrator.js +101 -0
- package/src/exos/remote-chain-facade.d.ts +88 -0
- package/src/exos/remote-chain-facade.d.ts.map +1 -0
- package/src/exos/remote-chain-facade.js +91 -0
- package/src/facade.d.ts +32 -4
- package/src/facade.d.ts.map +1 -1
- package/src/facade.js +28 -94
- package/src/utils/start-helper.d.ts.map +1 -1
- package/src/utils/start-helper.js +18 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"orchestrator.d.ts","sourceRoot":"","sources":["orchestrator.js"],"names":[],"mappings":"AA+BA,8DAAsC;AACtC,sEAAuE;AACvE,0DAAqC;AACrC,8DAAsC;;;;;AAItC,0BAA0B;AAC1B;;;;;GAKG;AAiBI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kDAaD,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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from '@agoric/internal';
|
|
4
|
+
import { V } from '@agoric/vow/vat.js';
|
|
5
|
+
import { M } from '@endo/patterns';
|
|
6
|
+
// eslint-disable-next-line import/no-cycle -- FIXME
|
|
7
|
+
import { makeLocalChainFacade } from '../facade.js';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* @import {Zone} from '@agoric/base-zone';
|
|
11
|
+
* @import {ChainHub} from '../utils/chainHub.js';
|
|
12
|
+
* @import {Connection, Port} from '@agoric/network';
|
|
13
|
+
* @import {AnyJson} from '@agoric/cosmic-proto';
|
|
14
|
+
* @import {TxBody} from '@agoric/cosmic-proto/cosmos/tx/v1beta1/tx.js';
|
|
15
|
+
* @import {LocalIbcAddress, RemoteIbcAddress} from '@agoric/vats/tools/ibc-utils.js';
|
|
16
|
+
* @import {AsyncFlowTools} from '@agoric/async-flow';
|
|
17
|
+
* @import {Vow} from '@agoric/vow';
|
|
18
|
+
* @import {TimerService} from '@agoric/time';
|
|
19
|
+
* @import {IBCConnectionID} from '@agoric/vats';
|
|
20
|
+
* @import {LocalChain} from '@agoric/vats/src/localchain.js';
|
|
21
|
+
* @import {RecorderKit, MakeRecorderKit} from '@agoric/zoe/src/contractSupport/recorder.js'.
|
|
22
|
+
* @import {Remote} from '@agoric/internal';
|
|
23
|
+
* @import {OrchestrationService} from '../service.js';
|
|
24
|
+
* @import {MakeLocalChainAccountKit} from './local-chain-account-kit.js';
|
|
25
|
+
* @import {Chain, ChainInfo, CosmosChainInfo, IBCConnectionInfo, OrchestrationAccount, Orchestrator} from '../types.js';
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
const { Fail } = assert;
|
|
29
|
+
const trace = makeTracer('Orchestrator');
|
|
30
|
+
|
|
31
|
+
// TODO more validation
|
|
32
|
+
export const ChainInfoShape = M.any();
|
|
33
|
+
export const LocalChainAccountShape = M.remotable('LocalChainAccount');
|
|
34
|
+
export const DenomShape = M.string();
|
|
35
|
+
export const BrandInfoShape = M.any();
|
|
36
|
+
|
|
37
|
+
export const DenomAmountShape = { denom: DenomShape, value: M.bigint() };
|
|
38
|
+
|
|
39
|
+
/** @see {Orchestrator} */
|
|
40
|
+
export const OrchestratorI = M.interface('Orchestrator', {
|
|
41
|
+
getChain: M.callWhen(M.string()).returns(ChainInfoShape),
|
|
42
|
+
makeLocalAccount: M.callWhen().returns(LocalChainAccountShape),
|
|
43
|
+
getBrandInfo: M.call(DenomShape).returns(BrandInfoShape),
|
|
44
|
+
asAmount: M.call(DenomAmountShape).returns(AmountShape),
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* @param {Zone} zone
|
|
49
|
+
* @param {{
|
|
50
|
+
* asyncFlowTools: AsyncFlowTools;
|
|
51
|
+
* chainHub: ChainHub;
|
|
52
|
+
* localchain: Remote<LocalChain>;
|
|
53
|
+
* makeLocalChainAccountKit: MakeLocalChainAccountKit;
|
|
54
|
+
* makeRecorderKit: MakeRecorderKit;
|
|
55
|
+
* makeRemoteChainFacade: any;
|
|
56
|
+
* orchestrationService: Remote<OrchestrationService>;
|
|
57
|
+
* storageNode: Remote<StorageNode>;
|
|
58
|
+
* timerService: Remote<TimerService>;
|
|
59
|
+
* zcf: ZCF;
|
|
60
|
+
* }} powers
|
|
61
|
+
*/
|
|
62
|
+
export const prepareOrchestrator = (
|
|
63
|
+
zone,
|
|
64
|
+
{ chainHub, localchain, makeLocalChainAccountKit, makeRemoteChainFacade },
|
|
65
|
+
) =>
|
|
66
|
+
zone.exoClass(
|
|
67
|
+
'Orchestrator',
|
|
68
|
+
OrchestratorI,
|
|
69
|
+
() => {
|
|
70
|
+
trace('making an Orchestrator');
|
|
71
|
+
return {};
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
/** @type {Orchestrator['getChain']} */
|
|
75
|
+
getChain: async name => {
|
|
76
|
+
const agoricChainInfo = await chainHub.getChainInfo('agoric');
|
|
77
|
+
|
|
78
|
+
if (name === 'agoric') {
|
|
79
|
+
return makeLocalChainFacade(
|
|
80
|
+
localchain,
|
|
81
|
+
makeLocalChainAccountKit,
|
|
82
|
+
agoricChainInfo,
|
|
83
|
+
);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
const remoteChainInfo = await chainHub.getChainInfo(name);
|
|
87
|
+
const connectionInfo = await chainHub.getConnectionInfo(
|
|
88
|
+
agoricChainInfo.chainId,
|
|
89
|
+
remoteChainInfo.chainId,
|
|
90
|
+
);
|
|
91
|
+
|
|
92
|
+
return makeRemoteChainFacade(remoteChainInfo, connectionInfo);
|
|
93
|
+
},
|
|
94
|
+
makeLocalAccount() {
|
|
95
|
+
return V(localchain).makeAccount();
|
|
96
|
+
},
|
|
97
|
+
getBrandInfo: () => Fail`not yet implemented`,
|
|
98
|
+
asAmount: () => Fail`not yet implemented`,
|
|
99
|
+
},
|
|
100
|
+
);
|
|
101
|
+
harden(prepareOrchestrator);
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/** @see {Chain} */
|
|
2
|
+
export const RemoteChainFacadeI: import("@endo/patterns").InterfaceGuard<{
|
|
3
|
+
getChainInfo: import("@endo/patterns").MethodGuard;
|
|
4
|
+
makeAccount: import("@endo/patterns").MethodGuard;
|
|
5
|
+
}>;
|
|
6
|
+
export function prepareRemoteChainFacade(zone: Zone, { makeCosmosOrchestrationAccount, orchestration, storageNode, timer }: {
|
|
7
|
+
makeCosmosOrchestrationAccount: (chainAddress: import("../orchestration-api.js").ChainAddress, bondDenom: string, io: {
|
|
8
|
+
account: import("../cosmos-api.js").IcaAccount;
|
|
9
|
+
storageNode: Remote<globalThis.StorageNode>;
|
|
10
|
+
icqConnection: import("@endo/exo").Guarded<{
|
|
11
|
+
getLocalAddress(): `/ibc-port/${string}`;
|
|
12
|
+
getRemoteAddress(): `/${string}ibc-port/${string}/ordered/${string}` | `/${string}ibc-port/${string}/unordered/${string}`;
|
|
13
|
+
query(msgs: import("@agoric/cosmic-proto").JsonSafe<import("@agoric/cosmic-proto/tendermint/abci/types.js").RequestQuery>[]): Promise<import("@agoric/cosmic-proto").JsonSafe<import("@agoric/cosmic-proto/tendermint/abci/types.js").ResponseQuery>[]>;
|
|
14
|
+
}> | undefined;
|
|
15
|
+
timer: Remote<TimerService>;
|
|
16
|
+
}) => import("@endo/exo").Guarded<{
|
|
17
|
+
asContinuingOffer(): {
|
|
18
|
+
publicSubscribers: {
|
|
19
|
+
account: {
|
|
20
|
+
description: string;
|
|
21
|
+
subscriber: globalThis.Subscriber<import("./cosmosOrchestrationAccount.js").ComosOrchestrationAccountNotification>;
|
|
22
|
+
storagePath: Promise<string>;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
invitationMakers: import("@endo/exo").Guarded<{
|
|
26
|
+
Delegate(validator: import("../cosmos-api.js").CosmosValidatorAddress, amount: import("../orchestration-api.js").AmountArg): Promise<Invitation<void, undefined>>;
|
|
27
|
+
Redelegate(srcValidator: import("../cosmos-api.js").CosmosValidatorAddress, dstValidator: import("../cosmos-api.js").CosmosValidatorAddress, amount: import("../orchestration-api.js").AmountArg): Promise<Invitation<void, undefined>>;
|
|
28
|
+
WithdrawReward(validator: import("../cosmos-api.js").CosmosValidatorAddress): Promise<Invitation<import("../orchestration-api.js").DenomAmount[], undefined>>;
|
|
29
|
+
Undelegate(delegations: Omit<import("@agoric/cosmic-proto/cosmos/staking/v1beta1/staking.js").Delegation, "delegatorAddress">[]): Promise<Invitation<void, undefined>>;
|
|
30
|
+
CloseAccount(): never;
|
|
31
|
+
TransferAccount(): never;
|
|
32
|
+
}>;
|
|
33
|
+
holder: import("@endo/exo").Guarded<any>;
|
|
34
|
+
};
|
|
35
|
+
getPublicTopics(): {
|
|
36
|
+
account: {
|
|
37
|
+
description: string;
|
|
38
|
+
subscriber: globalThis.Subscriber<import("./cosmosOrchestrationAccount.js").ComosOrchestrationAccountNotification>;
|
|
39
|
+
storagePath: Promise<string>;
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
getAddress(): import("../orchestration-api.js").ChainAddress;
|
|
43
|
+
delegate(validator: import("../cosmos-api.js").CosmosValidatorAddress, amount: import("../orchestration-api.js").AmountArg): Promise<void>;
|
|
44
|
+
deposit(payment: any): Promise<void>;
|
|
45
|
+
getBalances(): Promise<never>;
|
|
46
|
+
redelegate(srcValidator: import("../cosmos-api.js").CosmosValidatorAddress, dstValidator: import("../cosmos-api.js").CosmosValidatorAddress, amount: import("../orchestration-api.js").AmountArg): Promise<void>;
|
|
47
|
+
withdrawReward(validator: import("../cosmos-api.js").CosmosValidatorAddress): Promise<import("../orchestration-api.js").DenomAmount[]>;
|
|
48
|
+
getBalance(denom: import("../orchestration-api.js").DenomArg): Promise<import("../orchestration-api.js").DenomAmount>;
|
|
49
|
+
send(toAccount: any, amount: any): never;
|
|
50
|
+
transfer(amount: any, msg: any): never;
|
|
51
|
+
transferSteps(amount: any, msg: any): never;
|
|
52
|
+
withdrawRewards(): never;
|
|
53
|
+
undelegate(delegations: Omit<import("@agoric/cosmic-proto/cosmos/staking/v1beta1/staking.js").Delegation, "delegatorAddress">[]): Promise<void>;
|
|
54
|
+
}>;
|
|
55
|
+
orchestration: Remote<import("@endo/exo").Guarded<{
|
|
56
|
+
makeAccount(chainId: string, hostConnectionId: `connection-${number}`, controllerConnectionId: `connection-${number}`): Promise<import("../cosmos-api.js").IcaAccount>;
|
|
57
|
+
provideICQConnection(controllerConnectionId: `connection-${number}`): Promise<import("@endo/exo").Guarded<{
|
|
58
|
+
getLocalAddress(): `/ibc-port/${string}`;
|
|
59
|
+
getRemoteAddress(): `/${string}ibc-port/${string}/ordered/${string}` | `/${string}ibc-port/${string}/unordered/${string}`;
|
|
60
|
+
query(msgs: import("@agoric/cosmic-proto").JsonSafe<import("@agoric/cosmic-proto/tendermint/abci/types.js").RequestQuery>[]): Promise<import("@agoric/cosmic-proto").JsonSafe<import("@agoric/cosmic-proto/tendermint/abci/types.js").ResponseQuery>[]>;
|
|
61
|
+
}>>;
|
|
62
|
+
}>>;
|
|
63
|
+
storageNode: Remote<globalThis.StorageNode>;
|
|
64
|
+
timer: Remote<TimerService>;
|
|
65
|
+
}): (remoteChainInfo: Readonly<{
|
|
66
|
+
chainId: string;
|
|
67
|
+
connections?: Record<string, IBCConnectionInfo> | undefined;
|
|
68
|
+
icqEnabled?: boolean | undefined;
|
|
69
|
+
stakingTokens?: readonly {
|
|
70
|
+
denom: string;
|
|
71
|
+
}[] | undefined;
|
|
72
|
+
}>, connectionInfo: IBCConnectionInfo) => import("@endo/exo").Guarded<{
|
|
73
|
+
getChainInfo(): Promise<Readonly<{
|
|
74
|
+
chainId: string;
|
|
75
|
+
connections?: Record<string, IBCConnectionInfo> | undefined;
|
|
76
|
+
icqEnabled?: boolean | undefined;
|
|
77
|
+
stakingTokens?: readonly {
|
|
78
|
+
denom: string;
|
|
79
|
+
}[] | undefined;
|
|
80
|
+
}>>;
|
|
81
|
+
/** @returns {Promise<OrchestrationAccount<ChainInfo>>} */
|
|
82
|
+
makeAccount(): Promise<import("../orchestration-api.js").OrchestrationAccountI>;
|
|
83
|
+
}>;
|
|
84
|
+
import type { Zone } from '@agoric/base-zone';
|
|
85
|
+
import type { Remote } from '@agoric/internal';
|
|
86
|
+
import type { TimerService } from '@agoric/time';
|
|
87
|
+
import type { IBCConnectionInfo } from '../types.js';
|
|
88
|
+
//# sourceMappingURL=remote-chain-facade.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remote-chain-facade.d.ts","sourceRoot":"","sources":["remote-chain-facade.js"],"names":[],"mappings":"AAsBA,mBAAmB;AACnB;;;GAGG;AAaI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAsBD,0DAA0D;;GA4B7D;0BAjFoB,mBAAmB;4BAEjB,kBAAkB;kCADZ,cAAc;uCAIyC,aAAa"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/** @file ChainAccount exo */
|
|
2
|
+
import { makeTracer } from '@agoric/internal';
|
|
3
|
+
import { V } from '@agoric/vow/vat.js';
|
|
4
|
+
import { M } from '@endo/patterns';
|
|
5
|
+
|
|
6
|
+
import { ChainInfoShape } from './orchestrator.js';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* @import {Zone} from '@agoric/base-zone';
|
|
10
|
+
* @import {TimerService} from '@agoric/time';
|
|
11
|
+
* @import {Remote} from '@agoric/internal';
|
|
12
|
+
* @import {OrchestrationService} from '../service.js';
|
|
13
|
+
* @import {prepareCosmosOrchestrationAccount} from './cosmosOrchestrationAccount.js';
|
|
14
|
+
* @import {ChainInfo, CosmosChainInfo, IBCConnectionInfo, OrchestrationAccount} from '../types.js';
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
const { Fail } = assert;
|
|
18
|
+
const trace = makeTracer('RemoteChainFacade');
|
|
19
|
+
|
|
20
|
+
/** @type {any} */
|
|
21
|
+
const anyVal = null;
|
|
22
|
+
|
|
23
|
+
/** @see {Chain} */
|
|
24
|
+
export const RemoteChainFacadeI = M.interface('RemoteChainFacade', {
|
|
25
|
+
getChainInfo: M.callWhen().returns(ChainInfoShape),
|
|
26
|
+
makeAccount: M.callWhen().returns(M.remotable('OrchestrationAccount')),
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* @param {Zone} zone
|
|
31
|
+
* @param {{
|
|
32
|
+
* makeCosmosOrchestrationAccount: ReturnType<
|
|
33
|
+
* typeof prepareCosmosOrchestrationAccount
|
|
34
|
+
* >;
|
|
35
|
+
* orchestration: Remote<OrchestrationService>;
|
|
36
|
+
* storageNode: Remote<StorageNode>;
|
|
37
|
+
* timer: Remote<TimerService>;
|
|
38
|
+
* }} powers
|
|
39
|
+
*/
|
|
40
|
+
export const prepareRemoteChainFacade = (
|
|
41
|
+
zone,
|
|
42
|
+
{ makeCosmosOrchestrationAccount, orchestration, storageNode, timer },
|
|
43
|
+
) =>
|
|
44
|
+
zone.exoClass(
|
|
45
|
+
'RemoteChainFacade',
|
|
46
|
+
RemoteChainFacadeI,
|
|
47
|
+
/**
|
|
48
|
+
* @param {CosmosChainInfo} remoteChainInfo
|
|
49
|
+
* @param {IBCConnectionInfo} connectionInfo
|
|
50
|
+
*/
|
|
51
|
+
(remoteChainInfo, connectionInfo) => {
|
|
52
|
+
trace('making an RemoteChainFacade');
|
|
53
|
+
return { remoteChainInfo, connectionInfo };
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
async getChainInfo() {
|
|
57
|
+
return this.state.remoteChainInfo;
|
|
58
|
+
},
|
|
59
|
+
|
|
60
|
+
// FIXME parameterize on the remoteChainInfo to make()
|
|
61
|
+
// That used to work but got lost in the migration to Exo
|
|
62
|
+
/** @returns {Promise<OrchestrationAccount<ChainInfo>>} */
|
|
63
|
+
async makeAccount() {
|
|
64
|
+
const { remoteChainInfo, connectionInfo } = this.state;
|
|
65
|
+
|
|
66
|
+
const icaAccount = await V(orchestration).makeAccount(
|
|
67
|
+
remoteChainInfo.chainId,
|
|
68
|
+
connectionInfo.id,
|
|
69
|
+
connectionInfo.counterparty.connection_id,
|
|
70
|
+
);
|
|
71
|
+
|
|
72
|
+
const address = await V(icaAccount).getAddress();
|
|
73
|
+
|
|
74
|
+
const [{ denom: bondDenom }] = remoteChainInfo.stakingTokens || [
|
|
75
|
+
{
|
|
76
|
+
denom: null,
|
|
77
|
+
},
|
|
78
|
+
];
|
|
79
|
+
if (!bondDenom) {
|
|
80
|
+
throw Fail`missing bondDenom`;
|
|
81
|
+
}
|
|
82
|
+
return makeCosmosOrchestrationAccount(address, bondDenom, {
|
|
83
|
+
account: icaAccount,
|
|
84
|
+
storageNode,
|
|
85
|
+
icqConnection: anyVal,
|
|
86
|
+
timer,
|
|
87
|
+
});
|
|
88
|
+
},
|
|
89
|
+
},
|
|
90
|
+
);
|
|
91
|
+
harden(prepareRemoteChainFacade);
|
package/src/facade.d.ts
CHANGED
|
@@ -1,4 +1,27 @@
|
|
|
1
|
-
export function
|
|
1
|
+
export function makeLocalChainFacade(localchain: Remote<import("@endo/exo").Guarded<{
|
|
2
|
+
makeAccount(): import("@agoric/vow").PromiseVow<import("@endo/exo").Guarded<{
|
|
3
|
+
getAddress(): string;
|
|
4
|
+
getBalance(brand: Brand<"nat">): import("@agoric/vow").PromiseVow<import("@agoric/ertp/src/types.js").NatAmount>;
|
|
5
|
+
deposit(payment: Payment<"nat">, optAmountShape?: Pattern): import("@agoric/vow").PromiseVow<import("@agoric/ertp/src/types.js").NatAmount>;
|
|
6
|
+
withdraw(amount: Amount<"nat">): import("@agoric/vow").PromiseVow<globalThis.Payment<"nat">>;
|
|
7
|
+
executeTx<MT extends {
|
|
8
|
+
'@type': string;
|
|
9
|
+
}[]>(messages: MT): import("@agoric/vats/src/localchain.js").PromiseVowOfTupleMappedToGenerics<{ [K in keyof MT]: import("@agoric/cosmic-proto").JsonSafe<import("@agoric/cosmic-proto").ResponseTo<MT[K]>>; }>;
|
|
10
|
+
monitorTransfers(tap: import("@agoric/vats/src/bridge-target.js").TargetApp): import("@agoric/vow").PromiseVow<import("@agoric/vats/src/bridge-target.js").TargetRegistration>;
|
|
11
|
+
}>>;
|
|
12
|
+
query<T extends {
|
|
13
|
+
'@type': string;
|
|
14
|
+
} = {
|
|
15
|
+
'@type': string;
|
|
16
|
+
}>(request: T): import("@agoric/vow").PromiseVow<import("@agoric/cosmic-proto").JsonSafe<import("@agoric/cosmic-proto").ResponseTo<T>>>;
|
|
17
|
+
queryMany<RT extends {
|
|
18
|
+
'@type': string;
|
|
19
|
+
}[]>(requests: RT): import("@agoric/vats/src/localchain.js").PromiseVowOfTupleMappedToGenerics<{ [K_1 in keyof RT]: import("@agoric/cosmic-proto").JsonSafe<{
|
|
20
|
+
error?: string | undefined;
|
|
21
|
+
reply: import("@agoric/cosmic-proto").ResponseTo<RT[K_1]>;
|
|
22
|
+
}>; }>;
|
|
23
|
+
}>>, makeLocalChainAccountKit: ReturnType<typeof import("./exos/local-chain-account-kit.js").prepareLocalChainAccountKit>, localInfo: ChainInfo): Chain<any>;
|
|
24
|
+
export function makeOrchestrationFacade({ zone, timerService, zcf, storageNode, orchestrationService, localchain, chainHub, makeLocalChainAccountKit, makeRecorderKit, makeRemoteChainFacade, asyncFlowTools, }: {
|
|
2
25
|
zone: Zone;
|
|
3
26
|
timerService: Remote<TimerService>;
|
|
4
27
|
zcf: ZCF;
|
|
@@ -37,6 +60,8 @@ export function makeOrchestrationFacade({ zone, timerService, zcf, storageNode,
|
|
|
37
60
|
chainHub: import("./utils/chainHub.js").ChainHub;
|
|
38
61
|
makeLocalChainAccountKit: ReturnType<typeof import("./exos/local-chain-account-kit.js").prepareLocalChainAccountKit>;
|
|
39
62
|
makeRecorderKit: <T_1>(storageNode: StorageNode | Awaited<import("@endo/far").FarRef<StorageNode>>, valueShape?: import("@agoric/zoe/src/contractSupport/recorder.js").TypedMatcher<T_1> | undefined) => RecorderKit<T_1>;
|
|
63
|
+
makeCosmosOrchestrationAccount: any;
|
|
64
|
+
makeRemoteChainFacade: any;
|
|
40
65
|
asyncFlowTools: {
|
|
41
66
|
prepareAsyncFlowKit: (zone: Zone, tag: string, guestAsyncFunc: import("../../../node_modules/@agoric/async-flow/src/types.js").GuestAsyncFunc, options?: {
|
|
42
67
|
startEager?: boolean | undefined;
|
|
@@ -45,8 +70,8 @@ export function makeOrchestrationFacade({ zone, timerService, zcf, storageNode,
|
|
|
45
70
|
getFlowState(): import("../../../node_modules/@agoric/async-flow/src/types.js").FlowState;
|
|
46
71
|
restart(eager?: boolean | undefined): void;
|
|
47
72
|
wake(): void;
|
|
48
|
-
getOutcome():
|
|
49
|
-
dump(): ([op: "doFulfill", vow:
|
|
73
|
+
getOutcome(): Vow<any>;
|
|
74
|
+
dump(): ([op: "doFulfill", vow: Vow<import("@endo/pass-style").Passable>, fulfillment: import("@endo/pass-style").Passable] | [op: "doReject", vow: Vow<import("@endo/pass-style").Passable>, reason: import("@endo/pass-style").Passable] | [op: "doReturn", callIndex: number, result: import("@endo/pass-style").Passable] | [op: "doThrow", callIndex: number, problem: import("@endo/pass-style").Passable] | [op: "checkCall", target: import("@endo/pass-style").Passable, optVerb: PropertyKey | undefined, args: import("@endo/pass-style").Passable[], callIndex: number])[];
|
|
50
75
|
getOptFatalProblem(): any;
|
|
51
76
|
};
|
|
52
77
|
admin: {
|
|
@@ -82,9 +107,12 @@ export function makeOrchestrationFacade({ zone, timerService, zcf, storageNode,
|
|
|
82
107
|
orchestrate<Context, Args extends any[]>(durableName: string, ctx: Context, fn: (orc: Orchestrator, ctx2: Context, ...args: Args) => object): (...args: Args) => Promise<unknown>;
|
|
83
108
|
};
|
|
84
109
|
export type OrchestrationFacade = ReturnType<typeof makeOrchestrationFacade>;
|
|
110
|
+
import type { Remote } from '@agoric/internal';
|
|
111
|
+
import type { ChainInfo } from './types.js';
|
|
112
|
+
import type { Chain } from './types.js';
|
|
85
113
|
import type { Zone } from '@agoric/zone';
|
|
86
114
|
import type { TimerService } from '@agoric/time';
|
|
87
|
-
import type { Remote } from '@agoric/internal';
|
|
88
115
|
import type { RecorderKit } from '@agoric/zoe/src/contractSupport/recorder.js';
|
|
116
|
+
import type { Vow } from '@agoric/vow';
|
|
89
117
|
import type { Orchestrator } from './types.js';
|
|
90
118
|
//# sourceMappingURL=facade.d.ts.map
|
package/src/facade.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"facade.d.ts","sourceRoot":"","sources":["facade.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"facade.d.ts","sourceRoot":"","sources":["facade.js"],"names":[],"mappings":"AA8BO;;;0BAqE8B,MAChC,KAAE,CAAC;yBAciB,QAAQ,KAAK,CAAC,mBAGrC,OACA;yBAuBS,OAAO,KACf,CAAC;;;uBAwB4B,EAAC;;;;;;;gBAM63F,CAAC;;;mBAA6lB,EAAE;;;;+BApJn/G,UAAU,CACpB,cAAkB,mCAAmC,EAAE,2BAA2B,CAC/E,oCAoEH;AAoBM;;;SAdG,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;oBAwEi5F,CAAC;;;uBAA6lB,EAAE;;;;;cApE/+G,OAAO,qBAAqB,EAAE,QAAQ;8BACtB,UAAU,CACxC,cAAoB,mCAAmC,EAAE,2BAA2B,CAC/E;wCAmDkB,WAAW,GAC9B,QAAI,OAAO,WAAW,EAAG,MAAK,CAAE,WAAU,CAAC,CAAC;oCAlDZ,GAAG;2BACZ,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IA4C3B;;;;;;;;OAQG;gBAFkC,OAAO,EACrB,IAAI,6BAJhB,MAAM,OAGoB,OAAO,AAD1B,gCACmB,OAAO,WACrB,IAAI,AADgC,KAAK,MAAM,GACzD,CAAC,GAAG,IAAI,EAAE,IAAI,KAAK,OAAO,CAAC,OAAO,CAAC;EAQnD;kCAEa,UAAU,CAAC,OAAO,uBAAuB,CAAC;4BA3J/B,kBAAkB;+BAEgE,YAAY;2BAAZ,YAAY;0BARhG,cAAc;kCAEN,cAAc;iCAGE,6CAA6C;yBAJtE,aAAa;kCAOwE,YAAY"}
|
package/src/facade.js
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
/** @file Orchestration service */
|
|
2
2
|
|
|
3
|
-
import { V as E } from '@agoric/vow/vat.js';
|
|
4
3
|
import { Fail } from '@agoric/assert';
|
|
5
|
-
import {
|
|
4
|
+
import { V as E } from '@agoric/vow/vat.js';
|
|
5
|
+
import { Far } from '@endo/far';
|
|
6
|
+
// eslint-disable-next-line import/no-cycle -- FIXME
|
|
7
|
+
import { prepareOrchestrator } from './exos/orchestrator.js';
|
|
6
8
|
|
|
7
9
|
/**
|
|
8
10
|
* @import {AsyncFlowTools} from '@agoric/async-flow';
|
|
9
11
|
* @import {Zone} from '@agoric/zone';
|
|
12
|
+
* @import {Vow} from '@agoric/vow';
|
|
10
13
|
* @import {TimerService} from '@agoric/time';
|
|
11
14
|
* @import {IBCConnectionID} from '@agoric/vats';
|
|
12
15
|
* @import {LocalChain} from '@agoric/vats/src/localchain.js';
|
|
@@ -16,9 +19,7 @@ import { prepareCosmosOrchestrationAccount } from './exos/cosmosOrchestrationAcc
|
|
|
16
19
|
* @import {Chain, ChainInfo, CosmosChainInfo, IBCConnectionInfo, OrchestrationAccount, Orchestrator} from './types.js';
|
|
17
20
|
*/
|
|
18
21
|
|
|
19
|
-
|
|
20
|
-
const anyVal = null;
|
|
21
|
-
|
|
22
|
+
// FIXME turn this into an Exo
|
|
22
23
|
/**
|
|
23
24
|
* @param {Remote<LocalChain>} localchain
|
|
24
25
|
* @param {ReturnType<
|
|
@@ -27,12 +28,12 @@ const anyVal = null;
|
|
|
27
28
|
* @param {ChainInfo} localInfo
|
|
28
29
|
* @returns {Chain}
|
|
29
30
|
*/
|
|
30
|
-
const makeLocalChainFacade = (
|
|
31
|
+
export const makeLocalChainFacade = (
|
|
31
32
|
localchain,
|
|
32
33
|
makeLocalChainAccountKit,
|
|
33
34
|
localInfo,
|
|
34
35
|
) => {
|
|
35
|
-
return {
|
|
36
|
+
return Far('LocalChainFacade', {
|
|
36
37
|
/** @returns {Promise<ChainInfo>} */
|
|
37
38
|
async getChainInfo() {
|
|
38
39
|
return localInfo;
|
|
@@ -48,6 +49,7 @@ const makeLocalChainFacade = (
|
|
|
48
49
|
storageNode: null,
|
|
49
50
|
});
|
|
50
51
|
|
|
52
|
+
// FIXME turn this into an Exo LocalChainOrchestrationAccount or make that a facet of makeLocalChainAccountKit
|
|
51
53
|
return {
|
|
52
54
|
async deposit(payment) {
|
|
53
55
|
console.log('deposit got', payment);
|
|
@@ -89,60 +91,7 @@ const makeLocalChainFacade = (
|
|
|
89
91
|
},
|
|
90
92
|
};
|
|
91
93
|
},
|
|
92
|
-
};
|
|
93
|
-
};
|
|
94
|
-
|
|
95
|
-
/**
|
|
96
|
-
* @template {CosmosChainInfo} CCI
|
|
97
|
-
* @param {CCI} chainInfo
|
|
98
|
-
* @param {IBCConnectionInfo} connectionInfo
|
|
99
|
-
* @param {object} io
|
|
100
|
-
* @param {Remote<OrchestrationService>} io.orchestration
|
|
101
|
-
* @param {MakeRecorderKit} io.makeRecorderKit
|
|
102
|
-
* @param {Remote<StorageNode>} io.storageNode
|
|
103
|
-
* @param {Remote<TimerService>} io.timer
|
|
104
|
-
* @param {ZCF} io.zcf
|
|
105
|
-
* @param {Zone} io.zone
|
|
106
|
-
* @returns {Chain<CCI>}
|
|
107
|
-
*/
|
|
108
|
-
const makeRemoteChainFacade = (
|
|
109
|
-
chainInfo,
|
|
110
|
-
connectionInfo,
|
|
111
|
-
{ orchestration, makeRecorderKit, storageNode, timer, zcf, zone },
|
|
112
|
-
) => {
|
|
113
|
-
const makeCosmosOrchestrationAccount = prepareCosmosOrchestrationAccount(
|
|
114
|
-
zone.subZone(chainInfo.chainId),
|
|
115
|
-
makeRecorderKit,
|
|
116
|
-
zcf,
|
|
117
|
-
);
|
|
118
|
-
|
|
119
|
-
return {
|
|
120
|
-
getChainInfo: async () => chainInfo,
|
|
121
|
-
/** @returns {Promise<OrchestrationAccount<CCI>>} */
|
|
122
|
-
makeAccount: async () => {
|
|
123
|
-
const icaAccount = await E(orchestration).makeAccount(
|
|
124
|
-
chainInfo.chainId,
|
|
125
|
-
connectionInfo.id,
|
|
126
|
-
connectionInfo.counterparty.connection_id,
|
|
127
|
-
);
|
|
128
|
-
|
|
129
|
-
const address = await E(icaAccount).getAddress();
|
|
130
|
-
|
|
131
|
-
const [{ denom: bondDenom }] = chainInfo.stakingTokens || [
|
|
132
|
-
{
|
|
133
|
-
denom: null,
|
|
134
|
-
},
|
|
135
|
-
];
|
|
136
|
-
assert(bondDenom, 'missing bondDenom');
|
|
137
|
-
// @ts-expect-error XXX dynamic method availability
|
|
138
|
-
return makeCosmosOrchestrationAccount(address, bondDenom, {
|
|
139
|
-
account: icaAccount,
|
|
140
|
-
storageNode,
|
|
141
|
-
icqConnection: anyVal,
|
|
142
|
-
timer,
|
|
143
|
-
});
|
|
144
|
-
},
|
|
145
|
-
};
|
|
94
|
+
});
|
|
146
95
|
};
|
|
147
96
|
|
|
148
97
|
/**
|
|
@@ -158,6 +107,8 @@ const makeRemoteChainFacade = (
|
|
|
158
107
|
* typeof import('./exos/local-chain-account-kit.js').prepareLocalChainAccountKit
|
|
159
108
|
* >;
|
|
160
109
|
* makeRecorderKit: MakeRecorderKit;
|
|
110
|
+
* makeCosmosOrchestrationAccount: any;
|
|
111
|
+
* makeRemoteChainFacade: any;
|
|
161
112
|
* asyncFlowTools: AsyncFlowTools;
|
|
162
113
|
* }} powers
|
|
163
114
|
*/
|
|
@@ -171,6 +122,7 @@ export const makeOrchestrationFacade = ({
|
|
|
171
122
|
chainHub,
|
|
172
123
|
makeLocalChainAccountKit,
|
|
173
124
|
makeRecorderKit,
|
|
125
|
+
makeRemoteChainFacade,
|
|
174
126
|
asyncFlowTools,
|
|
175
127
|
}) => {
|
|
176
128
|
(zone &&
|
|
@@ -182,9 +134,23 @@ export const makeOrchestrationFacade = ({
|
|
|
182
134
|
makeLocalChainAccountKit &&
|
|
183
135
|
// @ts-expect-error type says defined but double check
|
|
184
136
|
makeRecorderKit &&
|
|
137
|
+
makeRemoteChainFacade &&
|
|
185
138
|
asyncFlowTools) ||
|
|
186
139
|
Fail`params missing`;
|
|
187
140
|
|
|
141
|
+
const makeOrchestrator = prepareOrchestrator(zone, {
|
|
142
|
+
asyncFlowTools,
|
|
143
|
+
chainHub,
|
|
144
|
+
localchain,
|
|
145
|
+
makeLocalChainAccountKit,
|
|
146
|
+
makeRecorderKit,
|
|
147
|
+
makeRemoteChainFacade,
|
|
148
|
+
orchestrationService,
|
|
149
|
+
storageNode,
|
|
150
|
+
timerService,
|
|
151
|
+
zcf,
|
|
152
|
+
});
|
|
153
|
+
|
|
188
154
|
return {
|
|
189
155
|
/**
|
|
190
156
|
* @template Context
|
|
@@ -196,40 +162,8 @@ export const makeOrchestrationFacade = ({
|
|
|
196
162
|
* @returns {(...args: Args) => Promise<unknown>}
|
|
197
163
|
*/
|
|
198
164
|
orchestrate(durableName, ctx, fn) {
|
|
199
|
-
|
|
200
|
-
const orc = {
|
|
201
|
-
async getChain(name) {
|
|
202
|
-
const agoricChainInfo = await chainHub.getChainInfo('agoric');
|
|
203
|
-
|
|
204
|
-
if (name === 'agoric') {
|
|
205
|
-
return makeLocalChainFacade(
|
|
206
|
-
localchain,
|
|
207
|
-
makeLocalChainAccountKit,
|
|
208
|
-
agoricChainInfo,
|
|
209
|
-
);
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
const remoteChainInfo = await chainHub.getChainInfo(name);
|
|
213
|
-
const connectionInfo = await chainHub.getConnectionInfo(
|
|
214
|
-
agoricChainInfo.chainId,
|
|
215
|
-
remoteChainInfo.chainId,
|
|
216
|
-
);
|
|
165
|
+
const orc = makeOrchestrator();
|
|
217
166
|
|
|
218
|
-
return makeRemoteChainFacade(remoteChainInfo, connectionInfo, {
|
|
219
|
-
orchestration: orchestrationService,
|
|
220
|
-
makeRecorderKit,
|
|
221
|
-
storageNode,
|
|
222
|
-
timer: timerService,
|
|
223
|
-
zcf,
|
|
224
|
-
zone,
|
|
225
|
-
});
|
|
226
|
-
},
|
|
227
|
-
makeLocalAccount() {
|
|
228
|
-
return E(localchain).makeAccount();
|
|
229
|
-
},
|
|
230
|
-
getBrandInfo: anyVal,
|
|
231
|
-
asAmount: anyVal,
|
|
232
|
-
};
|
|
233
167
|
return async (...args) => fn(orc, ctx, ...args);
|
|
234
168
|
},
|
|
235
169
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"start-helper.d.ts","sourceRoot":"","sources":["start-helper.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"start-helper.d.ts","sourceRoot":"","sources":["start-helper.js"],"names":[],"mappings":"AAuCO,0CALI,GAAG,kCAEH,mBAAmB,cACnB,UAAU;;;;;;;;;;kDAsDN,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;uEAAsjE,OAAO,kEAA+F,OAAQ,WAAU,IAAK,qBAA0C,IAAK;EAFjvE;;;;;8BAEijB,MAAM,KAAK,CAAC;6BAA6gB,QAAQ,KAAK,CAAC,mBAA6B,OAAO;6BAAwjB,OAAO,KAAK,CAAC;;;2BAA6rB,EAAE;;;;;;;oBAAqjG,CAAC;;;uBAA6lB,EAAE;;;;;;;;;;;;;;;;;6BA7E5/L,kBAAkB;4BAEnB,aAAa;kCAHK,cAAc;6BAE/B,cAAc"}
|
|
@@ -5,6 +5,8 @@ import { makeDurableZone } from '@agoric/zone/durable.js';
|
|
|
5
5
|
import { prepareLocalChainAccountKit } from '../exos/local-chain-account-kit.js';
|
|
6
6
|
import { makeOrchestrationFacade } from '../facade.js';
|
|
7
7
|
import { makeChainHub } from './chainHub.js';
|
|
8
|
+
import { prepareRemoteChainFacade } from '../exos/remote-chain-facade.js';
|
|
9
|
+
import { prepareCosmosOrchestrationAccount } from '../exos/cosmosOrchestrationAccount.js';
|
|
8
10
|
|
|
9
11
|
/**
|
|
10
12
|
* @import {PromiseKit} from '@endo/promise-kit'
|
|
@@ -59,12 +61,28 @@ export const provideOrchestration = (
|
|
|
59
61
|
vowTools,
|
|
60
62
|
});
|
|
61
63
|
|
|
64
|
+
const makeCosmosOrchestrationAccount = prepareCosmosOrchestrationAccount(
|
|
65
|
+
// XXX what zone?
|
|
66
|
+
zone,
|
|
67
|
+
makeRecorderKit,
|
|
68
|
+
zcf,
|
|
69
|
+
);
|
|
70
|
+
|
|
71
|
+
const makeRemoteChainFacade = prepareRemoteChainFacade(zone, {
|
|
72
|
+
makeCosmosOrchestrationAccount,
|
|
73
|
+
orchestration: remotePowers.orchestrationService,
|
|
74
|
+
storageNode: remotePowers.storageNode,
|
|
75
|
+
timer: remotePowers.timerService,
|
|
76
|
+
});
|
|
77
|
+
|
|
62
78
|
const facade = makeOrchestrationFacade({
|
|
63
79
|
zcf,
|
|
64
80
|
zone,
|
|
65
81
|
chainHub,
|
|
66
82
|
makeLocalChainAccountKit,
|
|
67
83
|
makeRecorderKit,
|
|
84
|
+
makeCosmosOrchestrationAccount,
|
|
85
|
+
makeRemoteChainFacade,
|
|
68
86
|
asyncFlowTools,
|
|
69
87
|
...remotePowers,
|
|
70
88
|
});
|