Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- data Credential (kr ∷ KeyRole)
- = ScriptHashObj !ScriptHash
- | KeyHashObj !(KeyHash kr)
- type PaymentCredential = Credential 'Payment
- credKeyHash ∷ Credential r → Maybe (KeyHash r)
- credKeyHashWitness ∷ Credential r → Maybe (KeyHash 'Witness)
- credScriptHash ∷ Credential kr → Maybe ScriptHash
- credToText ∷ Credential kr → Text
- parseCredential ∷ MonadFail m ⇒ Text → m (Credential kr)
- data Ptr = Ptr !SlotNo32 !TxIx !CertIx
- mkPtrNormalized ∷ Word64 → Word64 → Word64 → Ptr
- ptrSlotNo ∷ Ptr → SlotNo
- ptrTxIx ∷ Ptr → TxIx
- ptrCertIx ∷ Ptr → CertIx
- newtype SlotNo32 = SlotNo32 Word32
- type StakeCredential = Credential 'Staking
- data StakeReference
- normalizePtr ∷ Ptr → Ptr
Documentation
data Credential (kr ∷ KeyRole) Source #
Script hash or key hash for a payment or a staking object.
Note that credentials (unlike raw key hashes) do appear to vary from era to era, since they reference the hash of a script, which can change. This parameter is a phantom, however, so in actuality the instances will remain the same.
ScriptHashObj !ScriptHash | |
KeyHashObj !(KeyHash kr) |
Instances
type PaymentCredential = Credential 'Payment Source #
credKeyHash ∷ Credential r → Maybe (KeyHash r) Source #
credKeyHashWitness ∷ Credential r → Maybe (KeyHash 'Witness) Source #
Convert a KeyHash into a Witness KeyHash. Does nothing for Script credentials.
credScriptHash ∷ Credential kr → Maybe ScriptHash Source #
Extract ScriptHash from a Credential. Returns Nothing for KeyHashes
credToText ∷ Credential kr → Text Source #
parseCredential ∷ MonadFail m ⇒ Text → m (Credential kr) Source #
Pointer to a slot number, transaction index and an index in certificate list.
Instances
ToJSON Ptr Source # | |
ToJSONKey Ptr Source # | |
Defined in Cardano.Ledger.Credential | |
Generic Ptr Source # | |
Show Ptr Source # | |
FromCBOR Ptr Source # | |
ToCBOR Ptr Source # | |
DecCBOR Ptr Source # | |
EncCBOR Ptr Source # | |
DecCBORGroup Ptr Source # | |
Defined in Cardano.Ledger.Credential decCBORGroup ∷ Decoder s Ptr Source # | |
EncCBORGroup Ptr Source # | |
NFData Ptr Source # | |
Defined in Cardano.Ledger.Credential | |
Eq Ptr Source # | |
Ord Ptr Source # | |
NoThunks Ptr Source # | |
type Rep Ptr Source # | |
Defined in Cardano.Ledger.Credential type Rep Ptr = D1 ('MetaData "Ptr" "Cardano.Ledger.Credential" "cardano-ledger-core-1.17.0.0-inplace" 'False) (C1 ('MetaCons "Ptr" 'PrefixI 'False) (S1 ('MetaSel ('Nothing ∷ Maybe Symbol) 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 SlotNo32) :*: (S1 ('MetaSel ('Nothing ∷ Maybe Symbol) 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 TxIx) :*: S1 ('MetaSel ('Nothing ∷ Maybe Symbol) 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 CertIx)))) |
mkPtrNormalized ∷ Word64 → Word64 → Word64 → Ptr Source #
Construct a valid Ptr
, while protecting against overflow. Constructs a Ptr
with
all zeros for its fields, whenever either one of them doesn't fit in without overflowing. Any
pointer that contains a SlotNo
, TxIx
or CertIx
that is too large to fit into Word32
,
Word16
and Word16
respectively is considered to be an invalid Ptr
and result in all values
to be clamped to zero. In case of all valid arguments the Ptr
s will be constructed with values
unmodified.
Note - This functionality is in no way related to dangling pointers, with an exception that any
invalid Ptr
is guarateed to be a dangling Ptr
.
Pointers have been deprecated and aren't used anymore. For this reason we can safely use
Word32
for slots in pointers
Instances
type StakeCredential = Credential 'Staking Source #
data StakeReference Source #
Instances
normalizePtr ∷ Ptr → Ptr Source #
Deprecated: Starting with Conway era all Pointers are now normalized and this logic has been moved into the decoder
Convert any invalid Ptr
to a Ptr
that contains all zeros for its fields. Any
pointer that contains a SlotNo
, TxIx
or CertIx
that is too large to fit into
Word32
, Word16
and Word16
respectively is considered to be an invalid
Ptr
. Valid Ptr
s will be returned unmodified.
Note - This is in no way related to dangling pointers, with an exception that any
invalid Ptr
is guarateed to be a dangling Ptr
.