Skip to content

Commit

Permalink
Pre refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
Jimbo4350 committed Dec 13, 2023
1 parent 1d8b171 commit 5259d54
Showing 1 changed file with 57 additions and 3 deletions.
60 changes: 57 additions & 3 deletions cardano-api/internal/Cardano/Api/Protocol/Version.hs
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,60 @@ protocolVersionToSbe
protocolVersionToSbe CurrentProtocolVersion = ShelleyBasedEraBabbage
protocolVersionToSbe ExperimentalProtocolVersion = ShelleyBasedEraConway

createSingleProtVerProxy
:: Proxy version -> SingleProtVer version
createSingleProtVerProxy _ = SingleProtVer
-- An Example
validateTxBodyContent'
:: ShelleyBasedEra era
-> TxBodyContent BuildTx era
-> Either TxBodyError ()
validateTxBodyContent' sbe txBodContent@TxBodyContent {
txIns,
txInsCollateral,
txOuts,
txProtocolParams,
txMintValue,
txMetadata} =
let witnesses = collectTxBodyScriptWitnesses sbe txBodContent
languages = Set.fromList
[ toAlonzoLanguage (AnyPlutusScriptVersion v)
| (_, AnyScriptWitness (PlutusScriptWitness _ v _ _ _ _)) <- witnesses
]
in case sbe of
ShelleyBasedEraShelley -> do
validateTxIns txIns
guardShelleyTxInsOverflow (map fst txIns)
validateTxOuts sbe txOuts
validateMetadata txMetadata
ShelleyBasedEraAllegra -> do
validateTxIns txIns
guardShelleyTxInsOverflow (map fst txIns)
validateTxOuts sbe txOuts
validateMetadata txMetadata
ShelleyBasedEraMary -> do
validateTxIns txIns
guardShelleyTxInsOverflow (map fst txIns)
validateTxOuts sbe txOuts
validateMetadata txMetadata
validateMintValue txMintValue
ShelleyBasedEraAlonzo -> do
validateTxIns txIns
guardShelleyTxInsOverflow (map fst txIns)
validateTxOuts sbe txOuts
validateMetadata txMetadata
validateMintValue txMintValue
validateTxInsCollateral txInsCollateral languages
validateProtocolParameters txProtocolParams languages
ShelleyBasedEraBabbage -> do
validateTxIns txIns
guardShelleyTxInsOverflow (map fst txIns)
validateTxOuts sbe txOuts
validateMetadata txMetadata
validateMintValue txMintValue
validateTxInsCollateral txInsCollateral languages
validateProtocolParameters txProtocolParams languages
ShelleyBasedEraConway -> do
validateTxIns txIns
validateTxOuts sbe txOuts
validateMetadata txMetadata
validateMintValue txMintValue
validateTxInsCollateral txInsCollateral languages
validateProtocolParameters txProtocolParams languages

0 comments on commit 5259d54

Please sign in to comment.