Safe Haskell | None |
---|---|
Language | Haskell2010 |
Cardano.Api.Experimental
Description
This module provides an experimental library interface intended to replace the existing API. It is subject to significant changes. Please, use it with caution.
Synopsis
- newtype UnsignedTx era = UnsignedTx (Tx (LedgerEra era))
- newtype UnsignedTxError = UnsignedTxError TxBodyError
- makeUnsignedTx :: Era era -> TxBodyContent BuildTx era -> Either TxBodyError (UnsignedTx era)
- makeKeyWitness :: Era era -> UnsignedTx era -> ShelleyWitnessSigningKey -> WitVKey 'Witness StandardCrypto
- signTx :: Era era -> [BootstrapWitness StandardCrypto] -> [WitVKey 'Witness StandardCrypto] -> UnsignedTx era -> Tx (LedgerEra era)
- convertTxBodyToUnsignedTx :: HasCallStack => ShelleyBasedEra era -> TxBody era -> UnsignedTx era
- type EraCommonConstraints era = (AlonzoEraTx (LedgerEra era), BabbageEraTxBody (LedgerEra era), EraTx (LedgerEra era), EraUTxO (LedgerEra era), EraCrypto (LedgerEra era) ~ StandardCrypto, ShelleyLedgerEra era ~ LedgerEra era, HashAnnotated (TxBody (LedgerEra era)) EraIndependentTxBody StandardCrypto, IsEra era)
- obtainCommonConstraints :: Era era -> (EraCommonConstraints era => a) -> a
- hashTxBody :: HashAnnotated (TxBody era) EraIndependentTxBody StandardCrypto => TxBody era -> Hash StandardCrypto EraIndependentTxBody
- evaluateTransactionExecutionUnitsShelley :: ShelleyBasedEra era -> SystemStart -> LedgerEpochInfo -> LedgerProtocolParameters era -> UTxO era -> Tx (ShelleyLedgerEra era) -> Either (TransactionValidityError era) (Map ScriptWitnessIndex (Either ScriptExecutionError (EvalTxExecutionUnitsLog, ExecutionUnits)))
- data BabbageEra
- data ConwayEra
- data Era era where
- class IsEra era where
- data Some (f :: k -> Type) where
- type family LedgerEra era = (r :: Type) | r -> era where ...
- newtype DeprecatedEra era = DeprecatedEra (ShelleyBasedEra era)
- eraToSbe :: Era era -> ShelleyBasedEra era
- babbageEraOnwardsToEra :: BabbageEraOnwards era -> Era era
- eraToBabbageEraOnwards :: Era era -> BabbageEraOnwards era
- sbeToEra :: MonadError (DeprecatedEra era) m => ShelleyBasedEra era -> m (Era era)
Creating transactions
For details and an example of creating a transaction using the experimental API, see the Cardano.Api.Internal.Experimental.Tx documentation.
Contents
Transaction-related
newtype UnsignedTx era Source #
A transaction that can contain everything except key witnesses.
Constructors
UnsignedTx (Tx (LedgerEra era)) |
Instances
IsEra era => Show (UnsignedTx era) Source # | |
Defined in Cardano.Api.Internal.Experimental.Tx |
newtype UnsignedTxError Source #
Constructors
UnsignedTxError TxBodyError |
makeUnsignedTx :: Era era -> TxBodyContent BuildTx era -> Either TxBodyError (UnsignedTx era) Source #
makeKeyWitness :: Era era -> UnsignedTx era -> ShelleyWitnessSigningKey -> WitVKey 'Witness StandardCrypto Source #
signTx :: Era era -> [BootstrapWitness StandardCrypto] -> [WitVKey 'Witness StandardCrypto] -> UnsignedTx era -> Tx (LedgerEra era) Source #
convertTxBodyToUnsignedTx :: HasCallStack => ShelleyBasedEra era -> TxBody era -> UnsignedTx era Source #
type EraCommonConstraints era = (AlonzoEraTx (LedgerEra era), BabbageEraTxBody (LedgerEra era), EraTx (LedgerEra era), EraUTxO (LedgerEra era), EraCrypto (LedgerEra era) ~ StandardCrypto, ShelleyLedgerEra era ~ LedgerEra era, HashAnnotated (TxBody (LedgerEra era)) EraIndependentTxBody StandardCrypto, IsEra era) Source #
obtainCommonConstraints :: Era era -> (EraCommonConstraints era => a) -> a Source #
hashTxBody :: HashAnnotated (TxBody era) EraIndependentTxBody StandardCrypto => TxBody era -> Hash StandardCrypto EraIndependentTxBody Source #
evaluateTransactionExecutionUnitsShelley :: ShelleyBasedEra era -> SystemStart -> LedgerEpochInfo -> LedgerProtocolParameters era -> UTxO era -> Tx (ShelleyLedgerEra era) -> Either (TransactionValidityError era) (Map ScriptWitnessIndex (Either ScriptExecutionError (EvalTxExecutionUnitsLog, ExecutionUnits))) Source #
Era-related
data BabbageEra Source #
A type used as a tag to distinguish the Babbage era.
Instances
A type used as a tag to distinguish the Conway era.
Instances
IsAllegraBasedEra ConwayEra Source # | |||||
Defined in Cardano.Api.Internal.Eon.AllegraEraOnwards Methods | |||||
IsAlonzoBasedEra ConwayEra Source # | |||||
Defined in Cardano.Api.Internal.Eon.AlonzoEraOnwards Methods | |||||
IsBabbageBasedEra ConwayEra Source # | |||||
Defined in Cardano.Api.Internal.Eon.BabbageEraOnwards Methods | |||||
IsConwayBasedEra ConwayEra Source # | |||||
Defined in Cardano.Api.Internal.Eon.ConwayEraOnwards Methods | |||||
IsMaryBasedEra ConwayEra Source # | |||||
Defined in Cardano.Api.Internal.Eon.MaryEraOnwards Methods | |||||
IsShelleyBasedEra ConwayEra Source # | |||||
Defined in Cardano.Api.Internal.Eon.ShelleyBasedEra Methods | |||||
IsCardanoEra ConwayEra Source # | |||||
Defined in Cardano.Api.Internal.Eras.Core Methods | |||||
IsEra ConwayEra Source # | |||||
HasTypeProxy ConwayEra Source # | |||||
Defined in Cardano.Api.Internal.Eras.Core Associated Types
| |||||
HasScriptLanguageInEra PlutusScriptV1 ConwayEra Source # | |||||
Defined in Cardano.Api.Internal.Script | |||||
HasScriptLanguageInEra PlutusScriptV2 ConwayEra Source # | |||||
Defined in Cardano.Api.Internal.Script | |||||
HasScriptLanguageInEra PlutusScriptV3 ConwayEra Source # | |||||
Defined in Cardano.Api.Internal.Script | |||||
ToAlonzoScript PlutusScriptV1 ConwayEra Source # | |||||
Defined in Cardano.Api.Internal.Script Methods toLedgerScript :: PlutusScript PlutusScriptV1 -> AlonzoScript (ShelleyLedgerEra ConwayEra) Source # | |||||
ToAlonzoScript PlutusScriptV2 ConwayEra Source # | |||||
Defined in Cardano.Api.Internal.Script Methods toLedgerScript :: PlutusScript PlutusScriptV2 -> AlonzoScript (ShelleyLedgerEra ConwayEra) Source # | |||||
ToAlonzoScript PlutusScriptV3 ConwayEra Source # | |||||
Defined in Cardano.Api.Internal.Script Methods toLedgerScript :: PlutusScript PlutusScriptV3 -> AlonzoScript (ShelleyLedgerEra ConwayEra) Source # | |||||
data AsType ConwayEra Source # | |||||
Defined in Cardano.Api.Internal.Eras.Core |
Represents the latest Cardano blockchain eras, including the one currently on mainnet and the upcoming one.
After a hard fork takes place, the era on mainnet before the hard fork
is deprecated and, after a deprecation period, removed from cardano-api
.
During the deprecation period, cardano-api
users should update their
codebase to the new mainnet era.
Constructors
BabbageEra :: Era BabbageEra | The currently active era on the Cardano mainnet. |
ConwayEra :: Era ConwayEra | The upcoming era in development. |
Instances
Eon Era Source # | A temporary compatibility instance for easier conversion between the experimental and old APIs. |
Defined in Cardano.Api.Internal.Experimental.Eras Methods inEonForEra :: a -> (Era era -> a) -> CardanoEra era -> a Source # | |
TestEquality Era Source # | |
Defined in Cardano.Api.Internal.Experimental.Eras | |
Convert BabbageEraOnwards Era Source # | |
Defined in Cardano.Api.Internal.Experimental.Eras Methods convert :: BabbageEraOnwards era -> Era era Source # | |
Convert Era BabbageEraOnwards Source # | |
Defined in Cardano.Api.Internal.Experimental.Eras Methods convert :: Era era -> BabbageEraOnwards era Source # | |
Convert Era ShelleyBasedEra Source # | |
Defined in Cardano.Api.Internal.Experimental.Eras Methods convert :: Era era -> ShelleyBasedEra era Source # | |
Convert Era CardanoEra Source # | |
Defined in Cardano.Api.Internal.Experimental.Eras Methods convert :: Era era -> CardanoEra era Source # | |
ToJSON (Era era) Source # | |
Defined in Cardano.Api.Internal.Experimental.Eras Methods toEncoding :: Era era -> Encoding toJSONList :: [Era era] -> Value toEncodingList :: [Era era] -> Encoding | |
Show (Era era) Source # | |
Eq (Era era) Source # | |
Pretty (Era era) Source # | |
Defined in Cardano.Api.Internal.Experimental.Eras | |
FromJSON (Some Era) Source # | |
Defined in Cardano.Api.Internal.Experimental.Eras Methods parseJSON :: Value -> Parser (Some Era) parseJSONList :: Value -> Parser [Some Era] omittedField :: Maybe (Some Era) | |
ToJSON (Some Era) Source # | |
Defined in Cardano.Api.Internal.Experimental.Eras | |
Bounded (Some Era) Source # | |
Enum (Some Era) Source # | |
Defined in Cardano.Api.Internal.Experimental.Eras Methods succ :: Some Era -> Some Era Source # pred :: Some Era -> Some Era Source # toEnum :: Int -> Some Era Source # fromEnum :: Some Era -> Int Source # enumFrom :: Some Era -> [Some Era] Source # enumFromThen :: Some Era -> Some Era -> [Some Era] Source # enumFromTo :: Some Era -> Some Era -> [Some Era] Source # enumFromThenTo :: Some Era -> Some Era -> Some Era -> [Some Era] Source # | |
Show (Some Era) Source # | |
Eq (Some Era) Source # | |
Ord (Some Era) Source # | |
Defined in Cardano.Api.Internal.Experimental.Eras | |
Pretty (Some Era) Source # | |
class IsEra era where Source #
Type class interface for the Era
type.
Instances
IsEra BabbageEra Source # | |
Defined in Cardano.Api.Internal.Experimental.Eras Methods useEra :: Era BabbageEra Source # | |
IsEra ConwayEra Source # | |
data Some (f :: k -> Type) where Source #
An existential wrapper for types of kind k -> Type
. It can hold any
era, for example, Some Era
. The era witness can be brought back into scope,
for example, using this pattern:
anyEra = Some ConwayEra -- then later in the code Some era <- pure anyEra obtainCommonConstraints era foo
Constructors
Some :: forall {k} (f :: k -> Type) (a :: k). (Typeable a, Typeable (f a)) => f a -> Some f |
Instances
FromJSON (Some Era) Source # | |
Defined in Cardano.Api.Internal.Experimental.Eras Methods parseJSON :: Value -> Parser (Some Era) parseJSONList :: Value -> Parser [Some Era] omittedField :: Maybe (Some Era) | |
ToJSON (Some Era) Source # | |
Defined in Cardano.Api.Internal.Experimental.Eras | |
Bounded (Some Era) Source # | |
Enum (Some Era) Source # | |
Defined in Cardano.Api.Internal.Experimental.Eras Methods succ :: Some Era -> Some Era Source # pred :: Some Era -> Some Era Source # toEnum :: Int -> Some Era Source # fromEnum :: Some Era -> Int Source # enumFrom :: Some Era -> [Some Era] Source # enumFromThen :: Some Era -> Some Era -> [Some Era] Source # enumFromTo :: Some Era -> Some Era -> [Some Era] Source # enumFromThenTo :: Some Era -> Some Era -> Some Era -> [Some Era] Source # | |
Show (Some Era) Source # | |
Eq (Some Era) Source # | |
Ord (Some Era) Source # | |
Defined in Cardano.Api.Internal.Experimental.Eras | |
Pretty (Some Era) Source # | |
type family LedgerEra era = (r :: Type) | r -> era where ... Source #
Users typically interact with the latest features on the mainnet or experiment with features from the upcoming era. Therefore, protocol versions are limited to the current mainnet era and the next (upcoming) era.
newtype DeprecatedEra era Source #
Constructors
DeprecatedEra (ShelleyBasedEra era) |
Instances
Show (DeprecatedEra era) Source # | |
Defined in Cardano.Api.Internal.Experimental.Eras | |
Pretty (DeprecatedEra era) Source # | |
Defined in Cardano.Api.Internal.Experimental.Eras |
eraToSbe :: Era era -> ShelleyBasedEra era Source #
Deprecated: Use convert
instead.
How to deprecate an era:
- Add the DEPRECATED pragma to the era type tag and constructor at the same time:
{-# DEPRECATED BabbageEra "BabbageEra no longer supported, use ConwayEra" #-} data BabbageEra
- Update the Haddock documentation for the constructor of the deprecated era, mentioning the deprecation.
data Era era where {-# DEPRECATED BabbageEra "BabbageEra no longer supported, use ConwayEra" #-} BabbageEra :: Era BabbageEra -- | The era currently active on Cardano's mainnet. ConwayEra :: Era ConwayEra
- Add a new
IsEra
instance and update the deprecated era instance to produce a compile-time error:
instance TypeError ('Text "IsEra BabbageEra: Deprecated. Update to ConwayEra") => IsEra BabbageEra where useEra = error "unreachable" instance IsEra ConwayEra where useEra = ConwayEra
babbageEraOnwardsToEra :: BabbageEraOnwards era -> Era era Source #
Deprecated: Use convert
instead.
eraToBabbageEraOnwards :: Era era -> BabbageEraOnwards era Source #
Deprecated: Use convert
instead.
sbeToEra :: MonadError (DeprecatedEra era) m => ShelleyBasedEra era -> m (Era era) Source #