Skip to content

Commit

Permalink
Merge pull request #3441 from input-output-hk/KtorZ/IsScriptWitnessInCtx
Browse files Browse the repository at this point in the history
Add 'IsScriptWitnessInCtx'
  • Loading branch information
newhoggy authored Mar 19, 2023
2 parents 4a8b3d0 + e5b863d commit 8d969ec
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions cardano-api/src/Cardano/Api.hs
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,7 @@ module Cardano.Api (
Witness(..),
KeyWitnessInCtx(..),
ScriptWitnessInCtx(..),
IsScriptWitnessInCtx(..),
ScriptDatum(..),
ScriptRedeemer,
scriptWitnessScript,
Expand Down
12 changes: 12 additions & 0 deletions cardano-api/src/Cardano/Api/Script.hs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ module Cardano.Api.Script (
Witness(..),
KeyWitnessInCtx(..),
ScriptWitnessInCtx(..),
IsScriptWitnessInCtx(..),
ScriptDatum(..),
ScriptRedeemer,
scriptWitnessScript,
Expand Down Expand Up @@ -803,6 +804,17 @@ deriving instance Show (KeyWitnessInCtx witctx)
deriving instance Eq (ScriptWitnessInCtx witctx)
deriving instance Show (ScriptWitnessInCtx witctx)

class IsScriptWitnessInCtx ctx where
scriptWitnessInCtx :: ScriptWitnessInCtx ctx

instance IsScriptWitnessInCtx WitCtxTxIn where
scriptWitnessInCtx = ScriptWitnessForSpending

instance IsScriptWitnessInCtx WitCtxMint where
scriptWitnessInCtx = ScriptWitnessForMinting

instance IsScriptWitnessInCtx WitCtxStake where
scriptWitnessInCtx = ScriptWitnessForStakeAddr

-- ----------------------------------------------------------------------------
-- Script execution units
Expand Down

0 comments on commit 8d969ec

Please sign in to comment.