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 { ContractEventArgs, ContractEventName } 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 | undefined = ContractEventName | undefined, strict extends boolean | undefined = undefined, fromBlock extends BlockNumber | BlockTag | undefined = undefined, toBlock extends BlockNumber | BlockTag | undefined = undefined> = { /** The address of the contract. */ address?: Address | Address[] | undefined; /** Contract ABI. */ abi: abi; args?: ContractEventArgs ? eventName : ContractEventName> | undefined; /** Contract event. */ eventName?: eventName | ContractEventName | undefined; /** * Whether or not the logs must match the indexed/non-indexed arguments on `event`. * @default false */ strict?: strict | boolean | undefined; } & ({ /** Block number or tag after which to include logs */ fromBlock?: fromBlock | BlockNumber | BlockTag | undefined; /** Block number or tag before which to include logs */ toBlock?: toBlock | BlockNumber | BlockTag | undefined; blockHash?: undefined; } | { fromBlock?: undefined; toBlock?: undefined; /** Hash of block to include logs from */ blockHash?: Hash | undefined; }); export type GetContractEventsReturnType | undefined = ContractEventName | undefined, strict extends boolean | undefined = undefined, fromBlock extends BlockNumber | BlockTag | undefined = undefined, toBlock extends BlockNumber | BlockTag | undefined = undefined, isPending extends boolean = (fromBlock extends 'pending' ? true : false) | (toBlock extends 'pending' ? true : false)> = 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 * - 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 | undefined = undefined, strict extends boolean | undefined = undefined, fromBlock extends BlockNumber | BlockTag | undefined = undefined, toBlock extends BlockNumber | BlockTag | undefined = undefined>(client: Client, parameters: GetContractEventsParameters): Promise>; //# sourceMappingURL=getContractEvents.d.ts.map