From 311fd05b116497be9eabbb13da844e654b0754a4 Mon Sep 17 00:00:00 2001 From: Gregory Gerasev Date: Wed, 29 May 2024 00:30:43 +0700 Subject: [PATCH] Add `getAllSpecSigners` util --- src/Cardano/CEM.hs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/Cardano/CEM.hs b/src/Cardano/CEM.hs index f1b5f36..eeaa045 100644 --- a/src/Cardano/CEM.hs +++ b/src/Cardano/CEM.hs @@ -125,6 +125,15 @@ data TransitionSpec script = MkTransitionSpec } deriving stock (Show) +-- | List of all signing keys required for transition spec +getAllSpecSigners :: TransitionSpec script -> [PubKeyHash] +getAllSpecSigners spec = signers spec ++ txInPKHs + where + txInPKHs = mapMaybe getPubKey $ filter ((Prelude.== In) . txFanCKind) $ constraints spec + getPubKey c = case address (txFanCFilter c) of + ByPubKey key -> Just key + _ -> Nothing + {- | Static part of CEMScript datum. Datatype is actually used only by off-chain code due to Plutus limitations. -}