intrepidshape/elm-web3-ui/2.3.0

NOTE: the latest version is 4.0.0

Web3.Ui.Revert

Human-readable revert reasons. elm-web3 can decode Error(string) revert data (Web3.Abi.Decode.decodeRevertReason) — this module is the missing last mile that actually shows it to the user instead of a raw 0x08c379a0… blob.

case model.txError of
    Just raw ->
        Revert.banner [] { onDismiss = Just DismissError } raw


    Nothing ->
        Html.text ""

Decoding is best-effort and honest about it: a decodable Error(string) payload renders its message; anything else (custom solc errors, empty reverts, out-of-gas) renders a labelled fallback with the truncated selector so the information is preserved, never invented.

CSS classes: web3-revert, web3-revert--decoded, web3-revert--raw, web3-revert__reason, web3-revert__dismiss, web3-revert-toast.

List (Attribute msg)
-> { onDismiss : Maybe msg }
-> String
-> Html msg

The same content shaped for a toast/notification stack.

reason : String -> Result String String

Extract the best human-readable string from raw revert data. Ok message when it decoded as Error(string); Err shortForm (a truncated hex selector, or the raw input for non-hex strings) when it did not.

List (Attribute msg)
-> { onDismiss : Maybe msg
, decode :
String
-> Maybe
{ name : String
, args : List String
}
}
-> String
-> Html msg

Like banner, but tries a typed custom-error decoder first — pass elm-web3's Abi.Decode.decodeCustomError yourFragments (>= 1.4.0). A decoded custom error renders its name and args (web3-revert--custom, name in web3-revert__name); anything else falls through to the standard Error(string) path.

List (Attribute msg)
-> { onDismiss : Maybe msg
, decode :
String
-> Maybe
{ name : String
, args : List String
}
}
-> String
-> Html msg

Toast-shaped sibling of bannerWith.