quietgarden/elm-web3-ui/2.0.0

Unavailable. Nobody can download this version any more, with elm or with the Lamdera compiler: github.com/quietgarden/elm-web3-ui is gone (deleted or private); Software Heritage not asked yet (this run's --swh-calls were used up); no fork with tag 2.0.0 found (1 same-name repos checked); no cached copy. Use another version.

Details

Web3.Ui.Amount

Token amount input and display with SI suffix formatting.

-- Amount input with inline symbol label:
Web3.Ui.Amount.amountInput []
    { value = model.amountStr
    , onInput = AmountChanged
    , decimals = 18
    , symbol = "PLS"
    , valid = True
    }


-- Format a Wei value as human-readable (caller appends symbol):
Web3.Ui.Amount.formatWei 18 weiAmount ++ " PLS"
--> "1.23M PLS"
List (Attribute msg)
-> { value : String
, onInput : String -> msg
, decimals : Int
, symbol : String
, valid : Bool
}
-> Html msg

Numeric text input for a token amount. value is a plain decimal string (e.g. "1000.5"). No parsing is done here — call Web3.Units.parseUnits in your update to convert to Wei.

Adds web3-amount-input--invalid when valid is False.

CSS classes: web3-amount-wrapper (outer div), web3-amount-input (input), web3-amount-symbol (symbol label)

formatWei : Int -> BigInt -> String

Format a Wei BigInt as a human-readable string with SI suffix.

The symbol is not appended — concatenate it yourself so the caller controls spacing and placement.

formatWei 18 onePls   --> "1"
formatWei 18 largePls --> "1.23M"
formatWei 6  oneUsdc  --> "1"

SI suffixes: K (10³), M (10⁶), B (10⁹), T (10¹²). Values below 1000 are shown with up to 2 decimal places, trailing zeros trimmed.