diff --git a/docs.wrm/api/providers/provider.wrm b/docs.wrm/api/providers/provider.wrm index 517229f0b..0cd208322 100644 --- a/docs.wrm/api/providers/provider.wrm +++ b/docs.wrm/api/providers/provider.wrm @@ -240,6 +240,27 @@ gasPrice = await provider.getGasPrice() utils.formatUnits(gasPrice, "gwei") //_log: +_property: provider.getFeeData() => Promise<[[providers-FeeData]]> @ @SRC +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 + +// 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]]> @ @src Returns a Promise which will stall until the network has heen established, ignoring errors due to the target node not being active yet. diff --git a/docs.wrm/api/providers/types.wrm b/docs.wrm/api/providers/types.wrm index 7e66c3ffb..8e69bbbc8 100644 --- a/docs.wrm/api/providers/types.wrm +++ b/docs.wrm/api/providers/types.wrm @@ -34,6 +34,23 @@ _property: network.ensAddress => string<[[address]]> The address at which the ENS registry is deployed on this network. +_subsection: 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 @ _property: block.hash => string<[[DataHexString]]<32>>