diff --git a/packages/SwingSet/package.json b/packages/SwingSet/package.json index 35865dc0570..282286861b8 100644 --- a/packages/SwingSet/package.json +++ b/packages/SwingSet/package.json @@ -101,6 +101,6 @@ "access": "public" }, "typeCoverage": { - "atLeast": 76.19 + "atLeast": 76.24 } } diff --git a/packages/agoric-cli/package.json b/packages/agoric-cli/package.json index 9af2f1a5dce..bdcd0153724 100644 --- a/packages/agoric-cli/package.json +++ b/packages/agoric-cli/package.json @@ -100,6 +100,6 @@ "workerThreads": false }, "typeCoverage": { - "atLeast": 77.45 + "atLeast": 77.54 } } diff --git a/packages/agoric-cli/src/commands/auction.js b/packages/agoric-cli/src/commands/auction.js index 5a6ba79e84b..5746ce2263d 100644 --- a/packages/agoric-cli/src/commands/auction.js +++ b/packages/agoric-cli/src/commands/auction.js @@ -89,16 +89,12 @@ export const makeAuctionCommand = ( * }} opts */ async opts => { - const { agoricNames, readLatestHead } = await makeVstorageKit( + const { agoricNames, readPublished } = await makeVstorageKit( { fetch }, networkConfig, ); - /** @type {{ current: AuctionParamRecord }} */ - // @ts-expect-error XXX should runtime check? - const { current } = await readLatestHead( - `published.auction.governance`, - ); + const { current } = await readPublished(`auction.governance`); const { AuctionStartDelay: { diff --git a/packages/agoric-cli/src/commands/gov.js b/packages/agoric-cli/src/commands/gov.js index 26c8a280a25..f9611c75390 100644 --- a/packages/agoric-cli/src/commands/gov.js +++ b/packages/agoric-cli/src/commands/gov.js @@ -98,13 +98,13 @@ export const makeGovCommand = (_logger, io = {}) => { optUtils, ) { const utils = await (optUtils || makeVstorageKit({ fetch }, networkConfig)); - const { agoricNames, readLatestHead } = utils; + const { agoricNames, readPublished } = utils; assert(keyringBackend, 'missing keyring-backend option'); let current; if (sendFrom) { - current = await getCurrent(sendFrom, { readLatestHead }); + current = await getCurrent(sendFrom, { readPublished }); } const offer = toOffer(agoricNames, current); @@ -134,9 +134,9 @@ export const makeGovCommand = (_logger, io = {}) => { show({ timestamp, height, offerId: offer.id, txhash }); const checkInWallet = async blockInfo => { const [state, update] = await Promise.all([ - getCurrent(sendFrom, { readLatestHead }), - getLastUpdate(sendFrom, { readLatestHead }), - readLatestHead(`published.wallet.${sendFrom}`), + getCurrent(sendFrom, { readPublished }), + getLastUpdate(sendFrom, { readPublished }), + readPublished(`wallet.${sendFrom}`), ]); if (update.updated === 'offerStatus' && update.status.id === offer.id) { return blockInfo; @@ -265,11 +265,11 @@ export const makeGovCommand = (_logger, io = {}) => { ) .requiredOption('--for ', 'description of the invitation') .action(async opts => { - const { agoricNames, readLatestHead } = await makeVstorageKit( + const { agoricNames, readPublished } = await makeVstorageKit( { fetch }, networkConfig, ); - const current = await getCurrent(opts.from, { readLatestHead }); + const current = await getCurrent(opts.from, { readPublished }); const known = findContinuingIds(current, agoricNames); if (!known) { @@ -294,11 +294,11 @@ export const makeGovCommand = (_logger, io = {}) => { normalizeAddress, ) .action(async opts => { - const { agoricNames, readLatestHead } = await makeVstorageKit( + const { agoricNames, readPublished } = await makeVstorageKit( { fetch }, networkConfig, ); - const current = await getCurrent(opts.from, { readLatestHead }); + const current = await getCurrent(opts.from, { readPublished }); const found = findContinuingIds(current, agoricNames); for (const it of found) { @@ -334,19 +334,16 @@ export const makeGovCommand = (_logger, io = {}) => { ) .action(async function (opts, options) { const utils = await makeVstorageKit({ fetch }, networkConfig); - const { readLatestHead } = utils; + const { readPublished } = utils; - const info = await readLatestHead( - `published.committees.${opts.pathname}.latestQuestion`, + const questionDesc = await readPublished( + `committees.${opts.pathname}.latestQuestion`, ).catch(err => { // CommanderError is a class constructor, and so // must be invoked with `new`. throw new CommanderError(1, 'VSTORAGE_FAILURE', err.message); }); - // XXX runtime shape-check - const questionDesc = /** @type {QuestionDetails} */ (info); - // TODO support multiple position arguments const chosenPositions = [questionDesc.positions[opts.forPosition]]; assert(chosenPositions, `undefined position index ${opts.forPosition}`); diff --git a/packages/agoric-cli/src/commands/inter.js b/packages/agoric-cli/src/commands/inter.js index cf59a2c35e5..41e0d42eb05 100644 --- a/packages/agoric-cli/src/commands/inter.js +++ b/packages/agoric-cli/src/commands/inter.js @@ -281,14 +281,12 @@ inter auction status * }} */ opts, ) => { - const { agoricNames, readLatestHead } = await tryMakeUtils(); + const { agoricNames, readPublished } = await tryMakeUtils(); - /** @type { [ScheduleNotification, BookDataNotification, *] } */ - // @ts-expect-error dynamic cast const [schedule, book, { current: params }] = await Promise.all([ - readLatestHead(`published.auction.schedule`), - readLatestHead(`published.auction.book${opts.book}`), - readLatestHead(`published.auction.governance`), + readPublished('auction.schedule'), + readPublished(`auction.book${opts.book}`), + readPublished('auction.governance'), ]); const fmt = makeFormatters(Object.values(agoricNames.vbankAsset)); @@ -493,9 +491,9 @@ inter auction status return; } - const { networkConfig, readLatestHead } = await tryMakeUtils(); + const { networkConfig, readPublished } = await tryMakeUtils(); - const current = await getCurrent(from, { readLatestHead }); + const current = await getCurrent(from, { readPublished }); const liveIds = current.liveOffers.map(([i, _s]) => i); if (!liveIds.includes(id)) { // InvalidArgumentError is a class constructor, and so @@ -520,7 +518,7 @@ inter auction status show({ timestamp, height, offerId: id, txhash }); const checkGone = async blockInfo => { - const pollResult = await getCurrent(from, { readLatestHead }); + const pollResult = await getCurrent(from, { readPublished }); const found = pollResult.liveOffers.find(([i, _]) => i === id); if (found) throw Error('retry'); return blockInfo; @@ -562,11 +560,11 @@ $ inter bid list --from my-acct * }} opts */ async opts => { - const { agoricNames, readLatestHead, storedWalletState } = + const { agoricNames, readPublished, storedWalletState } = await tryMakeUtils(); const [current, state] = await Promise.all([ - getCurrent(opts.from, { readLatestHead }), + getCurrent(opts.from, { readPublished }), storedWalletState(opts.from), ]); const entries = opts.all diff --git a/packages/agoric-cli/src/commands/oracle.js b/packages/agoric-cli/src/commands/oracle.js index dea5ed9e04a..9eaf3f9de52 100644 --- a/packages/agoric-cli/src/commands/oracle.js +++ b/packages/agoric-cli/src/commands/oracle.js @@ -175,8 +175,8 @@ export const makeOracleCommand = (logger, io = {}) => { console.warn(sendHint); }); - const findOracleCap = async (instance, from, readLatestHead) => { - const current = await getCurrent(from, { readLatestHead }); + const findOracleCap = async (instance, from, readPublished) => { + const current = await getCurrent(from, { readPublished }); const { offerToUsedInvitation: entries } = /** @type {any} */ (current); Array.isArray(entries) || Fail`entries must be an array: ${entries}`; diff --git a/packages/agoric-cli/src/commands/vaults.js b/packages/agoric-cli/src/commands/vaults.js index 185157c1c3d..8d47ba9a3c2 100644 --- a/packages/agoric-cli/src/commands/vaults.js +++ b/packages/agoric-cli/src/commands/vaults.js @@ -39,13 +39,10 @@ export const makeVaultsCommand = logger => { normalizeAddress, ) .action(async function (opts) { - const { readLatestHead } = await makeVstorageKit( - { fetch }, - networkConfig, - ); + const { readPublished } = await makeVstorageKit({ fetch }, networkConfig); const current = await getCurrent(opts.from, { - readLatestHead, + readPublished, }); const vaultStoragePaths = current.offerToPublicSubscriberPaths.map( @@ -102,14 +99,14 @@ export const makeVaultsCommand = logger => { .requiredOption('--vaultId ', 'Key of vault (e.g. vault1)') .action(async function (opts) { logger.warn('running with options', opts); - const { agoricNames, readLatestHead } = await makeVstorageKit( + const { agoricNames, readPublished } = await makeVstorageKit( { fetch }, networkConfig, ); const previousOfferId = await lookupOfferIdForVault( opts.vaultId, - getCurrent(opts.from, { readLatestHead }), + getCurrent(opts.from, { readPublished }), ); const offer = Offers.vaults.AdjustBalances( @@ -146,14 +143,14 @@ export const makeVaultsCommand = logger => { ) .action(async function (opts) { logger.warn('running with options', opts); - const { agoricNames, readLatestHead } = await makeVstorageKit( + const { agoricNames, readPublished } = await makeVstorageKit( { fetch }, networkConfig, ); const previousOfferId = await lookupOfferIdForVault( opts.vaultId, - getCurrent(opts.from, { readLatestHead }), + getCurrent(opts.from, { readPublished }), ); const offer = Offers.vaults.CloseVault( diff --git a/packages/agoric-cli/src/commands/wallet.js b/packages/agoric-cli/src/commands/wallet.js index 480d37f4aa0..d6cac6fb2ee 100644 --- a/packages/agoric-cli/src/commands/wallet.js +++ b/packages/agoric-cli/src/commands/wallet.js @@ -172,7 +172,7 @@ export const makeWalletCommand = async command => { normalizeAddress, ) .action(async function (opts) { - const { agoricNames, unserializer, readLatestHead } = + const { agoricNames, unserializer, readPublished } = await makeVstorageKit( { fetch, @@ -191,7 +191,7 @@ export const makeWalletCommand = async command => { const coalesced = await coalesceWalletState(follower); - const current = await getCurrent(opts.from, { readLatestHead }); + const current = await getCurrent(opts.from, { readPublished }); console.warn( 'got coalesced', diff --git a/packages/agoric-cli/src/lib/wallet.js b/packages/agoric-cli/src/lib/wallet.js index aded59c45fe..e9eff2f2ca1 100644 --- a/packages/agoric-cli/src/lib/wallet.js +++ b/packages/agoric-cli/src/lib/wallet.js @@ -10,7 +10,7 @@ import { execSwingsetTransaction, pollTx } from './chain.js'; /** * @import {CurrentWalletRecord} from '@agoric/smart-wallet/src/smartWallet.js'; * @import {AgoricNamesRemotes} from '@agoric/vats/tools/board-utils.js'; - * @import {MinimalNetworkConfig, WalletUtils} from '@agoric/client-utils'; + * @import {MinimalNetworkConfig, VstorageKit} from '@agoric/client-utils'; */ const marshaller = boardSlottingMarshaller(); @@ -25,15 +25,15 @@ const emptyCurrentRecord = { /** * @param {string} addr - * @param {Pick} io + * @param {Pick} io * @returns {Promise} */ -export const getCurrent = async (addr, { readLatestHead }) => { +export const getCurrent = async (addr, { readPublished }) => { // Partial because older writes may not have had all properties // NB: assumes changes are only additions let current = /** @type {Partial | undefined} */ ( - await readLatestHead(`published.wallet.${addr}.current`) + await readPublished(`wallet.${addr}.current`) ); if (current === undefined) { throw Error(`undefined current node for ${addr}`); @@ -60,12 +60,11 @@ export const getCurrent = async (addr, { readLatestHead }) => { /** * @param {string} addr - * @param {Pick} io + * @param {Pick} io * @returns {Promise} */ -export const getLastUpdate = (addr, { readLatestHead }) => { - // @ts-expect-error cast - return readLatestHead(`published.wallet.${addr}`); +export const getLastUpdate = (addr, { readPublished }) => { + return readPublished(`wallet.${addr}`); }; /** diff --git a/packages/boot/package.json b/packages/boot/package.json index d0238a737a4..b6632fdf00e 100644 --- a/packages/boot/package.json +++ b/packages/boot/package.json @@ -92,6 +92,6 @@ "workerThreads": false }, "typeCoverage": { - "atLeast": 90.58 + "atLeast": 91.11 } } diff --git a/packages/cosmic-swingset/package.json b/packages/cosmic-swingset/package.json index 837f2a26e50..4751fdcd1d8 100644 --- a/packages/cosmic-swingset/package.json +++ b/packages/cosmic-swingset/package.json @@ -69,6 +69,6 @@ "timeout": "20m" }, "typeCoverage": { - "atLeast": 80.52 + "atLeast": 82.83 } } diff --git a/packages/internal/package.json b/packages/internal/package.json index 77ab29fce95..4ebd92eb032 100755 --- a/packages/internal/package.json +++ b/packages/internal/package.json @@ -58,6 +58,6 @@ "access": "public" }, "typeCoverage": { - "atLeast": 93.22 + "atLeast": 93.14 } } diff --git a/packages/vats/package.json b/packages/vats/package.json index 90de42f5e9a..ebb304b455b 100644 --- a/packages/vats/package.json +++ b/packages/vats/package.json @@ -77,6 +77,6 @@ "workerThreads": false }, "typeCoverage": { - "atLeast": 91.52 + "atLeast": 91.39 } }