| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
Cometa.PolicyId
Description
Validated 28-byte native-asset policy identifiers. Import assigns an identifier; it does not execute or hash a policy script.
import qualified Cometa.Credential as Credential import qualified Cometa.PolicyId as PolicyId policy :: Credential.ScriptHash -> PolicyId.PolicyId policy = PolicyId.fromScriptHash
Synopsis
- data PolicyId
- fromBytes :: ByteString -> Either Error PolicyId
- toBytes :: PolicyId -> ByteString
- fromHex :: Text -> Either Error PolicyId
- toHex :: PolicyId -> Text
- fromScriptHash :: ScriptHash -> PolicyId
- toScriptHash :: PolicyId -> ScriptHash
Documentation
A 28-byte script-policy hash. Equality and ordering compare bytes
lexicographically. Show is diagnostic output.
fromBytes :: ByteString -> Either Error PolicyId Source #
Import exactly 28 bytes. Other lengths return InvalidPolicyIdLength
with the actual byte count. This does not compute a script hash.
toBytes :: PolicyId -> ByteString Source #
Exact policy-hash bytes.
fromHex :: Text -> Either Error PolicyId Source #
Import exactly 56 ASCII hexadecimal digits, accepting either case.
Malformed hexadecimal returns InvalidHex; valid hex of another byte length
returns InvalidPolicyIdLength, including empty input.
fromScriptHash :: ScriptHash -> PolicyId Source #
Assign an already validated script hash as a minting-policy identifier.
toScriptHash :: PolicyId -> ScriptHash Source #
The script hash identifying this policy.