Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
-
data
TxOutSource
crypto
- = TxOutFromInput !( TxIn crypto)
- | TxOutFromOutput ! TxIx
-
data
TranslationError
crypto
- = ByronTxOutInContext !( TxOutSource crypto)
- | TranslationLogicMissingInput !( TxIn crypto)
- | RdmrPtrPointsToNothing ! RdmrPtr
- | LanguageNotSupported ! Language
- | InlineDatumsNotSupported !( TxOutSource crypto)
- | ReferenceScriptsNotSupported !( TxOutSource crypto)
- | ReferenceInputsNotSupported !( Set ( TxIn crypto))
- | TimeTranslationPastHorizon ! Text
- transDataHash :: StrictMaybe ( DataHash c) -> Maybe DatumHash
- transDataHash' :: DataHash c -> DatumHash
- transKeyHash :: KeyHash d c -> PubKeyHash
- transScriptHash :: ScriptHash c -> ValidatorHash
- transSafeHash :: SafeHash c i -> BuiltinByteString
- transHash :: Hash h a -> ByteString
- txInfoId :: TxId crypto -> TxId
- transStakeCred :: Credential keyrole crypto -> Credential
- transStakeReference :: StakeReference crypto -> Maybe StakingCredential
- transCred :: Credential keyrole crypto -> Credential
- transAddr :: Addr crypto -> Maybe Address
- transTxOutAddr :: Era era => TxOut era -> Maybe Address
- slotToPOSIXTime :: HasField "_protocolVersion" ( PParams era) ProtVer => PParams era -> EpochInfo ( Either Text ) -> SystemStart -> SlotNo -> Either Text POSIXTime
- transVITime :: HasField "_protocolVersion" ( PParams era) ProtVer => PParams era -> EpochInfo ( Either Text ) -> SystemStart -> ValidityInterval -> Either Text POSIXTimeRange
- txInfoIn' :: TxIn c -> TxOutRef
- txInfoIn :: forall era c i. ( Era era, Value era ~ Value ( Crypto era), HasField "datahash" ( TxOut era) ( StrictMaybe ( SafeHash c i))) => TxIn ( Crypto era) -> TxOut era -> Maybe TxInInfo
- txInfoOut :: forall era c. ( Era era, Value era ~ Value ( Crypto era), HasField "datahash" ( TxOut era) ( StrictMaybe ( DataHash c))) => TxOut era -> Maybe TxOut
- transPolicyID :: PolicyID crypto -> CurrencySymbol
- transAssetName :: AssetName -> TokenName
- transValue :: Value c -> Value
- transDCert :: DCert c -> DCert
- transWdrl :: Wdrl crypto -> Map StakingCredential Integer
- getWitVKeyHash :: ( Crypto crypto, Typeable kr) => WitVKey kr crypto -> PubKeyHash
- transDataPair :: ( DataHash c, Data era) -> ( DatumHash , Datum )
- transExUnits :: ExUnits -> ExBudget
- exBudgetToExUnits :: ExBudget -> Maybe ExUnits
- transScriptPurpose :: ScriptPurpose crypto -> ScriptPurpose
- data VersionedTxInfo
-
class
ExtendedUTxO
era
where
- txInfo :: PParams era -> Language -> EpochInfo ( Either Text ) -> SystemStart -> UTxO era -> Tx era -> Either ( TranslationError ( Crypto era)) VersionedTxInfo
- inputDataHashes :: Map ( ScriptHash ( Crypto era)) ( Script era) -> ValidatedTx era -> UTxO era -> ( Set ( DataHash ( Crypto era)), Set ( TxIn ( Crypto era)))
- txscripts :: UTxO era -> Tx era -> Map ( ScriptHash ( Crypto era)) ( Script era)
- getAllowedSupplimentalDataHashes :: TxBody era -> UTxO era -> Set ( DataHash ( Crypto era))
- getDatum :: Tx era -> UTxO era -> ScriptPurpose ( Crypto era) -> Maybe ( Data era)
- getTxOutDatum :: TxOut era -> Datum era
- allOuts :: TxBody era -> [ TxOut era]
- allSizedOuts :: TxBody era -> [ Sized ( TxOut era)]
- alonzoTxInfo :: forall era. ( Era era, Value era ~ Value ( Crypto era), HasField "wits" ( Tx era) ( TxWitness era), HasField "datahash" ( TxOut era) ( StrictMaybe ( SafeHash ( Crypto era) EraIndependentData )), HasField "_protocolVersion" ( PParams era) ProtVer , HasField "inputs" ( TxBody era) ( Set ( TxIn ( Crypto era))), HasField "reqSignerHashes" ( TxBody era) ( Set ( KeyHash ' Witness ( Crypto era))), HasField "certs" ( TxBody era) ( StrictSeq ( DCert ( Crypto era))), HasField "wdrls" ( TxBody era) ( Wdrl ( Crypto era)), HasField "mint" ( TxBody era) ( Value ( Crypto era)), HasField "vldt" ( TxBody era) ValidityInterval ) => PParams era -> Language -> EpochInfo ( Either Text ) -> SystemStart -> UTxO era -> Tx era -> Either ( TranslationError ( Crypto era)) VersionedTxInfo
- valContext :: VersionedTxInfo -> ScriptPurpose ( Crypto era) -> Data era
- data ScriptFailure = PlutusSF Text PlutusDebug
-
data
ScriptResult
- = Passes [ PlutusDebug ]
- | Fails [ PlutusDebug ] ( NonEmpty ScriptFailure )
- scriptPass :: PlutusDebug -> ScriptResult
- scriptFail :: ScriptFailure -> ScriptResult
- data PlutusDebug
- data PlutusError
- data PlutusDebugInfo
- debugPlutus :: String -> PlutusDebugInfo
- runPLCScript :: forall era. Show ( Script era) => Proxy era -> ProtVer -> Language -> CostModel -> ShortByteString -> ExUnits -> [ Data ] -> ScriptResult
- explainPlutusFailure :: forall era. Show ( Script era) => Proxy era -> ProtVer -> Language -> ShortByteString -> EvaluationError -> [ Data ] -> CostModel -> ExUnits -> ScriptResult
- validPlutusdata :: Data -> Bool
- validScript :: ProtVer -> Script era -> Bool
- transProtocolVersion :: ProtVer -> ProtocolVersion
- languages :: forall era. ( ExtendedUTxO era, Script era ~ Script era) => Tx era -> UTxO era -> Set ( ScriptHash ( Crypto era)) -> Set Language
Documentation
data TxOutSource crypto Source #
A transaction output can be translated because it is a newly created output, or because it is the output which is connected to a transaction input being spent.
TxOutFromInput !( TxIn crypto) | |
TxOutFromOutput ! TxIx |
Instances
data TranslationError crypto Source #
ByronTxOutInContext !( TxOutSource crypto) | |
TranslationLogicMissingInput !( TxIn crypto) | |
RdmrPtrPointsToNothing ! RdmrPtr | |
LanguageNotSupported ! Language | |
InlineDatumsNotSupported !( TxOutSource crypto) | |
ReferenceScriptsNotSupported !( TxOutSource crypto) | |
ReferenceInputsNotSupported !( Set ( TxIn crypto)) | |
TimeTranslationPastHorizon ! Text |
Instances
transDataHash :: StrictMaybe ( DataHash c) -> Maybe DatumHash Source #
transDataHash' :: DataHash c -> DatumHash Source #
transKeyHash :: KeyHash d c -> PubKeyHash Source #
transScriptHash :: ScriptHash c -> ValidatorHash Source #
transSafeHash :: SafeHash c i -> BuiltinByteString Source #
transHash :: Hash h a -> ByteString Source #
transStakeCred :: Credential keyrole crypto -> Credential Source #
transStakeReference :: StakeReference crypto -> Maybe StakingCredential Source #
transCred :: Credential keyrole crypto -> Credential Source #
slotToPOSIXTime :: HasField "_protocolVersion" ( PParams era) ProtVer => PParams era -> EpochInfo ( Either Text ) -> SystemStart -> SlotNo -> Either Text POSIXTime Source #
transVITime :: HasField "_protocolVersion" ( PParams era) ProtVer => PParams era -> EpochInfo ( Either Text ) -> SystemStart -> ValidityInterval -> Either Text POSIXTimeRange Source #
translate a validity interval to POSIX time
txInfoIn :: forall era c i. ( Era era, Value era ~ Value ( Crypto era), HasField "datahash" ( TxOut era) ( StrictMaybe ( SafeHash c i))) => TxIn ( Crypto era) -> TxOut era -> Maybe TxInInfo Source #
Given a TxIn, look it up in the UTxO. If it exists, translate it and return (Just translation). If does not exist in the UTxO, return Nothing.
txInfoOut :: forall era c. ( Era era, Value era ~ Value ( Crypto era), HasField "datahash" ( TxOut era) ( StrictMaybe ( DataHash c))) => TxOut era -> Maybe TxOut Source #
Given a TxOut, translate it and return (Just transalation). It is possible the address part is a Bootstrap Address, in that case return Nothing I.e. don't include Bootstrap Addresses in the answer.
transPolicyID :: PolicyID crypto -> CurrencySymbol Source #
transAssetName :: AssetName -> TokenName Source #
transValue :: Value c -> Value Source #
transDCert :: DCert c -> DCert Source #
getWitVKeyHash :: ( Crypto crypto, Typeable kr) => WitVKey kr crypto -> PubKeyHash Source #
transExUnits :: ExUnits -> ExBudget Source #
transScriptPurpose :: ScriptPurpose crypto -> ScriptPurpose Source #
data VersionedTxInfo Source #
Instances
Eq VersionedTxInfo Source # | |
Defined in Cardano.Ledger.Alonzo.TxInfo (==) :: VersionedTxInfo -> VersionedTxInfo -> Bool Source # (/=) :: VersionedTxInfo -> VersionedTxInfo -> Bool Source # |
|
Show VersionedTxInfo Source # | |
Defined in Cardano.Ledger.Alonzo.TxInfo |
class ExtendedUTxO era where Source #
Where we keep functions that differ from Era to Era but which deal with the extra things in the TxOut (Scripts, DataHash, Datum, etc)
txInfo , inputDataHashes , txscripts , getAllowedSupplimentalDataHashes , getDatum , getTxOutDatum , allSizedOuts
txInfo :: PParams era -> Language -> EpochInfo ( Either Text ) -> SystemStart -> UTxO era -> Tx era -> Either ( TranslationError ( Crypto era)) VersionedTxInfo Source #
inputDataHashes :: Map ( ScriptHash ( Crypto era)) ( Script era) -> ValidatedTx era -> UTxO era -> ( Set ( DataHash ( Crypto era)), Set ( TxIn ( Crypto era))) Source #
txscripts :: UTxO era -> Tx era -> Map ( ScriptHash ( Crypto era)) ( Script era) Source #
getAllowedSupplimentalDataHashes :: TxBody era -> UTxO era -> Set ( DataHash ( Crypto era)) Source #
getDatum :: Tx era -> UTxO era -> ScriptPurpose ( Crypto era) -> Maybe ( Data era) Source #
getTxOutDatum :: TxOut era -> Datum era Source #
allOuts :: TxBody era -> [ TxOut era] Source #
allSizedOuts :: TxBody era -> [ Sized ( TxOut era)] Source #
Instances
alonzoTxInfo :: forall era. ( Era era, Value era ~ Value ( Crypto era), HasField "wits" ( Tx era) ( TxWitness era), HasField "datahash" ( TxOut era) ( StrictMaybe ( SafeHash ( Crypto era) EraIndependentData )), HasField "_protocolVersion" ( PParams era) ProtVer , HasField "inputs" ( TxBody era) ( Set ( TxIn ( Crypto era))), HasField "reqSignerHashes" ( TxBody era) ( Set ( KeyHash ' Witness ( Crypto era))), HasField "certs" ( TxBody era) ( StrictSeq ( DCert ( Crypto era))), HasField "wdrls" ( TxBody era) ( Wdrl ( Crypto era)), HasField "mint" ( TxBody era) ( Value ( Crypto era)), HasField "vldt" ( TxBody era) ValidityInterval ) => PParams era -> Language -> EpochInfo ( Either Text ) -> SystemStart -> UTxO era -> Tx era -> Either ( TranslationError ( Crypto era)) VersionedTxInfo Source #
valContext :: VersionedTxInfo -> ScriptPurpose ( Crypto era) -> Data era Source #
valContext pairs transaction data with a script purpose. See figure 22 of the Alonzo specification.
data ScriptFailure Source #
Instances
Eq ScriptFailure Source # | |
Defined in Cardano.Ledger.Alonzo.TxInfo (==) :: ScriptFailure -> ScriptFailure -> Bool Source # (/=) :: ScriptFailure -> ScriptFailure -> Bool Source # |
|
Generic ScriptFailure Source # | |
Defined in Cardano.Ledger.Alonzo.TxInfo from :: ScriptFailure -> Rep ScriptFailure x Source # to :: Rep ScriptFailure x -> ScriptFailure Source # |
|
NoThunks ScriptFailure Source # | |
Defined in Cardano.Ledger.Alonzo.TxInfo |
|
type Rep ScriptFailure Source # | |
Defined in Cardano.Ledger.Alonzo.TxInfo
type
Rep
ScriptFailure
=
D1
('
MetaData
"ScriptFailure" "Cardano.Ledger.Alonzo.TxInfo" "cardano-ledger-alonzo-0.1.0.0-xW3meaGVQP43dxJ76zbGD" '
False
) (
C1
('
MetaCons
"PlutusSF" '
PrefixI
'
False
) (
S1
('
MetaSel
('
Nothing
::
Maybe
Symbol
) '
NoSourceUnpackedness
'
NoSourceStrictness
'
DecidedLazy
) (
Rec0
Text
)
:*:
S1
('
MetaSel
('
Nothing
::
Maybe
Symbol
) '
NoSourceUnpackedness
'
NoSourceStrictness
'
DecidedLazy
) (
Rec0
PlutusDebug
)))
|
data ScriptResult Source #
Passes [ PlutusDebug ] | |
Fails [ PlutusDebug ] ( NonEmpty ScriptFailure ) |
Instances
scriptPass :: PlutusDebug -> ScriptResult Source #
data PlutusDebug Source #
PlutusDebugV1 CostModel ExUnits ShortByteString [ Data ] ProtVer | |
PlutusDebugV2 CostModel ExUnits ShortByteString [ Data ] ProtVer |
Instances
data PlutusError Source #
Instances
Show PlutusError Source # | |
Defined in Cardano.Ledger.Alonzo.TxInfo |
data PlutusDebugInfo Source #
debugPlutus :: String -> PlutusDebugInfo Source #
runPLCScript :: forall era. Show ( Script era) => Proxy era -> ProtVer -> Language -> CostModel -> ShortByteString -> ExUnits -> [ Data ] -> ScriptResult Source #
Run a Plutus Script, given the script and the bounds on resources it is allocated.
explainPlutusFailure :: forall era. Show ( Script era) => Proxy era -> ProtVer -> Language -> ShortByteString -> EvaluationError -> [ Data ] -> CostModel -> ExUnits -> ScriptResult Source #
Explain why a script might fail. Scripts come in two flavors:
- with 3 data arguments [data,redeemer,context]
- with 2 data arguments [redeemer,context].
It pays to decode the context data into a real context because that provides way more information. But there is no guarantee the context data really can be decoded.
validPlutusdata :: Data -> Bool Source #