cardano-api:internal
Safe HaskellNone
LanguageHaskell2010

Cardano.Api.Query

Description

Queries from local clients to the node.

Synopsis

Queries

data QueryInEra era result where Source #

Constructors

QueryByronUpdateState :: QueryInEra ByronEra ByronUpdateState 
QueryInShelleyBasedEra :: forall era result. ShelleyBasedEra era -> QueryInShelleyBasedEra era result -> QueryInEra era result 

Instances

Instances details
Show (QueryInEra era result) Source # 
Instance details

Defined in Cardano.Api.Query

Methods

showsPrec :: Int -> QueryInEra era result -> ShowS Source #

show :: QueryInEra era result -> String Source #

showList :: [QueryInEra era result] -> ShowS Source #

NodeToClientVersionOf (QueryInEra era result) Source # 
Instance details

Defined in Cardano.Api.Query

data QueryInShelleyBasedEra era result where Source #

Constructors

QueryEpoch :: forall era. QueryInShelleyBasedEra era EpochNo 
QueryGenesisParameters :: forall era. QueryInShelleyBasedEra era (GenesisParameters ShelleyEra) 
QueryProtocolParameters :: forall era. QueryInShelleyBasedEra era (PParams (ShelleyLedgerEra era)) 
QueryProtocolParametersUpdate :: forall era. QueryInShelleyBasedEra era (Map (Hash GenesisKey) ProtocolParametersUpdate) 
QueryStakeDistribution :: forall era. QueryInShelleyBasedEra era (Map (Hash StakePoolKey) Rational) 
QueryUTxO :: forall era. QueryUTxOFilter -> QueryInShelleyBasedEra era (UTxO era) 
QueryStakeAddresses :: forall era. Set StakeCredential -> NetworkId -> QueryInShelleyBasedEra era (Map StakeAddress Coin, Map StakeAddress PoolId) 
QueryStakePools :: forall era. QueryInShelleyBasedEra era (Set PoolId) 
QueryStakePoolParameters :: forall era. Set PoolId -> QueryInShelleyBasedEra era (Map PoolId StakePoolParameters) 
QueryDebugLedgerState :: forall era. QueryInShelleyBasedEra era (SerialisedDebugLedgerState era) 
QueryProtocolState :: forall era. QueryInShelleyBasedEra era (ProtocolState era) 
QueryCurrentEpochState :: forall era. QueryInShelleyBasedEra era (SerialisedCurrentEpochState era) 
QueryPoolState :: forall era. Maybe (Set PoolId) -> QueryInShelleyBasedEra era (SerialisedPoolState era) 
QueryPoolDistribution :: forall era. Maybe (Set PoolId) -> QueryInShelleyBasedEra era (SerialisedPoolDistribution era) 
QueryStakeSnapshot :: forall era. Maybe (Set PoolId) -> QueryInShelleyBasedEra era (SerialisedStakeSnapshots era) 
QueryStakeDelegDeposits :: forall era. Set StakeCredential -> QueryInShelleyBasedEra era (Map StakeCredential Coin) 
QueryAccountState :: forall era. QueryInShelleyBasedEra era AccountState 
QueryConstitution :: forall era. QueryInShelleyBasedEra era (Constitution (ShelleyLedgerEra era)) 
QueryGovState :: forall era. QueryInShelleyBasedEra era (GovState (ShelleyLedgerEra era)) 
QueryDRepState :: forall era. Set (Credential 'DRepRole StandardCrypto) -> QueryInShelleyBasedEra era (Map (Credential 'DRepRole StandardCrypto) (DRepState StandardCrypto)) 
QueryDRepStakeDistr :: forall era. Set (DRep StandardCrypto) -> QueryInShelleyBasedEra era (Map (DRep StandardCrypto) Coin) 
QuerySPOStakeDistr :: forall era. Set (KeyHash 'StakePool StandardCrypto) -> QueryInShelleyBasedEra era (Map (KeyHash 'StakePool StandardCrypto) Coin) 
QueryCommitteeMembersState :: forall era. Set (Credential 'ColdCommitteeRole StandardCrypto) -> Set (Credential 'HotCommitteeRole StandardCrypto) -> Set MemberStatus -> QueryInShelleyBasedEra era (CommitteeMembersState StandardCrypto) 
QueryStakeVoteDelegatees :: forall era. Set StakeCredential -> QueryInShelleyBasedEra era (Map StakeCredential (DRep StandardCrypto)) 

