PublicClient class

Public client for read-only blockchain operations.

Implemented types

Constructors

PublicClient({required RpcProvider provider, required ChainConfig chain})

Properties

ccipHandler ↔ CCIPReadHandler
CCIP-Read handler (EIP-3668).
getter/setter pair
chain → ChainConfig
The chain configuration for this client.
final
hashCode int
The hash code for this object.
no setterinherited
provider RpcProvider
The RPC provider.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

call(CallRequest request, [String block = 'latest']) Future<Uint8List>
Executes a call without creating a transaction.
dispose() → void
Disposes of the client.
override
estimateGas(CallRequest request) Future<BigInt>
Estimates gas for a transaction.
getBalance(String address, [String block = 'latest']) Future<BigInt>
Gets the balance of an address.
override
getBlock(String blockHash) Future<Block?>
Gets a block by hash.
getBlockByNumber(String block) Future<Block?>
Gets a block by number.
getBlockNumber() Future<BigInt>
Gets the current block number.
override
getChainId() Future<int>
Gets the chain ID.
getCode(String address, [String block = 'latest']) Future<Uint8List>
Gets the code at an address.
getFeeData() Future<FeeData>
Gets fee data for EIP-1559 transactions.
getGasPrice() Future<BigInt>
Gets the current gas price.
getLogs(LogFilter filter) Future<List<Log>>
Gets logs matching a filter.
getTransaction(String txHash) Future<Transaction?>
Gets a transaction by hash.
getTransactionCount(String address, [String block = 'latest']) Future<BigInt>
Gets the transaction count (nonce) for an address.
getTransactionReceipt(String txHash) Future<TransactionReceipt?>
Gets a transaction receipt.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
sendTransaction(Uint8List tx) Future<String>
Sends a raw signed transaction to the network.
override
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited