cardano-api-1.35.4
Safe Haskell None
Language Haskell2010

Cardano.Api

Contents

Description

This module provides a library interface for interacting with Cardano as a user of the system.

It is intended to be the complete API covering everything but without exposing constructors that reveal any lower level types.

In the interest of simplicity it glosses over some details of the system. Most simple tools should be able to work just using this interface, however you can go deeper and expose the types from the underlying libraries using Cardano.Api.Byron or Cardano.Api.Shelley .

Synopsis

Eras

data CardanoEra era where Source #

This GADT provides a value-level representation of all the Cardano eras. This enables pattern matching on the era to allow them to be treated in a non-uniform way.

This can be used in combination with the IsCardanoEra class to get access to this value.

In combination this can often enable code that handles all eras, and does so uniformly where possible, and non-uniformly where necessary.

data AnyCardanoEra where Source #

Instances

Instances details
Bounded AnyCardanoEra Source #
Instance details

Defined in Cardano.Api.Eras

Enum AnyCardanoEra Source #
Instance details

Defined in Cardano.Api.Eras

Eq AnyCardanoEra Source #
Instance details

Defined in Cardano.Api.Eras

Show AnyCardanoEra Source #
Instance details

Defined in Cardano.Api.Eras

ToJSON AnyCardanoEra Source #
Instance details

Defined in Cardano.Api.Eras

FromJSON AnyCardanoEra Source #
Instance details

Defined in Cardano.Api.Eras

anyCardanoEra :: CardanoEra era -> AnyCardanoEra Source #

Like the AnyCardanoEra constructor but does not demand a IsCardanoEra class constraint.

data InAnyCardanoEra thing where Source #

This pairs up some era-dependent type with a CardanoEra value that tells us what era it is, but hides the era type. This is useful when the era is not statically known, for example when deserialising from a file.

Constructors

InAnyCardanoEra :: IsCardanoEra era => CardanoEra era -> thing era -> InAnyCardanoEra thing

Shelley-based eras

data ShelleyBasedEra era where Source #

While the Byron and Shelley eras are quite different, there are several eras that are based on Shelley with only minor differences. It is useful to be able to treat the Shelley-based eras in a mostly-uniform way.

Values of this type witness the fact that the era is Shelley-based. This can be used to constrain the era to being a Shelley-based on. It allows non-uniform handling making case distinctions on the constructor.

data InAnyShelleyBasedEra thing where Source #

This pairs up some era-dependent type with a ShelleyBasedEra value that tells us what era it is, but hides the era type. This is useful when the era is not statically known, for example when deserialising from a file.

data CardanoEraStyle era where Source #

This is the same essential information as CardanoEra but instead of a flat set of alternative eras, it is factored into the legcy Byron era and the current Shelley-based eras.

This way of factoring the eras is useful because in many cases the major differences are between the Byron and Shelley-based eras, and the Shelley-based eras can often be treated uniformly.

Deprecated

type Byron = ByronEra Source #

Deprecated: Use ByronEra or ByronAddr as appropriate

type Shelley = ShelleyEra Source #

Deprecated: Use ShelleyEra or ShelleyAddr as appropriate

type Mary = MaryEra Source #

Deprecated: Use MaryEra instead

Type tags

class HasTypeProxy t where Source #

Associated Types

data AsType t Source #

A family of singleton types used in this API to indicate which type to use where it would otherwise be ambiguous or merely unclear.

Values of this type are passed to deserialisation functions for example.

Instances

Instances details
HasTypeProxy BabbageEra Source #
Instance details

Defined in Cardano.Api.Eras

HasTypeProxy AlonzoEra Source #
Instance details

Defined in Cardano.Api.Eras

HasTypeProxy MaryEra Source #
Instance details

Defined in Cardano.Api.Eras

Associated Types

data AsType MaryEra Source #

HasTypeProxy AllegraEra Source #
Instance details

Defined in Cardano.Api.Eras

HasTypeProxy ShelleyEra Source #
Instance details

Defined in Cardano.Api.Eras

HasTypeProxy ByronEra Source #
Instance details

Defined in Cardano.Api.Eras

HasTypeProxy TxMetadata Source #
Instance details

Defined in Cardano.Api.TxMetadata

HasTypeProxy TextEnvelope Source #
Instance details

Defined in Cardano.Api.SerialiseTextEnvelope

