@@ -18,7 +18,12 @@ import {
1818
1919import { type ViemClient , isExtendedClient } from '../types.js' ;
2020
21- export function waitUntilBlock < T extends Client > ( client : T , blockNumber : number | bigint , logger ?: Logger ) {
21+ export function waitUntilBlock < T extends Client > (
22+ client : T ,
23+ blockNumber : number | bigint ,
24+ logger ?: Logger ,
25+ timeout ?: number ,
26+ ) {
2227 const publicClient =
2328 'getBlockNumber' in client && typeof client . getBlockNumber === 'function'
2429 ? ( client as unknown as PublicClient )
@@ -31,12 +36,17 @@ export function waitUntilBlock<T extends Client>(client: T, blockNumber: number
3136 return currentBlockNumber >= BigInt ( blockNumber ) ;
3237 } ,
3338 `Wait until L1 block ${ blockNumber } ` ,
34- 120 ,
39+ timeout ?? 120 ,
3540 0.1 ,
3641 ) ;
3742}
3843
39- export function waitUntilL1Timestamp < T extends Client > ( client : T , timestamp : number | bigint , logger ?: Logger ) {
44+ export function waitUntilL1Timestamp < T extends Client > (
45+ client : T ,
46+ timestamp : number | bigint ,
47+ logger ?: Logger ,
48+ timeout ?: number ,
49+ ) {
4050 const publicClient =
4151 'getBlockNumber' in client && typeof client . getBlockNumber === 'function'
4252 ? ( client as unknown as PublicClient )
@@ -56,7 +66,7 @@ export function waitUntilL1Timestamp<T extends Client>(client: T, timestamp: num
5666 return currentTs >= BigInt ( timestamp ) ;
5767 } ,
5868 `Wait until L1 timestamp ${ timestamp } ` ,
59- 120 ,
69+ timeout ?? 120 ,
6070 0.1 ,
6171 ) ;
6272}
0 commit comments