Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

export withOrchestration #9808

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/orchestration/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@
export * from './src/types.js';
export * from './src/exos/cosmos-interchain-service.js';
export * from './src/typeGuards.js';
export * from './src/utils/start-helper.js';
13 changes: 1 addition & 12 deletions packages/orchestration/src/examples/auto-stake-it.contract.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,7 @@ import * as flows from './auto-stake-it.flows.js';
* @import {NameHub} from '@agoric/vats';
* @import {Remote} from '@agoric/vow';
* @import {Zone} from '@agoric/zone';
* @import {CosmosInterchainService} from '@agoric/orchestration';
* @import {OrchestrationTools} from '../utils/start-helper.js';
*/

/**
* @typedef {{
* localchain: Remote<LocalChain>;
* orchestrationService: Remote<CosmosInterchainService>;
* storageNode: Remote<StorageNode>;
* timerService: Remote<TimerService>;
* agoricNames: Remote<NameHub>;
* }} OrchestrationPowers
* @import {OrchestrationPowers, OrchestrationTools} from '@agoric/orchestration';
*/

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ import * as flows from './basic-flows.flows.js';

/**
* @import {Zone} from '@agoric/zone';
* @import {OrchestrationPowers} from '../utils/start-helper.js';
* @import {OrchestrationTools} from '../utils/start-helper.js';
* @import {OrchestrationPowers, OrchestrationTools} from '@agoric/orchestration';
*/

/**
Expand Down
3 changes: 0 additions & 3 deletions packages/orchestration/src/examples/basic-flows.flows.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,9 @@
import { M, mustMatch } from '@endo/patterns';

/**
* @import {Zone} from '@agoric/zone';
* @import {OrchestrationAccount, OrchestrationFlow, Orchestrator} from '@agoric/orchestration';
* @import {ResolvedPublicTopic} from '@agoric/zoe/src/contractSupport/topics.js';
* @import {OrchestrationPowers} from '../utils/start-helper.js';
* @import {MakePortfolioHolder} from '../exos/portfolio-holder-kit.js';
* @import {OrchestrationTools} from '../utils/start-helper.js';
*/

/**
Expand Down
13 changes: 1 addition & 12 deletions packages/orchestration/src/examples/sendAnywhere.contract.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,7 @@ import { prepareChainHubAdmin } from '../exos/chain-hub-admin.js';
* @import {Remote, Vow} from '@agoric/vow';
* @import {Zone} from '@agoric/zone';
* @import {VBankAssetDetail} from '@agoric/vats/tools/board-utils.js';
* @import {CosmosInterchainService} from '../exos/cosmos-interchain-service.js';
* @import {OrchestrationTools} from '../utils/start-helper.js';
*/

/**
* @typedef {{
* localchain: Remote<LocalChain>;
* orchestrationService: Remote<CosmosInterchainService>;
* storageNode: Remote<StorageNode>;
* timerService: Remote<TimerService>;
* agoricNames: Remote<NameHub>;
* }} OrchestrationPowers
* @import {OrchestrationPowers, OrchestrationTools} from '@agoric/orchestration';
*/

