| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
Cardano.Ledger.Credential
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.
Constructors
| 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
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 Ptrs 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
| FromJSON SlotNo32 Source # | |
| ToJSON SlotNo32 Source # | |
| Bounded SlotNo32 Source # | |
| Generic SlotNo32 Source # | |
| Num SlotNo32 Source # | |
| Show SlotNo32 Source # | |
| FromCBOR SlotNo32 Source # | |
| ToCBOR SlotNo32 Source # | |
| DecCBOR SlotNo32 Source # | |
| EncCBOR SlotNo32 Source # | |
| NFData SlotNo32 Source # | |
Defined in Cardano.Ledger.Credential | |
| Eq SlotNo32 Source # | |
| Ord SlotNo32 Source # | |
Defined in Cardano.Ledger.Credential | |
| NoThunks SlotNo32 Source # | |
| Random SlotNo32 Source # | |
| Uniform SlotNo32 Source # | |
Defined in Cardano.Ledger.Credential Methods uniformM ∷ StatefulGen g m ⇒ g → m SlotNo32 Source # | |
| UniformRange SlotNo32 Source # | |
| type Rep SlotNo32 Source # | |
Defined in Cardano.Ledger.Credential | |
type StakeCredential = Credential 'Staking Source #
data StakeReference Source #
Constructors
| StakeRefBase !StakeCredential | |
| StakeRefPtr !Ptr | |
| StakeRefNull |
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 Ptrs 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.