Skip to content

Commit

Permalink
Remove redundant ScriptHash in ReferenceScript datatypes
Browse files Browse the repository at this point in the history
  • Loading branch information
Swordlash committed Sep 23, 2024
1 parent a08aa37 commit 1caba26
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 11 deletions.
4 changes: 2 additions & 2 deletions cardano-api/gen/Test/Gen/Cardano/Api/Typed.hs
Original file line number Diff line number Diff line change
Expand Up @@ -1184,13 +1184,13 @@ genScriptWitnessForStake sbe = do
SimpleScript simpleScript -> do
simpleScriptOrReferenceInput <- Gen.choice
[ pure $ SScript simpleScript
, SReferenceScript <$> genTxIn <*> Gen.maybe genScriptHash
, SReferenceScript <$> genTxIn
]
pure $ Api.SimpleScriptWitness scriptLangInEra simpleScriptOrReferenceInput
PlutusScript plutusScriptVersion' plutusScript -> do
plutusScriptOrReferenceInput <- Gen.choice
[ pure $ PScript plutusScript
, PReferenceScript <$> genTxIn <*> Gen.maybe genScriptHash
, PReferenceScript <$> genTxIn
]
scriptRedeemer <- genHashableScriptData
PlutusScriptWitness
Expand Down
13 changes: 4 additions & 9 deletions cardano-api/internal/Cardano/Api/Script.hs
Original file line number Diff line number Diff line change
Expand Up @@ -681,17 +681,12 @@ data WitCtx witctx where
-- or to mint tokens. This datatype encapsulates this concept.
data PlutusScriptOrReferenceInput lang
= PScript (PlutusScript lang)
| -- | Needed to construct the redeemer pointer map
-- in the case of minting reference scripts where we don't
-- have direct access to the script
PReferenceScript
TxIn
(Maybe ScriptHash)
| PReferenceScript TxIn
deriving (Eq, Show)

data SimpleScriptOrReferenceInput lang
= SScript SimpleScript
| SReferenceScript TxIn (Maybe ScriptHash)
| SReferenceScript TxIn
deriving (Eq, Show)

-- | A /use/ of a script within a transaction body to witness that something is
Expand Down Expand Up @@ -791,9 +786,9 @@ scriptWitnessScript (SimpleScriptWitness SimpleScriptInConway (SScript script))
Just $ ScriptInEra SimpleScriptInConway (SimpleScript script)
scriptWitnessScript (PlutusScriptWitness langInEra version (PScript script) _ _ _) =
Just $ ScriptInEra langInEra (PlutusScript version script)
scriptWitnessScript (SimpleScriptWitness _ (SReferenceScript _ _)) =
scriptWitnessScript (SimpleScriptWitness _ (SReferenceScript _)) =
Nothing
scriptWitnessScript (PlutusScriptWitness _ _ (PReferenceScript _ _) _ _ _) =
scriptWitnessScript (PlutusScriptWitness _ _ (PReferenceScript _) _ _ _) =
Nothing

-- ----------------------------------------------------------------------------
Expand Down

0 comments on commit 1caba26

Please sign in to comment.