@agoric/orchestration 0.2.0-upgrade-17-dev-a1453b2.0 → 0.2.0-upgrade-18-dev-bf39b10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.d.ts +1 -1
- package/index.js +2 -1
- package/package.json +29 -28
- package/src/chain-info.d.ts +31 -387
- package/src/chain-info.d.ts.map +1 -1
- package/src/chain-info.js +10 -64
- package/src/cosmos-api.d.ts +21 -10
- package/src/cosmos-api.d.ts.map +1 -1
- package/src/cosmos-api.ts +33 -14
- package/src/examples/README.md +3 -4
- package/src/examples/auto-stake-it-tap-kit.d.ts.map +1 -1
- package/src/examples/auto-stake-it-tap-kit.js +4 -7
- package/src/examples/auto-stake-it.contract.d.ts +1 -1
- package/src/examples/auto-stake-it.flows.d.ts +1 -1
- package/src/examples/auto-stake-it.flows.d.ts.map +1 -1
- package/src/examples/basic-flows.contract.d.ts +1 -1
- package/src/examples/basic-flows.flows.d.ts +1 -1
- package/src/examples/send-anywhere.contract.d.ts +20 -2
- package/src/examples/send-anywhere.contract.d.ts.map +1 -1
- package/src/examples/send-anywhere.contract.js +34 -18
- package/src/examples/send-anywhere.flows.d.ts +7 -7
- package/src/examples/send-anywhere.flows.d.ts.map +1 -1
- package/src/examples/send-anywhere.flows.js +40 -20
- package/src/examples/shared.flows.d.ts +4 -0
- package/src/examples/shared.flows.d.ts.map +1 -0
- package/src/examples/shared.flows.js +21 -0
- package/src/examples/stake-bld.contract.d.ts +49 -0
- package/src/examples/stake-bld.contract.d.ts.map +1 -0
- package/src/examples/{stakeBld.contract.js → stake-bld.contract.js} +10 -1
- package/src/examples/stake-ica.contract.d.ts +126 -0
- package/src/examples/stake-ica.contract.d.ts.map +1 -0
- package/src/examples/{stakeIca.contract.js → stake-ica.contract.js} +6 -2
- package/src/examples/staking-combinations.contract.d.ts +1 -1
- package/src/examples/staking-combinations.contract.d.ts.map +1 -1
- package/src/examples/staking-combinations.contract.js +16 -13
- package/src/examples/staking-combinations.flows.d.ts +6 -9
- package/src/examples/staking-combinations.flows.d.ts.map +1 -1
- package/src/examples/staking-combinations.flows.js +19 -16
- package/src/examples/swap.contract.d.ts.map +1 -1
- package/src/examples/swap.contract.js +0 -1
- package/src/examples/unbond.contract.d.ts +1 -1
- package/src/examples/unbond.contract.d.ts.map +1 -1
- package/src/examples/unbond.contract.js +10 -5
- package/src/examples/unbond.flows.d.ts +4 -3
- package/src/examples/unbond.flows.d.ts.map +1 -1
- package/src/examples/unbond.flows.js +23 -31
- package/src/exos/chain-hub.d.ts +12 -4
- package/src/exos/chain-hub.d.ts.map +1 -1
- package/src/exos/chain-hub.js +28 -19
- package/src/exos/combine-invitation-makers.d.ts +1 -0
- package/src/exos/combine-invitation-makers.d.ts.map +1 -1
- package/src/exos/combine-invitation-makers.js +6 -0
- package/src/exos/cosmos-interchain-service.d.ts +20 -70
- package/src/exos/cosmos-interchain-service.d.ts.map +1 -1
- package/src/exos/cosmos-orchestration-account.d.ts +152 -47
- package/src/exos/cosmos-orchestration-account.d.ts.map +1 -1
- package/src/exos/cosmos-orchestration-account.js +355 -13
- package/src/exos/exo-interfaces.d.ts +3 -3
- package/src/exos/exo-interfaces.d.ts.map +1 -1
- package/src/exos/exo-interfaces.ts +3 -3
- package/src/exos/ica-account-kit.d.ts +2 -2
- package/src/exos/ica-account-kit.d.ts.map +1 -1
- package/src/exos/icq-connection-kit.d.ts +17 -1
- package/src/exos/icq-connection-kit.d.ts.map +1 -1
- package/src/exos/local-chain-facade.d.ts +22 -170
- package/src/exos/local-chain-facade.d.ts.map +1 -1
- package/src/exos/local-orchestration-account.d.ts +41 -48
- package/src/exos/local-orchestration-account.d.ts.map +1 -1
- package/src/exos/local-orchestration-account.js +94 -13
- package/src/exos/orchestrator.d.ts +44 -136
- package/src/exos/orchestrator.d.ts.map +1 -1
- package/src/exos/orchestrator.js +42 -44
- package/src/exos/packet-tools.d.ts +21 -81
- package/src/exos/packet-tools.d.ts.map +1 -1
- package/src/exos/portfolio-holder-kit.d.ts +4 -4
- package/src/exos/portfolio-holder-kit.d.ts.map +1 -1
- package/src/exos/portfolio-holder-kit.js +65 -10
- package/src/exos/remote-chain-facade.d.ts +35 -128
- package/src/exos/remote-chain-facade.d.ts.map +1 -1
- package/src/facade.d.ts.map +1 -1
- package/src/facade.js +7 -0
- package/src/fetched-chain-info.d.ts +30 -340
- package/src/fetched-chain-info.js +18 -329
- package/src/fixtures/query-flows.flows.d.ts.map +1 -1
- package/src/orchestration-api.d.ts +4 -8
- package/src/orchestration-api.d.ts.map +1 -1
- package/src/orchestration-api.ts +3 -8
- package/src/proposals/init-chain-info.js +3 -3
- package/src/proposals/orchestration-proposal.d.ts.map +1 -1
- package/src/proposals/start-stakeAtom.d.ts +78 -16
- package/src/proposals/start-stakeAtom.d.ts.map +1 -1
- package/src/proposals/start-stakeAtom.js +9 -4
- package/src/proposals/start-stakeBld.d.ts +13 -39
- package/src/proposals/start-stakeBld.d.ts.map +1 -1
- package/src/proposals/start-stakeBld.js +2 -2
- package/src/proposals/start-stakeOsmo.d.ts +77 -15
- package/src/proposals/start-stakeOsmo.d.ts.map +1 -1
- package/src/proposals/start-stakeOsmo.js +9 -4
- package/src/typeGuards.d.ts +5 -1
- package/src/typeGuards.d.ts.map +1 -1
- package/src/typeGuards.js +21 -9
- package/src/types-index.d.ts +1 -0
- package/src/types-index.js +1 -0
- package/src/types.d.ts +14 -4
- package/src/types.d.ts.map +1 -1
- package/src/types.ts +15 -4
- package/src/utils/cosmos.d.ts +40 -1
- package/src/utils/cosmos.d.ts.map +1 -1
- package/src/utils/cosmos.js +48 -1
- package/src/utils/orchestrationAccount.js +1 -1
- package/src/utils/registry.d.ts.map +1 -1
- package/src/utils/registry.js +0 -3
- package/src/utils/start-helper.d.ts +4 -10
- package/src/utils/start-helper.d.ts.map +1 -1
- package/src/utils/start-helper.js +18 -15
- package/src/utils/zcf-tools.d.ts +5 -0
- package/src/utils/zcf-tools.d.ts.map +1 -0
- package/src/utils/zcf-tools.js +35 -0
- package/src/utils/zoe-tools.d.ts +5 -8
- package/src/utils/zoe-tools.d.ts.map +1 -1
- package/src/utils/zoe-tools.js +136 -33
- package/src/vat-orchestration.d.ts.map +1 -1
- package/src/examples/stakeBld.contract.d.ts +0 -75
- package/src/examples/stakeBld.contract.d.ts.map +0 -1
- package/src/examples/stakeIca.contract.d.ts +0 -64
- package/src/examples/stakeIca.contract.d.ts.map +0 -1
|
@@ -10,6 +10,7 @@ import { Fail, q } from '@endo/errors';
|
|
|
10
10
|
|
|
11
11
|
import {
|
|
12
12
|
AmountArgShape,
|
|
13
|
+
AnyNatAmountsRecord,
|
|
13
14
|
ChainAddressShape,
|
|
14
15
|
DenomAmountShape,
|
|
15
16
|
DenomShape,
|
|
@@ -27,7 +28,7 @@ import { coerceCoin, coerceDenomAmount } from '../utils/amounts.js';
|
|
|
27
28
|
/**
|
|
28
29
|
* @import {HostOf} from '@agoric/async-flow';
|
|
29
30
|
* @import {LocalChain, LocalChainAccount} from '@agoric/vats/src/localchain.js';
|
|
30
|
-
* @import {AmountArg, ChainAddress, DenomAmount, IBCMsgTransferOptions, IBCConnectionInfo, OrchestrationAccountI} from '@agoric/orchestration';
|
|
31
|
+
* @import {AmountArg, ChainAddress, DenomAmount, IBCMsgTransferOptions, IBCConnectionInfo, OrchestrationAccountI, LocalAccountMethods} from '@agoric/orchestration';
|
|
31
32
|
* @import {RecorderKit, MakeRecorderKit} from '@agoric/zoe/src/contractSupport/recorder.js'.
|
|
32
33
|
* @import {Zone} from '@agoric/zone';
|
|
33
34
|
* @import {Remote} from '@agoric/internal';
|
|
@@ -39,6 +40,7 @@ import { coerceCoin, coerceDenomAmount } from '../utils/amounts.js';
|
|
|
39
40
|
* @import {Matcher} from '@endo/patterns';
|
|
40
41
|
* @import {ChainHub} from './chain-hub.js';
|
|
41
42
|
* @import {PacketTools} from './packet-tools.js';
|
|
43
|
+
* @import {ZoeTools} from '../utils/zoe-tools.js';
|
|
42
44
|
*/
|
|
43
45
|
|
|
44
46
|
const trace = makeTracer('LOA');
|
|
@@ -91,10 +93,19 @@ const PUBLIC_TOPICS = {
|
|
|
91
93
|
* @param {VowTools} powers.vowTools
|
|
92
94
|
* @param {ChainHub} powers.chainHub
|
|
93
95
|
* @param {Remote<LocalChain>} powers.localchain
|
|
96
|
+
* @param {ZoeTools} powers.zoeTools
|
|
94
97
|
*/
|
|
95
98
|
export const prepareLocalOrchestrationAccountKit = (
|
|
96
99
|
zone,
|
|
97
|
-
{
|
|
100
|
+
{
|
|
101
|
+
makeRecorderKit,
|
|
102
|
+
zcf,
|
|
103
|
+
timerService,
|
|
104
|
+
vowTools,
|
|
105
|
+
chainHub,
|
|
106
|
+
localchain,
|
|
107
|
+
zoeTools,
|
|
108
|
+
},
|
|
98
109
|
) => {
|
|
99
110
|
const { watch, allVows, asVow, when } = vowTools;
|
|
100
111
|
const { makeIBCTransferSender } = prepareIBCTools(
|
|
@@ -139,6 +150,12 @@ export const prepareLocalOrchestrationAccountKit = (
|
|
|
139
150
|
returnVoidWatcher: M.interface('returnVoidWatcher', {
|
|
140
151
|
onFulfilled: M.call(M.any()).optional(M.any()).returns(M.undefined()),
|
|
141
152
|
}),
|
|
153
|
+
seatExiterHandler: M.interface('seatExiterHandler', {
|
|
154
|
+
onFulfilled: M.call(M.undefined(), M.remotable()).returns(
|
|
155
|
+
M.undefined(),
|
|
156
|
+
),
|
|
157
|
+
onRejected: M.call(M.error(), M.remotable()).returns(M.undefined()),
|
|
158
|
+
}),
|
|
142
159
|
getBalanceWatcher: M.interface('getBalanceWatcher', {
|
|
143
160
|
onFulfilled: M.call(AmountShape, DenomShape).returns(DenomAmountShape),
|
|
144
161
|
}),
|
|
@@ -151,12 +168,14 @@ export const prepareLocalOrchestrationAccountKit = (
|
|
|
151
168
|
),
|
|
152
169
|
}),
|
|
153
170
|
invitationMakers: M.interface('invitationMakers', {
|
|
154
|
-
Delegate: M.call(M.string(), AmountShape).returns(M.promise()),
|
|
155
|
-
Undelegate: M.call(M.string(), AmountShape).returns(M.promise()),
|
|
156
171
|
CloseAccount: M.call().returns(M.promise()),
|
|
172
|
+
Delegate: M.call(M.string(), AmountShape).returns(M.promise()),
|
|
173
|
+
Deposit: M.call().returns(M.promise()),
|
|
157
174
|
Send: M.call().returns(M.promise()),
|
|
158
175
|
SendAll: M.call().returns(M.promise()),
|
|
159
176
|
Transfer: M.call().returns(M.promise()),
|
|
177
|
+
Undelegate: M.call(M.string(), AmountShape).returns(M.promise()),
|
|
178
|
+
Withdraw: M.call().returns(M.promise()),
|
|
160
179
|
}),
|
|
161
180
|
},
|
|
162
181
|
/**
|
|
@@ -200,6 +219,27 @@ export const prepareLocalOrchestrationAccountKit = (
|
|
|
200
219
|
);
|
|
201
220
|
}, 'Delegate');
|
|
202
221
|
},
|
|
222
|
+
Deposit() {
|
|
223
|
+
trace('Deposit');
|
|
224
|
+
return zcf.makeInvitation(
|
|
225
|
+
seat => {
|
|
226
|
+
const { give } = seat.getProposal();
|
|
227
|
+
return watch(
|
|
228
|
+
zoeTools.localTransfer(
|
|
229
|
+
seat,
|
|
230
|
+
// @ts-expect-error LocalAccount vs LocalAccountMethods
|
|
231
|
+
this.state.account,
|
|
232
|
+
give,
|
|
233
|
+
),
|
|
234
|
+
this.facets.seatExiterHandler,
|
|
235
|
+
seat,
|
|
236
|
+
);
|
|
237
|
+
},
|
|
238
|
+
'Deposit',
|
|
239
|
+
undefined,
|
|
240
|
+
M.splitRecord({ give: AnyNatAmountsRecord, want: {} }),
|
|
241
|
+
);
|
|
242
|
+
},
|
|
203
243
|
/**
|
|
204
244
|
* @param {string} validatorAddress
|
|
205
245
|
* @param {Amount<'nat'>} ertpAmount
|
|
@@ -250,18 +290,39 @@ export const prepareLocalOrchestrationAccountKit = (
|
|
|
250
290
|
* {
|
|
251
291
|
* amount: AmountArg;
|
|
252
292
|
* destination: ChainAddress;
|
|
253
|
-
* opts
|
|
293
|
+
* opts?: IBCMsgTransferOptions;
|
|
254
294
|
* }
|
|
255
295
|
* >}
|
|
256
296
|
*/
|
|
257
297
|
const offerHandler = (seat, { amount, destination, opts }) => {
|
|
258
298
|
seat.exit();
|
|
259
299
|
return watch(
|
|
260
|
-
this.facets.holder.transfer(
|
|
300
|
+
this.facets.holder.transfer(destination, amount, opts),
|
|
261
301
|
);
|
|
262
302
|
};
|
|
263
303
|
return zcf.makeInvitation(offerHandler, 'Transfer');
|
|
264
304
|
},
|
|
305
|
+
Withdraw() {
|
|
306
|
+
trace('Withdraw');
|
|
307
|
+
return zcf.makeInvitation(
|
|
308
|
+
seat => {
|
|
309
|
+
const { want } = seat.getProposal();
|
|
310
|
+
return watch(
|
|
311
|
+
zoeTools.withdrawToSeat(
|
|
312
|
+
// @ts-expect-error LocalAccount vs LocalAccountMethods
|
|
313
|
+
this.state.account,
|
|
314
|
+
seat,
|
|
315
|
+
want,
|
|
316
|
+
),
|
|
317
|
+
this.facets.seatExiterHandler,
|
|
318
|
+
seat,
|
|
319
|
+
);
|
|
320
|
+
},
|
|
321
|
+
'Withdraw',
|
|
322
|
+
undefined,
|
|
323
|
+
M.splitRecord({ give: {}, want: AnyNatAmountsRecord }),
|
|
324
|
+
);
|
|
325
|
+
},
|
|
265
326
|
},
|
|
266
327
|
undelegateWatcher: {
|
|
267
328
|
/**
|
|
@@ -362,6 +423,24 @@ export const prepareLocalOrchestrationAccountKit = (
|
|
|
362
423
|
return harden({ denom, value: natAmount.value });
|
|
363
424
|
},
|
|
364
425
|
},
|
|
426
|
+
/** exits or fails a seat depending the outcome */
|
|
427
|
+
seatExiterHandler: {
|
|
428
|
+
/**
|
|
429
|
+
* @param {undefined} _
|
|
430
|
+
* @param {ZCFSeat} seat
|
|
431
|
+
*/
|
|
432
|
+
onFulfilled(_, seat) {
|
|
433
|
+
seat.exit();
|
|
434
|
+
},
|
|
435
|
+
/**
|
|
436
|
+
* @param {Error} reason
|
|
437
|
+
* @param {ZCFSeat} seat
|
|
438
|
+
*/
|
|
439
|
+
onRejected(reason, seat) {
|
|
440
|
+
seat.exit(reason);
|
|
441
|
+
throw reason;
|
|
442
|
+
},
|
|
443
|
+
},
|
|
365
444
|
/**
|
|
366
445
|
* handles a QueryBalanceRequest from localchain.query and returns the
|
|
367
446
|
* balance as a DenomAmount
|
|
@@ -387,8 +466,10 @@ export const prepareLocalOrchestrationAccountKit = (
|
|
|
387
466
|
*/
|
|
388
467
|
queryBalancesWatcher: {
|
|
389
468
|
/**
|
|
390
|
-
* @param {
|
|
391
|
-
*
|
|
469
|
+
* @param {JsonSafe<
|
|
470
|
+
* ResponseTo<
|
|
471
|
+
* TypedJson<'/cosmos.bank.v1beta1.QueryAllBalancesRequest'>
|
|
472
|
+
* >
|
|
392
473
|
* >} result
|
|
393
474
|
* @returns {DenomAmount[]}
|
|
394
475
|
*/
|
|
@@ -532,14 +613,14 @@ export const prepareLocalOrchestrationAccountKit = (
|
|
|
532
613
|
* updater will get a special notification that the account is being
|
|
533
614
|
* transferred.
|
|
534
615
|
*/
|
|
535
|
-
/** @type {HostOf<
|
|
616
|
+
/** @type {HostOf<LocalAccountMethods['deposit']>} */
|
|
536
617
|
deposit(payment) {
|
|
537
618
|
return watch(
|
|
538
619
|
E(this.state.account).deposit(payment),
|
|
539
620
|
this.facets.returnVoidWatcher,
|
|
540
621
|
);
|
|
541
622
|
},
|
|
542
|
-
/** @type {HostOf<
|
|
623
|
+
/** @type {HostOf<LocalAccountMethods['withdraw']>} */
|
|
543
624
|
withdraw(amount) {
|
|
544
625
|
return watch(E(this.state.account).withdraw(amount));
|
|
545
626
|
},
|
|
@@ -594,15 +675,15 @@ export const prepareLocalOrchestrationAccountKit = (
|
|
|
594
675
|
});
|
|
595
676
|
},
|
|
596
677
|
/**
|
|
678
|
+
* @param {ChainAddress} destination
|
|
597
679
|
* @param {AmountArg} amount an ERTP {@link Amount} or a
|
|
598
680
|
* {@link DenomAmount}
|
|
599
|
-
* @param {ChainAddress} destination
|
|
600
681
|
* @param {IBCMsgTransferOptions} [opts] if either timeoutHeight or
|
|
601
682
|
* timeoutTimestamp are not supplied, a default timeoutTimestamp will
|
|
602
683
|
* be set for 5 minutes in the future
|
|
603
684
|
* @returns {Vow<any>}
|
|
604
685
|
*/
|
|
605
|
-
transfer(
|
|
686
|
+
transfer(destination, amount, opts) {
|
|
606
687
|
return asVow(() => {
|
|
607
688
|
trace('Transferring funds from LCA over IBC');
|
|
608
689
|
|
|
@@ -652,7 +733,7 @@ export const prepareLocalOrchestrationAccountKit = (
|
|
|
652
733
|
matchFirstPacket(patternV) {
|
|
653
734
|
return watch(E(this.state.packetTools).matchFirstPacket(patternV));
|
|
654
735
|
},
|
|
655
|
-
/** @type {HostOf<
|
|
736
|
+
/** @type {HostOf<LocalAccountMethods['monitorTransfers']>} */
|
|
656
737
|
monitorTransfers(tap) {
|
|
657
738
|
return watch(E(this.state.packetTools).monitorTransfers(tap));
|
|
658
739
|
},
|
|
@@ -1,149 +1,51 @@
|
|
|
1
1
|
/** @see {Orchestrator} */
|
|
2
2
|
export const OrchestratorI: import("@endo/patterns").InterfaceGuard<{
|
|
3
3
|
getChain: import("@endo/patterns").MethodGuard;
|
|
4
|
-
makeLocalAccount: import("@endo/patterns").MethodGuard;
|
|
5
4
|
getDenomInfo: import("@endo/patterns").MethodGuard;
|
|
6
5
|
asAmount: import("@endo/patterns").MethodGuard;
|
|
7
6
|
}>;
|
|
8
7
|
export function prepareOrchestrator(zone: Zone, powers: {
|
|
9
|
-
asyncFlowTools: AsyncFlowTools;
|
|
10
8
|
chainHub: ChainHub;
|
|
11
|
-
localchain: Remote<LocalChain>;
|
|
12
|
-
chainByName: MapStore<string, HostInterface<Chain<any>>>;
|
|
13
|
-
makeRecorderKit: MakeRecorderKit;
|
|
14
9
|
makeLocalChainFacade: MakeLocalChainFacade;
|
|
15
10
|
makeRemoteChainFacade: MakeRemoteChainFacade;
|
|
16
|
-
orchestrationService: Remote<CosmosInterchainService>;
|
|
17
|
-
storageNode: Remote<StorageNode>;
|
|
18
|
-
timerService: Remote<TimerService>;
|
|
19
11
|
vowTools: VowTools;
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
getChainInfo(): Vow<Readonly<{
|
|
29
|
-
chainId: string;
|
|
30
|
-
connections?: Record<string, IBCConnectionInfo>;
|
|
31
|
-
icqEnabled?: boolean;
|
|
32
|
-
stakingTokens?: Readonly<Array<{
|
|
33
|
-
denom: string;
|
|
34
|
-
}>>;
|
|
35
|
-
}>>;
|
|
36
|
-
makeAccount(): Vow<import("./local-orchestration-account.js").LocalOrchestrationAccountKit["holder"]>;
|
|
37
|
-
query(args_0: {
|
|
38
|
-
'@type': string;
|
|
39
|
-
}[]): Vow<import("@agoric/cosmic-proto").JsonSafe<{
|
|
40
|
-
error?: string;
|
|
41
|
-
reply: {
|
|
42
|
-
'@type': string;
|
|
43
|
-
};
|
|
44
|
-
}>[] extends import("@endo/pass-style").Passable ? import("@agoric/cosmic-proto").JsonSafe<{
|
|
45
|
-
error?: string;
|
|
46
|
-
reply: {
|
|
47
|
-
'@type': string;
|
|
48
|
-
};
|
|
49
|
-
}>[] : HostInterface<import("@agoric/cosmic-proto").JsonSafe<{
|
|
50
|
-
error?: string;
|
|
51
|
-
reply: {
|
|
52
|
-
'@type': string;
|
|
53
|
-
};
|
|
54
|
-
}>[]>>;
|
|
55
|
-
getVBankAssetInfo(): Vow<import("@agoric/vats/src/vat-bank.js").AssetInfo[] extends import("@endo/pass-style").Passable ? import("@agoric/vats/src/vat-bank.js").AssetInfo[] : HostInterface<import("@agoric/vats/src/vat-bank.js").AssetInfo[]>>;
|
|
56
|
-
}>;
|
|
57
|
-
};
|
|
58
|
-
/**
|
|
59
|
-
* Waits for `chainInfo` for `agoric` and a remote chain and returns a
|
|
60
|
-
* RemoteChainFacade
|
|
61
|
-
*/
|
|
62
|
-
makeRemoteChainFacadeWatcher: {
|
|
63
|
-
/**
|
|
64
|
-
* Waits for `chainInfo` for `agoric` and a remote chain and returns a
|
|
65
|
-
* RemoteChainFacade
|
|
66
|
-
*
|
|
67
|
-
* @param {[ChainInfo, ChainInfo, IBCConnectionInfo]} chainsAndConnection
|
|
68
|
-
* @param {string} name
|
|
69
|
-
*/
|
|
70
|
-
onFulfilled([_agoricChainInfo, remoteChainInfo, connectionInfo]: [ChainInfo, ChainInfo, IBCConnectionInfo], name: string): import("@endo/exo").Guarded<{
|
|
71
|
-
getChainInfo(): Vow<any extends import("@endo/pass-style").Passable ? any : HostInterface<any>>;
|
|
72
|
-
makeAccount(): Vow<import("../orchestration-api.js").OrchestrationAccount<any> extends import("@endo/pass-style").Passable ? import("@endo/pass-style").Passable & import("../orchestration-api.js").OrchestrationAccount<any> : HostInterface<import("../orchestration-api.js").OrchestrationAccount<any>>>;
|
|
73
|
-
query(msgs: import("@agoric/cosmic-proto").JsonSafe<import("@agoric/cosmic-proto/tendermint/abci/types.js").RequestQuery>[]): Vow<import("@agoric/cosmic-proto").JsonSafe<import("@agoric/cosmic-proto/tendermint/abci/types.js").ResponseQuery>[] extends import("@endo/pass-style").Passable ? import("@endo/pass-style").Passable & import("@agoric/cosmic-proto").JsonSafe<import("@agoric/cosmic-proto/tendermint/abci/types.js").ResponseQuery>[] : HostInterface<import("@agoric/cosmic-proto").JsonSafe<import("@agoric/cosmic-proto/tendermint/abci/types.js").ResponseQuery>[]>>;
|
|
74
|
-
}>;
|
|
75
|
-
};
|
|
76
|
-
orchestrator: {
|
|
77
|
-
/** @type {HostOf<Orchestrator['getChain']>} */
|
|
78
|
-
getChain(chainName: string): Vow<Chain<any> extends import("@endo/pass-style").Passable ? import("@endo/pass-style").Passable & Chain<any> : HostInterface<Chain<any>>>;
|
|
79
|
-
makeLocalAccount(): Vow<import("@endo/exo").Guarded<{
|
|
80
|
-
getAddress(): string;
|
|
81
|
-
getBalance(brand: Brand<"nat">): import("@agoric/vow").PromiseVow<Amount<"nat">>;
|
|
82
|
-
deposit(payment: ERef<Payment<"nat">>, optAmountShape?: Pattern): import("@agoric/vow").PromiseVow<Amount<"nat">>;
|
|
83
|
-
withdraw(amount: Amount<"nat">): import("@agoric/vow").PromiseVow<Payment<"nat">>;
|
|
84
|
-
executeTx<MT extends import("@agoric/cosmic-proto").TypedJson[]>(messages: MT): PromiseVowOfTupleMappedToGenerics<{ [K in keyof MT]: import("@agoric/cosmic-proto").JsonSafe<import("@agoric/cosmic-proto").ResponseTo<MT[K]>>; }>;
|
|
85
|
-
monitorTransfers(tap: import("@agoric/vats/src/bridge-target.js").TargetApp): import("@agoric/vow").PromiseVow<import("@agoric/vats/src/bridge-target.js").TargetRegistration>;
|
|
86
|
-
}>>;
|
|
87
|
-
/** @type {HostOf<Orchestrator['getDenomInfo']>} */
|
|
88
|
-
getDenomInfo(denom: string): HostInterface<import("../orchestration-api.js").DenomInfo<"agoric" | "celestia" | "agoriclocal" | "cosmoshub" | "dydx" | "juno" | "neutron" | "noble" | "omniflixhub" | "osmosis" | "secretnetwork" | "stargaze" | "stride" | "umee", "agoric" | "celestia" | "agoriclocal" | "cosmoshub" | "dydx" | "juno" | "neutron" | "noble" | "omniflixhub" | "osmosis" | "secretnetwork" | "stargaze" | "stride" | "umee">>;
|
|
89
|
-
/** @type {HostOf<Orchestrator['asAmount']>} */
|
|
90
|
-
asAmount: HostOf<Orchestrator["asAmount"]>;
|
|
91
|
-
};
|
|
92
|
-
}>>["orchestrator"];
|
|
12
|
+
}): () => import("@endo/exo").Guarded<{
|
|
13
|
+
/** @type {HostOf<Orchestrator['getChain']>} */
|
|
14
|
+
getChain(chainName: string): Vow<HostInterface<Chain<any>>>;
|
|
15
|
+
/** @type {HostOf<Orchestrator['getDenomInfo']>} */
|
|
16
|
+
getDenomInfo(denom: string): HostInterface<import("../orchestration-api.js").DenomInfo<"agoric" | "celestia" | "cosmoshub" | "dydx" | "juno" | "neutron" | "noble" | "omniflixhub" | "osmosis" | "secretnetwork" | "stargaze" | "stride" | "umee", "agoric" | "celestia" | "cosmoshub" | "dydx" | "juno" | "neutron" | "noble" | "omniflixhub" | "osmosis" | "secretnetwork" | "stargaze" | "stride" | "umee">>;
|
|
17
|
+
/** @type {HostOf<Orchestrator['asAmount']>} */
|
|
18
|
+
asAmount: HostOf<Orchestrator["asAmount"]>;
|
|
19
|
+
}>;
|
|
93
20
|
/**
|
|
94
21
|
* Host side of the Orchestrator interface. (Methods return vows instead of
|
|
95
22
|
* promises as the interface within the guest function.)
|
|
96
23
|
*/
|
|
97
24
|
export type HostOrchestrator = ReturnType<ReturnType<typeof prepareOrchestratorKit>>["orchestrator"];
|
|
98
25
|
import type { Zone } from '@agoric/base-zone';
|
|
99
|
-
import type { AsyncFlowTools } from '@agoric/async-flow';
|
|
100
26
|
import type { ChainHub } from './chain-hub.js';
|
|
101
|
-
import type { LocalChain } from '@agoric/vats/src/localchain.js';
|
|
102
|
-
import type { Remote } from '@agoric/internal';
|
|
103
|
-
import type { Chain } from '../types.js';
|
|
104
|
-
import type { HostInterface } from '@agoric/async-flow';
|
|
105
|
-
import type { MakeRecorderKit } from '@agoric/zoe/src/contractSupport/recorder.js';
|
|
106
27
|
import type { MakeLocalChainFacade } from './local-chain-facade.js';
|
|
107
28
|
import type { MakeRemoteChainFacade } from './remote-chain-facade.js';
|
|
108
|
-
import type { CosmosInterchainService } from './exo-interfaces.js';
|
|
109
|
-
import type { TimerService } from '@agoric/time';
|
|
110
29
|
import type { VowTools } from '@agoric/vow';
|
|
111
|
-
import type {
|
|
112
|
-
import type {
|
|
30
|
+
import type { Chain } from '../types.js';
|
|
31
|
+
import type { HostInterface } from '@agoric/async-flow';
|
|
113
32
|
import type { Vow } from '@agoric/vow';
|
|
114
|
-
import type { ChainInfo } from '../types.js';
|
|
115
33
|
import type { Orchestrator } from '../types.js';
|
|
116
34
|
import type { HostOf } from '@agoric/async-flow';
|
|
117
35
|
/**
|
|
118
36
|
* @param {Zone} zone
|
|
119
37
|
* @param {{
|
|
120
|
-
* asyncFlowTools: AsyncFlowTools;
|
|
121
38
|
* chainHub: ChainHub;
|
|
122
|
-
* localchain: Remote<LocalChain>;
|
|
123
|
-
* chainByName: MapStore<string, HostInterface<Chain>>;
|
|
124
|
-
* makeRecorderKit: MakeRecorderKit;
|
|
125
39
|
* makeLocalChainFacade: MakeLocalChainFacade;
|
|
126
40
|
* makeRemoteChainFacade: MakeRemoteChainFacade;
|
|
127
|
-
* orchestrationService: Remote<CosmosInterchainService>;
|
|
128
|
-
* storageNode: Remote<StorageNode>;
|
|
129
|
-
* timerService: Remote<TimerService>;
|
|
130
41
|
* vowTools: VowTools;
|
|
131
|
-
* zcf: ZCF;
|
|
132
42
|
* }} powers
|
|
133
43
|
*/
|
|
134
|
-
declare function prepareOrchestratorKit(zone: Zone, { chainHub,
|
|
135
|
-
asyncFlowTools: AsyncFlowTools;
|
|
44
|
+
declare function prepareOrchestratorKit(zone: Zone, { chainHub, makeLocalChainFacade, makeRemoteChainFacade, vowTools: { watch, asVow }, }: {
|
|
136
45
|
chainHub: ChainHub;
|
|
137
|
-
localchain: Remote<LocalChain>;
|
|
138
|
-
chainByName: MapStore<string, HostInterface<Chain<any>>>;
|
|
139
|
-
makeRecorderKit: MakeRecorderKit;
|
|
140
46
|
makeLocalChainFacade: MakeLocalChainFacade;
|
|
141
47
|
makeRemoteChainFacade: MakeRemoteChainFacade;
|
|
142
|
-
orchestrationService: Remote<CosmosInterchainService>;
|
|
143
|
-
storageNode: Remote<StorageNode>;
|
|
144
|
-
timerService: Remote<TimerService>;
|
|
145
48
|
vowTools: VowTools;
|
|
146
|
-
zcf: ZCF;
|
|
147
49
|
}): () => import("@endo/exo").GuardedKit<{
|
|
148
50
|
/** Waits for `chainInfo` and returns a LocalChainFacade */
|
|
149
51
|
makeLocalChainFacadeWatcher: {
|
|
@@ -162,23 +64,13 @@ declare function prepareOrchestratorKit(zone: Zone, { chainHub, localchain, chai
|
|
|
162
64
|
makeAccount(): Vow<import("./local-orchestration-account.js").LocalOrchestrationAccountKit["holder"]>;
|
|
163
65
|
query(args_0: {
|
|
164
66
|
'@type': string;
|
|
165
|
-
}[]): Vow<
|
|
166
|
-
error?: string;
|
|
167
|
-
reply: {
|
|
168
|
-
'@type': string;
|
|
169
|
-
};
|
|
170
|
-
}>[] extends import("@endo/pass-style").Passable ? import("@agoric/cosmic-proto").JsonSafe<{
|
|
171
|
-
error?: string;
|
|
172
|
-
reply: {
|
|
173
|
-
'@type': string;
|
|
174
|
-
};
|
|
175
|
-
}>[] : HostInterface<import("@agoric/cosmic-proto").JsonSafe<{
|
|
176
|
-
error?: string;
|
|
67
|
+
}[]): Vow<{
|
|
68
|
+
error?: string | undefined;
|
|
177
69
|
reply: {
|
|
178
70
|
'@type': string;
|
|
179
71
|
};
|
|
180
|
-
}
|
|
181
|
-
getVBankAssetInfo(): Vow<import("@agoric/vats/src/vat-bank.js").AssetInfo[]
|
|
72
|
+
}[]>;
|
|
73
|
+
getVBankAssetInfo(): Vow<import("@agoric/vats/src/vat-bank.js").AssetInfo[]>;
|
|
182
74
|
}>;
|
|
183
75
|
};
|
|
184
76
|
/**
|
|
@@ -194,27 +86,43 @@ declare function prepareOrchestratorKit(zone: Zone, { chainHub, localchain, chai
|
|
|
194
86
|
* @param {string} name
|
|
195
87
|
*/
|
|
196
88
|
onFulfilled([_agoricChainInfo, remoteChainInfo, connectionInfo]: [ChainInfo, ChainInfo, IBCConnectionInfo], name: string): import("@endo/exo").Guarded<{
|
|
197
|
-
getChainInfo(): Vow<any
|
|
198
|
-
makeAccount(): Vow<import("../orchestration-api.js").
|
|
199
|
-
query(msgs:
|
|
89
|
+
getChainInfo(): Vow<any>;
|
|
90
|
+
makeAccount(): Vow<HostInterface<import("../orchestration-api.js").OrchestrationAccountI> | HostInterface<import("../orchestration-api.js").OrchestrationAccountI & import("../cosmos-api.js").LocalAccountMethods> | HostInterface<import("../orchestration-api.js").OrchestrationAccountI & import("../cosmos-api.js").StakingAccountActions & import("../cosmos-api.js").StakingAccountQueries> | HostInterface<import("../orchestration-api.js").OrchestrationAccountI & import("../cosmos-api.js").StakingAccountActions & import("../cosmos-api.js").StakingAccountQueries & import("../cosmos-api.js").LocalAccountMethods>>;
|
|
91
|
+
query(msgs: {
|
|
92
|
+
data: string;
|
|
93
|
+
path: string;
|
|
94
|
+
height: string;
|
|
95
|
+
prove: boolean;
|
|
96
|
+
}[]): Vow<{
|
|
97
|
+
code: number;
|
|
98
|
+
log: string;
|
|
99
|
+
info: string;
|
|
100
|
+
index: string;
|
|
101
|
+
key: string;
|
|
102
|
+
value: string;
|
|
103
|
+
proofOps?: {
|
|
104
|
+
ops: {
|
|
105
|
+
type: string;
|
|
106
|
+
key: string;
|
|
107
|
+
data: string;
|
|
108
|
+
}[];
|
|
109
|
+
} | undefined;
|
|
110
|
+
height: string;
|
|
111
|
+
codespace: string;
|
|
112
|
+
}[]>;
|
|
200
113
|
}>;
|
|
201
114
|
};
|
|
202
115
|
orchestrator: {
|
|
203
116
|
/** @type {HostOf<Orchestrator['getChain']>} */
|
|
204
|
-
getChain(chainName: string): Vow<
|
|
205
|
-
makeLocalAccount(): Vow<import("@endo/exo").Guarded<{
|
|
206
|
-
getAddress(): string;
|
|
207
|
-
getBalance(brand: Brand<"nat">): import("@agoric/vow").PromiseVow<Amount<"nat">>;
|
|
208
|
-
deposit(payment: ERef<Payment<"nat">>, optAmountShape?: Pattern): import("@agoric/vow").PromiseVow<Amount<"nat">>;
|
|
209
|
-
withdraw(amount: Amount<"nat">): import("@agoric/vow").PromiseVow<Payment<"nat">>;
|
|
210
|
-
executeTx<MT extends import("@agoric/cosmic-proto").TypedJson[]>(messages: MT): PromiseVowOfTupleMappedToGenerics<{ [K in keyof MT]: import("@agoric/cosmic-proto").JsonSafe<import("@agoric/cosmic-proto").ResponseTo<MT[K]>>; }>;
|
|
211
|
-
monitorTransfers(tap: import("@agoric/vats/src/bridge-target.js").TargetApp): import("@agoric/vow").PromiseVow<import("@agoric/vats/src/bridge-target.js").TargetRegistration>;
|
|
212
|
-
}>>;
|
|
117
|
+
getChain(chainName: string): Vow<HostInterface<Chain<any>>>;
|
|
213
118
|
/** @type {HostOf<Orchestrator['getDenomInfo']>} */
|
|
214
|
-
getDenomInfo(denom: string): HostInterface<import("../orchestration-api.js").DenomInfo<"agoric" | "celestia" | "
|
|
119
|
+
getDenomInfo(denom: string): HostInterface<import("../orchestration-api.js").DenomInfo<"agoric" | "celestia" | "cosmoshub" | "dydx" | "juno" | "neutron" | "noble" | "omniflixhub" | "osmosis" | "secretnetwork" | "stargaze" | "stride" | "umee", "agoric" | "celestia" | "cosmoshub" | "dydx" | "juno" | "neutron" | "noble" | "omniflixhub" | "osmosis" | "secretnetwork" | "stargaze" | "stride" | "umee">>;
|
|
215
120
|
/** @type {HostOf<Orchestrator['asAmount']>} */
|
|
216
121
|
asAmount: HostOf<Orchestrator["asAmount"]>;
|
|
217
122
|
};
|
|
218
123
|
}>;
|
|
124
|
+
import type { ActualChainInfo } from './chain-hub.js';
|
|
125
|
+
import type { IBCConnectionInfo } from '../types.js';
|
|
126
|
+
import type { ChainInfo } from '../types.js';
|
|
219
127
|
export {};
|
|
220
128
|
//# sourceMappingURL=orchestrator.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"orchestrator.d.ts","sourceRoot":"","sources":["orchestrator.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"orchestrator.d.ts","sourceRoot":"","sources":["orchestrator.js"],"names":[],"mappings":"AAiCA,0BAA0B;AAC1B;;;;GAIG;AA2II,0CARI,IAAI,UACJ;IACN,QAAQ,EAAE,QAAQ,CAAC;IACnB,oBAAoB,EAAE,oBAAoB,CAAC;IAC3C,qBAAqB,EAAE,qBAAqB,CAAC;IAC7C,QAAQ,EAAE,QAAQ,CAAC;CACpB;IA1DI,+CAA+C;;IAsB/C,mDAAmD;;IAqBnD,+CAA+C;cAApC,OAAO,YAAY,CAAC,UAAU,CAAC,CAAC;GAoBlD;;;;;+BAMY,UAAU,CAClB,UAAU,CAAC,OAAO,sBAAsB,CAAC,CAC1C,CAAC,cAAc,CAAC;0BA7KG,mBAAmB;8BACE,gBAAgB;0CASrB,yBAAyB;2CACxB,0BAA0B;8BARlC,aAAa;2BASuB,aAAa;mCAVzB,oBAAoB;yBAC5C,aAAa;kCASuB,aAAa;4BAVzB,oBAAoB;AAuB5E;;;;;;;;GAQG;AACH,8CARW,IAAI,0FACJ;IACN,QAAQ,EAAE,QAAQ,CAAC;IACnB,oBAAoB,EAAE,oBAAoB,CAAC;IAC3C,qBAAqB,EAAE,qBAAqB,CAAC;IAC7C,QAAQ,EAAE,QAAQ,CAAC;CACpB;IAwCE,2DAA2D;;QAEzD;;WAEG;qCADQ,gBAAgB,QAAQ,CAAC;;;;;;;;;;;;;;;;;;;;;IAQtC;;;OAGG;;QAED;;;;;;WAMG;0HADQ,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;QASjB,+CAA+C;;QAsB/C,mDAAmD;;QAqBnD,+CAA+C;kBAApC,OAAO,YAAY,CAAC,UAAU,CAAC,CAAC;;GAKlD;qCArJ2C,gBAAgB;uCAWQ,aAAa;+BAAb,aAAa"}
|
package/src/exos/orchestrator.js
CHANGED
|
@@ -4,14 +4,12 @@ import { pickFacet } from '@agoric/vat-data';
|
|
|
4
4
|
import { makeTracer } from '@agoric/internal';
|
|
5
5
|
import { Shape as NetworkShape } from '@agoric/network';
|
|
6
6
|
import { Fail, q } from '@endo/errors';
|
|
7
|
-
import { E } from '@endo/far';
|
|
8
7
|
import { M } from '@endo/patterns';
|
|
9
8
|
import {
|
|
10
9
|
DenomInfoShape,
|
|
11
10
|
ChainInfoShape,
|
|
12
11
|
DenomAmountShape,
|
|
13
12
|
DenomShape,
|
|
14
|
-
LocalChainAccountShape,
|
|
15
13
|
} from '../typeGuards.js';
|
|
16
14
|
|
|
17
15
|
/**
|
|
@@ -36,7 +34,6 @@ const trace = makeTracer('Orchestrator');
|
|
|
36
34
|
/** @see {Orchestrator} */
|
|
37
35
|
export const OrchestratorI = M.interface('Orchestrator', {
|
|
38
36
|
getChain: M.call(M.string()).returns(Vow$(ChainInfoShape)),
|
|
39
|
-
makeLocalAccount: M.call().returns(Vow$(LocalChainAccountShape)),
|
|
40
37
|
getDenomInfo: M.call(DenomShape).returns(DenomInfoShape),
|
|
41
38
|
asAmount: M.call(DenomAmountShape).returns(AmountShape),
|
|
42
39
|
});
|
|
@@ -44,32 +41,30 @@ export const OrchestratorI = M.interface('Orchestrator', {
|
|
|
44
41
|
/**
|
|
45
42
|
* @param {Zone} zone
|
|
46
43
|
* @param {{
|
|
47
|
-
* asyncFlowTools: AsyncFlowTools;
|
|
48
44
|
* chainHub: ChainHub;
|
|
49
|
-
* localchain: Remote<LocalChain>;
|
|
50
|
-
* chainByName: MapStore<string, HostInterface<Chain>>;
|
|
51
|
-
* makeRecorderKit: MakeRecorderKit;
|
|
52
45
|
* makeLocalChainFacade: MakeLocalChainFacade;
|
|
53
46
|
* makeRemoteChainFacade: MakeRemoteChainFacade;
|
|
54
|
-
* orchestrationService: Remote<CosmosInterchainService>;
|
|
55
|
-
* storageNode: Remote<StorageNode>;
|
|
56
|
-
* timerService: Remote<TimerService>;
|
|
57
47
|
* vowTools: VowTools;
|
|
58
|
-
* zcf: ZCF;
|
|
59
48
|
* }} powers
|
|
60
49
|
*/
|
|
61
50
|
const prepareOrchestratorKit = (
|
|
62
51
|
zone,
|
|
63
52
|
{
|
|
64
53
|
chainHub,
|
|
65
|
-
localchain,
|
|
66
|
-
chainByName,
|
|
67
54
|
makeLocalChainFacade,
|
|
68
55
|
makeRemoteChainFacade,
|
|
69
56
|
vowTools: { watch, asVow },
|
|
70
57
|
},
|
|
71
|
-
) =>
|
|
72
|
-
|
|
58
|
+
) => {
|
|
59
|
+
/**
|
|
60
|
+
* @template T
|
|
61
|
+
* @typedef {{ vow: Vow<T>; pending: true } | { value: T; pending: false }} MaybePendingValue
|
|
62
|
+
*/
|
|
63
|
+
|
|
64
|
+
/** @type {MapStore<string, MaybePendingValue<HostInterface<Chain>>>} */
|
|
65
|
+
const chainByName = zone.mapStore('chainName');
|
|
66
|
+
|
|
67
|
+
return zone.exoClassKit(
|
|
73
68
|
'Orchestrator',
|
|
74
69
|
{
|
|
75
70
|
orchestrator: OrchestratorI,
|
|
@@ -97,7 +92,7 @@ const prepareOrchestratorKit = (
|
|
|
97
92
|
*/
|
|
98
93
|
onFulfilled(agoricChainInfo) {
|
|
99
94
|
const it = makeLocalChainFacade(agoricChainInfo);
|
|
100
|
-
chainByName.
|
|
95
|
+
chainByName.set('agoric', harden({ value: it, pending: false }));
|
|
101
96
|
return it;
|
|
102
97
|
},
|
|
103
98
|
},
|
|
@@ -115,30 +110,32 @@ const prepareOrchestratorKit = (
|
|
|
115
110
|
*/
|
|
116
111
|
onFulfilled([_agoricChainInfo, remoteChainInfo, connectionInfo], name) {
|
|
117
112
|
const it = makeRemoteChainFacade(remoteChainInfo, connectionInfo);
|
|
118
|
-
chainByName.
|
|
113
|
+
chainByName.set(name, harden({ value: it, pending: false }));
|
|
119
114
|
return it;
|
|
120
115
|
},
|
|
121
116
|
},
|
|
122
117
|
orchestrator: {
|
|
123
118
|
/** @type {HostOf<Orchestrator['getChain']>} */
|
|
124
119
|
getChain(name) {
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
120
|
+
return asVow(() => {
|
|
121
|
+
if (chainByName.has(name)) {
|
|
122
|
+
const maybeChain = chainByName.get(name);
|
|
123
|
+
return maybeChain.pending ? maybeChain.vow : maybeChain.value;
|
|
124
|
+
}
|
|
125
|
+
const vow =
|
|
126
|
+
name === 'agoric'
|
|
127
|
+
? watch(
|
|
128
|
+
chainHub.getChainInfo('agoric'),
|
|
129
|
+
this.facets.makeLocalChainFacadeWatcher,
|
|
130
|
+
)
|
|
131
|
+
: watch(
|
|
132
|
+
chainHub.getChainsAndConnection('agoric', name),
|
|
133
|
+
this.facets.makeRemoteChainFacadeWatcher,
|
|
134
|
+
name,
|
|
135
|
+
);
|
|
136
|
+
chainByName.init(name, harden({ vow, pending: true }));
|
|
137
|
+
return vow;
|
|
138
|
+
});
|
|
142
139
|
},
|
|
143
140
|
/** @type {HostOf<Orchestrator['getDenomInfo']>} */
|
|
144
141
|
getDenomInfo(denom) {
|
|
@@ -147,10 +144,18 @@ const prepareOrchestratorKit = (
|
|
|
147
144
|
const { chainName, baseName, baseDenom, brand } = denomDetail;
|
|
148
145
|
chainByName.has(chainName) ||
|
|
149
146
|
Fail`use getChain(${q(chainName)}) before getDenomInfo(${q(denom)})`;
|
|
150
|
-
const
|
|
147
|
+
const maybeChain = chainByName.get(chainName);
|
|
148
|
+
if (maybeChain.pending) {
|
|
149
|
+
throw Fail`wait until getChain(${q(chainName)}) completes before getDenomInfo(${q(denom)})`;
|
|
150
|
+
}
|
|
151
|
+
const chain = maybeChain.value;
|
|
151
152
|
chainByName.has(baseName) ||
|
|
152
153
|
Fail`use getChain(${q(baseName)}) before getDenomInfo(${q(denom)})`;
|
|
153
|
-
const
|
|
154
|
+
const maybeBase = chainByName.get(baseName);
|
|
155
|
+
if (maybeBase.pending) {
|
|
156
|
+
throw Fail`wait until getChain(${q(baseName)}) completes before getDenomInfo(${q(denom)})`;
|
|
157
|
+
}
|
|
158
|
+
const base = maybeBase.value;
|
|
154
159
|
return harden({ chain, base, brand, baseDenom });
|
|
155
160
|
},
|
|
156
161
|
/** @type {HostOf<Orchestrator['asAmount']>} */
|
|
@@ -158,23 +163,16 @@ const prepareOrchestratorKit = (
|
|
|
158
163
|
},
|
|
159
164
|
},
|
|
160
165
|
);
|
|
166
|
+
};
|
|
161
167
|
harden(prepareOrchestratorKit);
|
|
162
168
|
|
|
163
169
|
/**
|
|
164
170
|
* @param {Zone} zone
|
|
165
171
|
* @param {{
|
|
166
|
-
* asyncFlowTools: AsyncFlowTools;
|
|
167
172
|
* chainHub: ChainHub;
|
|
168
|
-
* localchain: Remote<LocalChain>;
|
|
169
|
-
* chainByName: MapStore<string, HostInterface<Chain>>;
|
|
170
|
-
* makeRecorderKit: MakeRecorderKit;
|
|
171
173
|
* makeLocalChainFacade: MakeLocalChainFacade;
|
|
172
174
|
* makeRemoteChainFacade: MakeRemoteChainFacade;
|
|
173
|
-
* orchestrationService: Remote<CosmosInterchainService>;
|
|
174
|
-
* storageNode: Remote<StorageNode>;
|
|
175
|
-
* timerService: Remote<TimerService>;
|
|
176
175
|
* vowTools: VowTools;
|
|
177
|
-
* zcf: ZCF;
|
|
178
176
|
* }} powers
|
|
179
177
|
*/
|
|
180
178
|
export const prepareOrchestrator = (zone, powers) => {
|