cometa-0.1.0.0: Idiomatic Haskell bindings to cardano-c
Safe HaskellSafe-Inferred
LanguageHaskell2010

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

Documentation

data PolicyId Source #

A 28-byte script-policy hash. Equality and ordering compare bytes lexicographically. Show is diagnostic output.

Instances

Instances details
Show PolicyId Source # 
Instance details

Defined in Cometa.PolicyId

Eq PolicyId Source # 
Instance details

Defined in Cometa.PolicyId

Ord PolicyId Source # 
Instance details

Defined in Cometa.PolicyId

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.

toHex :: PolicyId -> Text Source #

Lowercase hexadecimal without a prefix, always 56 digits.

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.