diff --git a/packages/inter-protocol/src/vaultFactory/vaultHolder.js b/packages/inter-protocol/src/vaultFactory/vaultHolder.js index ddb87c1f933..18cc1c461aa 100644 --- a/packages/inter-protocol/src/vaultFactory/vaultHolder.js +++ b/packages/inter-protocol/src/vaultFactory/vaultHolder.js @@ -52,6 +52,11 @@ export const prepareVaultHolder = (baggage, marshaller) => { { helper: UnguardedHelperI, holder: HolderI, + invitationMakers: M.interface('invitationMakers', { + AdjustBalances: M.call().returns(M.promise()), + CloseVault: M.call().returns(M.promise()), + TransferVault: M.call().returns(M.promise()), + }), }, /** * @@ -83,6 +88,17 @@ export const prepareVaultHolder = (baggage, marshaller) => { return this.state.publisher; }, }, + invitationMakers: { + AdjustBalances() { + return this.facets.holder.makeAdjustBalancesInvitation(); + }, + CloseVault() { + return this.facets.holder.makeCloseInvitation(); + }, + TransferVault() { + return this.facets.holder.makeTransferInvitation(); + }, + }, holder: { /** @deprecated use getPublicTopics */ getSubscriber() { diff --git a/packages/inter-protocol/src/vaultFactory/vaultKit.js b/packages/inter-protocol/src/vaultFactory/vaultKit.js index 1d75b66428c..f09a9dd04b1 100644 --- a/packages/inter-protocol/src/vaultFactory/vaultKit.js +++ b/packages/inter-protocol/src/vaultFactory/vaultKit.js @@ -1,11 +1,12 @@ -import { makeTracer } from '@agoric/internal'; import '@agoric/zoe/exported.js'; -import { Far } from '@endo/marshal'; + +import { makeTracer } from '@agoric/internal'; import { prepareVaultHolder } from './vaultHolder.js'; const trace = makeTracer('VK', false); /** + * Wrap the VaultHolder duration object in a record suitable for the result of an invitation. * * @param {import('@agoric/ertp').Baggage} baggage * @param {ERef} marshaller @@ -22,17 +23,16 @@ export const prepareVaultKit = (baggage, marshaller) => { */ const makeVaultKit = (vault, storageNode) => { trace('prepareVaultKit makeVaultKit'); - const { holder, helper } = makeVaultHolder(vault, storageNode); + const { holder, helper, invitationMakers } = makeVaultHolder( + vault, + storageNode, + ); const holderTopics = holder.getPublicTopics(); const vaultKit = harden({ publicSubscribers: { vault: holderTopics.vault, }, - invitationMakers: Far('invitation makers', { - AdjustBalances: () => holder.makeAdjustBalancesInvitation(), - CloseVault: () => holder.makeCloseInvitation(), - TransferVault: () => holder.makeTransferInvitation(), - }), + invitationMakers, vault: holder, vaultUpdater: helper.getUpdater(), });