From 24f23f01aae3c589b62950370ae52165dc0f8eb4 Mon Sep 17 00:00:00 2001 From: Turadg Aleahmad Date: Fri, 10 Feb 2023 11:07:23 -0800 Subject: [PATCH] refactor: WellKnownInstallations --- packages/vats/src/core/types.js | 26 ++------------ packages/vats/src/core/wellKnown.d.ts | 51 +++++++++++++++++++++++++++ 2 files changed, 54 insertions(+), 23 deletions(-) create mode 100644 packages/vats/src/core/wellKnown.d.ts diff --git a/packages/vats/src/core/types.js b/packages/vats/src/core/types.js index 06131df24233..43a703b36ac2 100644 --- a/packages/vats/src/core/types.js +++ b/packages/vats/src/core/types.js @@ -130,27 +130,7 @@ */ /** - * @typedef {{ - * amm: import('@agoric/inter-protocol/src/vpool-xyk-amm/multipoolMarketMaker.js').start, - * binaryVoteCounter: import('@agoric/governance/src/binaryVoteCounter.js').start, - * centralSupply: import('@agoric/vats/src/centralSupply.js').start, - * committee: import('@agoric/governance/src/committee.js').start, - * contractGovernor: import('@agoric/governance/src/contractGovernor.js').start, - * econCommitteeCharter: import('@agoric/inter-protocol/src/econCommitteeCharter.js').start, - * feeDistributor: import('@agoric/inter-protocol/src/feeDistributor.js').start, - * interchainPool: import('@agoric/inter-protocol/src/interchainPool.js').start, - * liquidate: import('@agoric/inter-protocol/src/vaultFactory/liquidateIncrementally.js').start, - * mintHolder: import('@agoric/vats/src/mintHolder.js').prepare, - * noActionElectorate: unknown, - * Pegasus: unknown, - * psm: import('@agoric/inter-protocol/src/psm/psm.js').start, - * priceAggregator: import('@agoric/inter-protocol/src/price/fluxAggregator.contract.js').start, - * provisionPool: import('@agoric/vats/src/provisionPool.js').start, - * reserve: import('@agoric/inter-protocol/src/reserve/assetReserve.js').start, - * stakeFactory: import('@agoric/inter-protocol/src/stakeFactory/stakeFactory.js').start, - * walletFactory: import('@agoric/smart-wallet/src/walletFactory.js').start, - * VaultFactory: import('@agoric/inter-protocol/src/vaultFactory/vaultFactory.js').start, - * }} WellKnownInstallations */ + * @typedef {import('./wellKnown').WellKnownInstallations} WellKnownInstallations */ /** * @typedef {import('../tokens.js').TokenKeyword} TokenKeyword @@ -186,8 +166,8 @@ * consume: Record>, * }, * installation:{ - * produce: { [K in keyof WellKnownInstallations]: Producer> }, - * consume: { [K in keyof WellKnownInstallations]: Promise> }, + * produce: { [K in keyof WellKnownInstallations]: Producer }, + * consume: { [K in keyof WellKnownInstallations]: Promise }, * }, * instance:{ * produce: Record>, diff --git a/packages/vats/src/core/wellKnown.d.ts b/packages/vats/src/core/wellKnown.d.ts new file mode 100644 index 000000000000..2bb5464271ac --- /dev/null +++ b/packages/vats/src/core/wellKnown.d.ts @@ -0,0 +1,51 @@ +/** + * @file Type exports for WellKnown names. TS so it doesn't affect runtime dependency graph. + */ +// 'start' fns +import type { start as amm } from '@agoric/inter-protocol/src/vpool-xyk-amm/multipoolMarketMaker.js'; +import type { start as binaryVoteCounter } from '@agoric/governance/src/binaryVoteCounter.js'; +import type { start as committee } from '@agoric/governance/src/committee.js'; +import type { start as contractGovernor } from '@agoric/governance/src/contractGovernor.js'; +import type { start as econCommitteeCharter } from '@agoric/inter-protocol/src/econCommitteeCharter.js'; +import type { start as feeDistributor } from '@agoric/inter-protocol/src/feeDistributor.js'; +import type { start as interchainPool } from '@agoric/inter-protocol/src/interchainPool.js'; +import type { start as liquidate } from '@agoric/inter-protocol/src/vaultFactory/liquidateIncrementally.js'; +import type { start as noActionElectorate } from '@agoric/governance/src/noActionElectorate.js'; +import type { start as priceAggregator } from '@agoric/inter-protocol/src/price/fluxAggregator.contract.js'; +import type { start as psm } from '@agoric/inter-protocol/src/psm/psm.js'; +import type { start as reserve } from '@agoric/inter-protocol/src/reserve/assetReserve.js'; +import type { start as stakeFactory } from '@agoric/inter-protocol/src/stakeFactory/stakeFactory.js'; +import type { start as VaultFactory } from '@agoric/inter-protocol/src/vaultFactory/vaultFactory.js'; +import type { start as walletFactory } from '@agoric/smart-wallet/src/walletFactory.js'; +import type { start as Pegasus } from '@agoric/pegasus/src/pegasus.js'; +import type { start as provisionPool } from '../provisionPool.js'; +import type { start as centralSupply } from '../centralSupply.js'; + +// 'prepare' fns +import type { prepare as mintHolder } from '../mintHolder.js'; + +const contractFns = { + amm, + binaryVoteCounter, + centralSupply, + committee, + contractGovernor, + econCommitteeCharter, + feeDistributor, + interchainPool, + liquidate, + mintHolder, + noActionElectorate, + Pegasus, + priceAggregator, + provisionPool, + psm, + reserve, + stakeFactory, + VaultFactory, + walletFactory, +}; + +export type WellKnownInstallations = { + [K in keyof typeof contractFns]: Installation<(typeof contractFns)[K]>; +};