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

Cometa.Governance.DRep

Description

Delegation targets distinguish a DRep credential from the predefined always-abstain and always-no-confidence targets. Special targets cannot be used as voting authorities.

import qualified Cometa.Governance.DRep as DRep

abstainingTarget :: DRep.DRep
abstainingTarget = DRep.AlwaysAbstain
Synopsis

Documentation

data DRep Source #

A delegation target. The two special targets are not voting authorities; only a credential can identify a DRep voter.

Constructors

DRepCredential !(Credential DRep)

A key or script DRep credential.

AlwaysAbstain

Delegate to the predefined always-abstain target.

AlwaysNoConfidence

Delegate to the predefined always-no-confidence target.

Instances

Instances details
Show DRep Source # 
Instance details

Defined in Cometa.Internal.Governance

Methods

showsPrec :: Int -> DRep -> ShowS #

show :: DRep -> String #

showList :: [DRep] -> ShowS #

Eq DRep Source # 
Instance details

Defined in Cometa.Internal.Governance

Methods

(==) :: DRep -> DRep -> Bool #

(/=) :: DRep -> DRep -> Bool #

Ord DRep Source # 
Instance details

Defined in Cometa.Internal.Governance

Methods

compare :: DRep -> DRep -> Ordering #

(<) :: DRep -> DRep -> Bool #

(<=) :: DRep -> DRep -> Bool #

(>) :: DRep -> DRep -> Bool #

(>=) :: DRep -> DRep -> Bool #

max :: DRep -> DRep -> DRep #

min :: DRep -> DRep -> DRep #

encodeCbor :: DRep -> ByteString Source #

Encode fresh definite CBOR: [0, key hash], [1, script hash], [2] (always abstain), or [3] (always no confidence).

decodeCbor :: ByteString -> Either Error DRep Source #

Decode one complete DRep. Definite or indefinite arrays and nonminimal unsigned codes are accepted. Codes, arity and 28-byte credential lengths are checked; invalid input or trailing bytes returns InvalidGovernanceCbor. Original encoding is not retained.

toText :: DRep -> Either Error Text Source #

Encode a credential DRep as CIP-129 drep Bech32 text, using header 0x22 for a key or 0x23 for a script and its 28-byte hash. The special abstain and no-confidence delegation targets have no credential identifier; they return UnsupportedOperation.

fromText :: Text -> Either Error DRep Source #

Import either CIP-105 (28-byte drep key or drep_script script) or CIP-129 (29-byte drep header and hash) text. Uniform upper or lower case is accepted. Mixed case, invalid checksum/padding, other prefixes or headers and wrong lengths return InvalidDRepText. Re-encoding always produces CIP-129.