intrepidshape/elm-web3-ui/2.1.1

NOTE: the latest version is 4.0.0

Web3.Ui.GasEstimate

Gas cost estimate display.

Pair with Web3.Contract.Send.estimateGas and Web3.Fee.getGasPrice to show the expected cost of a transaction before the user confirms.

Web3.Ui.GasEstimate.view []
    { gasUnits = model.gasEstimate
    , gasPrice = model.gasPrice
    , decimals = 18
    , symbol = "PLS"
    }
List (Attribute msg)
-> { gasUnits : Maybe BigInt
, gasPrice : Maybe BigInt
, decimals : Int
, symbol : String
}
-> Html msg

Display an estimated transaction cost in the native token.

gasUnits — gas limit returned by estimateGas (decoded from port) gasPrice — current gas price in wei, from Web3.Fee.getGasPrice

Shows "Estimating…" while either value is Nothing.

Cost = gasUnits × gasPrice (in wei), displayed via formatUnits.

CSS class: web3-gas-estimate