Safe Haskell | None |
---|---|
Language | Haskell2010 |
Cardano.Ledger.Shelley.Tx
Synopsis
-
data
Tx
era
where
- pattern Tx :: ( Era era, ToCBOR ( AuxiliaryData era), ToCBOR ( TxBody era), ToCBOR ( Witnesses era)) => TxBody era -> Witnesses era -> StrictMaybe ( AuxiliaryData era) -> Tx era
-
newtype
TxBody
era
where
- TxBodyConstr ( MemoBytes ( TxBodyRaw era))
- pattern TxBody :: ( Era era, FromCBOR ( PParamsDelta era), TransTxBody ToCBOR era) => Set ( TxIn ( Crypto era)) -> StrictSeq ( TxOut era) -> StrictSeq ( DCert ( Crypto era)) -> Wdrl ( Crypto era) -> Coin -> SlotNo -> StrictMaybe ( Update era) -> StrictMaybe ( AuxiliaryDataHash ( Crypto era)) -> TxBody era
-
data
TxOut
era
where
- TxOutCompact !( CompactAddr ( Crypto era)) !( CompactForm ( Value era))
- pattern TxOut :: ( Era era, Show ( Value era), Compactible ( Value era)) => Addr ( Crypto era) -> Value era -> TxOut era
- data TxIn crypto = TxIn !( TxId crypto) ! TxIx
-
newtype
TxId
crypto =
TxId
{
- _unTxId :: SafeHash crypto EraIndependentTxBody
- decodeWits :: forall era s. ( FromCBOR ( Annotator ( Script era)), ValidateScript era) => Decoder s ( Annotator ( WitnessSet era))
- segwitTx :: ( ToCBOR ( TxBody era), ToCBOR ( Witnesses era), ToCBOR ( AuxiliaryData era)) => Annotator ( TxBody era) -> Annotator ( Witnesses era) -> Maybe ( Annotator ( AuxiliaryData era)) -> Annotator ( Tx era)
- type WitnessSet = WitnessSetHKD Identity
-
data
WitnessSetHKD
f era
where
- pattern WitnessSet :: ( Era era, AnnotatedData ( Script era)) => Set ( WitVKey ' Witness ( Crypto era)) -> Map ( ScriptHash ( Crypto era)) ( Script era) -> Set ( BootstrapWitness ( Crypto era)) -> WitnessSet era
-
data
WitVKey
kr crypto
where
- pattern WitVKey :: ( Typeable kr, Crypto crypto) => VKey kr crypto -> SignedDSIGN crypto ( Hash crypto EraIndependentTxBody ) -> WitVKey kr crypto
-
class
(
Era
era,
SafeToHash
(
Script
era),
HasField
"body" (
Tx
era) (
TxBody
era)) =>
ValidateScript
era
where
- scriptPrefixTag :: Script era -> ByteString
- validateScript :: Script era -> Tx era -> Bool
- hashScript :: Script era -> ScriptHash ( Crypto era)
- isNativeScript :: Script era -> Bool
- txwitsScript :: Witnesses era ~ WitnessSet era => Tx era -> Map ( ScriptHash ( Crypto era)) ( Script era)
- extractKeyHashWitnessSet :: forall (r :: KeyRole ) crypto. [ Credential r crypto] -> Set ( KeyHash ' Witness crypto)
- addrWits' :: WitnessSetHKD f era -> HKD f ( Set ( WitVKey ' Witness ( Crypto era)))
- evalNativeMultiSigScript :: Crypto crypto => MultiSig crypto -> Set ( KeyHash ' Witness crypto) -> Bool
- hashMultiSigScript :: forall era. ( ValidateScript era, Script era ~ MultiSig ( Crypto era)) => MultiSig ( Crypto era) -> ScriptHash ( Crypto era)
- validateNativeMultiSigScript :: ( TransTx ToCBOR era, Witnesses era ~ WitnessSet era) => MultiSig ( Crypto era) -> Tx era -> Bool
- type TransTx (c :: Type -> Constraint ) era = ( Era era, c ( Script era), c ( TxBody era), c ( AuxiliaryData era))
- type TransWitnessSet (c :: Type -> Constraint ) era = c ( Script era)
- prettyWitnessSetParts :: WitnessSetHKD Identity era -> ( Set ( WitVKey ' Witness ( Crypto era)), Map ( ScriptHash ( Crypto era)) ( Script era), Set ( BootstrapWitness ( Crypto era)))
Documentation
Bundled Patterns
pattern Tx :: ( Era era, ToCBOR ( AuxiliaryData era), ToCBOR ( TxBody era), ToCBOR ( Witnesses era)) => TxBody era -> Witnesses era -> StrictMaybe ( AuxiliaryData era) -> Tx era |
Instances
Constructors
TxBodyConstr ( MemoBytes ( TxBodyRaw era)) |
Bundled Patterns
pattern TxBody :: ( Era era, FromCBOR ( PParamsDelta era), TransTxBody ToCBOR era) => Set ( TxIn ( Crypto era)) -> StrictSeq ( TxOut era) -> StrictSeq ( DCert ( Crypto era)) -> Wdrl ( Crypto era) -> Coin -> SlotNo -> StrictMaybe ( Update era) -> StrictMaybe ( AuxiliaryDataHash ( Crypto era)) -> TxBody era |
Pattern for use by external users |
Instances
The output of a UTxO.
Constructors
TxOutCompact !( CompactAddr ( Crypto era)) !( CompactForm ( Value era)) |
Bundled Patterns
pattern TxOut :: ( Era era, Show ( Value era), Compactible ( Value era)) => Addr ( Crypto era) -> Value era -> TxOut era |
Instances
( Compactible v, v ~ Value era) => HasField "value" ( TxOut era) v Source # | |
Defined in Cardano.Ledger.Shelley.TxBody |
|
TransTxOut Eq era => Eq ( TxOut era) Source # | |
( TransTxOut Show era, Era era) => Show ( TxOut era) Source # | |
NFData ( TxOut era) Source # | |
Defined in Cardano.Ledger.Shelley.TxBody |
|
( Era era, TransTxOut ToCBOR era) => ToCBOR ( TxOut era) Source # | |
( Era era, TransTxOut DecodeNonNegative era, Show ( Value era)) => FromCBOR ( TxOut era) Source # | |
( Era era, TransTxOut DecodeNonNegative era, Show ( Value era)) => FromSharedCBOR ( TxOut era) Source # | |
( Crypto ( Crypto era), HeapWords ( CompactForm ( Value era))) => HeapWords ( TxOut era) Source # | |
NoThunks ( TxOut era) Source # | |
type Share ( TxOut era) Source # | |
The input of a UTxO.
Instances
Crypto era ~ crypto => HasField "inputs" ( TxBody era) ( Set ( TxIn crypto)) Source # | |
c ~ Crypto era => HasField "txinputs_fee" ( TxBody era) ( Set ( TxIn c)) Source # | |
Eq ( TxIn crypto) | |
Ord ( TxIn crypto) | |
Defined in Cardano.Ledger.TxIn Methods compare :: TxIn crypto -> TxIn crypto -> Ordering Source # (<) :: TxIn crypto -> TxIn crypto -> Bool Source # (<=) :: TxIn crypto -> TxIn crypto -> Bool Source # (>) :: TxIn crypto -> TxIn crypto -> Bool Source # (>=) :: TxIn crypto -> TxIn crypto -> Bool Source # |
|
Show ( TxIn crypto) | |
Generic ( TxIn crypto) | |
Crypto crypto => NFData ( TxIn crypto) | |
Defined in Cardano.Ledger.TxIn |
|
Crypto crypto => ToCBOR ( TxIn crypto) | |
Crypto crypto => FromCBOR ( TxIn crypto) | |
Crypto crypto => HeapWords ( TxIn crypto) | |
NoThunks ( TxIn crypto) | |
type Rep ( TxIn crypto) | |
Defined in Cardano.Ledger.TxIn
type
Rep
(
TxIn
crypto) =
D1
('
MetaData
"TxIn" "Cardano.Ledger.TxIn" "cardano-ledger-core-0.1.0.0-3EJt5rxsPizAWHDEqGPh9V" '
False
) (
C1
('
MetaCons
"TxIn" '
PrefixI
'
False
) (
S1
('
MetaSel
('
Nothing
::
Maybe
Symbol
) '
NoSourceUnpackedness
'
SourceStrict
'
DecidedStrict
) (
Rec0
(
TxId
crypto))
:*:
S1
('
MetaSel
('
Nothing
::
Maybe
Symbol
) '
SourceUnpack
'
SourceStrict
'
DecidedUnpack
) (
Rec0
TxIx
)))
|
A unique ID of a transaction, which is computable from the transaction.
Constructors
TxId | |
Fields
|
Instances
Eq ( TxId crypto) | |
Ord ( TxId crypto) | |
Defined in Cardano.Ledger.TxIn Methods compare :: TxId crypto -> TxId crypto -> Ordering Source # (<) :: TxId crypto -> TxId crypto -> Bool Source # (<=) :: TxId crypto -> TxId crypto -> Bool Source # (>) :: TxId crypto -> TxId crypto -> Bool Source # (>=) :: TxId crypto -> TxId crypto -> Bool Source # |
|
Show ( TxId crypto) | |
Generic ( TxId crypto) | |
Crypto crypto => NFData ( TxId crypto) | |
Defined in Cardano.Ledger.TxIn |
|
Crypto crypto => ToCBOR ( TxId crypto) | |
Crypto crypto => FromCBOR ( TxId crypto) | |
HeapWords ( TxId crypto) | |
NoThunks ( TxId crypto) | |
type Rep ( TxId crypto) | |
Defined in Cardano.Ledger.TxIn
type
Rep
(
TxId
crypto) =
D1
('
MetaData
"TxId" "Cardano.Ledger.TxIn" "cardano-ledger-core-0.1.0.0-3EJt5rxsPizAWHDEqGPh9V" '
True
) (
C1
('
MetaCons
"TxId" '
PrefixI
'
True
) (
S1
('
MetaSel
('
Just
"_unTxId") '
NoSourceUnpackedness
'
NoSourceStrictness
'
DecidedLazy
) (
Rec0
(
SafeHash
crypto
EraIndependentTxBody
))))
|
decodeWits :: forall era s. ( FromCBOR ( Annotator ( Script era)), ValidateScript era) => Decoder s ( Annotator ( WitnessSet era)) Source #
segwitTx :: ( ToCBOR ( TxBody era), ToCBOR ( Witnesses era), ToCBOR ( AuxiliaryData era)) => Annotator ( TxBody era) -> Annotator ( Witnesses era) -> Maybe ( Annotator ( AuxiliaryData era)) -> Annotator ( Tx era) Source #
type WitnessSet = WitnessSetHKD Identity Source #
data WitnessSetHKD f era where Source #
Bundled Patterns
pattern WitnessSet :: ( Era era, AnnotatedData ( Script era)) => Set ( WitVKey ' Witness ( Crypto era)) -> Map ( ScriptHash ( Crypto era)) ( Script era) -> Set ( BootstrapWitness ( Crypto era)) -> WitnessSet era |
Instances
data WitVKey kr crypto where Source #
Proof/Witness that a transaction is authorized by the given key holder.
Bundled Patterns
pattern WitVKey :: ( Typeable kr, Crypto crypto) => VKey kr crypto -> SignedDSIGN crypto ( Hash crypto EraIndependentTxBody ) -> WitVKey kr crypto |
Instances
class ( Era era, SafeToHash ( Script era), HasField "body" ( Tx era) ( TxBody era)) => ValidateScript era where Source #
Typeclass for script data types. Allows for script validation and hashing.
You must understand the role of SafeToHash and scriptPrefixTag to make new
instances.
scriptPrefixTag
is a magic number representing the tag of the
script language. For each new script language defined, a new tag is chosen
and the tag is included in the script hash for a script. The safeToHash
constraint ensures that Scripts are never reserialised.
Minimal complete definition
Methods
scriptPrefixTag :: Script era -> ByteString Source #
validateScript :: Script era -> Tx era -> Bool Source #
hashScript :: Script era -> ScriptHash ( Crypto era) Source #
isNativeScript :: Script era -> Bool Source #
Instances
( Crypto c, UsesTxBody ( ShelleyEra c)) => ValidateScript ( ShelleyEra c) Source # | |
Defined in Cardano.Ledger.Shelley Methods scriptPrefixTag :: Script ( ShelleyEra c) -> ByteString Source # validateScript :: Script ( ShelleyEra c) -> Tx ( ShelleyEra c) -> Bool Source # hashScript :: Script ( ShelleyEra c) -> ScriptHash ( Crypto ( ShelleyEra c)) Source # isNativeScript :: Script ( ShelleyEra c) -> Bool Source # |
txwitsScript :: Witnesses era ~ WitnessSet era => Tx era -> Map ( ScriptHash ( Crypto era)) ( Script era) Source #
Multi-signature script witness accessor function for Transactions
extractKeyHashWitnessSet :: forall (r :: KeyRole ) crypto. [ Credential r crypto] -> Set ( KeyHash ' Witness crypto) Source #
evalNativeMultiSigScript :: Crypto crypto => MultiSig crypto -> Set ( KeyHash ' Witness crypto) -> Bool Source #
Script evaluator for native multi-signature scheme.
vhks
is the set of
key hashes that signed the transaction to be validated.
hashMultiSigScript :: forall era. ( ValidateScript era, Script era ~ MultiSig ( Crypto era)) => MultiSig ( Crypto era) -> ScriptHash ( Crypto era) Source #
Hashes native multi-signature script.
validateNativeMultiSigScript :: ( TransTx ToCBOR era, Witnesses era ~ WitnessSet era) => MultiSig ( Crypto era) -> Tx era -> Bool Source #
Script validator for native multi-signature scheme.
type TransTx (c :: Type -> Constraint ) era = ( Era era, c ( Script era), c ( TxBody era), c ( AuxiliaryData era)) Source #
type TransWitnessSet (c :: Type -> Constraint ) era = c ( Script era) Source #
prettyWitnessSetParts :: WitnessSetHKD Identity era -> ( Set ( WitVKey ' Witness ( Crypto era)), Map ( ScriptHash ( Crypto era)) ( Script era), Set ( BootstrapWitness ( Crypto era))) Source #
Exports the relevant parts from a (WintessSetHKD Identity era) for use by the pretty printer without all the horrible constraints. Uses the non-exported WitnessSet' constructor.