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

Cometa.Governance.ActionId

Description

Identify a governance proposal by its containing transaction and index. These are standalone protocol identities; construction does not establish that a proposal exists or is currently eligible for voting.

import qualified Cometa.Governance.ActionId as ActionId
import qualified Cometa.TransactionId as TransactionId

firstProposal :: TransactionId.TransactionId -> ActionId.ActionId
firstProposal transaction = ActionId.ActionId transaction 0
Synopsis

Documentation

data ActionId Source #

A proposal's identity: the transaction containing it and its zero-based index within that transaction. The standalone native schema permits the full unsigned 64-bit index range. This does not establish ledger acceptance of an index in a particular era. Ordering compares transaction bytes, then index.

Constructors

ActionId 

Fields

Instances

Instances details
Show ActionId Source # 
Instance details

Defined in Cometa.Internal.Governance

Eq ActionId Source # 
Instance details

Defined in Cometa.Internal.Governance

Ord ActionId Source # 
Instance details

Defined in Cometa.Internal.Governance

encodeCbor :: ActionId -> ByteString Source #

Fresh definite CBOR [transaction hash bytes, unsigned index] with the shortest integer encoding. The index retains the full unsigned 64-bit range.

decodeCbor :: ByteString -> Either Error ActionId Source #

Decode exactly one complete action identifier. Both definite and indefinite arrays and nonminimal integer encodings are accepted. Wrong arity, hash length, non-unsigned index or trailing bytes returns InvalidGovernanceCbor. The result is semantic data; this function does not retain the original encoding.

toText :: ActionId -> Either Error Text Source #

Encode the CIP-129 gov_action Bech32 identifier: 32 transaction hash bytes followed by the one-byte proposal index. Indices above 255 return InvalidGovernanceActionTextIndex without truncation. CBOR retains the full unsigned 64-bit index range independently of this narrower display format.

fromText :: Text -> Either Error ActionId Source #

Decode a checksummed CIP-129 gov_action identifier with exactly 33 payload bytes. Uniform upper or lower case is accepted; mixed case, other prefixes, incorrect padding, checksum or length returns InvalidGovernanceActionText. The decoded index is always 0 through 255.