Skip to content

Commit

Permalink
Merge pull request #689 from IntersectMBO/expose-era-tx-wits
Browse files Browse the repository at this point in the history
Expose `EraTxWits`, `TxDats`, and functions for converting datums and scripts to JSON
  • Loading branch information
palas authored Nov 28, 2024
2 parents 997122e + 72a82e2 commit a8446e7
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 4 deletions.
22 changes: 18 additions & 4 deletions cardano-api/internal/Cardano/Api/ReexposeLedger.hs
Original file line number Diff line number Diff line change
Expand Up @@ -120,17 +120,28 @@ module Cardano.Api.ReexposeLedger
, AsIx (..)
, CoinPerWord (..)
, Data (..)
, EraTxWits (..)
, ExUnits (..)
, Language
, Plutus
, Prices (..)
, Script
, CostModels
, AlonzoGenesis
, AsIxItem (..)
, EraGov
, EraTx (witsTxL, bodyTxL)
, Tx
, TxDats (..)
, getNativeScript
, languageToText
, plutusBinary
, plutusScriptLanguage
, ppPricesL
, unData
, unRedeemers
, serializeAsHexText
, showTimelock
-- Base
, boundRational
, unboundRational
Expand Down Expand Up @@ -167,28 +178,30 @@ module Cardano.Api.ReexposeLedger
where

import Cardano.Crypto.Hash.Class (hashFromBytes, hashToBytes)
import Cardano.Ledger.Allegra.Scripts (showTimelock)
import Cardano.Ledger.Alonzo.Core (AlonzoEraScript (..), AlonzoEraTxBody (..),
AlonzoEraTxWits (..), AsIx (..), AsIxItem (AsIxItem), CoinPerWord (..), EraGov,
EraTx (bodyTxL, witsTxL), PParamsUpdate (..), Tx, ppPricesL)
EraTx (bodyTxL, witsTxL), EraTxWits (..), PParamsUpdate (..), Tx, ppPricesL)
import Cardano.Ledger.Alonzo.Genesis (AlonzoGenesis)
import Cardano.Ledger.Alonzo.Scripts (AlonzoPlutusPurpose (..), CostModels, ExUnits (..),
Prices (..))
Prices (..), Script, plutusScriptLanguage)
import Cardano.Ledger.Alonzo.TxWits (TxDats (..))
import Cardano.Ledger.Api (Constitution (..), GovAction (..), unRedeemers)
import Cardano.Ledger.Api.Tx.Cert (pattern AuthCommitteeHotKeyTxCert,
pattern DelegStakeTxCert, pattern DelegTxCert, pattern GenesisDelegTxCert,
pattern MirTxCert, pattern RegDRepTxCert, pattern RegDepositDelegTxCert,
pattern RegDepositTxCert, pattern RegPoolTxCert, pattern RegTxCert,
pattern ResignCommitteeColdTxCert, pattern RetirePoolTxCert,
pattern UnRegDRepTxCert, pattern UnRegDepositTxCert, pattern UnRegTxCert)
import Cardano.Ledger.Babbage.Core (CoinPerByte (..))
import Cardano.Ledger.Babbage.Core (CoinPerByte (..), getNativeScript)
import Cardano.Ledger.BaseTypes (AnchorData (..), DnsName, EpochInterval (..),
Network (..), NonNegativeInterval, ProtVer (..), StrictMaybe (..), UnitInterval,
Url, boundRational, dnsToText, hashAnchorData, maybeToStrictMaybe, mkVersion,
portToWord16, strictMaybeToMaybe, textToDns, textToUrl, txIxToInt,
unboundRational, urlToText)
import Cardano.Ledger.Binary (Annotated (..), ByteSpan (..), byronProtVer, fromCBOR,
serialize', slice, toCBOR, toPlainDecoder)
import Cardano.Ledger.Binary.Plain (Decoder)
import Cardano.Ledger.Binary.Plain (Decoder, serializeAsHexText)
import Cardano.Ledger.CertState (DRepState (..), csCommitteeCredsL)
import Cardano.Ledger.Coin (Coin (..), addDeltaCoin, toDeltaCoin)
import Cardano.Ledger.Conway.Core (DRepVotingThresholds (..), PoolVotingThresholds (..),
Expand All @@ -210,6 +223,7 @@ import Cardano.Ledger.DRep (DRep (..), drepAnchorL, drepDepositL, drep
import Cardano.Ledger.Keys (HasKeyRole, KeyHash (..), KeyRole (..), VKey (..),
hashWithSerialiser)
import Cardano.Ledger.Plutus.Data (Data (..), unData)
import Cardano.Ledger.Plutus.Language (Language, Plutus, languageToText, plutusBinary)
import Cardano.Ledger.PoolParams (PoolMetadata (..), PoolParams (..), StakePoolRelay (..))
import Cardano.Ledger.SafeHash (SafeHash, castSafeHash, extractHash, unsafeMakeSafeHash)
import Cardano.Ledger.Shelley.API (AccountState (..), GenDelegPair (..),
Expand Down
1 change: 1 addition & 0 deletions cardano-api/internal/Cardano/Api/ScriptData.hs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE DerivingVia #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE InstanceSigs #-}
{-# LANGUAGE LambdaCase #-}
Expand Down
1 change: 1 addition & 0 deletions cardano-api/src/Cardano/Api.hs
Original file line number Diff line number Diff line change
Expand Up @@ -532,6 +532,7 @@ module Cardano.Api
, eraOfScriptInEra
, HasScriptLanguageInEra (..)
, ToAlonzoScript (..)
, AlonzoEraOnwardsConstraints

-- ** Use of a script in an era as a witness
, WitCtxTxIn
Expand Down

0 comments on commit a8446e7

Please sign in to comment.