| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
Cometa.Encoding.Hex
Description
Strict hexadecimal conversion for raw bytes. Decode a textual payload, then pass the bytes to the domain's ordinary validator. Hexadecimal syntax does not establish a script, hash role, CBOR schema or ledger validity.
import qualified Cometa.Encoding.Hex as Hex import qualified Cometa.Script.Plutus as Plutus readScript text = Hex.decode text >>= Plutus.fromBytes Plutus.V3
Synopsis
- encode :: ByteString -> Text
- decode :: Text -> Either Error ByteString
Documentation
encode :: ByteString -> Text Source #
Render every byte as two lowercase ASCII hexadecimal digits, without a
prefix or whitespace. Empty bytes produce empty text. For all byte strings,
decode (encode bytes) == Right bytes.
decode :: Text -> Either Error ByteString Source #
Decode a complete even-length sequence of ASCII hexadecimal digits,
accepting either letter case. Empty text produces empty bytes. Odd length,
non-ASCII characters, whitespace, prefixes and embedded NUL characters return
InvalidHex; no partial payload is returned. A successful result still needs
validation by the intended domain decoder.