diff --git a/src/getRollupAddress.ts b/src/getRollupAddress.ts
index 532d0e8a..8adf7a7e 100644
--- a/src/getRollupAddress.ts
+++ b/src/getRollupAddress.ts
@@ -1,7 +1,7 @@
import { Address, Chain, PublicClient, Transport } from 'viem';
import { sequencerInboxABI } from './abi';
-const cache: Record
= {};
+const cache: Record = {};
export async function getRollupAddress(
publicClient: PublicClient,
params: { sequencerInbox: Address } | { rollupAdminLogic: Address },
@@ -11,7 +11,7 @@ export async function getRollupAddress(
return params.rollupAdminLogic;
}
- const addressFromCache = cache[params.sequencerInbox];
+ const addressFromCache = cache[`${publicClient.chain?.id}_${params.sequencerInbox}`];
if (addressFromCache) {
return addressFromCache;
}
@@ -22,6 +22,6 @@ export async function getRollupAddress(
address: params.sequencerInbox,
abi: sequencerInboxABI,
});
- cache[params.sequencerInbox] = rollupAddress;
+ cache[`${publicClient.chain?.id}_${params.sequencerInbox}`] = rollupAddress;
return rollupAddress;
}