diff --git a/packages/smart-wallet/src/marshal-contexts.js b/packages/smart-wallet/src/marshal-contexts.js index 99789be72e4e..8bc73c16e6cd 100644 --- a/packages/smart-wallet/src/marshal-contexts.js +++ b/packages/smart-wallet/src/marshal-contexts.js @@ -7,7 +7,7 @@ import { DEFAULT_PREFIX } from '@agoric/vats/src/lib-board.js'; const { Fail, quote: q } = assert; /** - * @import {PassableCap} from '@endo/marshal'; + * @import {PassableCap, RemotableObject} from '@endo/marshal'; * @import {Key} from '@endo/patterns'; * @import {BoardId} from '@agoric/vats/src/lib-board.js'; */ @@ -212,14 +212,14 @@ export const makeExportContext = () => { purseEntries: walletObjects.purse.bySlot.entries, /** * @param {BoardId} id - * @param {PassableCap} val + * @param {RemotableObject} val */ initBoardId: (id, val) => { initSlotVal(boardObjects, id, val); }, /** * @param {BoardId} id - * @param {PassableCap} val + * @param {RemotableObject} val */ ensureBoardId: (id, val) => { if (boardObjects.byVal.has(val)) { diff --git a/packages/smart-wallet/test/test-marshal-contexts.js b/packages/smart-wallet/test/test-marshal-contexts.js index 7ee179d0eac8..5af2fd47159d 100644 --- a/packages/smart-wallet/test/test-marshal-contexts.js +++ b/packages/smart-wallet/test/test-marshal-contexts.js @@ -26,7 +26,6 @@ const makeOnChainWallet = board => { getCurrentAmount: () => harden({ brand, value: 100 }), }); // only for private brands - // context.initBrandId(boardId, brand); context.initBoardId(boardId, brand); // @ts-expect-error mock purse context.initPurseId(name, purse); // TODO: strong id rather than name? diff --git a/packages/vats/src/lib-board.js b/packages/vats/src/lib-board.js index 16c70e708e97..90b305b93037 100644 --- a/packages/vats/src/lib-board.js +++ b/packages/vats/src/lib-board.js @@ -11,12 +11,12 @@ import { prepareRecorder, } from '@agoric/zoe/src/contractSupport/recorder.js'; import { E, Far } from '@endo/far'; -import { makeMarshal } from '@endo/marshal'; +import { isRemotable, makeMarshal } from '@endo/marshal'; import { crc6 } from './crc.js'; /** - * @import {PassableCap} from '@endo/marshal'; + * @import {RemotableObject} from '@endo/pass-style'; * @import {Key} from '@endo/patterns'); */ @@ -102,13 +102,13 @@ const initDurableBoardState = ( const immutable = { prefix, crcDigits }; const lastSequence = BigInt(initSequence); - /** @type {MapStore} */ + /** @type {MapStore} */ const idToVal = makeScalarBigMapStore('idToVal', { durable: true, keyShape: IdShape, valueShape: ValShape, }); - /** @type {MapStore} */ + /** @type {MapStore} */ const valToId = makeScalarBigMapStore('valToId', { durable: true, keyShape: ValShape, @@ -130,11 +130,14 @@ const initDurableBoardState = ( // transient marshallers that get GCed when the function completes. /** - * @param {PassableCap} value + * @param {RemotableObject} value * @param {BoardState} state */ const getId = (value, state) => { const { idToVal, valToId, prefix, crcDigits } = state; + if (!isRemotable(value)) { + Fail`Board cannot create id for non-remotable`; + } if (valToId.has(value)) { return valToId.get(value); @@ -267,8 +270,7 @@ export const prepareBoardKit = baggage => { * `value` for its entire lifetime. For a well-known board, this is * essentially forever. * - * @param {PassableCap} value - * @throws if `value` is not a Key in the @agoric/store sense + * @param {RemotableObject} value */ getId(value) { return getId(value, this.state); @@ -305,7 +307,7 @@ export const prepareBoardKit = baggage => { } return E(firstValue).lookup(...rest); }, - /** @param {PassableCap} val */ + /** @param {RemotableObject} val */ has(val) { const { state } = this; return state.valToId.has(val); diff --git a/packages/wallet/api/src/findOrMakeInvitation.js b/packages/wallet/api/src/findOrMakeInvitation.js index 9182a73bb2e9..e0f49b42266e 100644 --- a/packages/wallet/api/src/findOrMakeInvitation.js +++ b/packages/wallet/api/src/findOrMakeInvitation.js @@ -101,7 +101,9 @@ const makeInvitation = async ( board, zoe, ) => { - const instance = E(board).getValue(instanceHandleBoardId); + const instance = /** @type {Promise} */ ( + E(board).getValue(instanceHandleBoardId) + ); const publicFacet = E(zoe).getPublicFacet(instance); const { method, args = [] } = invitationMaker;