diff --git a/packages/boot/test/bootstrapTests/test-orchestration.ts b/packages/boot/test/bootstrapTests/test-orchestration.ts index a7d2cff9b55..6c67392d683 100644 --- a/packages/boot/test/bootstrapTests/test-orchestration.ts +++ b/packages/boot/test/bootstrapTests/test-orchestration.ts @@ -4,7 +4,7 @@ import type { TestFn } from 'ava'; import { Fail } from '@agoric/assert'; import { AmountMath } from '@agoric/ertp'; -import type { start as stakeBldStart } from '@agoric/orchestration/src/contracts/stakeBld.contract.js'; +import type { start as stakeBldStart } from '@agoric/orchestration/src/examples/stakeBld.contract.js'; import type { Instance } from '@agoric/zoe/src/zoeService/utils.js'; import { M, matches } from '@endo/patterns'; import { makeWalletFactoryContext } from './walletFactory.ts'; diff --git a/packages/builders/scripts/orchestration/init-stakeAtom.js b/packages/builders/scripts/orchestration/init-stakeAtom.js index 306834f34ab..9d96b937d01 100644 --- a/packages/builders/scripts/orchestration/init-stakeAtom.js +++ b/packages/builders/scripts/orchestration/init-stakeAtom.js @@ -16,9 +16,7 @@ export const defaultProposalBuilder = async ( { installKeys: { stakeAtom: publishRef( - install( - '@agoric/orchestration/src/contracts/stakeAtom.contract.js', - ), + install('@agoric/orchestration/src/examples/stakeAtom.contract.js'), ), }, hostConnectionId, diff --git a/packages/builders/scripts/orchestration/init-stakeBld.js b/packages/builders/scripts/orchestration/init-stakeBld.js index df380830007..cf4999e424d 100644 --- a/packages/builders/scripts/orchestration/init-stakeBld.js +++ b/packages/builders/scripts/orchestration/init-stakeBld.js @@ -10,7 +10,7 @@ export const defaultProposalBuilder = async ({ publishRef, install }) => { installKeys: { stakeBld: publishRef( - install('@agoric/orchestration/src/contracts/stakeBld.contract.js'), + install('@agoric/orchestration/src/examples/stakeBld.contract.js'), ), }, }, diff --git a/packages/orchestration/README.md b/packages/orchestration/README.md index 19d382cd9c2..3050f95c7da 100644 --- a/packages/orchestration/README.md +++ b/packages/orchestration/README.md @@ -1,4 +1,5 @@ # Orchestration +Build feature-rich applications that can orchestrate assets and services across the interchain. -Interface for Cosmos Interchain Accounts [(ICS-27)](https://github.com/cosmos/ibc/blob/main/spec/app/ics-027-interchain-accounts/README.md). +Usage examples can be found under [src/examples](https://github.com/Agoric/agoric-sdk/tree/master/packages/orchestration/src/examples). They are exported for integration testing with other packages. diff --git a/packages/orchestration/src/contracts/stakeAtom.contract.js b/packages/orchestration/src/examples/stakeAtom.contract.js similarity index 92% rename from packages/orchestration/src/contracts/stakeAtom.contract.js rename to packages/orchestration/src/examples/stakeAtom.contract.js index becca5d5919..614061cde5b 100644 --- a/packages/orchestration/src/contracts/stakeAtom.contract.js +++ b/packages/orchestration/src/examples/stakeAtom.contract.js @@ -7,7 +7,7 @@ import { makeDurableZone } from '@agoric/zone/durable.js'; import { V as E } from '@agoric/vat-data/vow.js'; import { M } from '@endo/patterns'; import { prepareRecorderKitMakers } from '@agoric/zoe/src/contractSupport'; -import { prepareStakingAccountHolder } from './stakingAccountHolder.js'; +import { prepareStakingAccountKit } from '../exos/stakingAccountKit.js'; const trace = makeTracer('StakeAtom'); /** @@ -41,7 +41,7 @@ export const start = async (zcf, privateArgs, baggage) => { const { makeRecorderKit } = prepareRecorderKitMakers(baggage, marshaller); - const makeStakingAccountHolder = prepareStakingAccountHolder( + const makeStakingAccountKit = prepareStakingAccountKit( baggage, makeRecorderKit, zcf, @@ -54,7 +54,7 @@ export const start = async (zcf, privateArgs, baggage) => { ); const accountAddress = await E(account).getAccountAddress(); trace('account address', accountAddress); - const { holder, invitationMakers } = makeStakingAccountHolder( + const { holder, invitationMakers } = makeStakingAccountKit( account, storageNode, accountAddress, diff --git a/packages/orchestration/src/contracts/stakeBld.contract.js b/packages/orchestration/src/examples/stakeBld.contract.js similarity index 91% rename from packages/orchestration/src/contracts/stakeBld.contract.js rename to packages/orchestration/src/examples/stakeBld.contract.js index 195f9ae5686..57a37c7ebd2 100644 --- a/packages/orchestration/src/contracts/stakeBld.contract.js +++ b/packages/orchestration/src/examples/stakeBld.contract.js @@ -10,7 +10,7 @@ import { M } from '@endo/patterns'; import { E } from '@endo/far'; import { prepareRecorderKitMakers } from '@agoric/zoe/src/contractSupport/recorder.js'; import { atomicTransfer } from '@agoric/zoe/src/contractSupport/atomicTransfer.js'; -import { prepareAccountHolder } from './localchainAccountHolder.js'; +import { prepareLocalchainAccountKit } from '../exos/localchainAccountKit.js'; const trace = makeTracer('StakeBld'); @@ -35,7 +35,7 @@ export const start = async (zcf, privateArgs, baggage) => { baggage, privateArgs.marshaller, ); - const makeAccountHolderKit = prepareAccountHolder( + const makeLocalchainAccountKit = prepareLocalchainAccountKit( baggage, makeRecorderKit, zcf, @@ -56,7 +56,7 @@ export const start = async (zcf, privateArgs, baggage) => { await E(lcaSeatKit.userSeat).tryExit(); trace('awaiting payouts'); const payouts = await E(lcaSeatKit.userSeat).getPayouts(); - const { holder, invitationMakers } = makeAccountHolderKit( + const { holder, invitationMakers } = makeLocalchainAccountKit( account, privateArgs.storageNode, ); diff --git a/packages/orchestration/src/contracts/swapExample.contract.js b/packages/orchestration/src/examples/swapExample.contract.js similarity index 100% rename from packages/orchestration/src/contracts/swapExample.contract.js rename to packages/orchestration/src/examples/swapExample.contract.js diff --git a/packages/orchestration/src/contracts/unbondExample.contract.js b/packages/orchestration/src/examples/unbondExample.contract.js similarity index 100% rename from packages/orchestration/src/contracts/unbondExample.contract.js rename to packages/orchestration/src/examples/unbondExample.contract.js diff --git a/packages/orchestration/src/contracts/localchainAccountHolder.js b/packages/orchestration/src/exos/localchainAccountKit.js similarity index 96% rename from packages/orchestration/src/contracts/localchainAccountHolder.js rename to packages/orchestration/src/exos/localchainAccountKit.js index e268c38d2d6..7a023a96844 100644 --- a/packages/orchestration/src/contracts/localchainAccountHolder.js +++ b/packages/orchestration/src/exos/localchainAccountKit.js @@ -40,7 +40,7 @@ const PUBLIC_TOPICS = { * @param {import('@agoric/zoe/src/contractSupport/recorder.js').MakeRecorderKit} makeRecorderKit * @param {ZCF} zcf */ -export const prepareAccountHolder = (baggage, makeRecorderKit, zcf) => { +export const prepareLocalchainAccountKit = (baggage, makeRecorderKit, zcf) => { const makeAccountHolderKit = prepareExoClassKit( baggage, 'Account Holder', @@ -152,3 +152,4 @@ export const prepareAccountHolder = (baggage, makeRecorderKit, zcf) => { ); return makeAccountHolderKit; }; +/** @typedef {ReturnType>} LocalchainAccountKit */ diff --git a/packages/orchestration/src/contracts/stakingAccountHolder.js b/packages/orchestration/src/exos/stakingAccountKit.js similarity index 96% rename from packages/orchestration/src/contracts/stakingAccountHolder.js rename to packages/orchestration/src/exos/stakingAccountKit.js index 497a3536b00..3df1c3019b2 100644 --- a/packages/orchestration/src/contracts/stakingAccountHolder.js +++ b/packages/orchestration/src/exos/stakingAccountKit.js @@ -54,8 +54,8 @@ const PUBLIC_TOPICS = { * @param {MakeRecorderKit} makeRecorderKit * @param {ZCF} zcf */ -export const prepareStakingAccountHolder = (baggage, makeRecorderKit, zcf) => { - const makeAccountHolderKit = prepareExoClassKit( +export const prepareStakingAccountKit = (baggage, makeRecorderKit, zcf) => { + const makeStakingAccountKit = prepareExoClassKit( baggage, 'Staking Account Holder', { @@ -193,5 +193,6 @@ export const prepareStakingAccountHolder = (baggage, makeRecorderKit, zcf) => { }, }, ); - return makeAccountHolderKit; + return makeStakingAccountKit; }; +/** @typedef {ReturnType>} StakingAccountKit */ diff --git a/packages/orchestration/src/proposals/start-stakeAtom.js b/packages/orchestration/src/proposals/start-stakeAtom.js index c41e07b486d..13aa78b1580 100644 --- a/packages/orchestration/src/proposals/start-stakeAtom.js +++ b/packages/orchestration/src/proposals/start-stakeAtom.js @@ -3,12 +3,12 @@ import { makeTracer } from '@agoric/internal'; import { makeStorageNodeChild } from '@agoric/internal/src/lib-chainStorage.js'; import { E } from '@endo/far'; -/** @import { StakeAtomSF, StakeAtomTerms} from '../contracts/stakeAtom.contract' */ +/** @import { StakeAtomSF, StakeAtomTerms} from '../examples/stakeAtom.contract' */ const trace = makeTracer('StartStakeAtom', true); /** - * @param {BootstrapPowers & { installation: {consume: {stakeAtom: Installation}}}} powers + * @param {BootstrapPowers & { installation: {consume: {stakeAtom: Installation}}}} powers * @param {{options: StakeAtomTerms }} options */ export const startStakeAtom = async ( diff --git a/packages/orchestration/src/proposals/start-stakeBld.js b/packages/orchestration/src/proposals/start-stakeBld.js index 66a49603c7f..f70a4b12a35 100644 --- a/packages/orchestration/src/proposals/start-stakeBld.js +++ b/packages/orchestration/src/proposals/start-stakeBld.js @@ -6,7 +6,7 @@ import { E } from '@endo/far'; const trace = makeTracer('StartStakeBld', true); /** - * @param {BootstrapPowers & {installation: {consume: {stakeBld: Installation}}}} powers + * @param {BootstrapPowers & {installation: {consume: {stakeBld: Installation}}}} powers */ export const startStakeBld = async ({ consume: { board, chainStorage, localchain, startUpgradable }, @@ -29,7 +29,7 @@ export const startStakeBld = async ({ const marshaller = await E(board).getPublishingMarshaller(); // FIXME this isn't detecting missing privateArgs - /** @type {StartUpgradableOpts} */ + /** @type {StartUpgradableOpts} */ const startOpts = { label: 'stakeBld', installation: stakeBld, diff --git a/packages/orchestration/typedoc.json b/packages/orchestration/typedoc.json index 3d381684efd..866c621516e 100644 --- a/packages/orchestration/typedoc.json +++ b/packages/orchestration/typedoc.json @@ -2,5 +2,7 @@ "extends": [ "../../typedoc.base.json" ], - "entryPoints": [] + "entryPoints": [ + "index.js", + ] }