2019-08-21 08:53:47 +03:00
|
|
|
_section: Provider @<provider>
|
|
|
|
|
|
|
|
Explain what a provider is...
|
|
|
|
|
|
|
|
|
|
|
|
_subsection: Accounts Methods
|
|
|
|
|
2020-04-17 05:25:05 +03:00
|
|
|
_property: provider.getBalance(address [ , blockTag = latest ]) => Promise<[[bignumber]]> @<provider-getbalance> @SRC<providers/base-provider>
|
2019-08-21 08:53:47 +03:00
|
|
|
Returns the balance of //address// as of the //blockTag// block height.
|
|
|
|
|
2020-04-17 05:25:05 +03:00
|
|
|
_property: provider.getCode(address [ , blockTag = latest ]) => Promise<string<[[datahexstring]]>> @<providers-getcode> @SRC<providers/base-provider>
|
2019-08-21 08:53:47 +03:00
|
|
|
Returns the contract code of //address// as of the //blockTag// block height. If there is
|
|
|
|
no contract currently deployed, the result is ``0x``.
|
|
|
|
|
2020-04-17 05:25:05 +03:00
|
|
|
_property: provider.getStorageAt(addr, pos [ , blockTag = latest ]) => Promise<string<[[datahexstring]]>> @<providers-getstorageat> @SRC<providers/base-provider>
|
2020-01-10 09:01:00 +03:00
|
|
|
Returns the ``Bytes32`` value of the position //pos// at address //addr//, as of the //blockTag//.
|
2019-08-21 08:53:47 +03:00
|
|
|
|
2020-04-17 05:25:05 +03:00
|
|
|
_property: provider.getTransactionCount(address [ , blockTag = latest ]) => Promise<number> @<providers-gettransactioncount> @SRC<providers/base-provider>
|
2019-08-21 08:53:47 +03:00
|
|
|
Returns the number of transactions //address// has ever **sent**, as of //blockTag//.
|
|
|
|
This value is required to be the nonce for the next transaction from //address//
|
|
|
|
sent to the network.
|
|
|
|
|
|
|
|
_heading: Examples
|
|
|
|
|
|
|
|
_code: example-account.js
|
|
|
|
|
|
|
|
|
|
|
|
_subsection: Blocks Methods
|
|
|
|
|
2020-01-10 09:01:00 +03:00
|
|
|
_property: provider.getBlock(block) => Promise<[[provider-block]]> @<providers-getblock> @SRC<providers/base-provider>
|
2019-08-21 08:53:47 +03:00
|
|
|
Get the //block// from the network, where the ``result.transactions`` is a list
|
|
|
|
of transaction hashes.
|
|
|
|
|
2020-01-10 09:01:00 +03:00
|
|
|
_property: provider.getBlockWithTransactions(block) => Promise<[[provider-blocktxs]]> @<providers-getblockwithtransactions> @SRC<providers/base-provider>
|
2019-08-21 08:53:47 +03:00
|
|
|
Get the //block// from the network, where the ``result.transactions`` is
|
|
|
|
an Array of [[provider-transactionresponse]] objects.
|
|
|
|
|
|
|
|
|
|
|
|
_subsection: Ethereum Naming Service (ENS) Methods
|
|
|
|
|
|
|
|
TODO: Explain ENS here...
|
|
|
|
|
2020-01-10 09:01:00 +03:00
|
|
|
_property: provider.lookupAddress(address) => Promise<string> @<providers-lookupaddress> @SRC<providers/base-provider>
|
2019-08-21 08:53:47 +03:00
|
|
|
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.
|
|
|
|
|
2020-01-10 09:01:00 +03:00
|
|
|
_property: provider.resolveName(name) => Promise<string<[Address](address)>> @<providers-resolvename> @SRC<providers/base-provider>
|
2019-08-21 08:53:47 +03:00
|
|
|
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.
|
|
|
|
|
|
|
|
_heading: Examples
|
|
|
|
|
|
|
|
_code: example-ens.js
|
|
|
|
|
|
|
|
_subsection: Logs Methods
|
|
|
|
|
2020-01-10 09:01:00 +03:00
|
|
|
_property: provider.getLogs(filter) => Promise<Array<[[provider-log]]>> @<providers-getlogs> @SRC<providers/base-provider>
|
2019-08-21 08:53:47 +03:00
|
|
|
Returns the Array of [[provider-log]] matching the //filter//.
|
|
|
|
|
|
|
|
Keep in mind that many backends will discard old events, and that requests
|
|
|
|
which are too broad may get dropped as they require too many resources to
|
|
|
|
execute the query.
|
|
|
|
|
|
|
|
|
|
|
|
_subsection: Network Status Methods
|
|
|
|
|
2020-01-10 09:01:00 +03:00
|
|
|
_property: provider.getNetwork() => Promise<[[provider-network]]> @<providers-getnetwork> @SRC<providers/base-provider:method.BaseProvider.getNetwork>
|
2019-08-21 08:53:47 +03:00
|
|
|
Returns the [[provider-network]] this Provider is connected to.
|
|
|
|
|
2020-01-10 09:01:00 +03:00
|
|
|
_property: provider.getBlockNumber() => Promise<number> @<providers-getblocknumber> @SRC<providers/base-provider>
|
2019-08-21 08:53:47 +03:00
|
|
|
Returns the block number (or height) of the most recently mined block.
|
|
|
|
|
2020-01-10 09:01:00 +03:00
|
|
|
_property: provider.getGasPrice() => Promise<[[bignumber]]> @<providers-getgasprice> @SRC<providers/base-provider>
|
2019-08-21 08:53:47 +03:00
|
|
|
Returns a //best guess// of the [[gas-price]] to use in a transaction.
|
|
|
|
|
|
|
|
|
|
|
|
_subsection: Transactions Methods
|
|
|
|
|
2020-04-17 05:25:05 +03:00
|
|
|
_property: provider.call(transaction [ , blockTag = latest ]) => Promise<string<[[datahexstring]]>> @<providers-call> @SRC<providers/base-provider>
|
2020-01-10 09:01:00 +03:00
|
|
|
Returns the result of executing the //transaction//, using //call//. A call
|
2019-08-21 08:53:47 +03:00
|
|
|
does not require any ether, but cannot change any state. This is useful
|
|
|
|
for calling gettings on Contracts.
|
|
|
|
|
2020-01-10 09:01:00 +03:00
|
|
|
_property: provider.estimateGas(transaction) => Promise<[[bignumber]]> @<providers-estimategas> @SRC<providers/base-provider>
|
2019-08-21 08:53:47 +03:00
|
|
|
Returns an estimate of the amount of gas that would be required to submit //transaction//
|
|
|
|
to the network.
|
|
|
|
|
|
|
|
An estimate may not be accurate since there could be another transaction
|
|
|
|
on the network that was not accounted for, but after being mined affected
|
|
|
|
relevant state.
|
|
|
|
|
2020-01-10 09:01:00 +03:00
|
|
|
_property: provider.sendTransaction(transaction) => Promise<[[provider-transactionresponse]]> @<providers-sendtransaction> @SRC<providers/base-provider>
|
2019-08-21 08:53:47 +03:00
|
|
|
Submits //transaction// to the network to be mined. The //transaction// **must** be signed,
|
|
|
|
and be valid (i.e. the nonce is correct and the account has sufficient balance to pay
|
|
|
|
for the transaction).
|
|
|
|
|
2020-04-17 05:25:05 +03:00
|
|
|
_property: provider.waitForTransaction(hash [ , confirms = 1 [ , timeout ] ]) => Promise<[TxReceipt](provider-receipt)> @<providers-waitfortransaction> @SRC<providers/base-provider>
|
2019-08-21 08:53:47 +03:00
|
|
|
Returns a Promise which will not resolve until //transactionHash// is mined.
|
|
|
|
|
|
|
|
|
|
|
|
_subsection: Event Emitter Methods
|
|
|
|
|
|
|
|
Explain events here...
|
|
|
|
|
2020-01-10 09:01:00 +03:00
|
|
|
_property: provider.on(eventName, listener) => this @<providers-on> @SRC<providers/base-provider>
|
2019-08-21 08:53:47 +03:00
|
|
|
Add a //listener// to be triggered for each //eventName//.
|
|
|
|
|
2020-01-10 09:01:00 +03:00
|
|
|
_property: provider.once(eventName, listener) => this @<providers-once> @SRC<providers/base-provider>
|
2019-08-21 08:53:47 +03:00
|
|
|
Add a //listener// to be triggered for only the next //eventName//,
|
|
|
|
at which time it be removed.
|
|
|
|
|
2020-01-10 09:01:00 +03:00
|
|
|
_property: provider.emit(eventName, ...args) => boolean @<providers-emit> @SRC<providers/base-provider>
|
2019-08-21 08:53:47 +03:00
|
|
|
Notify all listeners of //eventName//, passing //args// to each listener. This
|
|
|
|
is generally only used internally.
|
|
|
|
|
2020-01-10 09:01:00 +03:00
|
|
|
_property: provider.off(eventName [ , listener ]) => this @<providers-off> @SRC<providers/base-provider>
|
2019-08-21 08:53:47 +03:00
|
|
|
Remove a //listener// for //eventName//. If no //listener// is provided,
|
|
|
|
all listeners for //eventName// are removed.
|
|
|
|
|
2020-01-10 09:01:00 +03:00
|
|
|
_property: provider.removeAllListeners([ eventName ]) => this @<providers-removealllisteners> @SRC<providers/base-provider>
|
2019-08-21 08:53:47 +03:00
|
|
|
Remove all the listeners for //eventName//. If no //eventName// is provided,
|
|
|
|
**all** events are removed.
|
|
|
|
|
2020-01-10 09:01:00 +03:00
|
|
|
_property: provider.listenerCount([ eventName ]) => number @<providers-listenercount> @SRC<providers/base-provider>
|
2019-08-21 08:53:47 +03:00
|
|
|
Returns the number of listeners for //eventName//. If no //eventName// is
|
|
|
|
provided, the total number of listeners is returned.
|
|
|
|
|
2020-01-10 09:01:00 +03:00
|
|
|
_property: provider.listeners(eventName) => Array<Listener> @<providers-listeners> @SRC<providers/base-provider>
|
2019-08-21 08:53:47 +03:00
|
|
|
Returns the list of Listeners for //eventName//.
|
|
|
|
|
|
|
|
|
|
|
|
_subsection: Inspection Methods
|
|
|
|
|
2020-01-10 09:01:00 +03:00
|
|
|
_property: Provider.isProvider(object) => boolean @<providers-isprovider> @SRC<abstract-provider>
|
2019-08-22 08:52:17 +03:00
|
|
|
Returns true if and only if //object// is a Provider.
|
2019-08-21 08:53:47 +03:00
|
|
|
|