plutus-ledger-api-1.60.0.0: Interface to the Plutus ledger for the Cardano ledger.
Safe HaskellSafe-Inferred
LanguageHaskell2010

PlutusLedgerApi.V1.Bytes

Synopsis

Documentation

newtype LedgerBytes #

Instances

Instances details
IsString LedgerBytes #

Read in arbitrary LedgerBytes as a "string" (of characters).

This is mostly used together with GHC's OverloadedStrings extension to specify at the source code any LedgerBytes constants, by utilizing Haskell's double-quoted string syntax.

IMPORTANT: the LedgerBytes are expected to be already hex-encoded (base16); otherwise, LedgerBytesError will be raised as an Exception.

Instance details

Defined in PlutusLedgerApi.V1.Bytes

Generic LedgerBytes # 
Instance details

Defined in PlutusLedgerApi.V1.Bytes

Associated Types

type Rep LedgerBytes :: Type -> Type #

Show LedgerBytes #

The Show instance of LedgerBytes is its Base16/Hex encoded bytestring, decoded with UTF-8, unpacked to RepIsStuckError LedgerBytes :: Type -> Type) (Rep LedgerBytes)))

data LedgerBytesError #

An error that is encountered when converting a ByteString to a LedgerBytes.

Constructors

UnpairedDigit

Odd number of bytes in the original bytestring.

NotHexit !Char

A non-hex digit character ([^A-Fa-f0-9]) encountered during decoding.

fromHex :: ByteString -> Either LedgerBytesError LedgerBytes #

Convert a hex-encoded (Base16) ByteString to a LedgerBytes. May return an error (LedgerBytesError).

bytes :: LedgerBytes -> Text #

Encode a ByteString value to Base16 (i.e. hexadecimal), then decode with UTF-8 to a Text.