Skip to content

Commit 988495d

Browse files
committed
Add hashSimpleScript
1 parent 3e418e0 commit 988495d

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

cardano-api/src/Cardano/Api/Experimental.hs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ module Cardano.Api.Experimental
5353
, SimpleScript (..)
5454
, SimpleScriptOrReferenceInput (..)
5555
, deserialiseSimpleScript
56+
, hashSimpleScript
5657

5758
-- ** Plutus related
5859
, PlutusScriptInEra (..)

cardano-api/src/Cardano/Api/Experimental/Simple/Script.hs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,14 @@
44
{-# LANGUAGE StandaloneDeriving #-}
55
{-# LANGUAGE TypeApplications #-}
66
{-# LANGUAGE TypeFamilies #-}
7+
{-# LANGUAGE TypeOperators #-}
78
{-# LANGUAGE UndecidableInstances #-}
89

910
module Cardano.Api.Experimental.Simple.Script
1011
( SimpleScript (..)
1112
, SimpleScriptOrReferenceInput (..)
1213
, deserialiseSimpleScript
14+
, hashSimpleScript
1315
)
1416
where
1517

@@ -56,6 +58,10 @@ deserialiseSimpleScript
5658
deserialiseSimpleScript bs =
5759
deserialiseFromCBOR (proxyToAsType (Proxy @(SimpleScript era))) bs
5860

61+
hashSimpleScript
62+
:: L.NativeScript era ~ L.Script era => SimpleScript era -> L.ScriptHash
63+
hashSimpleScript (SimpleScript ns) = L.hashScript ns
64+
5965
data SimpleScriptOrReferenceInput era
6066
= SScript (SimpleScript era)
6167
| SReferenceScript TxIn

0 commit comments

Comments
 (0)