Web3Provider class

The Web3Provider is meant to ease moving from a web3.js based application to ethers by wrapping an existing Web3-compatible (such as a Web3HttpProvider, Web3IpcProvider or Web3WsProvider) and exposing it as an ethers.js Provider which can then be used with the rest of the library.

This may also be used to wrap a standard EIP-1193 Provider.

Inheritance

Constructors

Web3Provider(dynamic provider)
Create new Web3Provider instance from provider instance.
factory
Web3Provider.fromEthereum(Ethereum ethereum)
Create new Web3Provider instance from ethereum instance.
factory
Web3Provider.fromKlaytn(Klaytn klaytn)
factory
Web3Provider.fromWalletConnect(WalletConnectProvider walletConnect)
Create new Web3Provider instance from walletConnect instance.
factory

Properties

hashCode int
The hash code for this object.
no setterinherited
impl → _Web3ProviderImpl
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 setterinherited
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.
inherited
getBalance(String address, [dynamic blockTag]) Future<BigInt>
Returns the balance of address as of the blockTag.
inherited
getBlock(int blockNumber) Future<Block>
Get the Block from the network by blockNumber, where the Block.transactions is a list of transaction hashes.
inherited
getBlockNumber() Future<int>
Returns the block number (or height) of the most recently mined block.
inherited
getBlockWithTransaction(int blockNumber) Future<BlockWithTransaction>
Get the BlockWithTransaction at blockNumber from the network, where the BlockWithTransaction.transactions is an Array of TransactionResponse.
inherited
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.
inherited
getFeeData() Future<FeeData>
Returns the current recommended FeeData to use in a transaction.
inherited
getGasPrice() Future<BigInt>
Returns the current gas price.
inherited
getLastestBlock() Future<Block>
Get the lastest Block from the network.
inherited
getLastestBlockWithTransaction() Future<BlockWithTransaction>
Get the lastest BlockWithTransaction from the network.
inherited
getLogs(EventFilter<_EventFilterImpl> filter) Future<List<Log<_LogImpl>>>
Returns the List of Log matching the filter.
inherited
getNetwork() Future<Network>
Returns the Network that this is connected to.
inherited
getSigner() Signer<_SignerImpl>
Connect this to create Signer object.
getStorageAt(String address, int pos, [dynamic blockTag]) Future<String>
Returns the Bytes32 value of the position pos at address, as of the blockTag.
inherited
getTransaction(String hash) Future<TransactionResponse?>
Returns the TransactionResponse with hash or null if the transaction is unknown.
inherited
getTransactionCount(String address, [dynamic blockTag]) Future<int>
Returns the number of transactions address has ever sent, as of blockTag.
inherited
getTransactionReceipt(String hash) Future<TransactionReceipt?>
Returns the TransactionReceipt for hash or null if the transaction has not been mined.
inherited
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.
inherited
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.
inherited
onBlock(void listener(int blockNumber)) → void
Add a listener to be triggered for each new Block;
inherited
once(dynamic event, Function listener) → dynamic
Add a listener to be triggered once for event.
inherited
onceBlock(void listener(int blockNumber)) → void
Add a listener to be triggered once for new Block;
inherited
onceFilter(EventFilter<_EventFilterImpl> filter, Function listener) → void
Add a listener to be triggered once for filter;
inherited
onFilter(EventFilter<_EventFilterImpl> filter, Function listener) → void
Add a listener to be triggered for filter;
inherited
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.
inherited
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.
inherited
sendTransaction(String data) Future<TransactionResponse>
Submits transaction data to the network to be mined.
inherited
toString() String
A string representation of this object.
override
waitForTransaction(String transactionHash, [int confirms = 1, Duration? timeout]) Future<TransactionReceipt>
Returns a Future of TransactionReceipt which will not resolve until transactionHash is mined.
inherited

Operators

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