HasTypeProxy TxId Source #
Instance details

Defined in Cardano.Api.TxIn

Associated Types

data AsType TxId Source #

HasTypeProxy StakePoolKey Source #
Instance details

Defined in Cardano.Api.KeysShelley

HasTypeProxy GenesisUTxOKey Source #
Instance details

Defined in Cardano.Api.KeysShelley

HasTypeProxy GenesisDelegateExtendedKey Source #
Instance details

Defined in Cardano.Api.KeysShelley

HasTypeProxy GenesisDelegateKey Source #
Instance details

Defined in Cardano.Api.KeysShelley

HasTypeProxy GenesisExtendedKey Source #
Instance details

Defined in Cardano.Api.KeysShelley

HasTypeProxy GenesisKey Source #
Instance details

Defined in Cardano.Api.KeysShelley

HasTypeProxy StakeExtendedKey Source #
Instance details

Defined in Cardano.Api.KeysShelley

HasTypeProxy StakeKey Source #
Instance details

Defined in Cardano.Api.KeysShelley

HasTypeProxy PaymentExtendedKey Source #
Instance details

Defined in Cardano.Api.KeysShelley

HasTypeProxy PaymentKey Source #
Instance details

Defined in Cardano.Api.KeysShelley

HasTypeProxy ScriptData Source #
Instance details

Defined in Cardano.Api.ScriptData

HasTypeProxy ByronKeyLegacy Source #
Instance details

Defined in Cardano.Api.KeysByron

HasTypeProxy ByronKey Source #
Instance details

Defined in Cardano.Api.KeysByron

HasTypeProxy ByronVote Source #
Instance details

Defined in Cardano.Api.SpecialByron

HasTypeProxy ByronUpdateProposal Source #
Instance details

Defined in Cardano.Api.SpecialByron

HasTypeProxy VrfKey Source #
Instance details

Defined in Cardano.Api.KeysPraos

Associated Types

data AsType VrfKey Source #

HasTypeProxy KesKey Source #
Instance details

Defined in Cardano.Api.KeysPraos

Associated Types

data AsType KesKey Source #

HasTypeProxy ScriptHash Source #
Instance details

Defined in Cardano.Api.Script

HasTypeProxy ScriptInAnyLang Source #
Instance details

Defined in Cardano.Api.Script

HasTypeProxy PlutusScriptV2 Source #
Instance details

Defined in Cardano.Api.Script

HasTypeProxy PlutusScriptV1 Source #
Instance details

Defined in Cardano.Api.Script

HasTypeProxy SimpleScriptV2 Source #
Instance details

Defined in Cardano.Api.Script

HasTypeProxy SimpleScriptV1 Source #
Instance details

Defined in Cardano.Api.Script

HasTypeProxy StakePoolMetadata Source #
Instance details

Defined in Cardano.Api.StakePoolMetadata

HasTypeProxy StakeAddress Source #
Instance details

Defined in Cardano.Api.Address

HasTypeProxy AddressAny Source #
Instance details

Defined in Cardano.Api.Address

HasTypeProxy ShelleyAddr Source #
Instance details

Defined in Cardano.Api.Address

HasTypeProxy ByronAddr Source #
Instance details

Defined in Cardano.Api.Address

HasTypeProxy AssetName Source #
Instance details

Defined in Cardano.Api.Value

HasTypeProxy PolicyId Source #
Instance details

Defined in Cardano.Api.Value

HasTypeProxy UpdateProposal Source #
Instance details

Defined in Cardano.Api.ProtocolParameters

HasTypeProxy PraosNonce Source #
Instance details

Defined in Cardano.Api.ProtocolParameters

HasTypeProxy Certificate Source #
Instance details

Defined in Cardano.Api.Certificate

HasTypeProxy OperationalCertificateIssueCounter Source #
Instance details

Defined in Cardano.Api.OperationalCertificate

HasTypeProxy OperationalCertificate Source #
Instance details

Defined in Cardano.Api.OperationalCertificate

HasTypeProxy BlockHeader Source #
Instance details

Defined in Cardano.Api.Block

HasTypeProxy a => HasTypeProxy ( Hash a) Source #
Instance details

Defined in Cardano.Api.Hash

Associated Types

data AsType ( Hash a) Source #

HasTypeProxy a => HasTypeProxy ( VerificationKey a) Source #
Instance details

