promises/EvmPublicClient.ts
This module provides a promise-based EVM-backed public client.
Added in v0.4.0
constructors
Section titled “constructors”fromViem
Section titled “fromViem”Construct a public client from a viem::PublicClient.
Signature
export declare const fromViem: (config: { account: undefined batch?: ClientConfig["batch"] | undefined cacheTime: number ccipRead?: ClientConfig["ccipRead"] | undefined chain: Chain | undefined experimental_blockTag?: BlockTag | undefined key: string name: string pollingInterval: number request: EIP1193RequestFn<PublicRpcSchema> transport: TransportConfig<string, EIP1193RequestFn> & Record<string, any> type: string uid: string call: (parameters: CallParameters<Chain | undefined>) => Promise<CallReturnType> createAccessList: (parameters: CreateAccessListParameters<Chain | undefined>) => Promise<CreateAccessListReturnType> createBlockFilter: () => Promise<CreateBlockFilterReturnType> createContractEventFilter: < const abi extends Abi | readonly unknown[], eventName extends ContractEventName<abi> | undefined, args extends MaybeExtractEventArgsFromAbi<abi, eventName> | undefined, strict extends boolean | undefined = undefined, fromBlock extends BlockNumber | BlockTag | undefined = undefined, toBlock extends BlockNumber | BlockTag | undefined = undefined >( args: CreateContractEventFilterParameters<abi, eventName, args, strict, fromBlock, toBlock> ) => Promise<CreateContractEventFilterReturnType<abi, eventName, args, strict, fromBlock, toBlock>> createEventFilter: < const abiEvent extends AbiEvent | undefined = undefined, const abiEvents extends readonly AbiEvent[] | readonly unknown[] | undefined = abiEvent extends AbiEvent ? [abiEvent] : undefined, strict extends boolean | undefined = undefined, fromBlock extends BlockNumber | BlockTag | undefined = undefined, toBlock extends BlockNumber | BlockTag | undefined = undefined, _EventName extends string | undefined = MaybeAbiEventName<abiEvent>, _Args extends MaybeExtractEventArgsFromAbi<abiEvents, _EventName> | undefined = undefined >( args?: CreateEventFilterParameters<abiEvent, abiEvents, strict, fromBlock, toBlock, _EventName, _Args> | undefined ) => Promise<CreateEventFilterReturnType<abiEvent, abiEvents, strict, fromBlock, toBlock, _EventName, _Args>> createPendingTransactionFilter: () => Promise<CreatePendingTransactionFilterReturnType> estimateContractGas: < chain extends Chain | undefined, const abi extends Abi | readonly unknown[], functionName extends ContractFunctionName<abi, "nonpayable" | "payable">, args extends ContractFunctionArgs<abi, "nonpayable" | "payable", functionName> >( args: EstimateContractGasParameters<abi, functionName, args, chain> ) => Promise<EstimateContractGasReturnType> estimateGas: (args: EstimateGasParameters<Chain | undefined>) => Promise<EstimateGasReturnType> getBalance: (args: GetBalanceParameters) => Promise<GetBalanceReturnType> getBlobBaseFee: () => Promise<GetBlobBaseFeeReturnType> getBlock: <includeTransactions, blockTag>( args?: GetBlockParameters<includeTransactions, blockTag> | undefined ) => Promise<GetBlockReturnType<Chain | undefined, includeTransactions, blockTag>> getBlockNumber: (args?: GetBlockNumberParameters | undefined) => Promise<GetBlockNumberReturnType> getBlockTransactionCount: ( args?: GetBlockTransactionCountParameters | undefined ) => Promise<GetBlockTransactionCountReturnType> getBytecode: (args: GetBytecodeParameters) => Promise<GetBytecodeReturnType> getChainId: () => Promise<GetChainIdReturnType> getCode: (args: GetBytecodeParameters) => Promise<GetBytecodeReturnType> getContractEvents: < const abi extends Abi | readonly unknown[], eventName extends ContractEventName<abi> | undefined = undefined, strict extends boolean | undefined = undefined, fromBlock extends BlockNumber | BlockTag | undefined = undefined, toBlock extends BlockNumber | BlockTag | undefined = undefined >( args: GetContractEventsParameters<abi, eventName, strict, fromBlock, toBlock> ) => Promise<GetContractEventsReturnType<abi, eventName, strict, fromBlock, toBlock>> getEip712Domain: (args: GetEip712DomainParameters) => Promise<GetEip712DomainReturnType> getEnsAddress: (args: GetEnsAddressParameters) => Promise<GetEnsAddressReturnType> getEnsAvatar: (args: GetEnsAvatarParameters) => Promise<GetEnsAvatarReturnType> getEnsName: (args: GetEnsNameParameters) => Promise<GetEnsNameReturnType> getEnsResolver: (args: GetEnsResolverParameters) => Promise<GetEnsResolverReturnType> getEnsText: (args: GetEnsTextParameters) => Promise<GetEnsTextReturnType> getFeeHistory: (args: GetFeeHistoryParameters) => Promise<GetFeeHistoryReturnType> estimateFeesPerGas: <chainOverride, type>( args?: EstimateFeesPerGasParameters<Chain | undefined, chainOverride, type> | undefined ) => Promise<EstimateFeesPerGasReturnType<type>> getFilterChanges: < filterType extends FilterType, const abi extends Abi | readonly unknown[] | undefined, eventName extends string | undefined, strict extends boolean | undefined = undefined, fromBlock extends BlockNumber | BlockTag | undefined = undefined, toBlock extends BlockNumber | BlockTag | undefined = undefined >( args: GetFilterChangesParameters<filterType, abi, eventName, strict, fromBlock, toBlock> ) => Promise<GetFilterChangesReturnType<filterType, abi, eventName, strict, fromBlock, toBlock>> getFilterLogs: < const abi extends Abi | readonly unknown[] | undefined, eventName extends string | undefined, strict extends boolean | undefined = undefined, fromBlock extends BlockNumber | BlockTag | undefined = undefined, toBlock extends BlockNumber | BlockTag | undefined = undefined >( args: GetFilterLogsParameters<abi, eventName, strict, fromBlock, toBlock> ) => Promise<GetFilterLogsReturnType<abi, eventName, strict, fromBlock, toBlock>> getGasPrice: () => Promise<GetGasPriceReturnType> getLogs: < const abiEvent extends AbiEvent | undefined = undefined, const abiEvents extends readonly AbiEvent[] | readonly unknown[] | undefined = abiEvent extends AbiEvent ? [abiEvent] : undefined, strict extends boolean | undefined = undefined, fromBlock extends BlockNumber | BlockTag | undefined = undefined, toBlock extends BlockNumber | BlockTag | undefined = undefined >( args?: GetLogsParameters<abiEvent, abiEvents, strict, fromBlock, toBlock> | undefined ) => Promise<GetLogsReturnType<abiEvent, abiEvents, strict, fromBlock, toBlock>> getProof: (args: GetProofParameters) => Promise<GetProofReturnType> estimateMaxPriorityFeePerGas: <chainOverride>( args?: { chain: chainOverride | null } | undefined ) => Promise<EstimateMaxPriorityFeePerGasReturnType> getStorageAt: (args: GetStorageAtParameters) => Promise<GetStorageAtReturnType> getTransaction: <blockTag>( args: GetTransactionParameters<blockTag> ) => Promise<GetTransactionReturnType<Chain | undefined, blockTag>> getTransactionConfirmations: ( args: GetTransactionConfirmationsParameters<Chain | undefined> ) => Promise<GetTransactionConfirmationsReturnType> getTransactionCount: (args: GetTransactionCountParameters) => Promise<GetTransactionCountReturnType> getTransactionReceipt: ( args: GetTransactionReceiptParameters ) => Promise<GetTransactionReceiptReturnType<Chain | undefined>> multicall: <const contracts extends readonly unknown[], allowFailure extends boolean = true>( args: MulticallParameters<contracts, allowFailure> ) => Promise<MulticallReturnType<contracts, allowFailure>> prepareTransactionRequest: <request, chainOverride, accountOverride>( args: PrepareTransactionRequestParameters< Chain | undefined, Account | undefined, chainOverride, accountOverride, request > ) => Promise< PrepareTransactionRequestReturnType<Chain | undefined, Account | undefined, chainOverride, accountOverride, request> > readContract: < const abi extends Abi | readonly unknown[], functionName extends ContractFunctionName<abi, "pure" | "view">, const args extends ContractFunctionArgs<abi, "pure" | "view", functionName> >( args: ReadContractParameters<abi, functionName, args> ) => Promise<ReadContractReturnType<abi, functionName, args>> sendRawTransaction: (args: SendRawTransactionParameters) => Promise<SendRawTransactionReturnType> sendRawTransactionSync: ( args: SendRawTransactionSyncParameters ) => Promise<SendRawTransactionSyncReturnType<Chain | undefined>> simulate: <const calls extends readonly unknown[]>( args: SimulateBlocksParameters<calls> ) => Promise<SimulateBlocksReturnType<calls>> simulateBlocks: <const calls extends readonly unknown[]>( args: SimulateBlocksParameters<calls> ) => Promise<SimulateBlocksReturnType<calls>> simulateCalls: <const calls extends readonly unknown[]>( args: SimulateCallsParameters<calls> ) => Promise<SimulateCallsReturnType<calls>> simulateContract: <abi, functionName, args, chainOverride, accountOverride>( args: SimulateContractParameters<abi, functionName, args, Chain | undefined, chainOverride, accountOverride> ) => Promise< SimulateContractReturnType< abi, functionName, args, Chain | undefined, Account | undefined, chainOverride, accountOverride > > verifyHash: (args: VerifyHashActionParameters) => Promise<VerifyHashActionReturnType> verifyMessage: (args: VerifyMessageActionParameters) => Promise<VerifyMessageActionReturnType> verifySiweMessage: (args: VerifySiweMessageParameters) => Promise<VerifySiweMessageReturnType> verifyTypedData: (args: VerifyTypedDataActionParameters) => Promise<VerifyTypedDataActionReturnType> uninstallFilter: (args: UninstallFilterParameters) => Promise<UninstallFilterReturnType> waitForTransactionReceipt: ( args: WaitForTransactionReceiptParameters<Chain | undefined> ) => Promise<WaitForTransactionReceiptReturnType<Chain | undefined>> watchBlockNumber: (args: WatchBlockNumberParameters) => WatchBlockNumberReturnType watchBlocks: <includeTransactions, blockTag>( args: WatchBlocksParameters<Transport, Chain | undefined, includeTransactions, blockTag> ) => WatchBlocksReturnType watchContractEvent: <abi, eventName, strict>( args: WatchContractEventParameters<abi, eventName, strict, Transport> ) => WatchContractEventReturnType watchEvent: <abiEvent, abiEvents, strict>( args: WatchEventParameters<abiEvent, abiEvents, strict, Transport> ) => WatchEventReturnType watchPendingTransactions: (args: WatchPendingTransactionsParameters<Transport>) => WatchPendingTransactionsReturnType extend: <client>( fn: ( client: Client< Transport, Chain | undefined, undefined, PublicRpcSchema, PublicActions<Transport, Chain | undefined> > ) => client ) => Client< Transport, Chain | undefined, undefined, PublicRpcSchema, Prettify<client> & (PublicActions<Transport, Chain | undefined> extends { [x: string]: unknown account?: undefined batch?: undefined cacheTime?: undefined ccipRead?: undefined chain?: undefined experimental_blockTag?: undefined key?: undefined name?: undefined pollingInterval?: undefined request?: undefined transport?: undefined type?: undefined uid?: undefined } ? PublicActions<Transport, Chain | undefined> : unknown) >}) => Promise<EvmPublicClient>Added in v0.4.0
layers
Section titled “layers”fromThirdweb
Section titled “fromThirdweb”Signature
export declare const fromThirdweb: (options: { thirdwebClient: ThirdwebClient chain: Readonly<ChainOptions & { rpc: string }>}) => Promise<EvmPublicClient>Added in v0.4.0
services
Section titled “services”EvmPublicClient (class)
Section titled “EvmPublicClient (class)”Signature
export declare class EvmPublicClient { constructor({ client, evmClient }: { client: publicClient.PublicClient; evmClient: evmPublicClient.EvmPublicClient })}Added in v0.4.0