Small internal hex-string helpers shared across the payment-method and wire-format modules.
These cover two string-level checks that are used before length/format validation of Ethereum-style hex addresses and calldata:
strip_0x/1— drop an optional0xprefix, returning the rest unchanged.hex_string?/1— true when the (already prefix-stripped) string is one or more bare hex digits, with no0xprefix.
For decode/encode/integer conversion use Onchain.Hex (decode/1, encode/1,
to_integer/1, valid?/1). Note Onchain.Hex.valid?/1 accepts a 0x prefix,
whereas hex_string?/1 here does not — they are not interchangeable.
Summary
Functions
Return true when str is one or more bare hex digits (0-9a-fA-F), with no
0x prefix. An empty string is not valid hex.
Drop an optional leading 0x prefix, returning the remaining string unchanged.
Functions
Return true when str is one or more bare hex digits (0-9a-fA-F), with no
0x prefix. An empty string is not valid hex.
Drop an optional leading 0x prefix, returning the remaining string unchanged.