Defined in Cardano.Api.Key

Associated Types

data AsType ( VerificationKey a) Source #

HasTypeProxy a => HasTypeProxy ( SigningKey a) Source #
Instance details

Defined in Cardano.Api.Key

Associated Types

data AsType ( SigningKey a) Source #

HasTypeProxy lang => HasTypeProxy ( PlutusScript lang) Source #
Instance details

Defined in Cardano.Api.Script

Associated Types

data AsType ( PlutusScript lang) Source #

HasTypeProxy lang => HasTypeProxy ( SimpleScript lang) Source #
Instance details

Defined in Cardano.Api.Script

Associated Types

data AsType ( SimpleScript lang) Source #

HasTypeProxy era => HasTypeProxy ( ScriptInEra era) Source #
Instance details

Defined in Cardano.Api.Script

Associated Types

data AsType ( ScriptInEra era) Source #

HasTypeProxy lang => HasTypeProxy ( Script lang) Source #
Instance details

Defined in Cardano.Api.Script

Associated Types

data AsType ( Script lang) Source #

HasTypeProxy era => HasTypeProxy ( AddressInEra era) Source #
Instance details

Defined in Cardano.Api.Address

Associated Types

data AsType ( AddressInEra era) Source #

HasTypeProxy addrtype => HasTypeProxy ( Address addrtype) Source #
Instance details

Defined in Cardano.Api.Address

Associated Types

data AsType ( Address addrtype) Source #

HasTypeProxy era => HasTypeProxy ( TxBody era) Source #
Instance details

Defined in Cardano.Api.TxBody

Associated Types

data AsType ( TxBody era) Source #

HasTypeProxy era => HasTypeProxy ( KeyWitness era) Source #
Instance details

Defined in Cardano.Api.Tx

Associated Types

data AsType ( KeyWitness era) Source #

HasTypeProxy era => HasTypeProxy ( Tx era) Source #
Instance details

Defined in Cardano.Api.Tx

Associated Types

data AsType ( Tx era) Source #

Cryptographic key interface

class ( Eq ( VerificationKey keyrole), Show ( VerificationKey keyrole), SerialiseAsRawBytes ( Hash keyrole), HasTextEnvelope ( VerificationKey keyrole), HasTextEnvelope ( SigningKey keyrole)) => Key keyrole where Source #

An interface for cryptographic keys used for signatures with a SigningKey and a VerificationKey key.

This interface does not provide actual signing or verifying functions since this API is concerned with the management of keys: generating and serialising.

Associated Types

data VerificationKey keyrole :: Type Source #

The type of cryptographic verification key, for each key role.

data SigningKey keyrole :: Type Source #

The type of cryptographic signing key, for each key role.

Methods

getVerificationKey :: SigningKey keyrole -> VerificationKey keyrole Source #

Get the corresponding verification key from a signing key.

deterministicSigningKey :: AsType keyrole -> Seed -> SigningKey keyrole Source #

Generate a SigningKey deterministically, given a Seed . The required size of the seed is given by deterministicSigningKeySeedSize .

deterministicSigningKeySeedSize :: AsType keyrole -> Word Source #

verificationKeyHash :: VerificationKey keyrole -> Hash keyrole Source #

Instances

Instances details
Key StakePoolKey Source #
Instance details

Defined in Cardano.Api.KeysShelley

Key GenesisUTxOKey Source #
Instance details

Defined in Cardano.Api.KeysShelley

Key GenesisDelegateExtendedKey Source #
Instance details

Defined in Cardano.Api.KeysShelley

Key GenesisDelegateKey Source #
Instance details

Defined in Cardano.Api.KeysShelley

Key GenesisExtendedKey Source #
Instance details

Defined in Cardano.Api.KeysShelley

Key GenesisKey Source #
Instance details

Defined in Cardano.Api.KeysShelley

Key StakeExtendedKey Source #
Instance details

Defined in Cardano.Api.KeysShelley

Key StakeKey Source #
Instance details

Defined in Cardano.Api.KeysShelley

Key PaymentExtendedKey Source #
Instance details

Defined in Cardano.Api.KeysShelley

Key PaymentKey Source #
Instance details

Defined in Cardano.Api.KeysShelley

Key ByronKeyLegacy Source #
Instance details

Defined in Cardano.Api.KeysByron