Instances

Instances details
Show (QueryInShelleyBasedEra era result) Source # 
Instance details

Defined in Cardano.Api.Query

NodeToClientVersionOf (QueryInShelleyBasedEra era result) Source #

Mapping for queries in Shelley-based eras returning minimal node-to-client protocol versions. More information about queries versioning can be found: * https://ouroboros-network.cardano.intersectmbo.org/ouroboros-network/Ouroboros-Network-NodeToClient.html#t:NodeToClientVersion * https://ouroboros-consensus.cardano.intersectmbo.org/docs/for-developers/QueryVersioning/#implementation

Instance details

Defined in Cardano.Api.Query

data QueryUTxOFilter Source #

Getting the whole UTxO is obviously not efficient since the result can be huge. Filtering by address is also not efficient because it requires a linear search.

The QueryUTxOFilterByTxIn is efficient since it fits with the structure of the UTxO (which is indexed by TxIn).

Constructors

QueryUTxOWhole

O(n) time and space for utxo size n

QueryUTxOByAddress (Set AddressAny)

O(n) time, O(m) space for utxo size n, and address set size m

QueryUTxOByTxIn (Set TxIn)

O(m log n) time, O(m) space for utxo size n, and address set size m

newtype UTxO era Source #

Constructors

UTxO 

Fields

Instances

Instances details
(IsShelleyBasedEra era, FromJSON (TxOut CtxUTxO era)) => FromJSON (UTxO era) Source # 
Instance details

Defined in Cardano.Api.Query

Methods

parseJSON :: Value -> Parser (UTxO era) #

parseJSONList :: Value -> Parser [UTxO era] #

omittedField :: Maybe (UTxO era) #

IsCardanoEra era => ToJSON (UTxO era) Source # 
Instance details

Defined in Cardano.Api.Query

Methods

toJSON :: UTxO era -> Value #

toEncoding :: UTxO era -> Encoding #

toJSONList :: [UTxO era] -> Value #

toEncodingList :: [UTxO era] -> Encoding #

omitField :: UTxO era -> Bool #

Show (UTxO era) Source # 
Instance details

Defined in Cardano.Api.Query

Methods

showsPrec :: Int -> UTxO era -> ShowS Source #

show :: UTxO era -> String Source #

showList :: [UTxO era] -> ShowS Source #

Eq (UTxO era) Source # 
Instance details

Defined in Cardano.Api.Query

Methods

(==) :: UTxO era -> UTxO era -> Bool Source #

(/=) :: UTxO era -> UTxO era -> Bool Source #

data UTxOInAnyEra where Source #

Constructors

UTxOInAnyEra :: forall era. CardanoEra era -> UTxO era -> UTxOInAnyEra 

Instances

Instances details
Show UTxOInAnyEra Source # 
Instance details

Defined in Cardano.Api.Query

Internal conversion functions

fromConsensusQueryResult :: (HasCallStack, CardanoBlock StandardCrypto ~ block) => QueryInMode result -> Query block result' -> result' -> result Source #

Wrapper types used in queries

newtype DebugLedgerState era Source #

Instances

Instances details
IsShelleyBasedEra era => ToJSON (DebugLedgerState era) Source # 
Instance details

Defined in Cardano.Api.Query.Types

Methods

toJSON :: DebugLedgerState era -> Value #

toEncoding :: DebugLedgerState era -> Encoding #

toJSONList :: [DebugLedgerState era] -> Value #

toEncodingList :: [DebugLedgerState era] -> Encoding #

omitField :: DebugLedgerState era -> Bool #

