docs: added provider.FeeData

This commit is contained in:
Richard Moore 2021-08-27 15:35:23 -04:00
parent 5762a1f83d
commit f2a32d0d5b
No known key found for this signature in database
GPG Key ID: 665176BE8E9DC651
2 changed files with 38 additions and 0 deletions

@ -240,6 +240,27 @@ gasPrice = await provider.getGasPrice()
utils.formatUnits(gasPrice, "gwei")
//_log:
_property: provider.getFeeData() => Promise<[[providers-FeeData]]> @<Provider-getFeeData> @SRC<abstract-provider>
Returns the current recommended [[providers-FeeData]] to use in a transaction.
For an EIP-1559 transaction, the ``maxFeePerGas`` and ``maxPriorityFeePerGas``
should be used.
For legacy transactions and networks which do not support EIP-1559, the ``gasPrice``
should be used.
_code: @lang<javascript>
// The gas price (in wei)...
feeData = await provider.getFeeData()
//_log: feeData
// ...often these values are easier to understand or
// display to the user in gwei
//_result:
utils.formatUnits(feeData.maxFeePerGas, "gwei")
//_log:
_property: provider.ready => Promise<[[providers-Network]]> @<Provider-ready> @src<providers/base-provider>
Returns a Promise which will stall until the network has heen established,
ignoring errors due to the target node not being active yet.

@ -34,6 +34,23 @@ _property: network.ensAddress => string<[[address]]>
The address at which the ENS registry is deployed on this network.
_subsection: FeeData @<providers-FeeData>
A **FeeData** object encapsulates the necessary fee data required
to send a transaction, based on the best available recommendations.
_property: feeData.gasPrice => [[BigNumber]]
The gasPrice to use for legacy transactions or networks which do not
support EIP-1559.
_property: feeData.maxFeePerGas => [[BigNumber]]
The ``maxFeePerGas`` to use for a transaction. This is based on the
most recent block's ``baseFee``.
_property: feeData.maxPriorityFeePerGas => [[BigNumber]]
The ``maxPriorityFeePerGas`` to use for a transaction. This accounts
for the uncle risk and for the majority of current MEV risk.
_subsection: Block @<providers-Block>
_property: block.hash => string<[[DataHexString]]<32>>