Key ByronKey Source #
Instance details

Defined in Cardano.Api.KeysByron

Key VrfKey Source #
Instance details

Defined in Cardano.Api.KeysPraos

Key KesKey Source #
Instance details

Defined in Cardano.Api.KeysPraos

castVerificationKey :: CastVerificationKeyRole keyroleA keyroleB => VerificationKey keyroleA -> VerificationKey keyroleB Source #

Change the role of a VerificationKey , if the representation permits.

castSigningKey :: CastSigningKeyRole keyroleA keyroleB => SigningKey keyroleA -> SigningKey keyroleB Source #

Change the role of a SigningKey , if the representation permits.

generateSigningKey :: Key keyrole => AsType keyrole -> IO ( SigningKey keyrole) Source #

Generate a SigningKey using a seed from operating system entropy.

Hashes

In Cardano most keys are identified by their hash, and hashes are used in many other places.

data family Hash keyrole :: Type Source #

Instances

Instances details
Eq ( Hash StakePoolKey ) Source #
Instance details

Defined in Cardano.Api.KeysShelley

Eq ( Hash GenesisUTxOKey ) Source #
Instance details

Defined in Cardano.Api.KeysShelley

Eq ( Hash GenesisDelegateExtendedKey ) Source #
Instance details

Defined in Cardano.Api.KeysShelley

Eq ( Hash GenesisDelegateKey ) Source #
Instance details

Defined in Cardano.Api.KeysShelley

Eq ( Hash GenesisExtendedKey ) Source #
Instance details

Defined in Cardano.Api.KeysShelley

Eq ( Hash GenesisKey ) Source #
Instance details

Defined in Cardano.Api.KeysShelley

Eq ( Hash StakeExtendedKey ) Source #
Instance details

Defined in Cardano.Api.KeysShelley

Eq ( Hash StakeKey ) Source #
Instance details

Defined in Cardano.Api.KeysShelley

Eq ( Hash PaymentExtendedKey ) Source #
Instance details

Defined in Cardano.Api.KeysShelley

Eq ( Hash PaymentKey ) Source #
Instance details

Defined in Cardano.Api.KeysShelley

Eq ( Hash ScriptData ) Source #
Instance details

Defined in Cardano.Api.ScriptData

Eq ( Hash ByronKeyLegacy ) Source #
Instance details

Defined in Cardano.Api.KeysByron

Eq ( Hash ByronKey ) Source #
Instance details

Defined in Cardano.Api.KeysByron

Eq ( Hash VrfKey ) Source #
Instance details

Defined in Cardano.Api.KeysPraos

Eq ( Hash KesKey ) Source #
Instance details

Defined in Cardano.Api.KeysPraos

Eq ( Hash StakePoolMetadata ) Source #
Instance details

Defined in Cardano.Api.StakePoolMetadata

Eq ( Hash BlockHeader ) Source #
Instance details

Defined in Cardano.Api.Block

Ord ( Hash StakePoolKey ) Source #
Instance details

Defined in Cardano.Api.KeysShelley

Ord ( Hash GenesisUTxOKey ) Source #
Instance details

Defined in Cardano.Api.KeysShelley

Ord ( Hash GenesisDelegateExtendedKey ) Source #
Instance details

Defined in Cardano.Api.KeysShelley

Ord ( Hash GenesisDelegateKey ) Source #
Instance details

Defined in Cardano.Api.KeysShelley

Ord ( Hash GenesisExtendedKey ) Source #
Instance details

Defined in Cardano.Api.KeysShelley

Ord ( Hash GenesisKey ) Source #
Instance details

Defined in Cardano.Api.KeysShelley

Ord ( Hash StakeExtendedKey ) Source #
Instance details

Defined in Cardano.Api.KeysShelley

Ord ( Hash StakeKey ) Source #
Instance details

Defined in Cardano.Api.KeysShelley

Ord ( Hash PaymentExtendedKey ) Source #
Instance details

Defined in Cardano.Api.KeysShelley

Ord ( Hash PaymentKey ) Source #
Instance details

Defined in Cardano.Api.KeysShelley

Ord ( Hash ScriptData ) Source #
Instance details

Defined in Cardano.Api.ScriptData

Ord ( Hash ByronKeyLegacy ) Source #
Instance details

Defined in Cardano.Api.KeysByron