import type { Abi, Address } from 'abitype'; import type { Client } from '../../clients/createClient.js'; import type { Transport } from '../../clients/transports/createTransport.js'; import type { ErrorType } from '../../errors/utils.js'; import type { BlockNumber, BlockTag } from '../../types/block.js'; import type { Chain } from '../../types/chain.js'; import type { GetEventArgs, InferEventName } from '../../types/contract.js'; import type { Log } from '../../types/log.js'; import type { Hash } from '../../types/misc.js'; import { type GetAbiItemErrorType } from '../../utils/abi/getAbiItem.js'; import { type GetLogsErrorType } from './getLogs.js'; export type GetContractEventsParameters = { /** The address of the contract. */ address?: Address | Address[]; /** Contract ABI. */ abi: TAbi; args?: TEventName extends string ? GetEventArgs : undefined; /** Contract event. */ eventName?: InferEventName; /** * Whether or not the logs must match the indexed/non-indexed arguments on `event`. * @default false */ strict?: TStrict; } & ({ /** Block number or tag after which to include logs */ fromBlock?: TFromBlock | BlockNumber | BlockTag; /** Block number or tag before which to include logs */ toBlock?: TToBlock | BlockNumber | BlockTag; blockHash?: never; } | { fromBlock?: never; toBlock?: never; /** Hash of block to include logs from */ blockHash?: Hash; }); export type GetContractEventsReturnType = Log[]; export type GetContractEventsErrorType = GetAbiItemErrorType | GetLogsErrorType | ErrorType; /** * Returns a list of event logs emitted by a contract. * * - Docs: https://viem.sh/docs/actions/public/getContractEvents.html * - JSON-RPC Methods: [`eth_getLogs`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getlogs) * * @param client - Client to use * @param parameters - {@link GetContractEventsParameters} * @returns A list of event logs. {@link GetContractEventsReturnType} * * @example * import { createClient, http } from 'viem' * import { mainnet } from 'viem/chains' * import { getContractEvents } from 'viem/public' * import { wagmiAbi } from './abi' * * const client = createClient({ * chain: mainnet, * transport: http(), * }) * const logs = await getContractEvents(client, { * address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', * abi: wagmiAbi, * eventName: 'Transfer' * }) */ export declare function getContractEvents(client: Client, { abi, address, args, blockHash, eventName, fromBlock, toBlock, strict, }: GetContractEventsParameters): Promise>; //# sourceMappingURL=getContractEvents.d.ts.map