export const SingleAmountRecord = M.and(
Expand Down
4 changes: 2 additions & 2 deletions packages/orchestration/src/examples/swapExample.contract.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ import { withOrchestration } from '../utils/start-helper.js';
* @import {TimerService} from '@agoric/time';
* @import {LocalChain} from '@agoric/vats/src/localchain.js';
* @import {Remote} from '@agoric/internal';
* @import {CosmosInterchainService} from '../exos/cosmos-interchain-service.js';
* @import {CosmosInterchainService} from '../types.js';
* @import {NameHub} from '@agoric/vats';
* @import {Zone} from '@agoric/zone';
* @import {OrchestrationTools} from '../utils/start-helper.js';
* @import {OrchestrationPowers, OrchestrationTools} from '@agoric/orchestration';
*/

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ import { M } from '@endo/patterns';
import { withOrchestration } from '../utils/start-helper.js';

/**
* @import {OrchestrationPowers, OrchestrationTools} from '@agoric/orchestration';
* @import {Orchestrator, OrchestrationFlow} from '../types.js'
* @import {TimerService} from '@agoric/time';
* @import {LocalChain} from '@agoric/vats/src/localchain.js';
* @import {NameHub} from '@agoric/vats';
* @import {Remote} from '@agoric/internal';
* @import {Zone} from '@agoric/zone';
* @import {CosmosInterchainService} from '../exos/cosmos-interchain-service.js';
* @import {OrchestrationTools} from '../utils/start-helper.js';
* @import {CosmosInterchainService} from '../types.js';
*/

/**
Expand Down
18 changes: 10 additions & 8 deletions packages/orchestration/src/exos/cosmos-interchain-service.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import {

const { Vow$ } = NetworkShape; // TODO #9611
/**
* @typedef {object} OrchestrationPowers
* @typedef {object} CosmosInterchainPowers
* @property {Remote<PortAllocator>} portAllocator
*/

Expand All @@ -33,8 +33,8 @@ const { Vow$ } = NetworkShape; // TODO #9611
* state migrations.
*
* @typedef {MapStore<
* keyof OrchestrationPowers,
* OrchestrationPowers[keyof OrchestrationPowers]
* keyof CosmosInterchainPowers,
* CosmosInterchainPowers[keyof CosmosInterchainPowers]
* >} PowerStore
*/

Expand All @@ -43,13 +43,13 @@ const { Vow$ } = NetworkShape; // TODO #9611
/** @typedef {ChainAccountKit | ICQConnectionKit} ConnectionKit */

/**
* @template {keyof OrchestrationPowers} K
* @template {keyof CosmosInterchainPowers} K
* @param {PowerStore} powers
* @param {K} name
*/
const getPower = (powers, name) => {
powers.has(name) || Fail`need powers.${b(name)} for this method`;
return /** @type {OrchestrationPowers[K]} */ (powers.get(name));
return /** @type {CosmosInterchainPowers[K]} */ (powers.get(name));
Comment on lines 50 to +52
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this getPower thing still isn't gone? darn.

};

/** @typedef {{ powers: PowerStore; icqConnections: ICQConnectionStore }} OrchestrationState */
Expand Down Expand Up @@ -101,13 +101,16 @@ const prepareCosmosOrchestrationServiceKit = (
),
}),
},
/** @param {Partial<OrchestrationPowers>} [initialPowers] */
/** @param {Partial<CosmosInterchainPowers>} [initialPowers] */
initialPowers => {
/** @type {PowerStore} */
const powers = zone.detached().mapStore('PowerStore');
if (initialPowers) {
for (const [name, power] of Object.entries(initialPowers)) {
powers.init(/** @type {keyof OrchestrationPowers} */ (name), power);
powers.init(
/** @type {keyof CosmosInterchainPowers} */ (name),
power,
);
}
}
const icqConnections = zone.detached().mapStore('ICQConnections');
Expand Down Expand Up @@ -259,4 +262,3 @@ export const prepareCosmosInterchainService = (zone, vowTools) => {
harden(prepareCosmosInterchainService);

/** @typedef {ReturnType<typeof prepareCosmosInterchainService>} MakeCosmosInterchainService */
/** @typedef {ReturnType<MakeCosmosInterchainService>} CosmosInterchainService */
2 changes: 1 addition & 1 deletion packages/orchestration/src/exos/local-chain-facade.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { ChainFacadeI } from '../typeGuards.js';
* @import {Remote} from '@agoric/internal';
* @import {LocalChain, LocalChainAccount} from '@agoric/vats/src/localchain.js';
* @import {Vow, VowTools} from '@agoric/vow';
* @import {CosmosInterchainService} from './cosmos-interchain-service.js';
* @import {CosmosInterchainService} from '../types.js';
* @import {LocalOrchestrationAccountKit, MakeLocalOrchestrationAccountKit} from './local-orchestration-account.js';
* @import {ChainAddress, ChainInfo, CosmosChainInfo, IBCConnectionInfo, OrchestrationAccount} from '../types.js';
*/
Expand Down
2 changes: 1 addition & 1 deletion packages/orchestration/src/exos/orchestrator.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import {
* @import {RecorderKit, MakeRecorderKit} from '@agoric/zoe/src/contractSupport/recorder.js'.
* @import {Remote} from '@agoric/internal';
* @import {PickFacet} from '@agoric/swingset-liveslots';
* @import {CosmosInterchainService} from './cosmos-interchain-service.js';
* @import {CosmosInterchainService} from '../types.js';
* @import {MakeLocalOrchestrationAccountKit} from './local-orchestration-account.js';
* @import {MakeLocalChainFacade} from './local-chain-facade.js';
* @import {MakeRemoteChainFacade} from './remote-chain-facade.js';
Expand Down
2 changes: 1 addition & 1 deletion packages/orchestration/src/exos/remote-chain-facade.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { ChainAddressShape, ChainFacadeI } from '../typeGuards.js';
* @import {TimerService} from '@agoric/time';
* @import {Remote} from '@agoric/internal';
* @import {Vow, VowTools} from '@agoric/vow';
* @import {CosmosInterchainService} from './cosmos-interchain-service.js';
* @import {CosmosInterchainService} from '../types.js';
* @import {prepareCosmosOrchestrationAccount} from './cosmos-orchestration-account.js';
* @import {ChainInfo, CosmosChainInfo, IBCConnectionInfo, OrchestrationAccount, ChainAddress, IcaAccount, Denom, Chain} from '../types.js';
*/
Expand Down
2 changes: 1 addition & 1 deletion packages/orchestration/src/facade.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { assertAllDefined } from '@agoric/internal';
* @import {RecorderKit, MakeRecorderKit} from '@agoric/zoe/src/contractSupport/recorder.js'.
* @import {HostOrchestrator} from './exos/orchestrator.js';
* @import {Remote} from '@agoric/internal';
* @import {CosmosInterchainService} from './exos/cosmos-interchain-service.js';
* @import {CosmosInterchainService} from './types.js';
* @import {Chain, ChainInfo, CosmosChainInfo, IBCConnectionInfo, OrchestrationAccount, OrchestrationFlow, Orchestrator} from './types.js';
*/

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ const trace = makeTracer('CoreEvalOrchestration', true);

/**
* @import {PortAllocator} from '@agoric/network';
* @import {CosmosInterchainService} from '../exos/cosmos-interchain-service.js'
*/

/**
Expand Down
5 changes: 5 additions & 0 deletions packages/orchestration/src/types.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
/** @file Rollup of all type definitions in the package, for local import and external export */

import type { MakeCosmosInterchainService } from './exos/cosmos-interchain-service.js';

export type * from './chain-info.js';
export type * from './cosmos-api.js';
export type * from './ethereum-api.js';
Expand All @@ -9,3 +11,6 @@ export type * from './orchestration-api.js';
export type * from './exos/cosmos-interchain-service.js';
export type * from './exos/chain-hub.js';
export type * from './vat-orchestration.js';

/** @interface */
export type CosmosInterchainService = ReturnType<MakeCosmosInterchainService>;
3 changes: 2 additions & 1 deletion packages/orchestration/src/utils/start-helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import { makeZoeTools } from './zoe-tools.js';
* @import {NameHub} from '@agoric/vats';
* @import {Remote} from '@agoric/vow';
* @import {Zone} from '@agoric/zone';
* @import {CosmosInterchainService} from '../exos/cosmos-interchain-service.js';
* @import {CosmosInterchainService} from '../types.js';
*/

/**
Expand All @@ -43,6 +43,7 @@ import { makeZoeTools } from './zoe-tools.js';
* @param {Baggage} baggage
* @param {OrchestrationPowers} remotePowers
* @param {Marshaller} marshaller
* @internal
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

doesn't seem to have the desired effect. I still see it:

image

https://ta-export-withorchestration.agoric-sdk.pages.dev/modules/_agoric_orchestration

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch. It needs the excludeInternal option, but even with that it's appearing.
Screenshot 2024-07-31 at 8 33 18 AM

I'll wait for #9727 and try again. I don't want to create merge conflicts for that one and maybe it fixes the bug.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried merging and that didn't fix it. Now I suspect a bug in typedoc

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, I've tried without luck to get @internal to do anything

*/
export const provideOrchestration = (
zcf,
Expand Down
4 changes: 2 additions & 2 deletions packages/orchestration/src/vat-orchestration.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { prepareSwingsetVowTools } from '@agoric/vow/vat.js';
import { makeDurableZone } from '@agoric/zone/durable.js';
import { prepareCosmosInterchainService } from './exos/cosmos-interchain-service.js';

/** @import {OrchestrationPowers} from './exos/cosmos-interchain-service.js' */
/** @import {CosmosInterchainPowers} from './exos/cosmos-interchain-service.js' */

export const buildRootObject = (_vatPowers, _args, baggage) => {
const zone = makeDurableZone(baggage);
Expand All @@ -14,7 +14,7 @@ export const buildRootObject = (_vatPowers, _args, baggage) => {
);

return Far('OrchestrationVat', {
/** @param {Partial<OrchestrationPowers>} [initialPowers] */
/** @param {Partial<CosmosInterchainPowers>} [initialPowers] */
makeCosmosInterchainService(initialPowers = {}) {
return makeCosmosInterchainService(initialPowers);
},
Expand Down
Loading