From 6f0c0ee22d2a2740effb42a813e7be9c3f08df6f Mon Sep 17 00:00:00 2001 From: spsjvc Date: Tue, 15 Oct 2024 16:07:30 +0200 Subject: [PATCH] feat: enable fromBlock override in rollup tx fetch (#213) --- src/createRollupFetchTransactionHash.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/createRollupFetchTransactionHash.ts b/src/createRollupFetchTransactionHash.ts index 094c45e9..a0a86948 100644 --- a/src/createRollupFetchTransactionHash.ts +++ b/src/createRollupFetchTransactionHash.ts @@ -7,6 +7,7 @@ import { getEarliestRollupCreatorDeploymentBlockNumber } from './utils/getEarlie export type CreateRollupFetchTransactionHashParams = { rollup: Address; publicClient: PublicClient; + fromBlock?: bigint; }; const RollupInitializedEventAbi: AbiEvent = { @@ -32,12 +33,13 @@ const RollupInitializedEventAbi: AbiEvent = { export async function createRollupFetchTransactionHash({ rollup, publicClient, + fromBlock, }: CreateRollupFetchTransactionHashParams) { // Find the RollupInitialized event from that Rollup contract const rollupInitializedEvents = await getLogsWithBatching(publicClient, { address: rollup, event: RollupInitializedEventAbi, - fromBlock: getEarliestRollupCreatorDeploymentBlockNumber(publicClient), + fromBlock: fromBlock ?? getEarliestRollupCreatorDeploymentBlockNumber(publicClient), }); if (rollupInitializedEvents.length !== 1) {