Gas price and fee history queries.
fetchGasPrice : Platform.Cmd msg
fetchGasPrice =
web3Cmd (Fee.encode (Fee.getGasPrice "gas-query"))Messages from the JS fee port.
Historical fee data from eth_feeHistory.
Request the current gas price (eth_gasPrice). The id is echoed back.
Request fee history for the last blockCount blocks.
Request the current max priority fee per gas (eth_maxPriorityFeePerGas).
The id is echoed back in the maxPriorityFee response.
web3Cmd (Fee.getMaxPriorityFee "priority-1")This is a standalone encoder that produces the port value directly -- it is
deliberately NOT a new variant of Cmd. Adding a variant to an
exposed custom type is a MAJOR change under Elm's enforced semver (every
case expression over Cmd or Msg in consumer code would stop
compiling), so this addition ships as a pair of standalone functions to
stay MINOR-safe. Decode the response with
maxPriorityFeeDecoder.
Decode the maxPriorityFee response from the JS port into
( id, wei ).
Standalone (not a Msg variant) for the same additive-safety
reason as getMaxPriorityFee: extending Msg
would be a MAJOR version bump.
case D.decodeValue Fee.maxPriorityFeeDecoder incoming of
Ok ( id, wei ) ->
-- wei : BigInt -- suggested maxPriorityFeePerGas
Err _ ->
-- not a maxPriorityFee response
Commands to query fee data via port.