Skip to content

Commit

Permalink
Use CliCertificateScriptRequirements instead of ScriptWitnessFiles
Browse files Browse the repository at this point in the history
WitCtxStake in compatibility transaction build command
  • Loading branch information
Jimbo4350 committed Jan 22, 2025
1 parent c0c1f37 commit c62b2b1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
13 changes: 9 additions & 4 deletions cardano-cli/src/Cardano/CLI/Compatible/Transaction.hs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ import Cardano.Api.Shelley hiding (VotingProcedures)
import Cardano.CLI.Environment
import Cardano.CLI.EraBased.Options.Common hiding (pRefScriptFp, pTxOutDatum)
import Cardano.CLI.EraBased.Run.Transaction
import Cardano.CLI.EraBased.Script.Certificate.Read
import Cardano.CLI.EraBased.Script.Certificate.Types
import Cardano.CLI.EraBased.Script.Types
import Cardano.CLI.Parser
import Cardano.CLI.Read
import Cardano.CLI.Types.Common
Expand Down Expand Up @@ -185,7 +188,7 @@ data CompatibleTransactionCmds era
(Maybe NetworkId)
!Coin
-- ^ Tx fee
![(CertificateFile, Maybe (ScriptWitnessFiles WitCtxStake))]
![(CertificateFile, Maybe CliCertificateScriptRequirements)]
-- ^ stake registering certs
!(File () Out)

Expand All @@ -203,6 +206,7 @@ data CompatibleTransactionError
| CompatibleVoteError !VoteError
| forall era. CompatibleVoteMergeError !(VotesMergingConflict era)
| CompatibleScriptWitnessError !ScriptWitnessError
| CompatibleScriptWitnessReadError !(FileError CliScriptWitnessError)

instance Error CompatibleTransactionError where
prettyError = \case
Expand All @@ -216,6 +220,7 @@ instance Error CompatibleTransactionError where
CompatibleVoteError e -> pshow e
CompatibleVoteMergeError e -> pshow e
CompatibleScriptWitnessError e -> renderScriptWitnessError e
CompatibleScriptWitnessReadError e -> prettyError e

runCompatibleTransactionCmd
:: forall era
Expand All @@ -240,14 +245,14 @@ runCompatibleTransactionCmd
allOuts <- firstExceptT CompatibleTxCmdError $ mapM (toTxOutInAnyEra sbe) outs

certFilesAndMaybeScriptWits <-
firstExceptT CompatibleScriptWitnessError $
readScriptWitnessFiles sbe certificates
firstExceptT CompatibleScriptWitnessReadError $
readCertificateScriptWitnesses sbe certificates

certsAndMaybeScriptWits :: [(Certificate era, Maybe (ScriptWitness WitCtxStake era))] <-
shelleyBasedEraConstraints sbe $
sequence
[ fmap
(,mSwit)
(,cswScriptWitness <$> mSwit)
( firstExceptT CompatibleFileError . newExceptT $
readFileTextEnvelope AsCertificate (File certFile)
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE TupleSections #-}

module Cardano.CLI.EraBased.Script.Certificate.Read
Expand Down

0 comments on commit c62b2b1

Please sign in to comment.