import type { Common } from '../internal/common.js'; import type { Chain, IndexingBuild, SetupEvent } from '../internal/types.js'; import type { Event } from '../internal/types.js'; import type { RequestParameters, Rpc } from '../rpc/index.js'; import type { SyncStore } from '../sync-store/index.js'; import { type Abi, type Client, type ContractFunctionArgs, type ContractFunctionName, type GetBlockReturnType, type GetTransactionConfirmationsParameters, type GetTransactionConfirmationsReturnType, type GetTransactionParameters, type GetTransactionReceiptParameters, type GetTransactionReceiptReturnType, type GetTransactionReturnType, type Hash, type MulticallParameters, type MulticallReturnType, type Prettify, type PublicActions, type PublicRpcSchema, type ReadContractParameters, type ReadContractReturnType, type SimulateContractParameters, type SimulateContractReturnType, type Transport, type Chain as ViemChain, publicActions } from "viem"; export type CachedViemClient = { getClient: (chain: Chain) => ReadonlyClient; prefetch: (params: { events: Event[]; }) => Promise; clear: () => void; event: Event | SetupEvent | undefined; }; /** Viem actions where the `block` property is optional and implicit. */ declare const blockDependentActions: readonly ["getBalance", "call", "estimateGas", "getFeeHistory", "getProof", "getCode", "getStorageAt", "getEnsAddress", "getEnsAvatar", "getEnsName", "getEnsResolver", "getEnsText", "readContract", "multicall", "simulateContract"]; /** Viem actions where the `block` property is required. */ declare const blockRequiredActions: readonly ["getBlock", "getTransactionCount", "getBlockTransactionCount"]; /** Viem actions where the `block` property is non-existent. */ declare const nonBlockDependentActions: readonly ["getTransaction", "getTransactionReceipt", "getTransactionConfirmations"]; /** Viem actions that should be retried if they fail. */ declare const retryableActions: readonly ["readContract", "simulateContract", "multicall", "getBlock", "getTransaction", "getTransactionReceipt", "getTransactionConfirmations"]; type BlockOptions = { cache?: undefined; blockNumber?: undefined; } | { cache: "immutable"; blockNumber?: undefined; } | { cache?: undefined; blockNumber: bigint; }; type RequiredBlockOptions = { /** Hash of the block. */ blockHash: Hash; blockNumber?: undefined; } | { blockHash?: undefined; /** The block number. */ blockNumber: bigint; }; type RetryableOptions = { /** * Whether or not to retry the action if the response is empty. * * @default true */ retryEmptyResponse?: boolean; }; type BlockDependentAction unknown, params = Parameters[0], returnType = ReturnType> = (args: Omit & BlockOptions) => returnType; export type PonderActions = Omit<{ [action in (typeof blockDependentActions)[number]]: BlockDependentAction[action]>; } & Pick & Pick, (typeof retryableActions)[number]> & { readContract: , const args extends ContractFunctionArgs>(args: Omit, "blockTag" | "blockNumber"> & BlockOptions & RetryableOptions) => Promise>; simulateContract: , const args extends ContractFunctionArgs>(args: Omit, "blockTag" | "blockNumber"> & BlockOptions & RetryableOptions) => Promise>; multicall: (args: Omit, "blockTag" | "blockNumber"> & BlockOptions & RetryableOptions) => Promise>; getBlock: (args: { /** Whether or not to include transaction data in the response. */ includeTransactions?: includeTransactions | undefined; } & RequiredBlockOptions & RetryableOptions) => Promise>; getTransaction: (args: GetTransactionParameters & RetryableOptions) => Promise; getTransactionReceipt: (args: GetTransactionReceiptParameters & RetryableOptions) => Promise; getTransactionConfirmations: (args: GetTransactionConfirmationsParameters & RetryableOptions) => Promise; }; export type ReadonlyClient = Prettify, "extend" | "key" | "batch" | "cacheTime" | "account" | "type" | "uid" | "chain" | "name" | "pollingInterval" | "transport" | "ccipRead">>; /** * RPC request. */ export type Request = Pick & { blockNumber: bigint | "latest"; chainId: number; }; /** * Serialized RPC request for uniquely identifying a request. * * @dev Encoded from {@link Request} using `abi`. * * @example * "{ * "method": "eth_call", * "params": [{"data": "0x123", "to": "0x456"}, "0x789"] * }" */ type CacheKey = string; /** * Response of an RPC request. * * @example * "0x123" * * @example * ""0x123456789"" */ type Response = string; /** * Recorded RPC request pattern. * * @example * { * "address": ["args", "from"], * "abi": [...], * "functionName": "balanceOf", * "args": ["log", "address"], * } */ export type ProfilePattern = Pick & { address: { type: "constant"; value: unknown; } | { type: "derived"; value: string[]; }; args?: ({ type: "constant"; value: unknown; } | { type: "derived"; value: string[]; })[]; cache?: "immutable"; }; /** * Cache of RPC responses. */ type Cache = Map | Response>>; export declare const getCacheKey: (request: RequestParameters) => Lowercase; export declare const encodeRequest: (request: Request) => { method: "eth_call"; params: [{ to: `0x${string}` | undefined; data: `0x${string}`; }, `0x${string}` | "latest"]; }; export declare const decodeResponse: (response: Response) => any; export declare const createCachedViemClient: ({ common, indexingBuild, syncStore, eventCount, }: { common: Common; indexingBuild: Pick; syncStore: SyncStore; eventCount: { [eventName: string]: number; }; }) => CachedViemClient; export declare const cachedTransport: ({ common, chain, rpc, syncStore, cache, event, }: { common: Common; chain: Chain; rpc: Rpc; syncStore: SyncStore; cache: Cache; event: () => Event | SetupEvent; }) => Transport; export declare const extractBlockNumberParam: (request: RequestParameters) => `0x${string}` | "latest" | undefined; export {}; //# sourceMappingURL=client.d.ts.map