IsShelleyBasedEra era => FromCBOR (DebugLedgerState era) Source # 
Instance details

Defined in Cardano.Api.Query.Types

newtype PoolState era Source #

Constructors

PoolState (PState (ShelleyLedgerEra era)) 

data EraHistory where Source #

Constructors

EraHistory :: forall (xs :: [Type]). CardanoBlock StandardCrypto ~ HardForkBlock xs => Interpreter xs -> EraHistory 

newtype SystemStart Source #

System start

Slots are counted from the system start.

Constructors

SystemStart 

Instances

Instances details
FromJSON SystemStart 
Instance details

Defined in Cardano.Slotting.Time

Methods

parseJSON :: Value -> Parser SystemStart #

parseJSONList :: Value -> Parser [SystemStart] #

omittedField :: Maybe SystemStart #

ToJSON SystemStart 
Instance details

Defined in Cardano.Slotting.Time

Methods

toJSON :: SystemStart -> Value #

toEncoding :: SystemStart -> Encoding #

toJSONList :: [SystemStart] -> Value #

toEncodingList :: [SystemStart] -> Encoding #

omitField :: SystemStart -> Bool #

Generic SystemStart 
Instance details

Defined in Cardano.Slotting.Time

Associated Types

type Rep SystemStart 
Instance details

Defined in Cardano.Slotting.Time

