JsonRpcProvider class
The JSON-RPC API is a popular method for interacting with Ethereum and is available in all major Ethereum node implementations (e.g. Geth and Parity) as well as many third-party web services (e.g. INFURA)
Constructors
- JsonRpcProvider([String? rpcUrl])
-
Create new JsonRpcProvider from
rpcUrl
.factory
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- impl → _JsonRpcProviderImpl
-
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
- rpcUrl → String
-
Rpc url that
this
is connected to.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
withargs
.inherited -
getBalance(
String address, [dynamic blockTag]) → Future< BigInt> -
Returns the balance of
address
as of theblockTag
.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 theblockTag
block height. If there is no contract currently deployed, the result is0x
.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 -
getStorageAt(
String address, int pos, [dynamic blockTag]) → Future< String> -
Returns the
Bytes32
value of the positionpos
ataddress
, as of theblockTag
.inherited -
getTransaction(
String hash) → Future< TransactionResponse?> -
Returns the TransactionResponse with
hash
ornull
if the transaction is unknown.inherited -
getTransactionCount(
String address, [dynamic blockTag]) → Future< int> -
Returns the number of transactions
address
has ever sent, as ofblockTag
.inherited -
getTransactionReceipt(
String hash) → Future< TransactionReceipt?> -
Returns the TransactionReceipt for
hash
ornull
if the transaction has not been mined.inherited -
listAccounts(
) → Future< List< String> > -
Returns a list of all account addresses managed by
this
provider. -
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 eachevent
.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 forevent
.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 forfilter
;inherited -
onFilter(
EventFilter< _EventFilterImpl> filter, Function listener) → void -
Add a
listener
to be triggered forfilter
;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
ortransactionResponse
.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