Skip to content

Commit

Permalink
docs: added provider.FeeData
Browse files Browse the repository at this point in the history
  • Loading branch information
ricmoo committed Aug 27, 2021
1 parent 5762a1f commit f2a32d0
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
21 changes: 21 additions & 0 deletions docs.wrm/api/providers/provider.wrm
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
17 changes: 17 additions & 0 deletions docs.wrm/api/providers/types.wrm
Original file line number Diff line number Diff line change
Expand Up @@ -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>>
Expand Down

0 comments on commit f2a32d0

Please sign in to comment.