diff --git a/packages/dapp-svelte-wallet/api/src/lib-wallet.js b/packages/dapp-svelte-wallet/api/src/lib-wallet.js index d8d282af6ed..6b7e3364f21 100644 --- a/packages/dapp-svelte-wallet/api/src/lib-wallet.js +++ b/packages/dapp-svelte-wallet/api/src/lib-wallet.js @@ -1388,6 +1388,12 @@ export function makeWallet({ return paymentsNotifier; }, getUINotifier, + getZoe() { + return zoe; + }, + getBoard() { + return board; + }, }); const initialize = async () => { diff --git a/packages/dapp-svelte-wallet/api/src/types.js b/packages/dapp-svelte-wallet/api/src/types.js index d00c259ea5f..7498396528a 100644 --- a/packages/dapp-svelte-wallet/api/src/types.js +++ b/packages/dapp-svelte-wallet/api/src/types.js @@ -75,9 +75,14 @@ * @property {(petname: Petname, instanceBoardId: string) => Promise} * suggestInstance Introduce a Zoe contract instance to the wallet, with * suggested petname. - * @property {(rawId: string) => Promise>} getUINotifier Get the UI notifier from the offerResult - * for a particular offer, identified by id. This notifier should only - * contain information that is safe to pass to the dapp UI. + * @property {(rawId: string) => Promise>} getUINotifier + * Get the UI notifier from the offerResult for a particular offer, + * identified by id. This notifier should only contain information that + * is safe to pass to the dapp UI. + * @property {() => Promise} getZoe + * Get the Zoe Service + * @property {() => Promise} getBoard + * Get the Board */ /** diff --git a/packages/dapp-svelte-wallet/api/src/wallet.js b/packages/dapp-svelte-wallet/api/src/wallet.js index e4be50751bd..b8bd864116f 100644 --- a/packages/dapp-svelte-wallet/api/src/wallet.js +++ b/packages/dapp-svelte-wallet/api/src/wallet.js @@ -163,6 +163,14 @@ export function buildRootObject(_vatPowers) { await approve(); return walletAdmin.getUINotifier(rawId, dappOrigin); }, + async getZoe() { + await approve(); + return walletAdmin.getZoe(); + }, + async getBoard() { + await approve(); + return walletAdmin.getBoard(); + }, }; return harden(bridge); }; @@ -202,6 +210,12 @@ export function buildRootObject(_vatPowers) { getUINotifier(rawId) { return walletAdmin.getUINotifier(rawId); }, + async getZoe() { + return walletAdmin.getZoe(); + }, + async getBoard() { + return walletAdmin.getBoard(); + }, }; harden(preapprovedBridge); diff --git a/packages/dapp-svelte-wallet/api/test/test-lib-wallet.js b/packages/dapp-svelte-wallet/api/test/test-lib-wallet.js index 41beb60c100..0f0e4b430b2 100644 --- a/packages/dapp-svelte-wallet/api/test/test-lib-wallet.js +++ b/packages/dapp-svelte-wallet/api/test/test-lib-wallet.js @@ -1099,3 +1099,22 @@ test('addOffer makeContinuingInvitation', async t => { t.is(update2.value, 'second offer made'); }); + +test('getZoe, getBoard', async t => { + const zoe = makeZoe(fakeVatAdmin); + const board = makeBoard(); + + const pursesStateChangeHandler = _data => {}; + const inboxStateChangeHandler = _data => {}; + + const { admin: wallet, initialized } = makeWallet({ + zoe, + board, + pursesStateChangeHandler, + inboxStateChangeHandler, + }); + await initialized; + + t.is(await E(wallet).getZoe(), zoe); + t.is(await E(wallet).getBoard(), board); +});