From 7bbe21d92d05b3ab67ff8a75051a090aff84a422 Mon Sep 17 00:00:00 2001 From: 0xPatrick Date: Tue, 17 Dec 2024 18:26:57 -0500 Subject: [PATCH] chore: `makeFakeLocalchainBridge` accepts `makeAddressFn` --- packages/vats/tools/fake-bridge.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/packages/vats/tools/fake-bridge.js b/packages/vats/tools/fake-bridge.js index d8e1585d6a7..8f548418aa4 100644 --- a/packages/vats/tools/fake-bridge.js +++ b/packages/vats/tools/fake-bridge.js @@ -291,9 +291,14 @@ export const fakeLocalChainBridgeQueryHandler = message => { /** * @param {import('@agoric/zone').Zone} zone * @param {(obj) => void} [onToBridge] + * @param {(number) => string} [makeAddressFn] * @returns {ScopedBridgeManager<'vlocalchain'>} */ -export const makeFakeLocalchainBridge = (zone, onToBridge = () => {}) => { +export const makeFakeLocalchainBridge = ( + zone, + onToBridge = () => {}, + makeAddressFn, +) => { /** @type {Remote} */ let hndlr; let lcaExecuteTxSequence = 0; @@ -306,7 +311,9 @@ export const makeFakeLocalchainBridge = (zone, onToBridge = () => {}) => { trace('toBridge', type, method, params); switch (type) { case 'VLOCALCHAIN_ALLOCATE_ADDRESS': { - const address = `${LOCALCHAIN_DEFAULT_ADDRESS}${accountsCreated || ''}`; + const address = makeAddressFn + ? makeAddressFn(accountsCreated) + : `${LOCALCHAIN_DEFAULT_ADDRESS}${accountsCreated || ''}`; accountsCreated += 1; return address; }