Skip to content

Commit

Permalink
feat: enable fromBlock override in rollup tx fetch (#213)
Browse files Browse the repository at this point in the history
  • Loading branch information
spsjvc authored Oct 15, 2024
1 parent 7cc5266 commit 6f0c0ee
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/createRollupFetchTransactionHash.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { getEarliestRollupCreatorDeploymentBlockNumber } from './utils/getEarlie
export type CreateRollupFetchTransactionHashParams<TChain extends Chain | undefined> = {
rollup: Address;
publicClient: PublicClient<Transport, TChain>;
fromBlock?: bigint;
};

const RollupInitializedEventAbi: AbiEvent = {
Expand All @@ -32,12 +33,13 @@ const RollupInitializedEventAbi: AbiEvent = {
export async function createRollupFetchTransactionHash<TChain extends Chain | undefined>({
rollup,
publicClient,
fromBlock,
}: CreateRollupFetchTransactionHashParams<TChain>) {
// 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) {
Expand Down

0 comments on commit 6f0c0ee

Please sign in to comment.