import { Log } from 'viem'; import { Address } from '@hyperlane-xyz/utils'; import { MultiProvider } from '../../providers/MultiProvider.js'; import { ChainNameOrId } from '../../types.js'; import { GetEventLogsResponse } from './types.js'; /** * Finds the block a contract was deployed in by bisecting `eth_getCode` over * the chain's history. * * Every probe but the last few is a request for archive state, which an * endpoint that prunes answers in one of two ways. If it fails the probe, this * lookup fails rather than widening the subsequent log scan to genesis. If it * reports no code at a height where the contract did exist, that successful * response is indistinguishable from a genuine pre-deployment answer. Like any * other RPC read, this search therefore assumes a successful response describes * the requested block correctly. */ export declare function getContractCreationBlockFromRpc(chain: ChainNameOrId, contractAddress: Address, multiProvider: MultiProvider): Promise; export type GetLogsFromRpcOptions = { chain: ChainNameOrId; contractAddress: Address; multiProvider: MultiProvider; fromBlock: number; topic: string; toBlock?: number; range?: number; }; /** * True when the failure is about who is asking or about what the endpoint * serves rather than about the span that was asked for, so neither retrying nor * narrowing the block range can change the outcome and the error has to surface * at once. * * `isRecoverable === false` is the convention `retryAsync` already honours on * the error it is handed, and is read here through the same nested walk as * {@link isBlockRangeError} so that a wrapped error is still seen, which * `retryAsync` itself does not do. {@link LogBlockRangeTooLargeError} carries * that flag too, because repeating the identical request is exactly what it * refuses, so a caller has to ask {@link isBlockRangeError} first and reach * this only for what no narrower request recovers. * * The status, code and message matching beside * it is deliberately narrow: missing a terminal error only costs the retries and * halvings it takes to reach {@link MIN_UNRECOGNISED_FAILURE_BLOCK_RANGE}, * whereas a false positive fails a read that shrinking the range would have * completed. */ export declare function isTerminalLogReadError(error: unknown): boolean; /** * True when the provider rejected a log query because it spanned too many * blocks or matched too many logs, i.e. when retrying the same chunk is * pointless and the block range has to shrink. * * Among the failures that are not terminal this decides how quickly and how far * the range shrinks, never whether it shrinks: an unrecognised failure is * retried at the unchanged range first, the range is halved once those retries * are spent, and the halving stops at * {@link MIN_UNRECOGNISED_FAILURE_BLOCK_RANGE} instead of at the one block * minimum. Recognising a rate limit as a range error therefore costs a * premature reduction that is sticky for the rest of the scan, and failing to * recognise a provider's phrasing of a range error costs the retries that * precede the same reduction, and the read itself where the cap is narrower * than that floor. * * The one rejection raised inside this repository, {@link * LogBlockRangeTooLargeError}, is matched by type as well as by message, and is * looked for through the same nested walk because SmartProvider surfaces it as * the `cause` of its combined error. The message match is what covers every * external provider, so the type check is only there to keep a reword of that * one message from turning halving into a hard failure. */ export declare function isBlockRangeError(error: unknown): boolean; export declare function getLogsFromRpc({ chain, contractAddress, multiProvider, fromBlock, topic, toBlock, range, }: GetLogsFromRpcOptions): Promise; export declare function viemLogFromGetEventLogsResponse(log: GetEventLogsResponse): Log; //# sourceMappingURL=utils.d.ts.map