Skip to content

Commit

Permalink
feat: export OrchestrationPowersShape
Browse files Browse the repository at this point in the history
- useful for `privateArgsShape` in consuming contracts
- renames cosmos `orchestrationService`s powers from `OrchestrationPowers` -> `CosmosOrchestrationPowers`
  • Loading branch information
0xpatrickdev committed Nov 18, 2024
1 parent 5a4fc01 commit 34b61ea
Show file tree
Hide file tree
Showing 8 changed files with 35 additions and 6 deletions.
17 changes: 17 additions & 0 deletions packages/builders/test/snapshots/orchestration-imports.test.js.md
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,23 @@ Generated by [AVA](https://avajs.dev).
},
],
},
OrchestrationPowersShape: {
agoricNames: Object @match:kind {
payload: 'remotable',
},
localchain: Object @match:kind {
payload: 'remotable',
},
orchestrationService: Object @match:kind {
payload: 'remotable',
},
storageNode: Object @match:kind {
payload: 'remotable',
},
timerService: Object @match:kind {
payload: 'remotable',
},
},
OutboundConnectionHandlerI: Object @guard:interfaceGuard {
payload: {
defaultGuards: undefined,
Expand Down
Binary file modified packages/builders/test/snapshots/orchestration-imports.test.js.snap
Binary file not shown.
6 changes: 3 additions & 3 deletions packages/orchestration/src/exos/cosmos-interchain-service.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import { prepareICQConnectionKit } from './icq-connection-kit.js';

const { Vow$ } = NetworkShape; // TODO #9611
/**
* @typedef {object} OrchestrationPowers
* @typedef {object} CosmosOrchestrationPowers
* @property {Remote<PortAllocator>} portAllocator
* @property {undefined} reserved reserve a state key for future use. can hold
* an additional power or a record of powers
Expand All @@ -39,7 +39,7 @@ const { Vow$ } = NetworkShape; // TODO #9611
* @typedef {{
* icqConnections: ICQConnectionStore;
* sharedICQPort: Remote<Port> | undefined;
* } & OrchestrationPowers} OrchestrationState
* } & CosmosOrchestrationPowers} OrchestrationState
*/

/**
Expand Down Expand Up @@ -101,7 +101,7 @@ const prepareCosmosOrchestrationServiceKit = (
.returns(Vow$(M.remotable('ICQConnection'))),
}),
},
/** @param {Partial<OrchestrationPowers>} powers */
/** @param {Partial<CosmosOrchestrationPowers>} powers */
powers => {
mustMatch(powers?.portAllocator, M.remotable('PortAllocator'));
const icqConnections = zone.detached().mapStore('ICQConnections');
Expand Down
12 changes: 11 additions & 1 deletion packages/orchestration/src/typeGuards.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { M } from '@endo/patterns';

/**
* @import {TypedPattern} from '@agoric/internal';
* @import {ChainAddress, CosmosAssetInfo, Chain, ChainInfo, CosmosChainInfo, DenomAmount, DenomInfo, AmountArg, CosmosValidatorAddress} from './types.js';
* @import {ChainAddress, CosmosAssetInfo, Chain, ChainInfo, CosmosChainInfo, DenomAmount, DenomInfo, AmountArg, CosmosValidatorAddress, OrchestrationPowers} from './types.js';
* @import {Any as Proto3Msg} from '@agoric/cosmic-proto/google/protobuf/any.js';
* @import {TxBody} from '@agoric/cosmic-proto/cosmos/tx/v1beta1/tx.js';
* @import {TypedJson} from '@agoric/cosmic-proto';
Expand Down Expand Up @@ -195,3 +195,13 @@ export const AnyNatAmountsRecord = M.and(
M.recordOf(M.string(), AnyNatAmountShape),
M.not({}),
);

/** @type {TypedPattern<OrchestrationPowers>} */
export const OrchestrationPowersShape = {
agoricNames: M.remotable(),
localchain: M.remotable(),
orchestrationService: M.remotable(),
storageNode: M.remotable(),
timerService: M.remotable(),
};
harden(OrchestrationPowersShape);
1 change: 1 addition & 0 deletions packages/orchestration/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export type * from './exos/local-chain-facade.js';
export type * from './exos/portfolio-holder-kit.js';
export type * from './orchestration-api.js';
export type * from './vat-orchestration.js';
export type * from './utils/start-helper.js';

/**
* ({@link ZCF})-like tools for use in {@link OrchestrationFlow}s.
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 @@ -5,7 +5,7 @@ import { prepareCosmosInterchainService } from './exos/cosmos-interchain-service

/**
* @import {Baggage} from '@agoric/vat-data';
* @import {OrchestrationPowers} from './exos/cosmos-interchain-service.js';
* @import {CosmosOrchestrationPowers} from './exos/cosmos-interchain-service.js';
*/

/**
Expand All @@ -26,7 +26,7 @@ export const buildRootObject = (vatPowers, vatParameters, baggage) => {
);

return Far('OrchestrationVat', {
/** @param {Partial<OrchestrationPowers>} [initialPowers] */
/** @param {Partial<CosmosOrchestrationPowers>} [initialPowers] */
makeCosmosInterchainService(initialPowers = {}) {
return makeCosmosInterchainService(initialPowers);
},
Expand Down
1 change: 1 addition & 0 deletions packages/orchestration/test/snapshots/exports.test.ts.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ Generated by [AVA](https://avajs.dev).
'IBCConnectionInfoShape',
'IBCTransferOptionsShape',
'ICQMsgShape',
'OrchestrationPowersShape',
'OutboundConnectionHandlerI',
'Proto3Shape',
'TimestampProtoShape',
Expand Down
Binary file modified packages/orchestration/test/snapshots/exports.test.ts.snap
Binary file not shown.

0 comments on commit 34b61ea

Please sign in to comment.