Skip to content

Commit

Permalink
chore: makeFakeLocalchainBridge accepts makeAddressFn
Browse files Browse the repository at this point in the history
  • Loading branch information
0xpatrickdev committed Dec 18, 2024
1 parent b8cbd92 commit 7bbe21d
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions packages/vats/tools/fake-bridge.js
Original file line number Diff line number Diff line change
Expand Up @@ -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<BridgeHandler>} */
let hndlr;
let lcaExecuteTxSequence = 0;
Expand All @@ -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;
}
Expand Down

0 comments on commit 7bbe21d

Please sign in to comment.