Render a typed input for any Solidity argument shape — address,
uint*, int*, bool, string, bytes, bytesN, T[], T[N], and
tuple (recursively).
The component is stateless, like every other primitive in this library.
The caller owns a Value per ABI argument and passes it back in on every
render. Validation feedback is wired the same way (error : Maybe String).
A complete write flow looks like this:
-- in your Model
type alias Model =
{ fooArg : Web3.Ui.AbiInput.Value
, fooError : Maybe String
, …
}
-- in init
init =
{ fooArg = Web3.Ui.AbiInput.initFor fooField, … }
-- in your view
Web3.Ui.AbiInput.view []
{ field = fooField
, value = model.fooArg
, onChange = FooArgChanged
, error = model.fooError
}
-- when the user clicks Send, parse to JSON
case Web3.Ui.AbiInput.parse fooField model.fooArg of
Ok jsonValue -> -- pass to Web3.Contract.Send
Err msg -> ( { model | fooError = Just msg }, Cmd.none )Configuration for view.
Description of one ABI argument: name, Solidity type string, and (for tuples) the recursive list of child fields.
Extract the field's Solidity type string (e.g. "uint256", "address[]").
Extract a field's recursive children (tuple fields), empty otherwise.
Opaque user-input value for an ABI argument of any shape.
Scalars carry their raw input buffer (a String); arrays carry a list of
inner values; tuples carry an ordered list of field values matching their
Field.children.
Construct a scalar value from a raw input buffer.
Construct a tuple value.
Extract the raw input buffer from a scalar value, if it is one.
Extract array elements, if this is a list value.
Extract tuple field values, if this is a tuple value.
Build the empty Value matching a Field's shape.
For scalars, returns valueString "". For dynamic arrays, an empty list.
For fixed arrays, a list of N empty inner values. For tuples, a tuple of
empty values matching the field's children.
Parse a Value against its Field into a Json.Encode.Value ready for
the JS port. Returns Err message on the first validation failure.
Parse a Value against its Field into a Calldata.Slot.
This is the canonical parser for the pure-Elm calldata path — codegen tools
emit parseSlot calls and feed the resulting slots to
Web3.Abi.Calldata.calldata plus a baked
selector, producing complete "0x…" calldata with zero JavaScript
involvement.
Use parseSlot when building readCallRaw / writeCallRaw; use the
existing parse when you need the legacy method+args port shape.
Render the input(s) for one ABI argument.
Composes the existing
Web3.Ui.Input.*primitives, recursing into arrays and tuples. Class names follow the BEM conventionweb3-abi-input/web3-abi-input__label/web3-abi-input__error/web3-abi-input__list/web3-abi-input__tuple.