type Rep SystemStart = D1 ('MetaData "SystemStart" "Cardano.Slotting.Time" "cardano-slotting-0.2.0.0-1881c023e0886f672d28a4c45a256e973fe8d96632667e110b19ce5f49f52117" 'True) (C1 ('MetaCons "SystemStart" 'PrefixI 'True) (S1 ('MetaSel ('Just "getSystemStart") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 UTCTime)))
Show SystemStart 
Instance details

Defined in Cardano.Slotting.Time

FromCBOR SystemStart 
Instance details

Defined in Cardano.Slotting.Time

ToCBOR SystemStart 
Instance details

Defined in Cardano.Slotting.Time

DecCBOR SystemStart 
Instance details

Defined in Cardano.Ledger.Binary.Decoding.DecCBOR

EncCBOR SystemStart 
Instance details

Defined in Cardano.Ledger.Binary.Encoding.EncCBOR

Eq SystemStart 
Instance details

Defined in Cardano.Slotting.Time

NoThunks SystemStart 
Instance details

Defined in Cardano.Slotting.Time

Methods

noThunks :: Context -> SystemStart -> IO (Maybe ThunkInfo) #

wNoThunks :: Context -> SystemStart -> IO (Maybe ThunkInfo) #

showTypeOf :: Proxy SystemStart -> String #

Serialise SystemStart 
Instance details

Defined in Cardano.Slotting.Time

type Rep SystemStart 
Instance details

Defined in Cardano.Slotting.Time

type Rep SystemStart = D1 ('MetaData "SystemStart" "Cardano.Slotting.Time" "cardano-slotting-0.2.0.0-1881c023e0886f672d28a4c45a256e973fe8d96632667e110b19ce5f49f52117" 'True) (C1 ('MetaCons "SystemStart" 'PrefixI 'True) (S1 ('MetaSel ('Just "getSystemStart") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 UTCTime)))

newtype SlotsInEpoch Source #

Constructors

SlotsInEpoch Word64 

data family LedgerState blk Source #

Ledger state associated with a block

This is the Consensus notion of a ledger state. Each block type is associated with one of the Ledger types for the ledger state. Virtually every concept in this codebase revolves around this type, or the referenced blk. Whenever we use the type variable l, we intend to denote that the expected instantiation is either a LedgerState or some wrapper over it (like the ExtLedgerState).

The main operations we can do with a LedgerState are ticking (defined in IsLedger), and applying a block (defined in ApplyBlock).

Instances

Instances details
Inject LedgerState 
Instance details

Defined in Ouroboros.Consensus.HardFork.Combinator.Embed.Nary

Methods

inject :: forall x (xs :: [Type]). CanHardFork xs => Exactly xs Bound -> Index xs x -> LedgerState x -> LedgerState (HardForkBlock xs) Source #

Isomorphic LedgerState 
Instance details

Defined in Ouroboros.Consensus.HardFork.Combinator.Embed.Unary

CanHardFork xs => Show (LedgerState (HardForkBlock xs)) 
Instance details

Defined in Ouroboros.Consensus.HardFork.Combinator.Basics

Bridge m a => Show (LedgerState (DualBlock m a)) 
Instance details

Defined in Ouroboros.Consensus.Ledger.Dual

CanHardFork xs => Eq (LedgerState (HardForkBlock xs)) 
Instance details

Defined in Ouroboros.Consensus.HardFork.Combinator.Basics

Bridge m a => Eq (LedgerState (DualBlock m a)) 
Instance details

Defined in Ouroboros.Consensus.Ledger.Dual

CanHardFork xs => NoThunks (LedgerState (HardForkBlock xs)) 
Instance details

Defined in Ouroboros.Consensus.HardFork.Combinator.Basics

Methods

noThunks :: Context -> LedgerState (HardForkBlock xs) -> IO (Maybe ThunkInfo) #

wNoThunks :: Context -> LedgerState (HardForkBlock xs) -> IO (Maybe ThunkInfo) #

showTypeOf :: Proxy (LedgerState (HardForkBlock xs)) -> String #

NoThunks (LedgerState (DualBlock m a)) 
Instance details

Defined in Ouroboros.Consensus.Ledger.Dual

Methods

noThunks :: Context -> LedgerState (DualBlock m a) -> IO (Maybe ThunkInfo) #

wNoThunks :: Context -> LedgerState (DualBlock m a) -> IO (Maybe ThunkInfo) #

showTypeOf :: Proxy (LedgerState (DualBlock m a)) -> String #

NoThunks (Ticked (LedgerState (DualBlock m a))) 
Instance details

Defined in Ouroboros.Consensus.Ledger.Dual

Methods

noThunks :: Context -> Ticked (LedgerState (DualBlock m a)) -> IO (Maybe ThunkInfo) #

wNoThunks :: Context -> Ticked (LedgerState (DualBlock m a)) -> IO (Maybe ThunkInfo) #

showTypeOf :: Proxy (Ticked (LedgerState (DualBlock m a))) -> String #

Bridge m a => GetTip (LedgerState (DualBlock m a)) 
Instance details

Defined in Ouroboros.Consensus.Ledger.Dual

Bridge m a => GetTip (Ticked (LedgerState (DualBlock m a))) 
Instance details

Defined in Ouroboros.Consensus.Ledger.Dual

Bridge m a => IsLedger (LedgerState (DualBlock m a)) 
Instance details

Defined in Ouroboros.Consensus.Ledger.Dual

Associated Types

type LedgerErr (LedgerState (DualBlock m a)) 
Instance details

Defined in Ouroboros.Consensus.Ledger.Dual

type AuxLedgerEvent (LedgerState (DualBlock m a)) 
Instance details

Defined in Ouroboros.Consensus.Ledger.Dual

Bridge m a => ApplyBlock (LedgerState (DualBlock m a)) (DualBlock m a) 
Instance details

Defined in Ouroboros.Consensus.Ledger.Dual

Isomorphic (Ticked :.: LedgerState) 
Instance details

Defined in Ouroboros.Consensus.HardFork.Combinator.Embed.Unary

Methods

project :: NoHardForks blk => (Ticked :.: LedgerState) (HardForkBlock '[blk]) -> (Ticked :.: LedgerState) blk Source #

inject :: NoHardForks blk => (Ticked :.: LedgerState) blk -> (Ticked :.: LedgerState) (HardForkBlock '[blk]) Source #

data LedgerState ByronBlock 
Instance details

Defined in Ouroboros.Consensus.Byron.Ledger.Ledger

type HeaderHash (LedgerState blk :: Type) 
Instance details

Defined in Ouroboros.Consensus.Ledger.Basics

type TranslationError era (LedgerState :.: ShelleyBlock proto) 
Instance details

Defined in Ouroboros.Consensus.Shelley.ShelleyHFC

type Rep (LedgerState ByronBlock) 
Instance details

Defined in Ouroboros.Consensus.Byron.Ledger.Ledger

type Rep (LedgerState ByronBlock) = D1 ('MetaData "LedgerState" "Ouroboros.Consensus.Byron.Ledger.Ledger" "ouroboros-consensus-cardano-0.20.0.0-2bd9b95213c4ce1ce608f7e1fa75ab5517c5c68b93059f91e3d89fedcdadeff3" 'False) (C1 ('MetaCons "ByronLedgerState" 'PrefixI 'True) (S1 ('MetaSel ('Just "byronLedgerTipBlockNo") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (WithOrigin BlockNo)) :*: (S1 ('MetaSel ('Just "byronLedgerState") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 ChainValidationState) :*: S1 ('MetaSel ('Just "byronLedgerTransition") 'NoSourceUnpackedness 'SourceStrict 'DecidedUnpack) (Rec0 ByronTransition))))
type Rep (LedgerState (ShelleyBlock proto era)) 
Instance details

Defined in Ouroboros.Consensus.Shelley.Ledger.Ledger

type Rep (LedgerState (ShelleyBlock proto era)) = D1 ('MetaData "LedgerState" "Ouroboros.Consensus.Shelley.Ledger.Ledger" "ouroboros-consensus-cardano-0.20.0.0-2bd9b95213c4ce1ce608f7e1fa75ab5517c5c68b93059f91e3d89fedcdadeff3" 'False) (C1 ('MetaCons "ShelleyLedgerState" 'PrefixI 'True) (S1 ('MetaSel ('Just "shelleyLedgerTip") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (WithOrigin (ShelleyTip proto era))) :*: (S1 ('MetaSel ('Just "shelleyLedgerState") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (NewEpochState era)) :*: S1 ('MetaSel ('Just "shelleyLedgerTransition") 'NoSourceUnpackedness 'SourceStrict 'DecidedUnpack) (Rec0 ShelleyTransition))))
type Rep (Ticked (LedgerState (HardForkBlock xs))) 
Instance details

Defined in Ouroboros.Consensus.HardFork.Combinator.Ledger

type Rep (Ticked (LedgerState (HardForkBlock xs))) = D1 ('MetaData "Ticked" "Ouroboros.Consensus.HardFork.Combinator.Ledger" "ouroboros-consensus-0.21.0.0-96a81cb4588538917e2e1bd1565d867fc48490e88747b2693485d823f16f2133" 'False) (C1 ('MetaCons "TickedHardForkLedgerState" 'PrefixI 'True) (S1 ('MetaSel ('Just "tickedHardForkLedgerStateTransition") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 TransitionInfo) :*: S1 ('MetaSel ('Just "tickedHardForkLedgerStatePerEra") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (HardForkState (Ticked :.: LedgerState) xs))))
type Rep (Ticked (LedgerState ByronBlock)) 
Instance details

Defined in Ouroboros.Consensus.Byron.Ledger.Ledger

type Rep (Ticked (LedgerState ByronBlock)) = D1 ('MetaData "Ticked" "Ouroboros.Consensus.Byron.Ledger.Ledger" "ouroboros-consensus-cardano-0.20.0.0-2bd9b95213c4ce1ce608f7e1fa75ab5517c5c68b93059f91e3d89fedcdadeff3" 'False) (C1 ('MetaCons "TickedByronLedgerState" 'PrefixI 'True) (S1 ('MetaSel ('Just "tickedByronLedgerState") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 ChainValidationState) :*: S1 ('MetaSel ('Just "untickedByronLedgerTransition") 'NoSourceUnpackedness 'SourceStrict 'DecidedUnpack) (Rec0 ByronTransition)))
type Rep (Ticked (LedgerState (ShelleyBlock proto era))) 
Instance details

Defined in Ouroboros.Consensus.Shelley.Ledger.Ledger

type Rep (Ticked (LedgerState (ShelleyBlock proto era))) = D1 ('MetaData "Ticked" "Ouroboros.Consensus.Shelley.Ledger.Ledger" "ouroboros-consensus-cardano-0.20.0.0-2bd9b95213c4ce1ce608f7e1fa75ab5517c5c68b93059f91e3d89fedcdadeff3" 'False) (C1 ('MetaCons "TickedShelleyLedgerState" 'PrefixI 'True) (S1 ('MetaSel ('Just "untickedShelleyLedgerTip") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (WithOrigin (ShelleyTip proto era))) :*: (S1 ('MetaSel ('Just "tickedShelleyLedgerTransition") 'NoSourceUnpackedness 'SourceStrict 'DecidedUnpack) (Rec0 ShelleyTransition) :*: S1 ('MetaSel ('Just "tickedShelleyLedgerState") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (NewEpochState era)))))
type AuxLedgerEvent (LedgerState (HardForkBlock xs)) 
Instance details

Defined in Ouroboros.Consensus.HardFork.Combinator.Ledger

type AuxLedgerEvent (LedgerState (DualBlock m a)) 
Instance details

Defined in Ouroboros.Consensus.Ledger.Dual

type AuxLedgerEvent (LedgerState ByronBlock) 
Instance details

Defined in Ouroboros.Consensus.Byron.Ledger.Ledger

type AuxLedgerEvent (LedgerState (ShelleyBlock proto era)) 
Instance details

Defined in Ouroboros.Consensus.Shelley.Ledger.Ledger

type LedgerCfg (LedgerState (HardForkBlock xs)) 
Instance details

Defined in Ouroboros.Consensus.HardFork.Combinator.Basics

type LedgerCfg (LedgerState (DualBlock m a)) 
Instance details

Defined in Ouroboros.Consensus.Ledger.Dual

type LedgerCfg (LedgerState ByronBlock) 
Instance details

Defined in Ouroboros.Consensus.Byron.Ledger.Ledger

type LedgerCfg (LedgerState (ShelleyBlock proto era)) 
Instance details

Defined in Ouroboros.Consensus.Shelley.Ledger.Ledger

type LedgerErr (LedgerState (HardForkBlock xs)) 
Instance details

Defined in Ouroboros.Consensus.HardFork.Combinator.Ledger

type LedgerErr (LedgerState (DualBlock m a)) 
Instance details

Defined in Ouroboros.Consensus.Ledger.Dual

type LedgerErr (LedgerState ByronBlock) 
Instance details

Defined in Ouroboros.Consensus.Byron.Ledger.Ledger

type LedgerErr (LedgerState (ShelleyBlock proto era)) 
Instance details

Defined in Ouroboros.Consensus.Shelley.Ledger.Ledger

newtype LedgerState (HardForkBlock xs) 
Instance details

Defined in Ouroboros.Consensus.HardFork.Combinator.Basics

data Ticked (LedgerState (HardForkBlock xs)) 
Instance details

Defined in Ouroboros.Consensus.HardFork.Combinator.Ledger

data Ticked (LedgerState (DualBlock m a)) 
Instance details

Defined in Ouroboros.Consensus.Ledger.Dual

data Ticked (LedgerState ByronBlock)

The ticked Byron ledger state

Instance details

Defined in Ouroboros.Consensus.Byron.Ledger.Ledger

data Ticked (LedgerState (ShelleyBlock proto era))

Ticking only affects the state itself

Instance details

Defined in Ouroboros.Consensus.Shelley.Ledger.Ledger

data LedgerState (DualBlock m a) 
Instance details

Defined in Ouroboros.Consensus.Ledger.Dual

data LedgerState (ShelleyBlock proto era) 
Instance details

Defined in Ouroboros.Consensus.Shelley.Ledger.Ledger

getSlotForRelativeTime :: RelativeTime -> EraHistory -> Either PastHorizonException SlotNo Source #

Returns the slot number for provided relative time from SystemStart

Internal conversion functions