Skip to content

Commit

Permalink
Parametrise collectScriptHashes on Tx instead of TxBody
Browse files Browse the repository at this point in the history
  • Loading branch information
palas committed Feb 4, 2025
1 parent 29dae50 commit 6e17447
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions cardano-api/internal/Cardano/Api/Plutus.hs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ import Cardano.Api.Query (UTxO, toLedgerUTxO)
import qualified Cardano.Api.ReexposeLedger as L
import Cardano.Api.Script (ScriptHash, fromShelleyScriptHash)
import qualified Cardano.Api.Script as Api
import Cardano.Api.Tx.Body (ScriptWitnessIndex (..), TxBody, toScriptIndex)
import Cardano.Api.Tx.Sign (Tx (..), makeSignedTransaction)
import Cardano.Api.Tx.Body (ScriptWitnessIndex (..), toScriptIndex)
import Cardano.Api.Tx.Sign (Tx (..))

import qualified Cardano.Ledger.Alonzo.Scripts as L
import qualified Cardano.Ledger.Alonzo.UTxO as Alonzo
Expand Down Expand Up @@ -105,12 +105,12 @@ lookupPlutusErrorCode code =
-- and return them in a map with their corresponding 'ScriptWitnessIndex' as key.
collectPlutusScriptHashes
:: AlonzoEraOnwards era
-> TxBody era
-> Tx era
-> UTxO era
-> Map ScriptWitnessIndex ScriptHash
collectPlutusScriptHashes aeo tb utxo =
collectPlutusScriptHashes aeo tx utxo =
alonzoEraOnwardsConstraints aeo $
let ShelleyTx _ ledgerTx' = makeSignedTransaction [] tb
let ShelleyTx _ ledgerTx' = tx
ledgerUTxO = toLedgerUTxO (convert aeo) utxo
in getPurposes aeo $ L.getScriptsNeeded ledgerUTxO (ledgerTx' ^. L.bodyTxL)
where
Expand Down

0 comments on commit 6e17447

Please sign in to comment.