intrepidshape/elm-web3/1.2.0

NOTE: the latest version is 3.0.0

Web3.Fee

Gas price and fee history queries.

fetchGasPrice : Platform.Cmd msg
fetchGasPrice =
    web3Cmd (Fee.encode (Fee.getGasPrice "gas-query"))
type Cmd
= RequestGasPrice String
| RequestFeeHistory String Int

Commands to query fee data via port.

type Msg
= GotGasPrice String BigInt
| GotFeeHistory String FeeHistory

Messages from the JS fee port.

type alias FeeHistory =
{ baseFeePerGas : List BigInt
, gasUsedRatio : List Float
, oldestBlock : Int
}

Historical fee data from eth_feeHistory.

getGasPrice : String -> Cmd

Request the current gas price (eth_gasPrice). The id is echoed back.

getFeeHistory : String -> Int -> Cmd

Request fee history for the last blockCount blocks.

encode : Cmd -> Value

Encode a Cmd for the JS port.

decoder : Decoder Msg

Decode Msg responses from the JS port.