diff --git a/multichain-testing/test/fast-usdc/fast-usdc.test.ts b/multichain-testing/test/fast-usdc/fast-usdc.test.ts index 1b0958a3441..f9dea6796bb 100644 --- a/multichain-testing/test/fast-usdc/fast-usdc.test.ts +++ b/multichain-testing/test/fast-usdc/fast-usdc.test.ts @@ -1,27 +1,27 @@ import anyTest from '@endo/ses-ava/prepare-endo.js'; -import type { TestFn } from 'ava'; import { encodeAddressHook } from '@agoric/cosmic-proto/address-hooks.js'; +import type { QueryBalanceResponseSDKType } from '@agoric/cosmic-proto/cosmos/bank/v1beta1/query.js'; import { AmountMath } from '@agoric/ertp'; -import type { Denom } from '@agoric/orchestration'; -import { divideBy, multiplyBy } from '@agoric/zoe/src/contractSupport/ratio.js'; -import type { IBCChannelID } from '@agoric/vats'; -import { makeDoOffer, type WalletDriver } from '../../tools/e2e-tools.js'; -import { makeDenomTools } from '../../tools/asset-info.js'; -import { createWallet } from '../../tools/wallet.js'; -import { makeQueryClient } from '../../tools/query.js'; -import { commonSetup, type SetupContextWithWallets } from '../support.js'; -import { makeFeedPolicy, oracleMnemonics } from './config.js'; -import { makeRandomDigits } from '../../tools/random.js'; -import { makeTracer } from '@agoric/internal'; +import type { USDCProposalShapes } from '@agoric/fast-usdc/src/pool-share-math.js'; import type { CctpTxEvidence, EvmAddress, PoolMetrics, } from '@agoric/fast-usdc/src/types.js'; +import { makeTracer } from '@agoric/internal'; +import type { Denom } from '@agoric/orchestration'; import type { CurrentWalletRecord } from '@agoric/smart-wallet/src/smartWallet.js'; -import type { QueryBalanceResponseSDKType } from '@agoric/cosmic-proto/cosmos/bank/v1beta1/query.js'; -import type { USDCProposalShapes } from '@agoric/fast-usdc/src/pool-share-math.js'; +import type { IBCChannelID } from '@agoric/vats'; +import { divideBy, multiplyBy } from '@agoric/zoe/src/contractSupport/ratio.js'; +import type { TestFn } from 'ava'; +import { makeDenomTools } from '../../tools/asset-info.js'; +import { makeDoOffer, type WalletDriver } from '../../tools/e2e-tools.js'; +import { makeQueryClient } from '../../tools/query.js'; +import { makeRandomDigits } from '../../tools/random.js'; +import { createWallet } from '../../tools/wallet.js'; +import { commonSetup, type SetupContextWithWallets } from '../support.js'; +import { makeFeedPolicy, oracleMnemonics } from './config.js'; const log = makeTracer('MCFU'); diff --git a/multichain-testing/tools/noble-tools.ts b/multichain-testing/tools/noble-tools.ts index cd72a332857..c6aab6c5e0d 100644 --- a/multichain-testing/tools/noble-tools.ts +++ b/multichain-testing/tools/noble-tools.ts @@ -1,7 +1,7 @@ import type { IBCChannelID } from '@agoric/vats'; import type { ExecSync } from './agd-lib.js'; import type { ChainAddress } from '@agoric/orchestration'; -import type { NobleAddress } from '@agoric/fast-usdc/src/types.js'; +import type { NobleAddress } from '@agoric/fast-usdc'; const kubectlBinary = 'kubectl'; const noblePod = 'noblelocal-genesis-0'; diff --git a/packages/SwingSet/src/controller/controller.js b/packages/SwingSet/src/controller/controller.js index eace725d4ce..613f36fdaad 100644 --- a/packages/SwingSet/src/controller/controller.js +++ b/packages/SwingSet/src/controller/controller.js @@ -477,7 +477,7 @@ export async function makeSwingsetController( * * The first `controller.run()` after this call will delete all * the old vat's state at once, unless you use a - * [`runPolicy`](../docs/run-policy.md) to rate-limit cleanups. + * [`runPolicy`](../../docs/run-policy.md) to rate-limit cleanups. * * @param {VatID} vatID * @param {SwingSetCapData} reasonCD diff --git a/packages/builders/scripts/fast-usdc/fast-usdc-update.build.js b/packages/builders/scripts/fast-usdc/fast-usdc-update.build.js index 21a1e6a0573..4f8ab6993ac 100644 --- a/packages/builders/scripts/fast-usdc/fast-usdc-update.build.js +++ b/packages/builders/scripts/fast-usdc/fast-usdc-update.build.js @@ -7,7 +7,7 @@ import { makeHelpers } from '@agoric/deploy-script-support'; /** * @import {CoreEvalBuilder, DeployScriptFunction} from '@agoric/deploy-script-support/src/externalTypes.js' * @import {ParseArgsConfig} from 'node:util' - * @import {FastUSDCConfig} from '@agoric/fast-usdc/src/types.js' + * @import {FastUSDCConfig} from '@agoric/fast-usdc'; */ /** @type {ParseArgsConfig['options']} */ diff --git a/packages/builders/scripts/fast-usdc/init-fast-usdc.js b/packages/builders/scripts/fast-usdc/init-fast-usdc.js index fade01cea83..a25e044e853 100644 --- a/packages/builders/scripts/fast-usdc/init-fast-usdc.js +++ b/packages/builders/scripts/fast-usdc/init-fast-usdc.js @@ -17,7 +17,7 @@ import { parseArgs } from 'node:util'; /** * @import {CoreEvalBuilder, DeployScriptFunction} from '@agoric/deploy-script-support/src/externalTypes.js' * @import {ParseArgsConfig} from 'node:util' - * @import {FastUSDCConfig} from '@agoric/fast-usdc/src/types.js' + * @import {FastUSDCConfig} from '@agoric/fast-usdc'; */ const { keys } = Object; diff --git a/packages/client-utils/src/types.d.ts b/packages/client-utils/src/types.d.ts index fc11550bbf5..66b25c755e7 100644 --- a/packages/client-utils/src/types.d.ts +++ b/packages/client-utils/src/types.d.ts @@ -10,6 +10,7 @@ import type { CurrentWalletRecord, UpdateRecord, } from '@agoric/smart-wallet/src/smartWallet.js'; +import type { ContractRecord, PoolMetrics } from '@agoric/fast-usdc'; // For static string key types. String template matching has to be in the ternary below. type PublishedTypeMap = { @@ -34,4 +35,12 @@ export type TypedPublished = T extends keyof PublishedTypeMap ? OutcomeRecord : T extends `vaultFactory.managers.manager${number}.metrics` ? VaultManagerMetrics - : unknown; + : T extends 'agoricNames.instance' + ? Array<[string, Instance]> + : T extends 'agoricNames.brand' + ? Array<[string, Brand]> + : T extends 'fastUsdc' + ? ContractRecord + : T extends 'fastUsdc.poolMetrics' + ? PoolMetrics + : unknown; diff --git a/packages/fast-usdc/package.json b/packages/fast-usdc/package.json index 30e20a49253..9816516b698 100644 --- a/packages/fast-usdc/package.json +++ b/packages/fast-usdc/package.json @@ -8,6 +8,7 @@ "src", "tools" ], + "main": "src/main.js", "bin": { "fast-usdc": "./src/cli/bin.js" }, diff --git a/packages/fast-usdc/src/cli/lp-commands.js b/packages/fast-usdc/src/cli/lp-commands.js index afcbd063650..246d13bb19b 100644 --- a/packages/fast-usdc/src/cli/lp-commands.js +++ b/packages/fast-usdc/src/cli/lp-commands.js @@ -142,7 +142,6 @@ export const addLPCommands = ( const usdcAmount = parseUSDCAmount(opts.amount, usdc); /** @type {import('../types.js').PoolMetrics} */ - // @ts-expect-error it treats this as "unknown" const metrics = await swk.readPublished('fastUsdc.poolMetrics'); const fastLPAmount = ceilDivideBy(usdcAmount, metrics.shareWorth); diff --git a/packages/fast-usdc/src/exos/advancer.js b/packages/fast-usdc/src/exos/advancer.js index a96c781f140..1b9466ebd96 100644 --- a/packages/fast-usdc/src/exos/advancer.js +++ b/packages/fast-usdc/src/exos/advancer.js @@ -276,8 +276,8 @@ export const prepareAdvancerKit = ( notifyFacet: M.remotable(), borrowerFacet: M.remotable(), poolAccount: M.remotable(), + settlementAddress: ChainAddressShape, intermediateRecipient: M.opt(ChainAddressShape), - settlementAddress: M.opt(ChainAddressShape), }), }, ); diff --git a/packages/fast-usdc/src/fast-usdc.contract.js b/packages/fast-usdc/src/fast-usdc.contract.js index cb3ed9bd8e7..99e3ba7008d 100644 --- a/packages/fast-usdc/src/fast-usdc.contract.js +++ b/packages/fast-usdc/src/fast-usdc.contract.js @@ -38,7 +38,7 @@ const ADDRESSES_BAGGAGE_KEY = 'addresses'; * @import {Marshaller, StorageNode} from '@agoric/internal/src/lib-chainStorage.js' * @import {Zone} from '@agoric/zone'; * @import {OperatorKit} from './exos/operator-kit.js'; - * @import {CctpTxEvidence, FeeConfig} from './types.js'; + * @import {CctpTxEvidence, ContractRecord, FeeConfig} from './types.js'; */ /** @@ -76,10 +76,7 @@ const publishFeeConfig = async (node, marshaller, feeConfig) => { /** * @param {Remote} contractNode - * @param {{ - * poolAccount: ChainAddress['value']; - * settlementAccount: ChainAddress['value']; - * }} addresses + * @param {ContractRecord} addresses */ const publishAddresses = (contractNode, addresses) => { return E(contractNode).setValue(JSON.stringify(addresses)); diff --git a/packages/fast-usdc/src/main.js b/packages/fast-usdc/src/main.js new file mode 100644 index 00000000000..d4702960d54 --- /dev/null +++ b/packages/fast-usdc/src/main.js @@ -0,0 +1 @@ +export * from './types.js'; diff --git a/packages/fast-usdc/src/types.ts b/packages/fast-usdc/src/types.ts index 44f9669613d..fa3619b5ea4 100644 --- a/packages/fast-usdc/src/types.ts +++ b/packages/fast-usdc/src/types.ts @@ -45,6 +45,11 @@ export interface TransactionRecord extends CopyRecord { status: TxStatus; } +export interface ContractRecord extends CopyRecord { + poolAccount: ChainAddress['value']; + settlementAccount: ChainAddress['value']; +} + export type LogFn = (...args: unknown[]) => void; export interface PendingTx extends CctpTxEvidence { diff --git a/packages/fast-usdc/src/utils/deploy-config.js b/packages/fast-usdc/src/utils/deploy-config.js index 22b2cd5a593..5c59f1241b3 100644 --- a/packages/fast-usdc/src/utils/deploy-config.js +++ b/packages/fast-usdc/src/utils/deploy-config.js @@ -2,7 +2,7 @@ import { denomHash, withChainCapabilities } from '@agoric/orchestration'; import fetchedChainInfo from '@agoric/orchestration/src/fetched-chain-info.js'; /** - * @import {FastUSDCConfig} from '@agoric/fast-usdc/src/types.js' + * @import {FastUSDCConfig} from '@agoric/fast-usdc'; * @import {Passable} from '@endo/marshal'; * @import {CosmosChainInfo, Denom, DenomDetail} from '@agoric/orchestration'; */