JsonRPCProvider class

A class that implements the JsonRPCProviderBase interface and provides methods for interacting with an Ethereum-like blockchain via the JSON-RPC protocol.

Constructors

JsonRPCProvider.new(NetworkConfig chain, Client? httpClient)
Creates a new instance of the JsonRPCProvider class.

Properties

hashCode int
The hash code for this object.
no setterinherited
rpc RPCBase
The remote procedure call (RPC) client used to communicate with the blockchain.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

estimateGas(EthereumAddress to, String calldata) Future<BigInt>
Asynchronously estimates the gas cost for a transaction to the specified address with the given calldata.
getBlockInformation({String blockNumber = 'latest', bool isContainFullObj = true}) Future<BlockInformation>
Asynchronously retrieves information about the specified block. If no block number is provided, it defaults to the latest block. If isContainFullObj is set to true, the full block object will be returned.
getBlockNumber() Future<int>
Asynchronously retrieves the current block number from the Ethereum node.
getEip1559GasPrice() Future<Map<String, EtherAmount>>
Asynchronously retrieves the EIP-1559 gas prices, including maxFeePerGas and maxPriorityFeePerGas.
getGasPrice() Future<Map<String, EtherAmount>>
Asynchronously retrieves the gas prices, supporting both EIP-1559 and legacy gas models.
getLegacyGasPrice() Future<EtherAmount>
Asynchronously retrieves the legacy gas price from the Ethereum node.
getTransactionReceipt(String txHash) Future<TransactionReceipt>
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
sendTransaction({required EthereumAddress from, required String to, required String data, String? gas, String? gasPrice, String? value, String? nonce}) Future<String>
toString() String
A string representation of this object.
inherited

Operators

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