Skip to content

Commit 5d83693

Browse files
committed
Expose getPlutusArgs and rename fullyAppliedScript to getFullyAppliedScript
1 parent 3744729 commit 5d83693

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

src/mockchain/lib/Convex/MockChain.hs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ module Convex.MockChain(
4141
applyTransaction,
4242
-- * Plutus scripts
4343
PlutusWithContext(..),
44-
fullyAppliedScript,
44+
getFullyAppliedScript,
45+
getPlutusArgs,
4546
-- * Mockchain implementation
4647
MockchainT(..),
4748
Mockchain,
@@ -169,8 +170,8 @@ import qualified UntypedPlutusCore as UPLC
169170
{-| Apply the plutus script to all its arguments and return a plutus
170171
program
171172
-}
172-
fullyAppliedScript :: NodeParams C.ConwayEra -> PlutusWithContext StandardCrypto -> Either String (UPLC.Program UPLC.NamedDeBruijn UPLC.DefaultUni UPLC.DefaultFun ())
173-
fullyAppliedScript params pwc@PlutusWithContext{pwcScript} = do
173+
getFullyAppliedScript :: NodeParams C.ConwayEra -> PlutusWithContext StandardCrypto -> Either String (UPLC.Program UPLC.NamedDeBruijn UPLC.DefaultUni UPLC.DefaultFun ())
174+
getFullyAppliedScript params pwc@PlutusWithContext{pwcScript} = do
174175
let plutus = either id Plutus.Language.plutusFromRunnable pwcScript
175176
binScript = Plutus.Language.plutusBinary plutus
176177
pv = Plutus.MajorProtocolVersion $ getVersion $ pvMajor (Defaults.protVer params)
@@ -190,7 +191,7 @@ getPlutusArgs pwc =
190191
withRunnablePlutusWithContext
191192
pwc
192193
(const [])
193-
plutusArgs
194+
(const plutusArgs)
194195

195196
withRunnablePlutusWithContext ::
196197
PlutusWithContext c ->
@@ -206,8 +207,8 @@ withRunnablePlutusWithContext PlutusWithContext {pwcProtocolVersion, pwcScript,
206207
Right pr -> f pr pwcArgs
207208
Left err -> onError (PV3.CodecError err)
208209

209-
plutusArgs :: forall l. Plutus.Language.PlutusLanguage l => Plutus.Language.PlutusRunnable l -> PlutusArgs l -> [PV3.Data]
210-
plutusArgs _runnable args = case Plutus.Language.isLanguage @l of
210+
plutusArgs :: forall l. Plutus.Language.PlutusLanguage l => PlutusArgs l -> [PV3.Data]
211+
plutusArgs args = case Plutus.Language.isLanguage @l of
211212
Plutus.Language.SPlutusV1 -> getPlutusArgsV1 args
212213
Plutus.Language.SPlutusV2 -> getPlutusArgsV2 args
213214
Plutus.Language.SPlutusV3 -> getPlutusArgsV3 args
@@ -553,7 +554,7 @@ evalMockchain0T :: Functor m => InitialUTXOs -> MockchainT C.ConwayEra m a -> m
553554
evalMockchain0T dist action = evalMockchainT action Defaults.nodeParams (initialStateFor Defaults.nodeParams dist)
554555

555556
execMockchainIO :: MockchainIO era a -> NodeParams era -> MockChainState era -> IO (MockChainState era)
556-
execMockchainIO action nps = execMockchainT action nps
557+
execMockchainIO = execMockchainT
557558

558559
execMockchain0IO :: InitialUTXOs -> MockchainIO C.ConwayEra a -> IO (MockChainState C.ConwayEra)
559560
execMockchain0IO dist action = execMockchainIO action Defaults.nodeParams (initialStateFor Defaults.nodeParams dist)

0 commit comments

Comments
 (0)