Provider<T extends _ProviderImpl> class

A Provider is an abstraction of a connection to the Ethereum network, providing a concise, consistent interface to standard Ethereum node functionality.

The ethers.js library provides several options which should cover the vast majority of use-cases, but also includes the necessary functions and classes for sub-classing if a more custom configuration is necessary.

Implementers

Properties

hashCode int
The hash code for this object.
no setterinherited
impl → T
Internal JS Object, should not be used directly.
finalinherited
ready Future<Network>
Returns a Future which will stall until the Network has heen established, ignoring errors due to the target node not being active yet.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

call<T>(String method, [List args = const []]) Future<T>
Call Ethers provider method with args.
getBalance(String address, [dynamic blockTag]) Future<BigInt>
Returns the balance of address as of the blockTag.
getBlock(int blockNumber) Future<Block>
Get the Block from the network by blockNumber, where the Block.transactions is a list of transaction hashes.
getBlockNumber() Future<int>
Returns the block number (or height) of the most recently mined block.
getBlockWithTransaction(int blockNumber) Future<BlockWithTransaction>
Get the BlockWithTransaction at blockNumber from the network, where the BlockWithTransaction.transactions is an Array of TransactionResponse.
getCode(String address, [dynamic blockTag]) Future<String>
Returns the contract code of address as of the blockTag block height. If there is no contract currently deployed, the result is 0x.
getFeeData() Future<FeeData>
Returns the current recommended FeeData to use in a transaction.
getGasPrice() Future<BigInt>
Returns the current gas price.
getLastestBlock() Future<Block>
Get the lastest Block from the network.
getLastestBlockWithTransaction() Future<BlockWithTransaction>
Get the lastest BlockWithTransaction from the network.
getLogs(EventFilter<_EventFilterImpl> filter) Future<List<Log<_LogImpl>>>
Returns the List of Log matching the filter.
getNetwork() Future<Network>
Returns the Network that this is connected to.
getStorageAt(String address, int pos, [dynamic blockTag]) Future<String>
Returns the Bytes32 value of the position pos at address, as of the blockTag.
getTransaction(String hash) Future<TransactionResponse?>
Returns the TransactionResponse with hash or null if the transaction is unknown.
getTransactionCount(String address, [dynamic blockTag]) Future<int>
Returns the number of transactions address has ever sent, as of blockTag.
getTransactionReceipt(String hash) Future<TransactionReceipt?>
Returns the TransactionReceipt for hash or null if the transaction has not been mined.
lookupAddress(String address) Future<String?>
Performs a reverse lookup of the address in ENS using the Reverse Registrar. If the name does not exist, or the forward lookup does not match, null is returned.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
on(dynamic event, Function listener) → dynamic
Add a listener to be triggered for each event.
onBlock(void listener(int blockNumber)) → void
Add a listener to be triggered for each new Block;
once(dynamic event, Function listener) → dynamic
Add a listener to be triggered once for event.
onceBlock(void listener(int blockNumber)) → void
Add a listener to be triggered once for new Block;
onceFilter(EventFilter<_EventFilterImpl> filter, Function listener) → void
Add a listener to be triggered once for filter;
onFilter(EventFilter<_EventFilterImpl> filter, Function listener) → void
Add a listener to be triggered for filter;
rawCall<String>({TransactionRequest? transactionRequest, TransactionResponse? transactionResponse, dynamic blockTag}) Future<String>
Returns the result of executing the transaction in raw hex string, using either transactionRequest or transactionResponse.
resolveName(String name) Future<String?>
Looks up the address of name. If the name is not owned, or does not have a Resolver configured, or the Resolver does not have an address configured, null is returned.
sendTransaction(String data) Future<TransactionResponse>
Submits transaction data to the network to be mined.
toString() String
A string representation of this object.
inherited
waitForTransaction(String transactionHash, [int confirms = 1, Duration? timeout]) Future<TransactionReceipt>
Returns a Future of TransactionReceipt which will not resolve until transactionHash is mined.

Operators

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