{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE CPP #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DerivingStrategies #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE OverloadedRecordDot #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE UndecidableInstances #-}
{-# OPTIONS_GHC -Wno-orphans -Wno-x-ord-preserving-coercions #-}
#if __GLASGOW_HASKELL__ < 908
{-# OPTIONS_GHC -Wno-unrecognised-warning-flags #-}
#endif

module Ouroboros.Consensus.Shelley.Ledger.Query
  ( BlockQuery (.., GetLedgerPeerSnapshot)
  , NonMyopicMemberRewards (..)

    -- * Serialisation
  , decodeShelleyQuery
  , decodeShelleyResult
  , encodeShelleyQuery
  , encodeShelleyResult

    -- * BlockSupportsHFLedgerQuery instances
  , answerShelleyLookupQueries
  , answerShelleyTraversingQueries
  , shelleyQFTraverseTablesPredicate
  ) where

import Cardano.Binary (FromCBOR (..), ToCBOR (..))
import Cardano.Ledger.Address
import qualified Cardano.Ledger.Api.State.Query as SL
import Cardano.Ledger.Coin (Coin)
import qualified Cardano.Ledger.Conway.Governance as CG
import qualified Cardano.Ledger.Conway.State as CG
import qualified Cardano.Ledger.Core as SL
import Cardano.Ledger.Keys (KeyHash)
import qualified Cardano.Ledger.Shelley.API as SL
import qualified Cardano.Ledger.Shelley.Core as LC
import qualified Cardano.Ledger.Shelley.RewardProvenance as SL
  ( RewardProvenance
  )
import qualified Cardano.Ledger.State as SL
import Cardano.Protocol.Crypto (Crypto)
import Codec.CBOR.Decoding (Decoder)
import qualified Codec.CBOR.Decoding as CBOR
import Codec.CBOR.Encoding (Encoding)
import qualified Codec.CBOR.Encoding as CBOR
import Codec.Serialise (decode, encode)
import Data.Bifunctor (second)
import Data.Coerce
import Data.Map.Strict (Map)
import qualified Data.Map.Strict as Map
import Data.MemPack
import Data.Sequence (Seq (..))
import Data.Set (Set)
import qualified Data.Set as Set
import Data.Typeable (Typeable)
import Lens.Micro
import Lens.Micro.Extras (view)
import Ouroboros.Consensus.Block
import Ouroboros.Consensus.Config
import Ouroboros.Consensus.HardFork.Combinator.Basics
import Ouroboros.Consensus.HardFork.Combinator.Ledger.Query
import Ouroboros.Consensus.HeaderValidation
import Ouroboros.Consensus.Ledger.Basics
import Ouroboros.Consensus.Ledger.Extended
import Ouroboros.Consensus.Ledger.Query
import Ouroboros.Consensus.Ledger.SupportsPeerSelection
import Ouroboros.Consensus.Ledger.SupportsProtocol
import Ouroboros.Consensus.Protocol.Abstract (ChainDepState)
import Ouroboros.Consensus.Protocol.Praos.Common
import qualified Ouroboros.Consensus.Shelley.Eras as SE
import Ouroboros.Consensus.Shelley.Ledger.Block
import Ouroboros.Consensus.Shelley.Ledger.Config
import Ouroboros.Consensus.Shelley.Ledger.Ledger
import Ouroboros.Consensus.Shelley.Ledger.NetworkProtocolVersion
  ( ShelleyNodeToClientVersion (..)
  , ledgerPeerSnapshotSupportsSRV
  )
import Ouroboros.Consensus.Shelley.Ledger.PeerSelection ()
import Ouroboros.Consensus.Shelley.Ledger.Query.LegacyPParams
import Ouroboros.Consensus.Shelley.Ledger.Query.LegacyShelleyGenesis
import Ouroboros.Consensus.Shelley.Ledger.Query.Types
import Ouroboros.Consensus.Shelley.Protocol.Abstract (ProtoCrypto)
import Ouroboros.Consensus.Storage.LedgerDB
import qualified Ouroboros.Consensus.Storage.LedgerDB as LedgerDB
import Ouroboros.Consensus.Util (ShowProxy (..), coerceSet)
import Ouroboros.Consensus.Util.IndexedMemPack
import Ouroboros.Network.Block
  ( Point (..)
  , Serialised (..)
  , decodePoint
  , encodePoint
  , mkSerialised
  )
import Ouroboros.Network.PeerSelection.LedgerPeers.Type
import Ouroboros.Network.PeerSelection.LedgerPeers.Utils
import Ouroboros.Network.Point (Block (..))

{-------------------------------------------------------------------------------
  BlockSupportsLedgerQuery
-------------------------------------------------------------------------------}

newtype NonMyopicMemberRewards = NonMyopicMemberRewards
  { NonMyopicMemberRewards
-> Map
     (Either Coin (Credential Staking)) (Map (KeyHash StakePool) Coin)
unNonMyopicMemberRewards ::
      Map
        (Either SL.Coin (SL.Credential SL.Staking))
        (Map (SL.KeyHash SL.StakePool) SL.Coin)
  }
  deriving stock Int -> NonMyopicMemberRewards -> ShowS
[NonMyopicMemberRewards] -> ShowS
NonMyopicMemberRewards -> String
(Int -> NonMyopicMemberRewards -> ShowS)
-> (NonMyopicMemberRewards -> String)
-> ([NonMyopicMemberRewards] -> ShowS)
-> Show NonMyopicMemberRewards
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> NonMyopicMemberRewards -> ShowS
showsPrec :: Int -> NonMyopicMemberRewards -> ShowS
$cshow :: NonMyopicMemberRewards -> String
show :: NonMyopicMemberRewards -> String
$cshowList :: [NonMyopicMemberRewards] -> ShowS
showList :: [NonMyopicMemberRewards] -> ShowS
Show
  deriving newtype (NonMyopicMemberRewards -> NonMyopicMemberRewards -> Bool
(NonMyopicMemberRewards -> NonMyopicMemberRewards -> Bool)
-> (NonMyopicMemberRewards -> NonMyopicMemberRewards -> Bool)
-> Eq NonMyopicMemberRewards
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: NonMyopicMemberRewards -> NonMyopicMemberRewards -> Bool
== :: NonMyopicMemberRewards -> NonMyopicMemberRewards -> Bool
$c/= :: NonMyopicMemberRewards -> NonMyopicMemberRewards -> Bool
/= :: NonMyopicMemberRewards -> NonMyopicMemberRewards -> Bool
Eq, Typeable NonMyopicMemberRewards
Typeable NonMyopicMemberRewards =>
(NonMyopicMemberRewards -> Encoding)
-> ((forall t. ToCBOR t => Proxy t -> Size)
    -> Proxy NonMyopicMemberRewards -> Size)
-> ((forall t. ToCBOR t => Proxy t -> Size)
    -> Proxy [NonMyopicMemberRewards] -> Size)
-> ToCBOR NonMyopicMemberRewards
NonMyopicMemberRewards -> Encoding
(forall t. ToCBOR t => Proxy t -> Size)
-> Proxy [NonMyopicMemberRewards] -> Size
(forall t. ToCBOR t => Proxy t -> Size)
-> Proxy NonMyopicMemberRewards -> Size
forall a.
Typeable a =>
(a -> Encoding)
-> ((forall t. ToCBOR t => Proxy t -> Size) -> Proxy a -> Size)
-> ((forall t. ToCBOR t => Proxy t -> Size) -> Proxy [a] -> Size)
-> ToCBOR a
$ctoCBOR :: NonMyopicMemberRewards -> Encoding
toCBOR :: NonMyopicMemberRewards -> Encoding
$cencodedSizeExpr :: (forall t. ToCBOR t => Proxy t -> Size)
-> Proxy NonMyopicMemberRewards -> Size
encodedSizeExpr :: (forall t. ToCBOR t => Proxy t -> Size)
-> Proxy NonMyopicMemberRewards -> Size
$cencodedListSizeExpr :: (forall t. ToCBOR t => Proxy t -> Size)
-> Proxy [NonMyopicMemberRewards] -> Size
encodedListSizeExpr :: (forall t. ToCBOR t => Proxy t -> Size)
-> Proxy [NonMyopicMemberRewards] -> Size
ToCBOR, Typeable NonMyopicMemberRewards
Typeable NonMyopicMemberRewards =>
(forall s. Decoder s NonMyopicMemberRewards)
-> (Proxy NonMyopicMemberRewards -> Text)
-> FromCBOR NonMyopicMemberRewards
Proxy NonMyopicMemberRewards -> Text
forall s. Decoder s NonMyopicMemberRewards
forall a.
Typeable a =>
(forall s. Decoder s a) -> (Proxy a -> Text) -> FromCBOR a
$cfromCBOR :: forall s. Decoder s NonMyopicMemberRewards
fromCBOR :: forall s. Decoder s NonMyopicMemberRewards
$clabel :: Proxy NonMyopicMemberRewards -> Text
label :: Proxy NonMyopicMemberRewards -> Text
FromCBOR)

type Delegations = Map (SL.Credential SL.Staking) (SL.KeyHash SL.StakePool)

type VoteDelegatees = Map (SL.Credential SL.Staking) SL.DRep

{-# DEPRECATED GetProposedPParamsUpdates "Deprecated in ShelleyNodeToClientVersion12" #-}
{-# DEPRECATED
  GetPoolDistr
  "Deprecated in ShelleyNodeToClientVersion13. Implement the new alterative GetPoolDistr2"
  #-}
{-# DEPRECATED
  GetStakeDistribution
  "Deprecated in ShelleyNodeToClientVersion13. Implement the new alterative GetStakeDistribution2"
  #-}

-- convenience wrapper to hide the boolean, this pattern can be removed
-- once support for ntcV22/shelleyV14 is removed
pattern GetLedgerPeerSnapshot ::
  LedgerPeersKind ->
  BlockQuery (ShelleyBlock proto era) QFNoTables SomeLedgerPeerSnapshot
pattern $mGetLedgerPeerSnapshot :: forall {r} {proto} {era}.
BlockQuery
  (ShelleyBlock proto era) 'QFNoTables SomeLedgerPeerSnapshot
-> (LedgerPeersKind -> r) -> ((# #) -> r) -> r
$bGetLedgerPeerSnapshot :: forall proto era.
LedgerPeersKind
-> BlockQuery
     (ShelleyBlock proto era) 'QFNoTables SomeLedgerPeerSnapshot
GetLedgerPeerSnapshot kind = GetLedgerPeerSnapshot' True kind

data instance BlockQuery (ShelleyBlock proto era) fp result where
  GetLedgerTip :: BlockQuery (ShelleyBlock proto era) QFNoTables (Point (ShelleyBlock proto era))
  GetEpochNo :: BlockQuery (ShelleyBlock proto era) QFNoTables EpochNo
  -- | Calculate the Non-Myopic Pool Member Rewards for a set of
  -- credentials. See 'SL.getNonMyopicMemberRewards'
  GetNonMyopicMemberRewards ::
    Set (Either SL.Coin (SL.Credential SL.Staking)) ->
    BlockQuery (ShelleyBlock proto era) QFNoTables NonMyopicMemberRewards
  GetCurrentPParams ::
    BlockQuery (ShelleyBlock proto era) QFNoTables (LC.PParams era)
  GetProposedPParamsUpdates ::
    BlockQuery (ShelleyBlock proto era) QFNoTables (SL.ProposedPPUpdates era)
  -- | This gets the stake distribution, but not in terms of _active_ stake
  -- (which we need for the leader schedule), but rather in terms of _total_
  -- stake, which is relevant for rewards. It is used by the wallet to show
  -- saturation levels to the end user. We should consider refactoring this, to
  -- an endpoint that provides all the information that the wallet wants about
  -- pools, in an extensible fashion.
  GetStakeDistribution ::
    BlockQuery (ShelleyBlock proto era) QFNoTables (PoolDistr (ProtoCrypto proto))
  -- | Get a subset of the UTxO, filtered by address. Although this will
  -- typically return a lot less data than 'GetUTxOWhole', it requires a linear
  -- search over the UTxO and so cost O(n) time.
  --
  -- Only 'GetUTxOByTxIn' is efficient in time and space.
  GetUTxOByAddress ::
    Set SL.Addr ->
    BlockQuery (ShelleyBlock proto era) QFTraverseTables (SL.UTxO era)
  -- | Get the /entire/ UTxO. This is only suitable for debug/testing purposes
  -- because otherwise it is far too much data.
  GetUTxOWhole ::
    BlockQuery (ShelleyBlock proto era) QFTraverseTables (SL.UTxO era)
  -- | Only for debugging purposes, we make no effort to ensure binary
  -- compatibility (cf the comment on 'GetCBOR'). Moreover, it is huge.
  DebugEpochState ::
    BlockQuery (ShelleyBlock proto era) QFNoTables (SL.EpochState era)
  -- | Wrap the result of the query using CBOR-in-CBOR.
  --
  -- For example, when a client is running a different version than the server
  -- and it sends a 'DebugEpochState' query, the client's decoder might fail to
  -- deserialise the epoch state as it might have changed between the two
  -- different versions. The client will then disconnect.
  --
  -- By using CBOR-in-CBOR, the client always successfully decodes the outer
  -- CBOR layer (so no disconnect) and can then manually try to decode the
  -- inner result. When the client's decoder is able to decode the inner
  -- result, it has access to the deserialised epoch state. When it fails to
  -- decode it, the client can fall back to pretty printing the actual CBOR,
  -- which is better than no output at all.
  GetCBOR ::
    BlockQuery (ShelleyBlock proto era) fp result ->
    BlockQuery (ShelleyBlock proto era) fp (Serialised result)
  GetFilteredDelegationsAndRewardAccounts ::
    Set (SL.Credential SL.Staking) ->
    BlockQuery
      (ShelleyBlock proto era)
      QFNoTables
      (Delegations, Map (SL.Credential SL.Staking) Coin)
  GetGenesisConfig ::
    BlockQuery (ShelleyBlock proto era) QFNoTables CompactGenesis
  -- | Only for debugging purposes, we make no effort to ensure binary
  -- compatibility (cf the comment on 'GetCBOR'). Moreover, it is huge.
  DebugNewEpochState ::
    BlockQuery (ShelleyBlock proto era) QFNoTables (SL.NewEpochState era)
  -- | Only for debugging purposes, we make no effort to ensure binary
  -- compatibility (cf the comment on 'GetCBOR').
  DebugChainDepState ::
    BlockQuery (ShelleyBlock proto era) QFNoTables (ChainDepState proto)
  GetRewardProvenance ::
    BlockQuery (ShelleyBlock proto era) QFNoTables SL.RewardProvenance
  -- | Get a subset of the UTxO, filtered by transaction input. This is
  -- efficient and costs only O(m * log n) for m inputs and a UTxO of size n.
  GetUTxOByTxIn ::
    Set SL.TxIn ->
    BlockQuery (ShelleyBlock proto era) QFLookupTables (SL.UTxO era)
  GetStakePools ::
    BlockQuery
      (ShelleyBlock proto era)
      QFNoTables
      (Set (SL.KeyHash SL.StakePool))
  GetStakePoolParams ::
    Set (SL.KeyHash SL.StakePool) ->
    BlockQuery
      (ShelleyBlock proto era)
      QFNoTables
      (Map (SL.KeyHash SL.StakePool) SL.StakePoolParams)
  GetRewardInfoPools ::
    BlockQuery
      (ShelleyBlock proto era)
      QFNoTables
      ( SL.RewardParams
      , Map
          (SL.KeyHash SL.StakePool)
          (SL.RewardInfoPool)
      )
  GetPoolState ::
    Maybe (Set (SL.KeyHash SL.StakePool)) ->
    BlockQuery
      (ShelleyBlock proto era)
      QFNoTables
      SL.QueryPoolStateResult
  GetStakeSnapshots ::
    SL.EraGov era =>
    Maybe (Set (SL.KeyHash SL.StakePool)) ->
    BlockQuery
      (ShelleyBlock proto era)
      QFNoTables
      SL.StakeSnapshots
  GetPoolDistr ::
    Maybe (Set (SL.KeyHash SL.StakePool)) ->
    BlockQuery
      (ShelleyBlock proto era)
      QFNoTables
      (PoolDistr (ProtoCrypto proto))
  GetStakeDelegDeposits ::
    Set (SL.Credential LC.Staking) ->
    BlockQuery
      (ShelleyBlock proto era)
      QFNoTables
      (Map (SL.Credential LC.Staking) Coin)
  -- | Not supported in eras before Conway
  GetConstitution ::
    CG.ConwayEraGov era =>
    BlockQuery (ShelleyBlock proto era) QFNoTables (CG.Constitution era)
  -- | Although this query was introduced as part of Conway, it is general and
  --  so has non-degenerate semantics for eras before Conway.
  GetGovState ::
    BlockQuery (ShelleyBlock proto era) QFNoTables (LC.GovState era)
  -- | The argument specifies the credential of each 'DRep' whose state should
  -- be returned. When it's empty, the state of every 'DRep' is returned.
  --
  -- Not supported in eras before Conway.
  GetDRepState ::
    (CG.ConwayEraGov era, CG.ConwayEraCertState era) =>
    Set (SL.Credential SL.DRepRole) ->
    BlockQuery
      (ShelleyBlock proto era)
      QFNoTables
      ( Map
          (SL.Credential SL.DRepRole)
          SL.DRepState
      )
  -- | Query the 'DRep' stake distribution. Note that this can be an expensive
  -- query because there is a chance that the latest snapshot's distribution
  -- has not yet been fully computed.
  --
  -- The argument specifies whose stake should be returned. When it's empty,
  -- the stake of every 'DRep's is returned.
  --
  -- Not supported in eras before Conway.
  GetDRepStakeDistr ::
    CG.ConwayEraGov era =>
    Set SL.DRep ->
    BlockQuery (ShelleyBlock proto era) QFNoTables (Map SL.DRep Coin)
  -- | Query committee members
  --
  -- Not supported in eras before Conway.
  GetCommitteeMembersState ::
    (CG.ConwayEraGov era, CG.ConwayEraCertState era) =>
    Set (SL.Credential SL.ColdCommitteeRole) ->
    Set (SL.Credential SL.HotCommitteeRole) ->
    Set SL.MemberStatus ->
    BlockQuery (ShelleyBlock proto era) QFNoTables SL.CommitteeMembersState
  -- | The argument specifies the credential of each account whose delegatee
  -- should be returned. When it's empty, the full map of delegatees is
  -- returned.
  --
  -- Not supported in eras before Conway.
  GetFilteredVoteDelegatees ::
    CG.ConwayEraGov era =>
    Set (SL.Credential SL.Staking) ->
    BlockQuery (ShelleyBlock proto era) QFNoTables VoteDelegatees
  GetAccountState ::
    BlockQuery (ShelleyBlock proto era) QFNoTables SL.ChainAccountState
  -- | Query the SPO voting stake distribution.
  -- This stake distribution is different from the one used in leader election.
  --
  -- See: https://github.com/IntersectMBO/cardano-ledger/issues/4342
  --
  -- Not supported in eras before Conway.
  GetSPOStakeDistr ::
    CG.ConwayEraGov era =>
    Set (KeyHash SL.StakePool) ->
    BlockQuery (ShelleyBlock proto era) QFNoTables (Map (KeyHash SL.StakePool) Coin)
  GetProposals ::
    CG.ConwayEraGov era =>
    Set CG.GovActionId ->
    BlockQuery (ShelleyBlock proto era) QFNoTables (Seq (CG.GovActionState era))
  GetRatifyState ::
    CG.ConwayEraGov era =>
    BlockQuery (ShelleyBlock proto era) QFNoTables (CG.RatifyState era)
  GetFuturePParams ::
    BlockQuery (ShelleyBlock proto era) QFNoTables (Maybe (LC.PParams era))
  -- | A snapshot of all or big ledger peers
  -- use 'GetLedgerPeerSnapshot' pattern synonym
  GetLedgerPeerSnapshot' ::
    -- | >= Shelley v15/NtC v23
    -- TODO: remove once NodeToClientV_22/Shelley V14  is no longer supported,
    -- rename to GetLedgerPeerSnapshot and remove the pattern synonym
    Bool ->
    LedgerPeersKind ->
    BlockQuery (ShelleyBlock proto era) QFNoTables SomeLedgerPeerSnapshot
  QueryStakePoolDefaultVote ::
    CG.ConwayEraGov era =>
    KeyHash SL.StakePool ->
    BlockQuery (ShelleyBlock proto era) QFNoTables CG.DefaultVote
  GetPoolDistr2 ::
    Maybe (Set (SL.KeyHash SL.StakePool)) ->
    BlockQuery
      (ShelleyBlock proto era)
      QFNoTables
      SL.PoolDistr
  -- | This gets the stake distribution, but not in terms of _active_ stake
  -- (which we need for the leader schedule), but rather in terms of _total_
  -- stake, which is relevant for rewards. It is used by the wallet to show
  -- saturation levels to the end user. We should consider refactoring this, to
  -- an endpoint that provides all the information that the wallet wants about
  -- pools, in an extensible fashion.
  GetStakeDistribution2 ::
    BlockQuery (ShelleyBlock proto era) QFNoTables SL.PoolDistr
  GetMaxMajorProtocolVersion ::
    BlockQuery (ShelleyBlock proto era) QFNoTables MaxMajorProtVer
  GetDRepDelegations ::
    (CG.ConwayEraGov era, CG.ConwayEraCertState era) =>
    Set SL.DRep ->
    BlockQuery
      (ShelleyBlock proto era)
      QFNoTables
      (Map SL.DRep (Set (SL.Credential SL.Staking)))

{-# DEPRECATED GetLedgerPeerSnapshot' "Use GetLedgerPeerSnapshot instead" #-}

-- WARNING: please add new queries to the end of the list and stick to this
-- order in all other pattern matches on queries. This helps in particular
-- with the en/decoders, as we want the CBOR tags to be ordered.
--
-- WARNING: when adding a new query, a new @ShelleyNodeToClientVersionX@ must
-- be added. See #2830 for a template on how to do this.
--
-- WARNING: never modify an existing query that has been incorporated in a
-- release of the node, as it will break compatibility with deployed nodes.
-- Instead, add a new query. To remove the old query, first to stop supporting
-- it by modifying 'querySupportedVersion' (@< X@) and when the version is no
-- longer used (because mainnet has hard-forked to a newer version), it can be
-- removed.

instance
  (Typeable era, Typeable proto) =>
  ShowProxy (BlockQuery (ShelleyBlock proto era))

instance
  ( ShelleyCompatible proto era
  , LedgerSupportsProtocol (ShelleyBlock proto era)
  , ConfigSupportsNode (ShelleyBlock proto era)
  , ProtoCrypto proto ~ crypto
  , Crypto crypto
  ) =>
  BlockSupportsLedgerQuery (ShelleyBlock proto era)
  where
  answerPureBlockQuery :: forall result.
ExtLedgerCfg (ShelleyBlock proto era)
-> BlockQuery (ShelleyBlock proto era) 'QFNoTables result
-> ExtLedgerState (ShelleyBlock proto era) EmptyMK
-> result
answerPureBlockQuery ExtLedgerCfg (ShelleyBlock proto era)
cfg BlockQuery (ShelleyBlock proto era) 'QFNoTables result
query ExtLedgerState (ShelleyBlock proto era) EmptyMK
ext =
    case BlockQuery (ShelleyBlock proto era) 'QFNoTables result
query of
      BlockQuery (ShelleyBlock proto era) 'QFNoTables result
R:BlockQueryShelleyBlockfpresult proto era 'QFNoTables result
GetLedgerTip ->
        LedgerState (ShelleyBlock proto era) EmptyMK
-> Point (ShelleyBlock proto era)
forall proto era (mk :: * -> * -> *).
LedgerState (ShelleyBlock proto era) mk
-> Point (ShelleyBlock proto era)
shelleyLedgerTipPoint LedgerState (ShelleyBlock proto era) EmptyMK
lst
      BlockQuery (ShelleyBlock proto era) 'QFNoTables result
R:BlockQueryShelleyBlockfpresult proto era 'QFNoTables result
GetEpochNo ->
        NewEpochState era -> EpochNo
forall era. NewEpochState era -> EpochNo
SL.nesEL NewEpochState era
st
      GetNonMyopicMemberRewards Set (Either Coin (Credential Staking))
creds ->
        Map
  (Either Coin (Credential Staking)) (Map (KeyHash StakePool) Coin)
-> NonMyopicMemberRewards
NonMyopicMemberRewards (Map
   (Either Coin (Credential Staking)) (Map (KeyHash StakePool) Coin)
 -> NonMyopicMemberRewards)
-> Map
     (Either Coin (Credential Staking)) (Map (KeyHash StakePool) Coin)
-> NonMyopicMemberRewards
forall a b. (a -> b) -> a -> b
$
          Globals
-> NewEpochState era
-> Set (Either Coin (Credential Staking))
-> Map
     (Either Coin (Credential Staking)) (Map (KeyHash StakePool) Coin)
forall era.
(EraGov era, EraStake era, EraCertState era) =>
Globals
-> NewEpochState era
-> Set (Either Coin (Credential Staking))
-> Map
     (Either Coin (Credential Staking)) (Map (KeyHash StakePool) Coin)
SL.getNonMyopicMemberRewards Globals
globals NewEpochState era
st Set (Either Coin (Credential Staking))
creds
      BlockQuery (ShelleyBlock proto era) 'QFNoTables result
R:BlockQueryShelleyBlockfpresult proto era 'QFNoTables result
GetCurrentPParams ->
        NewEpochState era -> PParams era
forall era. EraGov era => NewEpochState era -> PParams era
getPParams NewEpochState era
st
      BlockQuery (ShelleyBlock proto era) 'QFNoTables result
R:BlockQueryShelleyBlockfpresult proto era 'QFNoTables result
GetProposedPParamsUpdates ->
        Map (KeyHash GenesisRole) (PParamsUpdate era)
-> ProposedPPUpdates era
forall era.
Map (KeyHash GenesisRole) (PParamsUpdate era)
-> ProposedPPUpdates era
SL.ProposedPPUpdates Map (KeyHash GenesisRole) (PParamsUpdate era)
forall k a. Map k a
Map.empty
      BlockQuery (ShelleyBlock proto era) 'QFNoTables result
R:BlockQueryShelleyBlockfpresult proto era 'QFNoTables result
GetStakeDistribution ->
        PoolDistr -> PoolDistr crypto
forall c. PoolDistr -> PoolDistr c
fromLedgerPoolDistr (PoolDistr -> PoolDistr crypto) -> PoolDistr -> PoolDistr crypto
forall a b. (a -> b) -> a -> b
$ ExtLedgerCfg (ShelleyBlock proto era)
-> BlockQuery (ShelleyBlock proto era) 'QFNoTables PoolDistr
-> ExtLedgerState (ShelleyBlock proto era) EmptyMK
-> PoolDistr
forall result.
ExtLedgerCfg (ShelleyBlock proto era)
-> BlockQuery (ShelleyBlock proto era) 'QFNoTables result
-> ExtLedgerState (ShelleyBlock proto era) EmptyMK
-> result
forall blk result.
BlockSupportsLedgerQuery blk =>
ExtLedgerCfg blk
-> BlockQuery blk 'QFNoTables result
-> ExtLedgerState blk EmptyMK
-> result
answerPureBlockQuery ExtLedgerCfg (ShelleyBlock proto era)
cfg BlockQuery (ShelleyBlock proto era) 'QFNoTables PoolDistr
forall proto era.
BlockQuery (ShelleyBlock proto era) 'QFNoTables PoolDistr
GetStakeDistribution2 ExtLedgerState (ShelleyBlock proto era) EmptyMK
ext
      BlockQuery (ShelleyBlock proto era) 'QFNoTables result
R:BlockQueryShelleyBlockfpresult proto era 'QFNoTables result
DebugEpochState ->
        NewEpochState era -> EpochState era
forall era. NewEpochState era -> EpochState era
getEpochState NewEpochState era
st
      GetCBOR BlockQuery (ShelleyBlock proto era) 'QFNoTables result
query' ->
        -- We encode using the latest (@maxBound@) ShelleyNodeToClientVersion,
        -- as the @GetCBOR@ query already is about opportunistically assuming
        -- both client and server are running the same version; cf. the
        -- @GetCBOR@ Haddocks.
        (result -> Encoding) -> result -> Serialised result
forall a. (a -> Encoding) -> a -> Serialised a
mkSerialised (ShelleyNodeToClientVersion
-> BlockQuery (ShelleyBlock proto era) 'QFNoTables result
-> result
-> Encoding
forall proto era (fp :: QueryFootprint) result.
ShelleyCompatible proto era =>
ShelleyNodeToClientVersion
-> BlockQuery (ShelleyBlock proto era) fp result
-> result
-> Encoding
encodeShelleyResult ShelleyNodeToClientVersion
forall a. Bounded a => a
maxBound BlockQuery (ShelleyBlock proto era) 'QFNoTables result
query') (result -> Serialised result) -> result -> Serialised result
forall a b. (a -> b) -> a -> b
$
          ExtLedgerCfg (ShelleyBlock proto era)
-> BlockQuery (ShelleyBlock proto era) 'QFNoTables result
-> ExtLedgerState (ShelleyBlock proto era) EmptyMK
-> result
forall result.
ExtLedgerCfg (ShelleyBlock proto era)
-> BlockQuery (ShelleyBlock proto era) 'QFNoTables result
-> ExtLedgerState (ShelleyBlock proto era) EmptyMK
-> result
forall blk result.
BlockSupportsLedgerQuery blk =>
ExtLedgerCfg blk
-> BlockQuery blk 'QFNoTables result
-> ExtLedgerState blk EmptyMK
-> result
answerPureBlockQuery ExtLedgerCfg (ShelleyBlock proto era)
cfg BlockQuery (ShelleyBlock proto era) 'QFNoTables result
query' ExtLedgerState (ShelleyBlock proto era) EmptyMK
ext
      GetFilteredDelegationsAndRewardAccounts Set (Credential Staking)
creds ->
        NewEpochState era
-> Set (Credential Staking)
-> (Delegations, Map (Credential Staking) Coin)
forall era.
EraCertState era =>
NewEpochState era
-> Set (Credential Staking)
-> (Delegations, Map (Credential Staking) Coin)
getFilteredDelegationsAndRewardAccounts NewEpochState era
st Set (Credential Staking)
creds
      BlockQuery (ShelleyBlock proto era) 'QFNoTables result
R:BlockQueryShelleyBlockfpresult proto era 'QFNoTables result
GetGenesisConfig ->
        ShelleyLedgerConfig era -> CompactGenesis
forall era. ShelleyLedgerConfig era -> CompactGenesis
shelleyLedgerCompactGenesis LedgerConfig (ShelleyBlock proto era)
ShelleyLedgerConfig era
lcfg
      BlockQuery (ShelleyBlock proto era) 'QFNoTables result
R:BlockQueryShelleyBlockfpresult proto era 'QFNoTables result
DebugNewEpochState ->
        result
NewEpochState era
st
      BlockQuery (ShelleyBlock proto era) 'QFNoTables result
R:BlockQueryShelleyBlockfpresult proto era 'QFNoTables result
DebugChainDepState ->
        HeaderState (ShelleyBlock proto era)
-> ChainDepState (BlockProtocol (ShelleyBlock proto era))
forall blk. HeaderState blk -> ChainDepState (BlockProtocol blk)
headerStateChainDep HeaderState (ShelleyBlock proto era)
hst
      BlockQuery (ShelleyBlock proto era) 'QFNoTables result
R:BlockQueryShelleyBlockfpresult proto era 'QFNoTables result
GetRewardProvenance ->
        (RewardUpdate, RewardProvenance) -> RewardProvenance
forall a b. (a, b) -> b
snd ((RewardUpdate, RewardProvenance) -> RewardProvenance)
-> (RewardUpdate, RewardProvenance) -> RewardProvenance
forall a b. (a -> b) -> a -> b
$ Globals -> NewEpochState era -> (RewardUpdate, RewardProvenance)
forall era.
(EraGov era, EraCertState era) =>
Globals -> NewEpochState era -> (RewardUpdate, RewardProvenance)
SL.getRewardProvenance Globals
globals NewEpochState era
st
      BlockQuery (ShelleyBlock proto era) 'QFNoTables result
R:BlockQueryShelleyBlockfpresult proto era 'QFNoTables result
GetStakePools ->
        NewEpochState era -> Set (KeyHash StakePool)
forall era.
EraCertState era =>
NewEpochState era -> Set (KeyHash StakePool)
SL.getPools NewEpochState era
st
      GetStakePoolParams Set (KeyHash StakePool)
poolids ->
        Network
-> NewEpochState era
-> Set (KeyHash StakePool)
-> Map (KeyHash StakePool) StakePoolParams
forall era.
EraCertState era =>
Network
-> NewEpochState era
-> Set (KeyHash StakePool)
-> Map (KeyHash StakePool) StakePoolParams
SL.queryPoolParameters (Globals -> Network
SL.networkId Globals
globals) NewEpochState era
st Set (KeyHash StakePool)
poolids
      BlockQuery (ShelleyBlock proto era) 'QFNoTables result
R:BlockQueryShelleyBlockfpresult proto era 'QFNoTables result
GetRewardInfoPools ->
        Globals
-> NewEpochState era
-> (RewardParams, Map (KeyHash StakePool) RewardInfoPool)
forall era.
(EraGov era, EraStake era, EraCertState era) =>
Globals
-> NewEpochState era
-> (RewardParams, Map (KeyHash StakePool) RewardInfoPool)
SL.getRewardInfoPools Globals
globals NewEpochState era
st
      GetPoolState Maybe (Set (KeyHash StakePool))
mPoolIds ->
        NewEpochState era
-> Maybe (Set (KeyHash StakePool))
-> Network
-> QueryPoolStateResult
forall era.
EraCertState era =>
NewEpochState era
-> Maybe (Set (KeyHash StakePool))
-> Network
-> QueryPoolStateResult
SL.queryPoolState NewEpochState era
st Maybe (Set (KeyHash StakePool))
mPoolIds (Globals -> Network
SL.networkId Globals
globals)
      GetStakeSnapshots Maybe (Set (KeyHash StakePool))
mPoolIds ->
        NewEpochState era
-> Maybe (Set (KeyHash StakePool)) -> StakeSnapshots
forall era.
EraGov era =>
NewEpochState era
-> Maybe (Set (KeyHash StakePool)) -> StakeSnapshots
SL.queryStakeSnapshots NewEpochState era
st Maybe (Set (KeyHash StakePool))
mPoolIds
      GetPoolDistr Maybe (Set (KeyHash StakePool))
mPoolIds ->
        PoolDistr -> PoolDistr crypto
forall c. PoolDistr -> PoolDistr c
fromLedgerPoolDistr (PoolDistr -> PoolDistr crypto) -> PoolDistr -> PoolDistr crypto
forall a b. (a -> b) -> a -> b
$ ExtLedgerCfg (ShelleyBlock proto era)
-> BlockQuery (ShelleyBlock proto era) 'QFNoTables PoolDistr
-> ExtLedgerState (ShelleyBlock proto era) EmptyMK
-> PoolDistr
forall result.
ExtLedgerCfg (ShelleyBlock proto era)
-> BlockQuery (ShelleyBlock proto era) 'QFNoTables result
-> ExtLedgerState (ShelleyBlock proto era) EmptyMK
-> result
forall blk result.
BlockSupportsLedgerQuery blk =>
ExtLedgerCfg blk
-> BlockQuery blk 'QFNoTables result
-> ExtLedgerState blk EmptyMK
-> result
answerPureBlockQuery ExtLedgerCfg (ShelleyBlock proto era)
cfg (Maybe (Set (KeyHash StakePool))
-> BlockQuery (ShelleyBlock proto era) 'QFNoTables PoolDistr
forall proto era.
Maybe (Set (KeyHash StakePool))
-> BlockQuery (ShelleyBlock proto era) 'QFNoTables PoolDistr
GetPoolDistr2 Maybe (Set (KeyHash StakePool))
mPoolIds) ExtLedgerState (ShelleyBlock proto era) EmptyMK
ext
      GetStakeDelegDeposits Set (Credential Staking)
stakeCreds ->
        let lookupDeposit :: Credential Staking -> Maybe Coin
lookupDeposit =
              DState era -> Credential Staking -> Maybe Coin
forall era.
EraAccounts era =>
DState era -> Credential Staking -> Maybe Coin
SL.lookupDepositDState (Getting (DState era) (CertState era) (DState era)
-> CertState era -> DState era
forall a s. Getting a s a -> s -> a
view Getting (DState era) (CertState era) (DState era)
forall era. EraCertState era => Lens' (CertState era) (DState era)
Lens' (CertState era) (DState era)
SL.certDStateL (CertState era -> DState era) -> CertState era -> DState era
forall a b. (a -> b) -> a -> b
$ LedgerState era -> CertState era
forall era. LedgerState era -> CertState era
SL.lsCertState (LedgerState era -> CertState era)
-> LedgerState era -> CertState era
forall a b. (a -> b) -> a -> b
$ EpochState era -> LedgerState era
forall era. EpochState era -> LedgerState era
SL.esLState (EpochState era -> LedgerState era)
-> EpochState era -> LedgerState era
forall a b. (a -> b) -> a -> b
$ NewEpochState era -> EpochState era
forall era. NewEpochState era -> EpochState era
SL.nesEs NewEpochState era
st)
            lookupInsert :: Map (Credential Staking) Coin
-> Credential Staking -> Map (Credential Staking) Coin
lookupInsert Map (Credential Staking) Coin
acc Credential Staking
cred =
              case Credential Staking -> Maybe Coin
lookupDeposit Credential Staking
cred of
                Maybe Coin
Nothing -> Map (Credential Staking) Coin
acc
                Just Coin
deposit -> Credential Staking
-> Coin
-> Map (Credential Staking) Coin
-> Map (Credential Staking) Coin
forall k a. Ord k => k -> a -> Map k a -> Map k a
Map.insert Credential Staking
cred Coin
deposit Map (Credential Staking) Coin
acc
         in (result -> Credential Staking -> result)
-> result -> Set (Credential Staking) -> result
forall a b. (a -> b -> a) -> a -> Set b -> a
Set.foldl' result -> Credential Staking -> result
Map (Credential Staking) Coin
-> Credential Staking -> Map (Credential Staking) Coin
lookupInsert result
Map (Credential Staking) Coin
forall k a. Map k a
Map.empty Set (Credential Staking)
stakeCreds
      BlockQuery (ShelleyBlock proto era) 'QFNoTables result
R:BlockQueryShelleyBlockfpresult proto era 'QFNoTables result
GetConstitution ->
        NewEpochState era -> Constitution era
forall era.
ConwayEraGov era =>
NewEpochState era -> Constitution era
SL.queryConstitution NewEpochState era
st
      BlockQuery (ShelleyBlock proto era) 'QFNoTables result
R:BlockQueryShelleyBlockfpresult proto era 'QFNoTables result
GetGovState ->
        NewEpochState era -> GovState era
forall era. NewEpochState era -> GovState era
SL.queryGovState NewEpochState era
st
      GetDRepState Set (Credential DRepRole)
drepCreds ->
        NewEpochState era
-> Set (Credential DRepRole) -> Map (Credential DRepRole) DRepState
forall era.
ConwayEraCertState era =>
NewEpochState era
-> Set (Credential DRepRole) -> Map (Credential DRepRole) DRepState
SL.queryDRepState NewEpochState era
st Set (Credential DRepRole)
drepCreds
      GetDRepStakeDistr Set DRep
dreps ->
        NewEpochState era -> Set DRep -> Map DRep Coin
forall era.
ConwayEraGov era =>
NewEpochState era -> Set DRep -> Map DRep Coin
SL.queryDRepStakeDistr NewEpochState era
st Set DRep
dreps
      GetCommitteeMembersState Set (Credential ColdCommitteeRole)
coldCreds Set (Credential HotCommitteeRole)
hotCreds Set MemberStatus
statuses ->
        Set (Credential ColdCommitteeRole)
-> Set (Credential HotCommitteeRole)
-> Set MemberStatus
-> NewEpochState era
-> CommitteeMembersState
forall era.
(ConwayEraGov era, ConwayEraCertState era) =>
Set (Credential ColdCommitteeRole)
-> Set (Credential HotCommitteeRole)
-> Set MemberStatus
-> NewEpochState era
-> CommitteeMembersState
SL.queryCommitteeMembersState Set (Credential ColdCommitteeRole)
coldCreds Set (Credential HotCommitteeRole)
hotCreds Set MemberStatus
statuses NewEpochState era
st
      GetFilteredVoteDelegatees Set (Credential Staking)
stakeCreds ->
        NewEpochState era
-> Set (Credential Staking) -> Map (Credential Staking) DRep
forall era.
(EraCertState era, ConwayEraAccounts era) =>
NewEpochState era
-> Set (Credential Staking) -> Map (Credential Staking) DRep
getFilteredVoteDelegatees NewEpochState era
st Set (Credential Staking)
stakeCreds
      BlockQuery (ShelleyBlock proto era) 'QFNoTables result
R:BlockQueryShelleyBlockfpresult proto era 'QFNoTables result
GetAccountState ->
        NewEpochState era -> ChainAccountState
forall era. NewEpochState era -> ChainAccountState
SL.queryChainAccountState NewEpochState era
st
      GetSPOStakeDistr Set (KeyHash StakePool)
keys ->
        NewEpochState era
-> Set (KeyHash StakePool) -> Map (KeyHash StakePool) Coin
forall era.
ConwayEraGov era =>
NewEpochState era
-> Set (KeyHash StakePool) -> Map (KeyHash StakePool) Coin
SL.querySPOStakeDistr NewEpochState era
st Set (KeyHash StakePool)
keys
      GetProposals Set GovActionId
gids ->
        NewEpochState era -> Set GovActionId -> Seq (GovActionState era)
forall era.
ConwayEraGov era =>
NewEpochState era -> Set GovActionId -> Seq (GovActionState era)
SL.queryProposals NewEpochState era
st Set GovActionId
gids
      BlockQuery (ShelleyBlock proto era) 'QFNoTables result
R:BlockQueryShelleyBlockfpresult proto era 'QFNoTables result
GetRatifyState ->
        NewEpochState era -> RatifyState era
forall era.
ConwayEraGov era =>
NewEpochState era -> RatifyState era
SL.queryRatifyState NewEpochState era
st
      BlockQuery (ShelleyBlock proto era) 'QFNoTables result
R:BlockQueryShelleyBlockfpresult proto era 'QFNoTables result
GetFuturePParams ->
        NewEpochState era -> Maybe (PParams era)
forall era. EraGov era => NewEpochState era -> Maybe (PParams era)
SL.queryFuturePParams NewEpochState era
st
      -- use bundled pattern synonym GetLedgerPeerSnapshot instead for stable API
      GetLedgerPeerSnapshot' Bool
v15Encoding LedgerPeersKind
kind ->
        let allPools :: [(PoolStake, NonEmpty LedgerRelayAccessPoint)]
allPools = (NonEmpty StakePoolRelay -> NonEmpty LedgerRelayAccessPoint)
-> (PoolStake, NonEmpty StakePoolRelay)
-> (PoolStake, NonEmpty LedgerRelayAccessPoint)
forall b c a. (b -> c) -> (a, b) -> (a, c)
forall (p :: * -> * -> *) b c a.
Bifunctor p =>
(b -> c) -> p a b -> p a c
second ((StakePoolRelay -> LedgerRelayAccessPoint)
-> NonEmpty StakePoolRelay -> NonEmpty LedgerRelayAccessPoint
forall a b. (a -> b) -> NonEmpty a -> NonEmpty b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap StakePoolRelay -> LedgerRelayAccessPoint
stakePoolRelayAccessPoint) ((PoolStake, NonEmpty StakePoolRelay)
 -> (PoolStake, NonEmpty LedgerRelayAccessPoint))
-> [(PoolStake, NonEmpty StakePoolRelay)]
-> [(PoolStake, NonEmpty LedgerRelayAccessPoint)]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> LedgerState (ShelleyBlock proto era) EmptyMK
-> [(PoolStake, NonEmpty StakePoolRelay)]
forall blk (mk :: * -> * -> *).
LedgerSupportsPeerSelection blk =>
LedgerState blk mk -> [(PoolStake, NonEmpty StakePoolRelay)]
forall (mk :: * -> * -> *).
LedgerState (ShelleyBlock proto era) mk
-> [(PoolStake, NonEmpty StakePoolRelay)]
getPeers LedgerState (ShelleyBlock proto era) EmptyMK
lst
            bigLedgerPools :: [(AccPoolStake, (PoolStake, NonEmpty LedgerRelayAccessPoint))]
bigLedgerPools = [(PoolStake, NonEmpty LedgerRelayAccessPoint)]
-> [(AccPoolStake, (PoolStake, NonEmpty LedgerRelayAccessPoint))]
forall relayAccessPoint.
[(PoolStake, NonEmpty relayAccessPoint)]
-> [(AccPoolStake, (PoolStake, NonEmpty relayAccessPoint))]
accumulateBigLedgerStake [(PoolStake, NonEmpty LedgerRelayAccessPoint)]
allPools
            magic :: NetworkMagic
magic = BlockConfig (ShelleyBlock proto era) -> NetworkMagic
forall blk.
ConfigSupportsNode blk =>
BlockConfig blk -> NetworkMagic
getNetworkMagic ExtLedgerCfg (ShelleyBlock proto era)
cfg.getExtLedgerCfg.topLevelConfigBlock
            point :: Point SomeHashableBlock
point =
              WithOrigin (Block SlotNo (HeaderHash SomeHashableBlock))
-> Point SomeHashableBlock
forall {k} (block :: k).
WithOrigin (Block SlotNo (HeaderHash block)) -> Point block
Point (WithOrigin (Block SlotNo (HeaderHash SomeHashableBlock))
 -> Point SomeHashableBlock)
-> WithOrigin (Block SlotNo (HeaderHash SomeHashableBlock))
-> Point SomeHashableBlock
forall a b. (a -> b) -> a -> b
$
                LedgerState (ShelleyBlock proto era) EmptyMK
-> Point (ShelleyBlock proto era)
forall proto era (mk :: * -> * -> *).
LedgerState (ShelleyBlock proto era) mk
-> Point (ShelleyBlock proto era)
shelleyLedgerTipPoint LedgerState (ShelleyBlock proto era) EmptyMK
lst
                  Point (ShelleyBlock proto era)
-> (Point (ShelleyBlock proto era)
    -> WithOrigin (Block SlotNo ShelleyHash))
-> WithOrigin (Block SlotNo ShelleyHash)
forall a b. a -> (a -> b) -> b
& Point (ShelleyBlock proto era)
-> WithOrigin (Block SlotNo (HeaderHash (ShelleyBlock proto era)))
Point (ShelleyBlock proto era)
-> WithOrigin (Block SlotNo ShelleyHash)
forall {k} (block :: k).
Point block -> WithOrigin (Block SlotNo (HeaderHash block))
getPoint
                  WithOrigin (Block SlotNo ShelleyHash)
-> (Block SlotNo ShelleyHash -> Block SlotNo SomeHashableBlock)
-> WithOrigin (Block SlotNo SomeHashableBlock)
forall (f :: * -> *) a b. Functor f => f a -> (a -> b) -> f b
<&> \Block SlotNo ShelleyHash
blk ->
                    Block SlotNo ShelleyHash
blk
                      { blockPointHash = SomeHashableBlock (Proxy :: Proxy (ShelleyBlock proto era)) (blockPointHash blk)
                      }
         in case Bool
v15Encoding of
              Bool
True
                | LedgerPeersKind
BigLedgerPeers <- LedgerPeersKind
kind ->
                    Proxy 'BigLedgerPeers
-> LedgerPeerSnapshot 'BigLedgerPeers -> SomeLedgerPeerSnapshot
forall (k :: LedgerPeersKind).
Typeable k =>
Proxy k -> LedgerPeerSnapshot k -> SomeLedgerPeerSnapshot
SomeLedgerPeerSnapshot Proxy 'BigLedgerPeers
forall {k} (t :: k). Proxy t
Proxy (LedgerPeerSnapshot 'BigLedgerPeers -> SomeLedgerPeerSnapshot)
-> LedgerPeerSnapshot 'BigLedgerPeers -> SomeLedgerPeerSnapshot
forall a b. (a -> b) -> a -> b
$ Point SomeHashableBlock
-> NetworkMagic
-> [(AccPoolStake, (PoolStake, NonEmpty LedgerRelayAccessPoint))]
-> LedgerPeerSnapshot 'BigLedgerPeers
LedgerBigPeerSnapshotV23 Point SomeHashableBlock
point NetworkMagic
magic [(AccPoolStake, (PoolStake, NonEmpty LedgerRelayAccessPoint))]
bigLedgerPools
                | LedgerPeersKind
AllLedgerPeers <- LedgerPeersKind
kind ->
                    Proxy 'AllLedgerPeers
-> LedgerPeerSnapshot 'AllLedgerPeers -> SomeLedgerPeerSnapshot
forall (k :: LedgerPeersKind).
Typeable k =>
Proxy k -> LedgerPeerSnapshot k -> SomeLedgerPeerSnapshot
SomeLedgerPeerSnapshot Proxy 'AllLedgerPeers
forall {k} (t :: k). Proxy t
Proxy (LedgerPeerSnapshot 'AllLedgerPeers -> SomeLedgerPeerSnapshot)
-> LedgerPeerSnapshot 'AllLedgerPeers -> SomeLedgerPeerSnapshot
forall a b. (a -> b) -> a -> b
$ Point SomeHashableBlock
-> NetworkMagic
-> [(PoolStake, NonEmpty LedgerRelayAccessPoint)]
-> LedgerPeerSnapshot 'AllLedgerPeers
LedgerAllPeerSnapshotV23 Point SomeHashableBlock
point NetworkMagic
magic [(PoolStake, NonEmpty LedgerRelayAccessPoint)]
allPools
              Bool
False -> Proxy 'BigLedgerPeers
-> LedgerPeerSnapshot 'BigLedgerPeers -> SomeLedgerPeerSnapshot
forall (k :: LedgerPeersKind).
Typeable k =>
Proxy k -> LedgerPeerSnapshot k -> SomeLedgerPeerSnapshot
SomeLedgerPeerSnapshot Proxy 'BigLedgerPeers
forall {k} (t :: k). Proxy t
Proxy (LedgerPeerSnapshot 'BigLedgerPeers -> SomeLedgerPeerSnapshot)
-> LedgerPeerSnapshot 'BigLedgerPeers -> SomeLedgerPeerSnapshot
forall a b. (a -> b) -> a -> b
$ (WithOrigin SlotNo,
 [(AccPoolStake, (PoolStake, NonEmpty LedgerRelayAccessPoint))])
-> LedgerPeerSnapshot 'BigLedgerPeers
LedgerPeerSnapshotV2 (LedgerState (ShelleyBlock proto era) EmptyMK -> WithOrigin SlotNo
forall (l :: LedgerStateKind) (mk :: * -> * -> *).
GetTip l =>
l mk -> WithOrigin SlotNo
getTipSlot LedgerState (ShelleyBlock proto era) EmptyMK
lst, [(AccPoolStake, (PoolStake, NonEmpty LedgerRelayAccessPoint))]
bigLedgerPools)
      QueryStakePoolDefaultVote KeyHash StakePool
stakePool ->
        NewEpochState era -> KeyHash StakePool -> DefaultVote
forall era.
(EraCertState era, ConwayEraAccounts era) =>
NewEpochState era -> KeyHash StakePool -> DefaultVote
SL.queryStakePoolDefaultVote NewEpochState era
st KeyHash StakePool
stakePool
      GetPoolDistr2 Maybe (Set (KeyHash StakePool))
mPoolIds ->
        let stakeSet :: SnapShot
stakeSet = SnapShots -> SnapShot
SL.ssStakeSet (SnapShots -> SnapShot)
-> (EpochState era -> SnapShots) -> EpochState era -> SnapShot
forall b c a. (b -> c) -> (a -> b) -> a -> c
. EpochState era -> SnapShots
forall era. EpochState era -> SnapShots
SL.esSnapshots (EpochState era -> SnapShot) -> EpochState era -> SnapShot
forall a b. (a -> b) -> a -> b
$ NewEpochState era -> EpochState era
forall era. NewEpochState era -> EpochState era
getEpochState NewEpochState era
st
         in (KeyHash StakePool -> Bool) -> SnapShot -> PoolDistr
SL.calculatePoolDistr' ((KeyHash StakePool -> Bool)
-> (Set (KeyHash StakePool) -> KeyHash StakePool -> Bool)
-> Maybe (Set (KeyHash StakePool))
-> KeyHash StakePool
-> Bool
forall b a. b -> (a -> b) -> Maybe a -> b
maybe (Bool -> KeyHash StakePool -> Bool
forall a b. a -> b -> a
const Bool
True) ((KeyHash StakePool -> Set (KeyHash StakePool) -> Bool)
-> Set (KeyHash StakePool) -> KeyHash StakePool -> Bool
forall a b c. (a -> b -> c) -> b -> a -> c
flip KeyHash StakePool -> Set (KeyHash StakePool) -> Bool
forall a. Ord a => a -> Set a -> Bool
Set.member) Maybe (Set (KeyHash StakePool))
mPoolIds) SnapShot
stakeSet
      BlockQuery (ShelleyBlock proto era) 'QFNoTables result
R:BlockQueryShelleyBlockfpresult proto era 'QFNoTables result
GetStakeDistribution2 ->
        Globals -> NewEpochState era -> PoolDistr
forall era.
(EraStake era, EraCertState era) =>
Globals -> NewEpochState era -> PoolDistr
SL.poolsByTotalStakeFraction Globals
globals NewEpochState era
st
      BlockQuery (ShelleyBlock proto era) 'QFNoTables result
R:BlockQueryShelleyBlockfpresult proto era 'QFNoTables result
GetMaxMajorProtocolVersion ->
        ConsensusConfig proto -> result
ConsensusConfig proto -> MaxMajorProtVer
forall proto.
HasMaxMajorProtVer proto =>
ConsensusConfig proto -> MaxMajorProtVer
protoMaxMajorPV
          (ConsensusConfig proto -> result)
-> (ExtLedgerCfg (ShelleyBlock proto era) -> ConsensusConfig proto)
-> ExtLedgerCfg (ShelleyBlock proto era)
-> result
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TopLevelConfig (ShelleyBlock proto era) -> ConsensusConfig proto
TopLevelConfig (ShelleyBlock proto era)
-> ConsensusConfig (BlockProtocol (ShelleyBlock proto era))
forall blk.
TopLevelConfig blk -> ConsensusConfig (BlockProtocol blk)
configConsensus
          (TopLevelConfig (ShelleyBlock proto era) -> ConsensusConfig proto)
-> (ExtLedgerCfg (ShelleyBlock proto era)
    -> TopLevelConfig (ShelleyBlock proto era))
-> ExtLedgerCfg (ShelleyBlock proto era)
-> ConsensusConfig proto
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ExtLedgerCfg (ShelleyBlock proto era)
-> TopLevelConfig (ShelleyBlock proto era)
forall blk. ExtLedgerCfg blk -> TopLevelConfig blk
getExtLedgerCfg
          (ExtLedgerCfg (ShelleyBlock proto era) -> result)
-> ExtLedgerCfg (ShelleyBlock proto era) -> result
forall a b. (a -> b) -> a -> b
$ ExtLedgerCfg (ShelleyBlock proto era)
cfg
      GetDRepDelegations Set DRep
dreps ->
        NewEpochState era
-> Set DRep -> Map DRep (Set (Credential Staking))
forall era.
ConwayEraCertState era =>
NewEpochState era
-> Set DRep -> Map DRep (Set (Credential Staking))
SL.queryDRepDelegations NewEpochState era
st Set DRep
dreps
   where
    lcfg :: LedgerConfig (ShelleyBlock proto era)
lcfg = TopLevelConfig (ShelleyBlock proto era)
-> LedgerConfig (ShelleyBlock proto era)
forall blk. TopLevelConfig blk -> LedgerConfig blk
configLedger (TopLevelConfig (ShelleyBlock proto era)
 -> LedgerConfig (ShelleyBlock proto era))
-> TopLevelConfig (ShelleyBlock proto era)
-> LedgerConfig (ShelleyBlock proto era)
forall a b. (a -> b) -> a -> b
$ ExtLedgerCfg (ShelleyBlock proto era)
-> TopLevelConfig (ShelleyBlock proto era)
forall blk. ExtLedgerCfg blk -> TopLevelConfig blk
getExtLedgerCfg ExtLedgerCfg (ShelleyBlock proto era)
cfg
    globals :: Globals
globals = ShelleyLedgerConfig era -> Globals
forall era. ShelleyLedgerConfig era -> Globals
shelleyLedgerGlobals LedgerConfig (ShelleyBlock proto era)
ShelleyLedgerConfig era
lcfg
    -- NOTE: we are not pattern matching on @ext@ but using the accessors
    -- here. The reason for that is that that pattern match blows up the
    -- compile time (in particular the time spent desugaring, which is when
    -- the compiler looks at pattern matches) to 2m30s! We don't really
    -- understand why, but our guess is that it has to do with the combination
    -- of the strictness of 'ExtLedgerState', the fact that @LedgerState@ is a
    -- data family, and the 'ShelleyBasedEra' constraint.
    lst :: LedgerState (ShelleyBlock proto era) EmptyMK
lst = ExtLedgerState (ShelleyBlock proto era) EmptyMK
-> LedgerState (ShelleyBlock proto era) EmptyMK
forall blk (mk :: * -> * -> *).
ExtLedgerState blk mk -> LedgerState blk mk
ledgerState ExtLedgerState (ShelleyBlock proto era) EmptyMK
ext
    hst :: HeaderState (ShelleyBlock proto era)
hst = ExtLedgerState (ShelleyBlock proto era) EmptyMK
-> HeaderState (ShelleyBlock proto era)
forall blk (mk :: * -> * -> *).
ExtLedgerState blk mk -> HeaderState blk
headerState ExtLedgerState (ShelleyBlock proto era) EmptyMK
ext
    st :: NewEpochState era
st = LedgerState (ShelleyBlock proto era) EmptyMK -> NewEpochState era
forall proto era (mk :: * -> * -> *).
LedgerState (ShelleyBlock proto era) mk -> NewEpochState era
shelleyLedgerState LedgerState (ShelleyBlock proto era) EmptyMK
lst

  answerBlockQueryLookup :: forall (m :: * -> *) result.
MonadSTM m =>
ExtLedgerCfg (ShelleyBlock proto era)
-> BlockQuery (ShelleyBlock proto era) 'QFLookupTables result
-> ReadOnlyForker' m (ShelleyBlock proto era)
-> m result
answerBlockQueryLookup = (LedgerTables (LedgerState (ShelleyBlock proto era)) KeysMK
 -> LedgerTables (LedgerState (ShelleyBlock proto era)) KeysMK)
-> (TxOut (LedgerState (ShelleyBlock proto era)) -> TxOut era)
-> (TxIn (LedgerState (ShelleyBlock proto era)) -> TxIn)
-> ExtLedgerCfg (ShelleyBlock proto era)
-> BlockQuery (ShelleyBlock proto era) 'QFLookupTables result
-> ReadOnlyForker' m (ShelleyBlock proto era)
-> m result
forall proto era (m :: * -> *) result blk.
(Monad m, ShelleyCompatible proto era) =>
(LedgerTables (LedgerState (ShelleyBlock proto era)) KeysMK
 -> LedgerTables (LedgerState blk) KeysMK)
-> (TxOut (LedgerState blk) -> TxOut era)
-> (TxIn (LedgerState blk) -> TxIn)
-> ExtLedgerCfg (ShelleyBlock proto era)
-> BlockQuery (ShelleyBlock proto era) 'QFLookupTables result
-> ReadOnlyForker' m blk
-> m result
answerShelleyLookupQueries LedgerTables (LedgerState (ShelleyBlock proto era)) KeysMK
-> LedgerTables (LedgerState (ShelleyBlock proto era)) KeysMK
forall a. a -> a
id TxOut era -> TxOut era
TxOut (LedgerState (ShelleyBlock proto era)) -> TxOut era
forall a. a -> a
id TxIn (LedgerState (ShelleyBlock proto era)) -> TxIn
BigEndianTxIn -> TxIn
forall a b. Coercible a b => a -> b
coerce

  answerBlockQueryTraverse :: forall (m :: * -> *) result.
MonadSTM m =>
ExtLedgerCfg (ShelleyBlock proto era)
-> BlockQuery (ShelleyBlock proto era) 'QFTraverseTables result
-> ReadOnlyForker' m (ShelleyBlock proto era)
-> m result
answerBlockQueryTraverse = (TxOut (LedgerState (ShelleyBlock proto era)) -> TxOut era)
-> (TxIn (LedgerState (ShelleyBlock proto era)) -> TxIn)
-> (forall result'.
    BlockQuery (ShelleyBlock proto era) 'QFTraverseTables result'
    -> TxOut (LedgerState (ShelleyBlock proto era)) -> Bool)
-> ExtLedgerCfg (ShelleyBlock proto era)
-> BlockQuery (ShelleyBlock proto era) 'QFTraverseTables result
-> ReadOnlyForker' m (ShelleyBlock proto era)
-> m result
forall proto era (m :: * -> *) result blk.
(ShelleyCompatible proto era, Ord (TxIn (LedgerState blk)),
 Eq (TxOut (LedgerState blk)), MemPack (TxIn (LedgerState blk)),
 IndexedMemPack (LedgerState blk EmptyMK) (TxOut (LedgerState blk)),
 Monad m) =>
(TxOut (LedgerState blk) -> TxOut era)
-> (TxIn (LedgerState blk) -> TxIn)
-> (forall result'.
    BlockQuery (ShelleyBlock proto era) 'QFTraverseTables result'
    -> TxOut (LedgerState blk) -> Bool)
-> ExtLedgerCfg (ShelleyBlock proto era)
-> BlockQuery (ShelleyBlock proto era) 'QFTraverseTables result
-> ReadOnlyForker' m blk
-> m result
answerShelleyTraversingQueries TxOut era -> TxOut era
TxOut (LedgerState (ShelleyBlock proto era)) -> TxOut era
forall a. a -> a
id TxIn (LedgerState (ShelleyBlock proto era)) -> TxIn
BigEndianTxIn -> TxIn
forall a b. Coercible a b => a -> b
coerce BlockQuery (ShelleyBlock proto era) 'QFTraverseTables result'
-> TxOut (LedgerState (ShelleyBlock proto era)) -> Bool
BlockQuery (ShelleyBlock proto era) 'QFTraverseTables result'
-> TxOut (LedgerState (ShelleyBlock (ZonkAny 3) era)) -> Bool
forall result'.
BlockQuery (ShelleyBlock proto era) 'QFTraverseTables result'
-> TxOut (LedgerState (ShelleyBlock proto era)) -> Bool
forall proto era proto' era' result.
(ShelleyBasedEra era, ShelleyBasedEra era') =>
BlockQuery (ShelleyBlock proto era) 'QFTraverseTables result
-> TxOut (LedgerState (ShelleyBlock proto' era')) -> Bool
shelleyQFTraverseTablesPredicate

  -- \| Is the given query supported by the given 'ShelleyNodeToClientVersion'?
  blockQueryIsSupportedOnVersion :: forall (fp :: QueryFootprint) result.
BlockQuery (ShelleyBlock proto era) fp result
-> BlockNodeToClientVersion (ShelleyBlock proto era) -> Bool
blockQueryIsSupportedOnVersion = \case
    BlockQuery (ShelleyBlock proto era) fp result
R:BlockQueryShelleyBlockfpresult proto era fp result
GetLedgerTip -> Bool -> ShelleyNodeToClientVersion -> Bool
forall a b. a -> b -> a
const Bool
True
    BlockQuery (ShelleyBlock proto era) fp result
R:BlockQueryShelleyBlockfpresult proto era fp result
GetEpochNo -> Bool -> ShelleyNodeToClientVersion -> Bool
forall a b. a -> b -> a
const Bool
True
    GetNonMyopicMemberRewards{} -> Bool -> ShelleyNodeToClientVersion -> Bool
forall a b. a -> b -> a
const Bool
True
    BlockQuery (ShelleyBlock proto era) fp result
R:BlockQueryShelleyBlockfpresult proto era fp result
GetCurrentPParams -> Bool -> ShelleyNodeToClientVersion -> Bool
forall a b. a -> b -> a
const Bool
True
    BlockQuery (ShelleyBlock proto era) fp result
R:BlockQueryShelleyBlockfpresult proto era fp result
GetProposedPParamsUpdates -> (ShelleyNodeToClientVersion -> ShelleyNodeToClientVersion -> Bool
forall a. Ord a => a -> a -> Bool
< ShelleyNodeToClientVersion
v12)
    BlockQuery (ShelleyBlock proto era) fp result
R:BlockQueryShelleyBlockfpresult proto era fp result
GetStakeDistribution -> (ShelleyNodeToClientVersion -> ShelleyNodeToClientVersion -> Bool
forall a. Ord a => a -> a -> Bool
< ShelleyNodeToClientVersion
v13)
    GetUTxOByAddress{} -> Bool -> ShelleyNodeToClientVersion -> Bool
forall a b. a -> b -> a
const Bool
True
    BlockQuery (ShelleyBlock proto era) fp result
R:BlockQueryShelleyBlockfpresult proto era fp result
GetUTxOWhole -> Bool -> ShelleyNodeToClientVersion -> Bool
forall a b. a -> b -> a
const Bool
True
    BlockQuery (ShelleyBlock proto era) fp result
R:BlockQueryShelleyBlockfpresult proto era fp result
DebugEpochState -> Bool -> ShelleyNodeToClientVersion -> Bool
forall a b. a -> b -> a
const Bool
True
    GetCBOR BlockQuery (ShelleyBlock proto era) fp result
q -> BlockQuery (ShelleyBlock proto era) fp result
-> BlockNodeToClientVersion (ShelleyBlock proto era) -> Bool
forall blk (fp :: QueryFootprint) result.
BlockSupportsLedgerQuery blk =>
BlockQuery blk fp result -> BlockNodeToClientVersion blk -> Bool
forall (fp :: QueryFootprint) result.
BlockQuery (ShelleyBlock proto era) fp result
-> BlockNodeToClientVersion (ShelleyBlock proto era) -> Bool
blockQueryIsSupportedOnVersion BlockQuery (ShelleyBlock proto era) fp result
q
    GetFilteredDelegationsAndRewardAccounts{} -> Bool -> ShelleyNodeToClientVersion -> Bool
forall a b. a -> b -> a
const Bool
True
    BlockQuery (ShelleyBlock proto era) fp result
R:BlockQueryShelleyBlockfpresult proto era fp result
GetGenesisConfig -> Bool -> ShelleyNodeToClientVersion -> Bool
forall a b. a -> b -> a
const Bool
True
    BlockQuery (ShelleyBlock proto era) fp result
R:BlockQueryShelleyBlockfpresult proto era fp result
DebugNewEpochState -> Bool -> ShelleyNodeToClientVersion -> Bool
forall a b. a -> b -> a
const Bool
True
    BlockQuery (ShelleyBlock proto era) fp result
R:BlockQueryShelleyBlockfpresult proto era fp result
DebugChainDepState -> Bool -> ShelleyNodeToClientVersion -> Bool
forall a b. a -> b -> a
const Bool
True
    BlockQuery (ShelleyBlock proto era) fp result
R:BlockQueryShelleyBlockfpresult proto era fp result
GetRewardProvenance -> Bool -> ShelleyNodeToClientVersion -> Bool
forall a b. a -> b -> a
const Bool
True
    GetUTxOByTxIn{} -> Bool -> ShelleyNodeToClientVersion -> Bool
forall a b. a -> b -> a
const Bool
True
    BlockQuery (ShelleyBlock proto era) fp result
R:BlockQueryShelleyBlockfpresult proto era fp result
GetStakePools -> Bool -> ShelleyNodeToClientVersion -> Bool
forall a b. a -> b -> a
const Bool
True
    GetStakePoolParams{} -> Bool -> ShelleyNodeToClientVersion -> Bool
forall a b. a -> b -> a
const Bool
True
    BlockQuery (ShelleyBlock proto era) fp result
R:BlockQueryShelleyBlockfpresult proto era fp result
GetRewardInfoPools -> Bool -> ShelleyNodeToClientVersion -> Bool
forall a b. a -> b -> a
const Bool
True
    GetPoolState{} -> Bool -> ShelleyNodeToClientVersion -> Bool
forall a b. a -> b -> a
const Bool
True
    GetStakeSnapshots{} -> Bool -> ShelleyNodeToClientVersion -> Bool
forall a b. a -> b -> a
const Bool
True
    GetPoolDistr{} -> (ShelleyNodeToClientVersion -> ShelleyNodeToClientVersion -> Bool
forall a. Ord a => a -> a -> Bool
< ShelleyNodeToClientVersion
v13)
    GetStakeDelegDeposits{} -> Bool -> ShelleyNodeToClientVersion -> Bool
forall a b. a -> b -> a
const Bool
True
    BlockQuery (ShelleyBlock proto era) fp result
R:BlockQueryShelleyBlockfpresult proto era fp result
GetConstitution -> (ShelleyNodeToClientVersion -> ShelleyNodeToClientVersion -> Bool
forall a. Ord a => a -> a -> Bool
>= ShelleyNodeToClientVersion
v8)
    BlockQuery (ShelleyBlock proto era) fp result
R:BlockQueryShelleyBlockfpresult proto era fp result
GetGovState -> (ShelleyNodeToClientVersion -> ShelleyNodeToClientVersion -> Bool
forall a. Ord a => a -> a -> Bool
>= ShelleyNodeToClientVersion
v8)
    GetDRepState{} -> (ShelleyNodeToClientVersion -> ShelleyNodeToClientVersion -> Bool
forall a. Ord a => a -> a -> Bool
>= ShelleyNodeToClientVersion
v8)
    GetDRepStakeDistr{} -> (ShelleyNodeToClientVersion -> ShelleyNodeToClientVersion -> Bool
forall a. Ord a => a -> a -> Bool
>= ShelleyNodeToClientVersion
v8)
    GetCommitteeMembersState{} -> (ShelleyNodeToClientVersion -> ShelleyNodeToClientVersion -> Bool
forall a. Ord a => a -> a -> Bool
>= ShelleyNodeToClientVersion
v8)
    GetFilteredVoteDelegatees{} -> (ShelleyNodeToClientVersion -> ShelleyNodeToClientVersion -> Bool
forall a. Ord a => a -> a -> Bool
>= ShelleyNodeToClientVersion
v8)
    GetAccountState{} -> (ShelleyNodeToClientVersion -> ShelleyNodeToClientVersion -> Bool
forall a. Ord a => a -> a -> Bool
>= ShelleyNodeToClientVersion
v8)
    GetSPOStakeDistr{} -> (ShelleyNodeToClientVersion -> ShelleyNodeToClientVersion -> Bool
forall a. Ord a => a -> a -> Bool
>= ShelleyNodeToClientVersion
v8)
    GetProposals{} -> (ShelleyNodeToClientVersion -> ShelleyNodeToClientVersion -> Bool
forall a. Ord a => a -> a -> Bool
>= ShelleyNodeToClientVersion
v9)
    GetRatifyState{} -> (ShelleyNodeToClientVersion -> ShelleyNodeToClientVersion -> Bool
forall a. Ord a => a -> a -> Bool
>= ShelleyNodeToClientVersion
v9)
    GetFuturePParams{} -> (ShelleyNodeToClientVersion -> ShelleyNodeToClientVersion -> Bool
forall a. Ord a => a -> a -> Bool
>= ShelleyNodeToClientVersion
v10)
    GetLedgerPeerSnapshot' Bool
False LedgerPeersKind
_peerKind -> (ShelleyNodeToClientVersion -> ShelleyNodeToClientVersion -> Bool
forall a. Ord a => a -> a -> Bool
>= ShelleyNodeToClientVersion
v11)
    GetLedgerPeerSnapshot' Bool
True LedgerPeersKind
_peerKind -> (ShelleyNodeToClientVersion -> ShelleyNodeToClientVersion -> Bool
forall a. Ord a => a -> a -> Bool
>= ShelleyNodeToClientVersion
v15)
    QueryStakePoolDefaultVote{} -> (ShelleyNodeToClientVersion -> ShelleyNodeToClientVersion -> Bool
forall a. Ord a => a -> a -> Bool
>= ShelleyNodeToClientVersion
v12)
    GetPoolDistr2{} -> (ShelleyNodeToClientVersion -> ShelleyNodeToClientVersion -> Bool
forall a. Ord a => a -> a -> Bool
>= ShelleyNodeToClientVersion
v13)
    GetStakeDistribution2{} -> (ShelleyNodeToClientVersion -> ShelleyNodeToClientVersion -> Bool
forall a. Ord a => a -> a -> Bool
>= ShelleyNodeToClientVersion
v13)
    BlockQuery (ShelleyBlock proto era) fp result
R:BlockQueryShelleyBlockfpresult proto era fp result
GetMaxMajorProtocolVersion -> (ShelleyNodeToClientVersion -> ShelleyNodeToClientVersion -> Bool
forall a. Ord a => a -> a -> Bool
>= ShelleyNodeToClientVersion
v13)
    GetDRepDelegations{} -> (ShelleyNodeToClientVersion -> ShelleyNodeToClientVersion -> Bool
forall a. Ord a => a -> a -> Bool
>= ShelleyNodeToClientVersion
v15)
   where
    -- WARNING: when adding a new query, a new @ShelleyNodeToClientVersionX@
    -- must be added. See #2830 for a template on how to do this.

    v8 :: ShelleyNodeToClientVersion
v8 = ShelleyNodeToClientVersion
ShelleyNodeToClientVersion8
    v9 :: ShelleyNodeToClientVersion
v9 = ShelleyNodeToClientVersion
ShelleyNodeToClientVersion9
    v10 :: ShelleyNodeToClientVersion
v10 = ShelleyNodeToClientVersion
ShelleyNodeToClientVersion10
    v11 :: ShelleyNodeToClientVersion
v11 = ShelleyNodeToClientVersion
ShelleyNodeToClientVersion11
    v12 :: ShelleyNodeToClientVersion
v12 = ShelleyNodeToClientVersion
ShelleyNodeToClientVersion12
    v13 :: ShelleyNodeToClientVersion
v13 = ShelleyNodeToClientVersion
ShelleyNodeToClientVersion13
    v15 :: ShelleyNodeToClientVersion
v15 = ShelleyNodeToClientVersion
ShelleyNodeToClientVersion15

instance SameDepIndex2 (BlockQuery (ShelleyBlock proto era)) where
  sameDepIndex2 :: forall (x :: QueryFootprint) a (y :: QueryFootprint) b.
BlockQuery (ShelleyBlock proto era) x a
-> BlockQuery (ShelleyBlock proto era) y b
-> Maybe ('(x, a) :~: '(y, b))
sameDepIndex2 BlockQuery (ShelleyBlock proto era) x a
R:BlockQueryShelleyBlockfpresult proto era x a
GetLedgerTip BlockQuery (ShelleyBlock proto era) y b
R:BlockQueryShelleyBlockfpresult proto era y b
GetLedgerTip =
    ('(x, a) :~: '(y, b)) -> Maybe ('(x, a) :~: '(y, b))
forall a. a -> Maybe a
Just '(x, a) :~: '(x, a)
'(x, a) :~: '(y, b)
forall {k} (a :: k). a :~: a
Refl
  sameDepIndex2 BlockQuery (ShelleyBlock proto era) x a
R:BlockQueryShelleyBlockfpresult proto era x a
GetLedgerTip BlockQuery (ShelleyBlock proto era) y b
_ =
    Maybe ('(x, a) :~: '(y, b))
forall a. Maybe a
Nothing
  sameDepIndex2 BlockQuery (ShelleyBlock proto era) x a
R:BlockQueryShelleyBlockfpresult proto era x a
GetEpochNo BlockQuery (ShelleyBlock proto era) y b
R:BlockQueryShelleyBlockfpresult proto era y b
GetEpochNo =
    ('(x, a) :~: '(y, b)) -> Maybe ('(x, a) :~: '(y, b))
forall a. a -> Maybe a
Just '(x, a) :~: '(x, a)
'(x, a) :~: '(y, b)
forall {k} (a :: k). a :~: a
Refl
  sameDepIndex2 BlockQuery (ShelleyBlock proto era) x a
R:BlockQueryShelleyBlockfpresult proto era x a
GetEpochNo BlockQuery (ShelleyBlock proto era) y b
_ =
    Maybe ('(x, a) :~: '(y, b))
forall a. Maybe a
Nothing
  sameDepIndex2 (GetNonMyopicMemberRewards Set (Either Coin (Credential Staking))
creds) (GetNonMyopicMemberRewards Set (Either Coin (Credential Staking))
creds')
    | Set (Either Coin (Credential Staking))
creds Set (Either Coin (Credential Staking))
-> Set (Either Coin (Credential Staking)) -> Bool
forall a. Eq a => a -> a -> Bool
== Set (Either Coin (Credential Staking))
creds' =
        ('(x, a) :~: '(y, b)) -> Maybe ('(x, a) :~: '(y, b))
forall a. a -> Maybe a
Just '(x, a) :~: '(x, a)
'(x, a) :~: '(y, b)
forall {k} (a :: k). a :~: a
Refl
    | Bool
otherwise =
        Maybe ('(x, a) :~: '(y, b))
forall a. Maybe a
Nothing
  sameDepIndex2 (GetNonMyopicMemberRewards Set (Either Coin (Credential Staking))
_) BlockQuery (ShelleyBlock proto era) y b
_ =
    Maybe ('(x, a) :~: '(y, b))
forall a. Maybe a
Nothing
  sameDepIndex2 BlockQuery (ShelleyBlock proto era) x a
R:BlockQueryShelleyBlockfpresult proto era x a
GetCurrentPParams BlockQuery (ShelleyBlock proto era) y b
R:BlockQueryShelleyBlockfpresult proto era y b
GetCurrentPParams =
    ('(x, a) :~: '(y, b)) -> Maybe ('(x, a) :~: '(y, b))
forall a. a -> Maybe a
Just '(x, a) :~: '(x, a)
'(x, a) :~: '(y, b)
forall {k} (a :: k). a :~: a
Refl
  sameDepIndex2 BlockQuery (ShelleyBlock proto era) x a
R:BlockQueryShelleyBlockfpresult proto era x a
GetCurrentPParams BlockQuery (ShelleyBlock proto era) y b
_ =
    Maybe ('(x, a) :~: '(y, b))
forall a. Maybe a
Nothing
  sameDepIndex2 BlockQuery (ShelleyBlock proto era) x a
R:BlockQueryShelleyBlockfpresult proto era x a
GetProposedPParamsUpdates BlockQuery (ShelleyBlock proto era) y b
R:BlockQueryShelleyBlockfpresult proto era y b
GetProposedPParamsUpdates =
    ('(x, a) :~: '(y, b)) -> Maybe ('(x, a) :~: '(y, b))
forall a. a -> Maybe a
Just '(x, a) :~: '(x, a)
'(x, a) :~: '(y, b)
forall {k} (a :: k). a :~: a
Refl
  sameDepIndex2 BlockQuery (ShelleyBlock proto era) x a
R:BlockQueryShelleyBlockfpresult proto era x a
GetProposedPParamsUpdates BlockQuery (ShelleyBlock proto era) y b
_ =
    Maybe ('(x, a) :~: '(y, b))
forall a. Maybe a
Nothing
  sameDepIndex2 BlockQuery (ShelleyBlock proto era) x a
R:BlockQueryShelleyBlockfpresult proto era x a
GetStakeDistribution BlockQuery (ShelleyBlock proto era) y b
R:BlockQueryShelleyBlockfpresult proto era y b
GetStakeDistribution =
    ('(x, a) :~: '(y, b)) -> Maybe ('(x, a) :~: '(y, b))
forall a. a -> Maybe a
Just '(x, a) :~: '(x, a)
'(x, a) :~: '(y, b)
forall {k} (a :: k). a :~: a
Refl
  sameDepIndex2 BlockQuery (ShelleyBlock proto era) x a
R:BlockQueryShelleyBlockfpresult proto era x a
GetStakeDistribution BlockQuery (ShelleyBlock proto era) y b
_ =
    Maybe ('(x, a) :~: '(y, b))
forall a. Maybe a
Nothing
  sameDepIndex2 (GetUTxOByAddress Set Addr
addrs) (GetUTxOByAddress Set Addr
addrs')
    | Set Addr
addrs Set Addr -> Set Addr -> Bool
forall a. Eq a => a -> a -> Bool
== Set Addr
addrs' =
        ('(x, a) :~: '(y, b)) -> Maybe ('(x, a) :~: '(y, b))
forall a. a -> Maybe a
Just '(x, a) :~: '(x, a)
'(x, a) :~: '(y, b)
forall {k} (a :: k). a :~: a
Refl
    | Bool
otherwise =
        Maybe ('(x, a) :~: '(y, b))
forall a. Maybe a
Nothing
  sameDepIndex2 (GetUTxOByAddress Set Addr
_) BlockQuery (ShelleyBlock proto era) y b
_ =
    Maybe ('(x, a) :~: '(y, b))
forall a. Maybe a
Nothing
  sameDepIndex2 BlockQuery (ShelleyBlock proto era) x a
R:BlockQueryShelleyBlockfpresult proto era x a
GetUTxOWhole BlockQuery (ShelleyBlock proto era) y b
R:BlockQueryShelleyBlockfpresult proto era y b
GetUTxOWhole =
    ('(x, a) :~: '(y, b)) -> Maybe ('(x, a) :~: '(y, b))
forall a. a -> Maybe a
Just '(x, a) :~: '(x, a)
'(x, a) :~: '(y, b)
forall {k} (a :: k). a :~: a
Refl
  sameDepIndex2 BlockQuery (ShelleyBlock proto era) x a
R:BlockQueryShelleyBlockfpresult proto era x a
GetUTxOWhole BlockQuery (ShelleyBlock proto era) y b
_ =
    Maybe ('(x, a) :~: '(y, b))
forall a. Maybe a
Nothing
  sameDepIndex2 BlockQuery (ShelleyBlock proto era) x a
R:BlockQueryShelleyBlockfpresult proto era x a
DebugEpochState BlockQuery (ShelleyBlock proto era) y b
R:BlockQueryShelleyBlockfpresult proto era y b
DebugEpochState =
    ('(x, a) :~: '(y, b)) -> Maybe ('(x, a) :~: '(y, b))
forall a. a -> Maybe a
Just '(x, a) :~: '(x, a)
'(x, a) :~: '(y, b)
forall {k} (a :: k). a :~: a
Refl
  sameDepIndex2 BlockQuery (ShelleyBlock proto era) x a
R:BlockQueryShelleyBlockfpresult proto era x a
DebugEpochState BlockQuery (ShelleyBlock proto era) y b
_ =
    Maybe ('(x, a) :~: '(y, b))
forall a. Maybe a
Nothing
  sameDepIndex2 (GetCBOR BlockQuery (ShelleyBlock proto era) x result
q) (GetCBOR BlockQuery (ShelleyBlock proto era) y result
q') =
    (\'(x, result) :~: '(y, result)
Refl -> '(x, a) :~: '(x, a)
'(x, a) :~: '(y, b)
forall {k} (a :: k). a :~: a
Refl) (('(x, result) :~: '(y, result)) -> '(x, a) :~: '(y, b))
-> Maybe ('(x, result) :~: '(y, result))
-> Maybe ('(x, a) :~: '(y, b))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> BlockQuery (ShelleyBlock proto era) x result
-> BlockQuery (ShelleyBlock proto era) y result
-> Maybe ('(x, result) :~: '(y, result))
forall k1 k2 (f :: k1 -> k2 -> *) (x :: k1) (a :: k2) (y :: k1)
       (b :: k2).
SameDepIndex2 f =>
f x a -> f y b -> Maybe ('(x, a) :~: '(y, b))
forall (x :: QueryFootprint) a (y :: QueryFootprint) b.
BlockQuery (ShelleyBlock proto era) x a
-> BlockQuery (ShelleyBlock proto era) y b
-> Maybe ('(x, a) :~: '(y, b))
sameDepIndex2 BlockQuery (ShelleyBlock proto era) x result
q BlockQuery (ShelleyBlock proto era) y result
q'
  sameDepIndex2 (GetCBOR BlockQuery (ShelleyBlock proto era) x result
_) BlockQuery (ShelleyBlock proto era) y b
_ =
    Maybe ('(x, a) :~: '(y, b))
forall a. Maybe a
Nothing
  sameDepIndex2
    (GetFilteredDelegationsAndRewardAccounts Set (Credential Staking)
creds)
    (GetFilteredDelegationsAndRewardAccounts Set (Credential Staking)
creds')
      | Set (Credential Staking)
creds Set (Credential Staking) -> Set (Credential Staking) -> Bool
forall a. Eq a => a -> a -> Bool
== Set (Credential Staking)
creds' =
          ('(x, a) :~: '(y, b)) -> Maybe ('(x, a) :~: '(y, b))
forall a. a -> Maybe a
Just '(x, a) :~: '(x, a)
'(x, a) :~: '(y, b)
forall {k} (a :: k). a :~: a
Refl
      | Bool
otherwise =
          Maybe ('(x, a) :~: '(y, b))
forall a. Maybe a
Nothing
  sameDepIndex2 (GetFilteredDelegationsAndRewardAccounts Set (Credential Staking)
_) BlockQuery (ShelleyBlock proto era) y b
_ =
    Maybe ('(x, a) :~: '(y, b))
forall a. Maybe a
Nothing
  sameDepIndex2 BlockQuery (ShelleyBlock proto era) x a
R:BlockQueryShelleyBlockfpresult proto era x a
GetGenesisConfig BlockQuery (ShelleyBlock proto era) y b
R:BlockQueryShelleyBlockfpresult proto era y b
GetGenesisConfig =
    ('(x, a) :~: '(y, b)) -> Maybe ('(x, a) :~: '(y, b))
forall a. a -> Maybe a
Just '(x, a) :~: '(x, a)
'(x, a) :~: '(y, b)
forall {k} (a :: k). a :~: a
Refl
  sameDepIndex2 BlockQuery (ShelleyBlock proto era) x a
R:BlockQueryShelleyBlockfpresult proto era x a
GetGenesisConfig BlockQuery (ShelleyBlock proto era) y b
_ =
    Maybe ('(x, a) :~: '(y, b))
forall a. Maybe a
Nothing
  sameDepIndex2 BlockQuery (ShelleyBlock proto era) x a
R:BlockQueryShelleyBlockfpresult proto era x a
DebugNewEpochState BlockQuery (ShelleyBlock proto era) y b
R:BlockQueryShelleyBlockfpresult proto era y b
DebugNewEpochState =
    ('(x, a) :~: '(y, b)) -> Maybe ('(x, a) :~: '(y, b))
forall a. a -> Maybe a
Just '(x, a) :~: '(x, a)
'(x, a) :~: '(y, b)
forall {k} (a :: k). a :~: a
Refl
  sameDepIndex2 BlockQuery (ShelleyBlock proto era) x a
R:BlockQueryShelleyBlockfpresult proto era x a
DebugNewEpochState BlockQuery (ShelleyBlock proto era) y b
_ =
    Maybe ('(x, a) :~: '(y, b))
forall a. Maybe a
Nothing
  sameDepIndex2 BlockQuery (ShelleyBlock proto era) x a
R:BlockQueryShelleyBlockfpresult proto era x a
DebugChainDepState BlockQuery (ShelleyBlock proto era) y b
R:BlockQueryShelleyBlockfpresult proto era y b
DebugChainDepState =
    ('(x, a) :~: '(y, b)) -> Maybe ('(x, a) :~: '(y, b))
forall a. a -> Maybe a
Just '(x, a) :~: '(x, a)
'(x, a) :~: '(y, b)
forall {k} (a :: k). a :~: a
Refl
  sameDepIndex2 BlockQuery (ShelleyBlock proto era) x a
R:BlockQueryShelleyBlockfpresult proto era x a
DebugChainDepState BlockQuery (ShelleyBlock proto era) y b
_ =
    Maybe ('(x, a) :~: '(y, b))
forall a. Maybe a
Nothing
  sameDepIndex2 BlockQuery (ShelleyBlock proto era) x a
R:BlockQueryShelleyBlockfpresult proto era x a
GetRewardProvenance BlockQuery (ShelleyBlock proto era) y b
R:BlockQueryShelleyBlockfpresult proto era y b
GetRewardProvenance =
    ('(x, a) :~: '(y, b)) -> Maybe ('(x, a) :~: '(y, b))
forall a. a -> Maybe a
Just '(x, a) :~: '(x, a)
'(x, a) :~: '(y, b)
forall {k} (a :: k). a :~: a
Refl
  sameDepIndex2 BlockQuery (ShelleyBlock proto era) x a
R:BlockQueryShelleyBlockfpresult proto era x a
GetRewardProvenance BlockQuery (ShelleyBlock proto era) y b
_ =
    Maybe ('(x, a) :~: '(y, b))
forall a. Maybe a
Nothing
  sameDepIndex2 (GetUTxOByTxIn Set TxIn
addrs) (GetUTxOByTxIn Set TxIn
addrs')
    | Set TxIn
addrs Set TxIn -> Set TxIn -> Bool
forall a. Eq a => a -> a -> Bool
== Set TxIn
addrs' =
        ('(x, a) :~: '(y, b)) -> Maybe ('(x, a) :~: '(y, b))
forall a. a -> Maybe a
Just '(x, a) :~: '(x, a)
'(x, a) :~: '(y, b)
forall {k} (a :: k). a :~: a
Refl
    | Bool
otherwise =
        Maybe ('(x, a) :~: '(y, b))
forall a. Maybe a
Nothing
  sameDepIndex2 (GetUTxOByTxIn Set TxIn
_) BlockQuery (ShelleyBlock proto era) y b
_ =
    Maybe ('(x, a) :~: '(y, b))
forall a. Maybe a
Nothing
  sameDepIndex2 BlockQuery (ShelleyBlock proto era) x a
R:BlockQueryShelleyBlockfpresult proto era x a
GetStakePools BlockQuery (ShelleyBlock proto era) y b
R:BlockQueryShelleyBlockfpresult proto era y b
GetStakePools =
    ('(x, a) :~: '(y, b)) -> Maybe ('(x, a) :~: '(y, b))
forall a. a -> Maybe a
Just '(x, a) :~: '(x, a)
'(x, a) :~: '(y, b)
forall {k} (a :: k). a :~: a
Refl
  sameDepIndex2 BlockQuery (ShelleyBlock proto era) x a
R:BlockQueryShelleyBlockfpresult proto era x a
GetStakePools BlockQuery (ShelleyBlock proto era) y b
_ =
    Maybe ('(x, a) :~: '(y, b))
forall a. Maybe a
Nothing
  sameDepIndex2 (GetStakePoolParams Set (KeyHash StakePool)
poolids) (GetStakePoolParams Set (KeyHash StakePool)
poolids')
    | Set (KeyHash StakePool)
poolids Set (KeyHash StakePool) -> Set (KeyHash StakePool) -> Bool
forall a. Eq a => a -> a -> Bool
== Set (KeyHash StakePool)
poolids' =
        ('(x, a) :~: '(y, b)) -> Maybe ('(x, a) :~: '(y, b))
forall a. a -> Maybe a
Just '(x, a) :~: '(x, a)
'(x, a) :~: '(y, b)
forall {k} (a :: k). a :~: a
Refl
    | Bool
otherwise =
        Maybe ('(x, a) :~: '(y, b))
forall a. Maybe a
Nothing
  sameDepIndex2 (GetStakePoolParams Set (KeyHash StakePool)
_) BlockQuery (ShelleyBlock proto era) y b
_ =
    Maybe ('(x, a) :~: '(y, b))
forall a. Maybe a
Nothing
  sameDepIndex2 BlockQuery (ShelleyBlock proto era) x a
R:BlockQueryShelleyBlockfpresult proto era x a
GetRewardInfoPools BlockQuery (ShelleyBlock proto era) y b
R:BlockQueryShelleyBlockfpresult proto era y b
GetRewardInfoPools =
    ('(x, a) :~: '(y, b)) -> Maybe ('(x, a) :~: '(y, b))
forall a. a -> Maybe a
Just '(x, a) :~: '(x, a)
'(x, a) :~: '(y, b)
forall {k} (a :: k). a :~: a
Refl
  sameDepIndex2 BlockQuery (ShelleyBlock proto era) x a
R:BlockQueryShelleyBlockfpresult proto era x a
GetRewardInfoPools BlockQuery (ShelleyBlock proto era) y b
_ =
    Maybe ('(x, a) :~: '(y, b))
forall a. Maybe a
Nothing
  sameDepIndex2 (GetPoolState Maybe (Set (KeyHash StakePool))
poolids) (GetPoolState Maybe (Set (KeyHash StakePool))
poolids')
    | Maybe (Set (KeyHash StakePool))
poolids Maybe (Set (KeyHash StakePool))
-> Maybe (Set (KeyHash StakePool)) -> Bool
forall a. Eq a => a -> a -> Bool
== Maybe (Set (KeyHash StakePool))
poolids' =
        ('(x, a) :~: '(y, b)) -> Maybe ('(x, a) :~: '(y, b))
forall a. a -> Maybe a
Just '(x, a) :~: '(x, a)
'(x, a) :~: '(y, b)
forall {k} (a :: k). a :~: a
Refl
    | Bool
otherwise =
        Maybe ('(x, a) :~: '(y, b))
forall a. Maybe a
Nothing
  sameDepIndex2 (GetPoolState Maybe (Set (KeyHash StakePool))
_) BlockQuery (ShelleyBlock proto era) y b
_ =
    Maybe ('(x, a) :~: '(y, b))
forall a. Maybe a
Nothing
  sameDepIndex2 (GetStakeSnapshots Maybe (Set (KeyHash StakePool))
poolid) (GetStakeSnapshots Maybe (Set (KeyHash StakePool))
poolid')
    | Maybe (Set (KeyHash StakePool))
poolid Maybe (Set (KeyHash StakePool))
-> Maybe (Set (KeyHash StakePool)) -> Bool
forall a. Eq a => a -> a -> Bool
== Maybe (Set (KeyHash StakePool))
poolid' =
        ('(x, a) :~: '(y, b)) -> Maybe ('(x, a) :~: '(y, b))
forall a. a -> Maybe a
Just '(x, a) :~: '(x, a)
'(x, a) :~: '(y, b)
forall {k} (a :: k). a :~: a
Refl
    | Bool
otherwise =
        Maybe ('(x, a) :~: '(y, b))
forall a. Maybe a
Nothing
  sameDepIndex2 (GetStakeSnapshots Maybe (Set (KeyHash StakePool))
_) BlockQuery (ShelleyBlock proto era) y b
_ =
    Maybe ('(x, a) :~: '(y, b))
forall a. Maybe a
Nothing
  sameDepIndex2 (GetPoolDistr Maybe (Set (KeyHash StakePool))
poolids) (GetPoolDistr Maybe (Set (KeyHash StakePool))
poolids')
    | Maybe (Set (KeyHash StakePool))
poolids Maybe (Set (KeyHash StakePool))
-> Maybe (Set (KeyHash StakePool)) -> Bool
forall a. Eq a => a -> a -> Bool
== Maybe (Set (KeyHash StakePool))
poolids' =
        ('(x, a) :~: '(y, b)) -> Maybe ('(x, a) :~: '(y, b))
forall a. a -> Maybe a
Just '(x, a) :~: '(x, a)
'(x, a) :~: '(y, b)
forall {k} (a :: k). a :~: a
Refl
    | Bool
otherwise =
        Maybe ('(x, a) :~: '(y, b))
forall a. Maybe a
Nothing
  sameDepIndex2 (GetPoolDistr Maybe (Set (KeyHash StakePool))
_) BlockQuery (ShelleyBlock proto era) y b
_ =
    Maybe ('(x, a) :~: '(y, b))
forall a. Maybe a
Nothing
  sameDepIndex2 (GetStakeDelegDeposits Set (Credential Staking)
stakeCreds) (GetStakeDelegDeposits Set (Credential Staking)
stakeCreds')
    | Set (Credential Staking)
stakeCreds Set (Credential Staking) -> Set (Credential Staking) -> Bool
forall a. Eq a => a -> a -> Bool
== Set (Credential Staking)
stakeCreds' =
        ('(x, a) :~: '(y, b)) -> Maybe ('(x, a) :~: '(y, b))
forall a. a -> Maybe a
Just '(x, a) :~: '(x, a)
'(x, a) :~: '(y, b)
forall {k} (a :: k). a :~: a
Refl
    | Bool
otherwise =
        Maybe ('(x, a) :~: '(y, b))
forall a. Maybe a
Nothing
  sameDepIndex2 (GetStakeDelegDeposits Set (Credential Staking)
_) BlockQuery (ShelleyBlock proto era) y b
_ =
    Maybe ('(x, a) :~: '(y, b))
forall a. Maybe a
Nothing
  sameDepIndex2 BlockQuery (ShelleyBlock proto era) x a
R:BlockQueryShelleyBlockfpresult proto era x a
GetConstitution BlockQuery (ShelleyBlock proto era) y b
R:BlockQueryShelleyBlockfpresult proto era y b
GetConstitution = ('(x, a) :~: '(y, b)) -> Maybe ('(x, a) :~: '(y, b))
forall a. a -> Maybe a
Just '(x, a) :~: '(x, a)
'(x, a) :~: '(y, b)
forall {k} (a :: k). a :~: a
Refl
  sameDepIndex2 BlockQuery (ShelleyBlock proto era) x a
R:BlockQueryShelleyBlockfpresult proto era x a
GetConstitution BlockQuery (ShelleyBlock proto era) y b
_ = Maybe ('(x, a) :~: '(y, b))
forall a. Maybe a
Nothing
  sameDepIndex2 BlockQuery (ShelleyBlock proto era) x a
R:BlockQueryShelleyBlockfpresult proto era x a
GetGovState BlockQuery (ShelleyBlock proto era) y b
R:BlockQueryShelleyBlockfpresult proto era y b
GetGovState = ('(x, a) :~: '(y, b)) -> Maybe ('(x, a) :~: '(y, b))
forall a. a -> Maybe a
Just '(x, a) :~: '(x, a)
'(x, a) :~: '(y, b)
forall {k} (a :: k). a :~: a
Refl
  sameDepIndex2 BlockQuery (ShelleyBlock proto era) x a
R:BlockQueryShelleyBlockfpresult proto era x a
GetGovState BlockQuery (ShelleyBlock proto era) y b
_ = Maybe ('(x, a) :~: '(y, b))
forall a. Maybe a
Nothing
  sameDepIndex2 GetDRepState{} GetDRepState{} = ('(x, a) :~: '(y, b)) -> Maybe ('(x, a) :~: '(y, b))
forall a. a -> Maybe a
Just '(x, a) :~: '(x, a)
'(x, a) :~: '(y, b)
forall {k} (a :: k). a :~: a
Refl
  sameDepIndex2 GetDRepState{} BlockQuery (ShelleyBlock proto era) y b
_ = Maybe ('(x, a) :~: '(y, b))
forall a. Maybe a
Nothing
  sameDepIndex2 GetDRepStakeDistr{} GetDRepStakeDistr{} = ('(x, a) :~: '(y, b)) -> Maybe ('(x, a) :~: '(y, b))
forall a. a -> Maybe a
Just '(x, a) :~: '(x, a)
'(x, a) :~: '(y, b)
forall {k} (a :: k). a :~: a
Refl
  sameDepIndex2 GetDRepStakeDistr{} BlockQuery (ShelleyBlock proto era) y b
_ = Maybe ('(x, a) :~: '(y, b))
forall a. Maybe a
Nothing
  sameDepIndex2 GetCommitteeMembersState{} GetCommitteeMembersState{} = ('(x, a) :~: '(y, b)) -> Maybe ('(x, a) :~: '(y, b))
forall a. a -> Maybe a
Just '(x, a) :~: '(x, a)
'(x, a) :~: '(y, b)
forall {k} (a :: k). a :~: a
Refl
  sameDepIndex2 GetCommitteeMembersState{} BlockQuery (ShelleyBlock proto era) y b
_ = Maybe ('(x, a) :~: '(y, b))
forall a. Maybe a
Nothing
  sameDepIndex2 (GetFilteredVoteDelegatees Set (Credential Staking)
stakeCreds) (GetFilteredVoteDelegatees Set (Credential Staking)
stakeCreds')
    | Set (Credential Staking)
stakeCreds Set (Credential Staking) -> Set (Credential Staking) -> Bool
forall a. Eq a => a -> a -> Bool
== Set (Credential Staking)
stakeCreds' =
        ('(x, a) :~: '(y, b)) -> Maybe ('(x, a) :~: '(y, b))
forall a. a -> Maybe a
Just '(x, a) :~: '(x, a)
'(x, a) :~: '(y, b)
forall {k} (a :: k). a :~: a
Refl
    | Bool
otherwise =
        Maybe ('(x, a) :~: '(y, b))
forall a. Maybe a
Nothing
  sameDepIndex2 GetFilteredVoteDelegatees{} BlockQuery (ShelleyBlock proto era) y b
_ = Maybe ('(x, a) :~: '(y, b))
forall a. Maybe a
Nothing
  sameDepIndex2 GetAccountState{} GetAccountState{} = ('(x, a) :~: '(y, b)) -> Maybe ('(x, a) :~: '(y, b))
forall a. a -> Maybe a
Just '(x, a) :~: '(x, a)
'(x, a) :~: '(y, b)
forall {k} (a :: k). a :~: a
Refl
  sameDepIndex2 GetAccountState{} BlockQuery (ShelleyBlock proto era) y b
_ = Maybe ('(x, a) :~: '(y, b))
forall a. Maybe a
Nothing
  sameDepIndex2 GetSPOStakeDistr{} GetSPOStakeDistr{} = ('(x, a) :~: '(y, b)) -> Maybe ('(x, a) :~: '(y, b))
forall a. a -> Maybe a
Just '(x, a) :~: '(x, a)
'(x, a) :~: '(y, b)
forall {k} (a :: k). a :~: a
Refl
  sameDepIndex2 GetSPOStakeDistr{} BlockQuery (ShelleyBlock proto era) y b
_ = Maybe ('(x, a) :~: '(y, b))
forall a. Maybe a
Nothing
  sameDepIndex2 GetProposals{} GetProposals{} = ('(x, a) :~: '(y, b)) -> Maybe ('(x, a) :~: '(y, b))
forall a. a -> Maybe a
Just '(x, a) :~: '(x, a)
'(x, a) :~: '(y, b)
forall {k} (a :: k). a :~: a
Refl
  sameDepIndex2 GetProposals{} BlockQuery (ShelleyBlock proto era) y b
_ = Maybe ('(x, a) :~: '(y, b))
forall a. Maybe a
Nothing
  sameDepIndex2 GetRatifyState{} GetRatifyState{} = ('(x, a) :~: '(y, b)) -> Maybe ('(x, a) :~: '(y, b))
forall a. a -> Maybe a
Just '(x, a) :~: '(x, a)
'(x, a) :~: '(y, b)
forall {k} (a :: k). a :~: a
Refl
  sameDepIndex2 GetRatifyState{} BlockQuery (ShelleyBlock proto era) y b
_ = Maybe ('(x, a) :~: '(y, b))
forall a. Maybe a
Nothing
  sameDepIndex2 GetFuturePParams{} GetFuturePParams{} = ('(x, a) :~: '(y, b)) -> Maybe ('(x, a) :~: '(y, b))
forall a. a -> Maybe a
Just '(x, a) :~: '(x, a)
'(x, a) :~: '(y, b)
forall {k} (a :: k). a :~: a
Refl
  sameDepIndex2 GetFuturePParams{} BlockQuery (ShelleyBlock proto era) y b
_ = Maybe ('(x, a) :~: '(y, b))
forall a. Maybe a
Nothing
  sameDepIndex2 GetLedgerPeerSnapshot'{} GetLedgerPeerSnapshot'{} = ('(x, a) :~: '(y, b)) -> Maybe ('(x, a) :~: '(y, b))
forall a. a -> Maybe a
Just '(x, a) :~: '(x, a)
'(x, a) :~: '(y, b)
forall {k} (a :: k). a :~: a
Refl
  sameDepIndex2 GetLedgerPeerSnapshot'{} BlockQuery (ShelleyBlock proto era) y b
_ = Maybe ('(x, a) :~: '(y, b))
forall a. Maybe a
Nothing
  sameDepIndex2 QueryStakePoolDefaultVote{} QueryStakePoolDefaultVote{} = ('(x, a) :~: '(y, b)) -> Maybe ('(x, a) :~: '(y, b))
forall a. a -> Maybe a
Just '(x, a) :~: '(x, a)
'(x, a) :~: '(y, b)
forall {k} (a :: k). a :~: a
Refl
  sameDepIndex2 QueryStakePoolDefaultVote{} BlockQuery (ShelleyBlock proto era) y b
_ = Maybe ('(x, a) :~: '(y, b))
forall a. Maybe a
Nothing
  sameDepIndex2 GetPoolDistr2{} GetPoolDistr2{} = ('(x, a) :~: '(y, b)) -> Maybe ('(x, a) :~: '(y, b))
forall a. a -> Maybe a
Just '(x, a) :~: '(x, a)
'(x, a) :~: '(y, b)
forall {k} (a :: k). a :~: a
Refl
  sameDepIndex2 GetPoolDistr2{} BlockQuery (ShelleyBlock proto era) y b
_ = Maybe ('(x, a) :~: '(y, b))
forall a. Maybe a
Nothing
  sameDepIndex2 GetStakeDistribution2{} GetStakeDistribution2{} = ('(x, a) :~: '(y, b)) -> Maybe ('(x, a) :~: '(y, b))
forall a. a -> Maybe a
Just '(x, a) :~: '(x, a)
'(x, a) :~: '(y, b)
forall {k} (a :: k). a :~: a
Refl
  sameDepIndex2 GetStakeDistribution2{} BlockQuery (ShelleyBlock proto era) y b
_ = Maybe ('(x, a) :~: '(y, b))
forall a. Maybe a
Nothing
  sameDepIndex2 GetMaxMajorProtocolVersion{} GetMaxMajorProtocolVersion{} = ('(x, a) :~: '(y, b)) -> Maybe ('(x, a) :~: '(y, b))
forall a. a -> Maybe a
Just '(x, a) :~: '(x, a)
'(x, a) :~: '(y, b)
forall {k} (a :: k). a :~: a
Refl
  sameDepIndex2 GetMaxMajorProtocolVersion{} BlockQuery (ShelleyBlock proto era) y b
_ = Maybe ('(x, a) :~: '(y, b))
forall a. Maybe a
Nothing
  sameDepIndex2 (GetDRepDelegations Set DRep
dreps) (GetDRepDelegations Set DRep
dreps')
    | Set DRep
dreps Set DRep -> Set DRep -> Bool
forall a. Eq a => a -> a -> Bool
== Set DRep
dreps' =
        ('(x, a) :~: '(y, b)) -> Maybe ('(x, a) :~: '(y, b))
forall a. a -> Maybe a
Just '(x, a) :~: '(x, a)
'(x, a) :~: '(y, b)
forall {k} (a :: k). a :~: a
Refl
    | Bool
otherwise =
        Maybe ('(x, a) :~: '(y, b))
forall a. Maybe a
Nothing
  sameDepIndex2 GetDRepDelegations{} BlockQuery (ShelleyBlock proto era) y b
_ = Maybe ('(x, a) :~: '(y, b))
forall a. Maybe a
Nothing

deriving instance Eq (BlockQuery (ShelleyBlock proto era) fp result)
deriving instance Show (BlockQuery (ShelleyBlock proto era) fp result)

instance ShelleyCompatible proto era => ShowQuery (BlockQuery (ShelleyBlock proto era) fp) where
  showResult :: forall result.
BlockQuery (ShelleyBlock proto era) fp result -> result -> String
showResult = \case
    BlockQuery (ShelleyBlock proto era) fp result
R:BlockQueryShelleyBlockfpresult proto era fp result
GetLedgerTip -> result -> String
forall a. Show a => a -> String
show
    BlockQuery (ShelleyBlock proto era) fp result
R:BlockQueryShelleyBlockfpresult proto era fp result
GetEpochNo -> result -> String
forall a. Show a => a -> String
show
    GetNonMyopicMemberRewards{} -> result -> String
forall a. Show a => a -> String
show
    BlockQuery (ShelleyBlock proto era) fp result
R:BlockQueryShelleyBlockfpresult proto era fp result
GetCurrentPParams -> result -> String
forall a. Show a => a -> String
show
    BlockQuery (ShelleyBlock proto era) fp result
R:BlockQueryShelleyBlockfpresult proto era fp result
GetProposedPParamsUpdates -> result -> String
forall a. Show a => a -> String
show
    BlockQuery (ShelleyBlock proto era) fp result
R:BlockQueryShelleyBlockfpresult proto era fp result
GetStakeDistribution -> result -> String
forall a. Show a => a -> String
show
    GetUTxOByAddress{} -> result -> String
forall a. Show a => a -> String
show
    BlockQuery (ShelleyBlock proto era) fp result
R:BlockQueryShelleyBlockfpresult proto era fp result
GetUTxOWhole -> result -> String
forall a. Show a => a -> String
show
    BlockQuery (ShelleyBlock proto era) fp result
R:BlockQueryShelleyBlockfpresult proto era fp result
DebugEpochState -> result -> String
forall a. Show a => a -> String
show
    GetCBOR{} -> result -> String
forall a. Show a => a -> String
show
    GetFilteredDelegationsAndRewardAccounts{} -> result -> String
forall a. Show a => a -> String
show
    BlockQuery (ShelleyBlock proto era) fp result
R:BlockQueryShelleyBlockfpresult proto era fp result
GetGenesisConfig -> result -> String
forall a. Show a => a -> String
show
    BlockQuery (ShelleyBlock proto era) fp result
R:BlockQueryShelleyBlockfpresult proto era fp result
DebugNewEpochState -> result -> String
forall a. Show a => a -> String
show
    BlockQuery (ShelleyBlock proto era) fp result
R:BlockQueryShelleyBlockfpresult proto era fp result
DebugChainDepState -> result -> String
forall a. Show a => a -> String
show
    BlockQuery (ShelleyBlock proto era) fp result
R:BlockQueryShelleyBlockfpresult proto era fp result
GetRewardProvenance -> result -> String
forall a. Show a => a -> String
show
    GetUTxOByTxIn{} -> result -> String
forall a. Show a => a -> String
show
    BlockQuery (ShelleyBlock proto era) fp result
R:BlockQueryShelleyBlockfpresult proto era fp result
GetStakePools -> result -> String
forall a. Show a => a -> String
show
    GetStakePoolParams{} -> result -> String
forall a. Show a => a -> String
show
    BlockQuery (ShelleyBlock proto era) fp result
R:BlockQueryShelleyBlockfpresult proto era fp result
GetRewardInfoPools -> result -> String
forall a. Show a => a -> String
show
    GetPoolState{} -> result -> String
forall a. Show a => a -> String
show
    GetStakeSnapshots{} -> result -> String
forall a. Show a => a -> String
show
    GetPoolDistr{} -> result -> String
forall a. Show a => a -> String
show
    GetStakeDelegDeposits{} -> result -> String
forall a. Show a => a -> String
show
    BlockQuery (ShelleyBlock proto era) fp result
R:BlockQueryShelleyBlockfpresult proto era fp result
GetConstitution -> result -> String
forall a. Show a => a -> String
show
    BlockQuery (ShelleyBlock proto era) fp result
R:BlockQueryShelleyBlockfpresult proto era fp result
GetGovState -> result -> String
forall a. Show a => a -> String
show
    GetDRepState{} -> result -> String
forall a. Show a => a -> String
show
    GetDRepStakeDistr{} -> result -> String
forall a. Show a => a -> String
show
    GetCommitteeMembersState{} -> result -> String
forall a. Show a => a -> String
show
    GetFilteredVoteDelegatees{} -> result -> String
forall a. Show a => a -> String
show
    GetAccountState{} -> result -> String
forall a. Show a => a -> String
show
    GetSPOStakeDistr{} -> result -> String
forall a. Show a => a -> String
show
    GetProposals{} -> result -> String
forall a. Show a => a -> String
show
    GetRatifyState{} -> result -> String
forall a. Show a => a -> String
show
    GetFuturePParams{} -> result -> String
forall a. Show a => a -> String
show
    GetLedgerPeerSnapshot'{} -> result -> String
forall a. Show a => a -> String
show
    QueryStakePoolDefaultVote{} -> result -> String
forall a. Show a => a -> String
show
    GetPoolDistr2{} -> result -> String
forall a. Show a => a -> String
show
    GetStakeDistribution2{} -> result -> String
forall a. Show a => a -> String
show
    GetMaxMajorProtocolVersion{} -> result -> String
forall a. Show a => a -> String
show
    GetDRepDelegations{} -> result -> String
forall a. Show a => a -> String
show

{-------------------------------------------------------------------------------
  Auxiliary
-------------------------------------------------------------------------------}

-- Get the current 'EpochState.' This is mainly for debugging.
getEpochState :: SL.NewEpochState era -> SL.EpochState era
getEpochState :: forall era. NewEpochState era -> EpochState era
getEpochState = NewEpochState era -> EpochState era
forall era. NewEpochState era -> EpochState era
SL.nesEs

getDState :: SL.EraCertState era => SL.NewEpochState era -> SL.DState era
getDState :: forall era. EraCertState era => NewEpochState era -> DState era
getDState = Getting (DState era) (CertState era) (DState era)
-> CertState era -> DState era
forall a s. Getting a s a -> s -> a
view Getting (DState era) (CertState era) (DState era)
forall era. EraCertState era => Lens' (CertState era) (DState era)
Lens' (CertState era) (DState era)
SL.certDStateL (CertState era -> DState era)
-> (NewEpochState era -> CertState era)
-> NewEpochState era
-> DState era
forall b c a. (b -> c) -> (a -> b) -> a -> c
. LedgerState era -> CertState era
forall era. LedgerState era -> CertState era
SL.lsCertState (LedgerState era -> CertState era)
-> (NewEpochState era -> LedgerState era)
-> NewEpochState era
-> CertState era
forall b c a. (b -> c) -> (a -> b) -> a -> c
. EpochState era -> LedgerState era
forall era. EpochState era -> LedgerState era
SL.esLState (EpochState era -> LedgerState era)
-> (NewEpochState era -> EpochState era)
-> NewEpochState era
-> LedgerState era
forall b c a. (b -> c) -> (a -> b) -> a -> c
. NewEpochState era -> EpochState era
forall era. NewEpochState era -> EpochState era
SL.nesEs

getFilteredDelegationsAndRewardAccounts ::
  SL.EraCertState era =>
  SL.NewEpochState era ->
  Set (SL.Credential SL.Staking) ->
  (Delegations, Map (SL.Credential SL.Staking) Coin)
getFilteredDelegationsAndRewardAccounts :: forall era.
EraCertState era =>
NewEpochState era
-> Set (Credential Staking)
-> (Delegations, Map (Credential Staking) Coin)
getFilteredDelegationsAndRewardAccounts = NewEpochState era
-> Set (Credential Staking)
-> (Delegations, Map (Credential Staking) Coin)
forall era.
EraCertState era =>
NewEpochState era
-> Set (Credential Staking)
-> (Delegations, Map (Credential Staking) Coin)
SL.queryStakePoolDelegsAndRewards

getFilteredVoteDelegatees ::
  (SL.EraCertState era, CG.ConwayEraAccounts era) =>
  SL.NewEpochState era ->
  Set (SL.Credential SL.Staking) ->
  VoteDelegatees
getFilteredVoteDelegatees :: forall era.
(EraCertState era, ConwayEraAccounts era) =>
NewEpochState era
-> Set (Credential Staking) -> Map (Credential Staking) DRep
getFilteredVoteDelegatees NewEpochState era
ss Set (Credential Staking)
creds
  | Set (Credential Staking) -> Bool
forall a. Set a -> Bool
Set.null Set (Credential Staking)
creds =
      (AccountState era -> Maybe DRep)
-> Map (Credential Staking) (AccountState era)
-> Map (Credential Staking) DRep
forall a b k. (a -> Maybe b) -> Map k a -> Map k b
Map.mapMaybe (AccountState era
-> Getting (Maybe DRep) (AccountState era) (Maybe DRep)
-> Maybe DRep
forall s a. s -> Getting a s a -> a
^. Getting (Maybe DRep) (AccountState era) (Maybe DRep)
forall era.
ConwayEraAccounts era =>
Lens' (AccountState era) (Maybe DRep)
Lens' (AccountState era) (Maybe DRep)
CG.dRepDelegationAccountStateL) Map (Credential Staking) (AccountState era)
accountsMap
  | Bool
otherwise =
      (AccountState era -> Maybe DRep)
-> Map (Credential Staking) (AccountState era)
-> Map (Credential Staking) DRep
forall a b k. (a -> Maybe b) -> Map k a -> Map k b
Map.mapMaybe (AccountState era
-> Getting (Maybe DRep) (AccountState era) (Maybe DRep)
-> Maybe DRep
forall s a. s -> Getting a s a -> a
^. Getting (Maybe DRep) (AccountState era) (Maybe DRep)
forall era.
ConwayEraAccounts era =>
Lens' (AccountState era) (Maybe DRep)
Lens' (AccountState era) (Maybe DRep)
CG.dRepDelegationAccountStateL) Map (Credential Staking) (AccountState era)
accountsMapRestricted
 where
  accountsMap :: Map (Credential Staking) (AccountState era)
accountsMap = NewEpochState era -> DState era
forall era. EraCertState era => NewEpochState era -> DState era
getDState NewEpochState era
ss DState era
-> Getting
     (Map (Credential Staking) (AccountState era))
     (DState era)
     (Map (Credential Staking) (AccountState era))
-> Map (Credential Staking) (AccountState era)
forall s a. s -> Getting a s a -> a
^. (Accounts era
 -> Const
      (Map (Credential Staking) (AccountState era)) (Accounts era))
-> DState era
-> Const (Map (Credential Staking) (AccountState era)) (DState era)
forall era. Lens' (DState era) (Accounts era)
forall (t :: * -> *) era.
CanSetAccounts t =>
Lens' (t era) (Accounts era)
SL.accountsL ((Accounts era
  -> Const
       (Map (Credential Staking) (AccountState era)) (Accounts era))
 -> DState era
 -> Const
      (Map (Credential Staking) (AccountState era)) (DState era))
-> ((Map (Credential Staking) (AccountState era)
     -> Const
          (Map (Credential Staking) (AccountState era))
          (Map (Credential Staking) (AccountState era)))
    -> Accounts era
    -> Const
         (Map (Credential Staking) (AccountState era)) (Accounts era))
-> Getting
     (Map (Credential Staking) (AccountState era))
     (DState era)
     (Map (Credential Staking) (AccountState era))
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Map (Credential Staking) (AccountState era)
 -> Const
      (Map (Credential Staking) (AccountState era))
      (Map (Credential Staking) (AccountState era)))
-> Accounts era
-> Const
     (Map (Credential Staking) (AccountState era)) (Accounts era)
forall era.
EraAccounts era =>
Lens' (Accounts era) (Map (Credential Staking) (AccountState era))
Lens' (Accounts era) (Map (Credential Staking) (AccountState era))
SL.accountsMapL
  accountsMapRestricted :: Map (Credential Staking) (AccountState era)
accountsMapRestricted = Map (Credential Staking) (AccountState era)
-> Set (Credential Staking)
-> Map (Credential Staking) (AccountState era)
forall k a. Ord k => Map k a -> Set k -> Map k a
Map.restrictKeys Map (Credential Staking) (AccountState era)
accountsMap Set (Credential Staking)
creds

{-------------------------------------------------------------------------------
  Serialisation
-------------------------------------------------------------------------------}

encodeShelleyQuery ::
  forall era proto fp result.
  ShelleyBasedEra era =>
  BlockQuery (ShelleyBlock proto era) fp result -> Encoding
encodeShelleyQuery :: forall era proto (fp :: QueryFootprint) result.
ShelleyBasedEra era =>
BlockQuery (ShelleyBlock proto era) fp result -> Encoding
encodeShelleyQuery BlockQuery (ShelleyBlock proto era) fp result
query = case BlockQuery (ShelleyBlock proto era) fp result
query of
  BlockQuery (ShelleyBlock proto era) fp result
R:BlockQueryShelleyBlockfpresult proto era fp result
GetLedgerTip ->
    Word -> Encoding
CBOR.encodeListLen Word
1 Encoding -> Encoding -> Encoding
forall a. Semigroup a => a -> a -> a
<> Word8 -> Encoding
CBOR.encodeWord8 Word8
0
  BlockQuery (ShelleyBlock proto era) fp result
R:BlockQueryShelleyBlockfpresult proto era fp result
GetEpochNo ->
    Word -> Encoding
CBOR.encodeListLen Word
1 Encoding -> Encoding -> Encoding
forall a. Semigroup a => a -> a -> a
<> Word8 -> Encoding
CBOR.encodeWord8 Word8
1
  GetNonMyopicMemberRewards Set (Either Coin (Credential Staking))
creds ->
    Word -> Encoding
CBOR.encodeListLen Word
2 Encoding -> Encoding -> Encoding
forall a. Semigroup a => a -> a -> a
<> Word8 -> Encoding
CBOR.encodeWord8 Word8
2 Encoding -> Encoding -> Encoding
forall a. Semigroup a => a -> a -> a
<> Set (Either Coin (Credential Staking)) -> Encoding
forall a. ToCBOR a => a -> Encoding
toCBOR Set (Either Coin (Credential Staking))
creds
  BlockQuery (ShelleyBlock proto era) fp result
R:BlockQueryShelleyBlockfpresult proto era fp result
GetCurrentPParams ->
    Word -> Encoding
CBOR.encodeListLen Word
1 Encoding -> Encoding -> Encoding
forall a. Semigroup a => a -> a -> a
<> Word8 -> Encoding
CBOR.encodeWord8 Word8
3
  BlockQuery (ShelleyBlock proto era) fp result
R:BlockQueryShelleyBlockfpresult proto era fp result
GetProposedPParamsUpdates ->
    Word -> Encoding
CBOR.encodeListLen Word
1 Encoding -> Encoding -> Encoding
forall a. Semigroup a => a -> a -> a
<> Word8 -> Encoding
CBOR.encodeWord8 Word8
4
  BlockQuery (ShelleyBlock proto era) fp result
R:BlockQueryShelleyBlockfpresult proto era fp result
GetStakeDistribution ->
    Word -> Encoding
CBOR.encodeListLen Word
1 Encoding -> Encoding -> Encoding
forall a. Semigroup a => a -> a -> a
<> Word8 -> Encoding
CBOR.encodeWord8 Word8
5
  GetUTxOByAddress Set Addr
addrs ->
    Word -> Encoding
CBOR.encodeListLen Word
2 Encoding -> Encoding -> Encoding
forall a. Semigroup a => a -> a -> a
<> Word8 -> Encoding
CBOR.encodeWord8 Word8
6 Encoding -> Encoding -> Encoding
forall a. Semigroup a => a -> a -> a
<> forall era t. (Era era, EncCBOR t) => t -> Encoding
LC.toEraCBOR @era Set Addr
addrs
  BlockQuery (ShelleyBlock proto era) fp result
R:BlockQueryShelleyBlockfpresult proto era fp result
GetUTxOWhole ->
    Word -> Encoding
CBOR.encodeListLen Word
1 Encoding -> Encoding -> Encoding
forall a. Semigroup a => a -> a -> a
<> Word8 -> Encoding
CBOR.encodeWord8 Word8
7
  BlockQuery (ShelleyBlock proto era) fp result
R:BlockQueryShelleyBlockfpresult proto era fp result
DebugEpochState ->
    Word -> Encoding
CBOR.encodeListLen Word
1 Encoding -> Encoding -> Encoding
forall a. Semigroup a => a -> a -> a
<> Word8 -> Encoding
CBOR.encodeWord8 Word8
8
  GetCBOR BlockQuery (ShelleyBlock proto era) fp result
query' ->
    Word -> Encoding
CBOR.encodeListLen Word
2 Encoding -> Encoding -> Encoding
forall a. Semigroup a => a -> a -> a
<> Word8 -> Encoding
CBOR.encodeWord8 Word8
9 Encoding -> Encoding -> Encoding
forall a. Semigroup a => a -> a -> a
<> BlockQuery (ShelleyBlock proto era) fp result -> Encoding
forall era proto (fp :: QueryFootprint) result.
ShelleyBasedEra era =>
BlockQuery (ShelleyBlock proto era) fp result -> Encoding
encodeShelleyQuery BlockQuery (ShelleyBlock proto era) fp result
query'
  GetFilteredDelegationsAndRewardAccounts Set (Credential Staking)
creds ->
    Word -> Encoding
CBOR.encodeListLen Word
2 Encoding -> Encoding -> Encoding
forall a. Semigroup a => a -> a -> a
<> Word8 -> Encoding
CBOR.encodeWord8 Word8
10 Encoding -> Encoding -> Encoding
forall a. Semigroup a => a -> a -> a
<> forall era t. (Era era, EncCBOR t) => t -> Encoding
LC.toEraCBOR @era Set (Credential Staking)
creds
  BlockQuery (ShelleyBlock proto era) fp result
R:BlockQueryShelleyBlockfpresult proto era fp result
GetGenesisConfig ->
    Word -> Encoding
CBOR.encodeListLen Word
1 Encoding -> Encoding -> Encoding
forall a. Semigroup a => a -> a -> a
<> Word8 -> Encoding
CBOR.encodeWord8 Word8
11
  BlockQuery (ShelleyBlock proto era) fp result
R:BlockQueryShelleyBlockfpresult proto era fp result
DebugNewEpochState ->
    Word -> Encoding
CBOR.encodeListLen Word
1 Encoding -> Encoding -> Encoding
forall a. Semigroup a => a -> a -> a
<> Word8 -> Encoding
CBOR.encodeWord8 Word8
12
  BlockQuery (ShelleyBlock proto era) fp result
R:BlockQueryShelleyBlockfpresult proto era fp result
DebugChainDepState ->
    Word -> Encoding
CBOR.encodeListLen Word
1 Encoding -> Encoding -> Encoding
forall a. Semigroup a => a -> a -> a
<> Word8 -> Encoding
CBOR.encodeWord8 Word8
13
  BlockQuery (ShelleyBlock proto era) fp result
R:BlockQueryShelleyBlockfpresult proto era fp result
GetRewardProvenance ->
    Word -> Encoding
CBOR.encodeListLen Word
1 Encoding -> Encoding -> Encoding
forall a. Semigroup a => a -> a -> a
<> Word8 -> Encoding
CBOR.encodeWord8 Word8
14
  GetUTxOByTxIn Set TxIn
txins ->
    Word -> Encoding
CBOR.encodeListLen Word
2 Encoding -> Encoding -> Encoding
forall a. Semigroup a => a -> a -> a
<> Word8 -> Encoding
CBOR.encodeWord8 Word8
15 Encoding -> Encoding -> Encoding
forall a. Semigroup a => a -> a -> a
<> forall era t. (Era era, EncCBOR t) => t -> Encoding
LC.toEraCBOR @era Set TxIn
txins
  BlockQuery (ShelleyBlock proto era) fp result
R:BlockQueryShelleyBlockfpresult proto era fp result
GetStakePools ->
    Word -> Encoding
CBOR.encodeListLen Word
1 Encoding -> Encoding -> Encoding
forall a. Semigroup a => a -> a -> a
<> Word8 -> Encoding
CBOR.encodeWord8 Word8
16
  GetStakePoolParams Set (KeyHash StakePool)
poolids ->
    Word -> Encoding
CBOR.encodeListLen Word
2 Encoding -> Encoding -> Encoding
forall a. Semigroup a => a -> a -> a
<> Word8 -> Encoding
CBOR.encodeWord8 Word8
17 Encoding -> Encoding -> Encoding
forall a. Semigroup a => a -> a -> a
<> Set (KeyHash StakePool) -> Encoding
forall a. ToCBOR a => a -> Encoding
toCBOR Set (KeyHash StakePool)
poolids
  BlockQuery (ShelleyBlock proto era) fp result
R:BlockQueryShelleyBlockfpresult proto era fp result
GetRewardInfoPools ->
    Word -> Encoding
CBOR.encodeListLen Word
1 Encoding -> Encoding -> Encoding
forall a. Semigroup a => a -> a -> a
<> Word8 -> Encoding
CBOR.encodeWord8 Word8
18
  GetPoolState Maybe (Set (KeyHash StakePool))
poolids ->
    Word -> Encoding
CBOR.encodeListLen Word
2 Encoding -> Encoding -> Encoding
forall a. Semigroup a => a -> a -> a
<> Word8 -> Encoding
CBOR.encodeWord8 Word8
19 Encoding -> Encoding -> Encoding
forall a. Semigroup a => a -> a -> a
<> Maybe (Set (KeyHash StakePool)) -> Encoding
forall a. ToCBOR a => a -> Encoding
toCBOR Maybe (Set (KeyHash StakePool))
poolids
  GetStakeSnapshots Maybe (Set (KeyHash StakePool))
poolId ->
    Word -> Encoding
CBOR.encodeListLen Word
2 Encoding -> Encoding -> Encoding
forall a. Semigroup a => a -> a -> a
<> Word8 -> Encoding
CBOR.encodeWord8 Word8
20 Encoding -> Encoding -> Encoding
forall a. Semigroup a => a -> a -> a
<> Maybe (Set (KeyHash StakePool)) -> Encoding
forall a. ToCBOR a => a -> Encoding
toCBOR Maybe (Set (KeyHash StakePool))
poolId
  GetPoolDistr Maybe (Set (KeyHash StakePool))
poolids ->
    Word -> Encoding
CBOR.encodeListLen Word
2 Encoding -> Encoding -> Encoding
forall a. Semigroup a => a -> a -> a
<> Word8 -> Encoding
CBOR.encodeWord8 Word8
21 Encoding -> Encoding -> Encoding
forall a. Semigroup a => a -> a -> a
<> Maybe (Set (KeyHash StakePool)) -> Encoding
forall a. ToCBOR a => a -> Encoding
toCBOR Maybe (Set (KeyHash StakePool))
poolids
  GetStakeDelegDeposits Set (Credential Staking)
stakeCreds ->
    Word -> Encoding
CBOR.encodeListLen Word
2 Encoding -> Encoding -> Encoding
forall a. Semigroup a => a -> a -> a
<> Word8 -> Encoding
CBOR.encodeWord8 Word8
22 Encoding -> Encoding -> Encoding
forall a. Semigroup a => a -> a -> a
<> Set (Credential Staking) -> Encoding
forall a. ToCBOR a => a -> Encoding
toCBOR Set (Credential Staking)
stakeCreds
  BlockQuery (ShelleyBlock proto era) fp result
R:BlockQueryShelleyBlockfpresult proto era fp result
GetConstitution ->
    Word -> Encoding
CBOR.encodeListLen Word
1 Encoding -> Encoding -> Encoding
forall a. Semigroup a => a -> a -> a
<> Word8 -> Encoding
CBOR.encodeWord8 Word8
23
  BlockQuery (ShelleyBlock proto era) fp result
R:BlockQueryShelleyBlockfpresult proto era fp result
GetGovState ->
    Word -> Encoding
CBOR.encodeListLen Word
1 Encoding -> Encoding -> Encoding
forall a. Semigroup a => a -> a -> a
<> Word8 -> Encoding
CBOR.encodeWord8 Word8
24
  GetDRepState Set (Credential DRepRole)
drepCreds ->
    Word -> Encoding
CBOR.encodeListLen Word
2 Encoding -> Encoding -> Encoding
forall a. Semigroup a => a -> a -> a
<> Word8 -> Encoding
CBOR.encodeWord8 Word8
25 Encoding -> Encoding -> Encoding
forall a. Semigroup a => a -> a -> a
<> Set (Credential DRepRole) -> Encoding
forall a. ToCBOR a => a -> Encoding
toCBOR Set (Credential DRepRole)
drepCreds
  GetDRepStakeDistr Set DRep
dreps ->
    Word -> Encoding
CBOR.encodeListLen Word
2 Encoding -> Encoding -> Encoding
forall a. Semigroup a => a -> a -> a
<> Word8 -> Encoding
CBOR.encodeWord8 Word8
26 Encoding -> Encoding -> Encoding
forall a. Semigroup a => a -> a -> a
<> forall era t. (Era era, EncCBOR t) => t -> Encoding
LC.toEraCBOR @era Set DRep
dreps
  GetCommitteeMembersState Set (Credential ColdCommitteeRole)
coldCreds Set (Credential HotCommitteeRole)
hotCreds Set MemberStatus
statuses ->
    Word -> Encoding
CBOR.encodeListLen Word
4
      Encoding -> Encoding -> Encoding
forall a. Semigroup a => a -> a -> a
<> Word8 -> Encoding
CBOR.encodeWord8 Word8
27
      Encoding -> Encoding -> Encoding
forall a. Semigroup a => a -> a -> a
<> Set (Credential ColdCommitteeRole) -> Encoding
forall a. ToCBOR a => a -> Encoding
toCBOR Set (Credential ColdCommitteeRole)
coldCreds
      Encoding -> Encoding -> Encoding
forall a. Semigroup a => a -> a -> a
<> Set (Credential HotCommitteeRole) -> Encoding
forall a. ToCBOR a => a -> Encoding
toCBOR Set (Credential HotCommitteeRole)
hotCreds
      Encoding -> Encoding -> Encoding
forall a. Semigroup a => a -> a -> a
<> forall era t. (Era era, EncCBOR t) => t -> Encoding
LC.toEraCBOR @era Set MemberStatus
statuses
  GetFilteredVoteDelegatees Set (Credential Staking)
stakeCreds ->
    Word -> Encoding
CBOR.encodeListLen Word
2 Encoding -> Encoding -> Encoding
forall a. Semigroup a => a -> a -> a
<> Word8 -> Encoding
CBOR.encodeWord8 Word8
28 Encoding -> Encoding -> Encoding
forall a. Semigroup a => a -> a -> a
<> forall era t. (Era era, EncCBOR t) => t -> Encoding
LC.toEraCBOR @era Set (Credential Staking)
stakeCreds
  BlockQuery (ShelleyBlock proto era) fp result
R:BlockQueryShelleyBlockfpresult proto era fp result
GetAccountState ->
    Word -> Encoding
CBOR.encodeListLen Word
1 Encoding -> Encoding -> Encoding
forall a. Semigroup a => a -> a -> a
<> Word8 -> Encoding
CBOR.encodeWord8 Word8
29
  GetSPOStakeDistr Set (KeyHash StakePool)
keys ->
    Word -> Encoding
CBOR.encodeListLen Word
2 Encoding -> Encoding -> Encoding
forall a. Semigroup a => a -> a -> a
<> Word8 -> Encoding
CBOR.encodeWord8 Word8
30 Encoding -> Encoding -> Encoding
forall a. Semigroup a => a -> a -> a
<> forall era t. (Era era, EncCBOR t) => t -> Encoding
LC.toEraCBOR @era Set (KeyHash StakePool)
keys
  GetProposals Set GovActionId
gids ->
    Word -> Encoding
CBOR.encodeListLen Word
2 Encoding -> Encoding -> Encoding
forall a. Semigroup a => a -> a -> a
<> Word8 -> Encoding
CBOR.encodeWord8 Word8
31 Encoding -> Encoding -> Encoding
forall a. Semigroup a => a -> a -> a
<> forall era t. (Era era, EncCBOR t) => t -> Encoding
LC.toEraCBOR @era Set GovActionId
gids
  BlockQuery (ShelleyBlock proto era) fp result
R:BlockQueryShelleyBlockfpresult proto era fp result
GetRatifyState ->
    Word -> Encoding
CBOR.encodeListLen Word
1 Encoding -> Encoding -> Encoding
forall a. Semigroup a => a -> a -> a
<> Word8 -> Encoding
CBOR.encodeWord8 Word8
32
  BlockQuery (ShelleyBlock proto era) fp result
R:BlockQueryShelleyBlockfpresult proto era fp result
GetFuturePParams ->
    Word -> Encoding
CBOR.encodeListLen Word
1 Encoding -> Encoding -> Encoding
forall a. Semigroup a => a -> a -> a
<> Word8 -> Encoding
CBOR.encodeWord8 Word8
33
  GetLedgerPeerSnapshot' Bool
v15OrNewer LedgerPeersKind
peerKind ->
    if Bool
v15OrNewer
      then Word -> Encoding
CBOR.encodeListLen Word
2 Encoding -> Encoding -> Encoding
forall a. Semigroup a => a -> a -> a
<> Word8 -> Encoding
CBOR.encodeWord8 Word8
34 Encoding -> Encoding -> Encoding
forall a. Semigroup a => a -> a -> a
<> Word8 -> Encoding
CBOR.encodeWord8 Word8
peerKindTag
      else Word -> Encoding
CBOR.encodeListLen Word
1 Encoding -> Encoding -> Encoding
forall a. Semigroup a => a -> a -> a
<> Word8 -> Encoding
CBOR.encodeWord8 Word8
34
   where
    peerKindTag :: Word8
peerKindTag =
      case LedgerPeersKind
peerKind of
        LedgerPeersKind
AllLedgerPeers -> Word8
0
        LedgerPeersKind
BigLedgerPeers -> Word8
1
  QueryStakePoolDefaultVote KeyHash StakePool
stakePoolKey ->
    Word -> Encoding
CBOR.encodeListLen Word
2 Encoding -> Encoding -> Encoding
forall a. Semigroup a => a -> a -> a
<> Word8 -> Encoding
CBOR.encodeWord8 Word8
35 Encoding -> Encoding -> Encoding
forall a. Semigroup a => a -> a -> a
<> forall era t. (Era era, EncCBOR t) => t -> Encoding
LC.toEraCBOR @era KeyHash StakePool
stakePoolKey
  GetPoolDistr2 Maybe (Set (KeyHash StakePool))
poolids ->
    Word -> Encoding
CBOR.encodeListLen Word
2 Encoding -> Encoding -> Encoding
forall a. Semigroup a => a -> a -> a
<> Word8 -> Encoding
CBOR.encodeWord8 Word8
36 Encoding -> Encoding -> Encoding
forall a. Semigroup a => a -> a -> a
<> Maybe (Set (KeyHash StakePool)) -> Encoding
forall a. ToCBOR a => a -> Encoding
toCBOR Maybe (Set (KeyHash StakePool))
poolids
  BlockQuery (ShelleyBlock proto era) fp result
R:BlockQueryShelleyBlockfpresult proto era fp result
GetStakeDistribution2 ->
    Word -> Encoding
CBOR.encodeListLen Word
1 Encoding -> Encoding -> Encoding
forall a. Semigroup a => a -> a -> a
<> Word8 -> Encoding
CBOR.encodeWord8 Word8
37
  BlockQuery (ShelleyBlock proto era) fp result
R:BlockQueryShelleyBlockfpresult proto era fp result
GetMaxMajorProtocolVersion ->
    Word -> Encoding
CBOR.encodeListLen Word
1 Encoding -> Encoding -> Encoding
forall a. Semigroup a => a -> a -> a
<> Word8 -> Encoding
CBOR.encodeWord8 Word8
38
  GetDRepDelegations Set DRep
dreps ->
    Word -> Encoding
CBOR.encodeListLen Word
2 Encoding -> Encoding -> Encoding
forall a. Semigroup a => a -> a -> a
<> Word8 -> Encoding
CBOR.encodeWord8 Word8
39 Encoding -> Encoding -> Encoding
forall a. Semigroup a => a -> a -> a
<> forall era t. (Era era, EncCBOR t) => t -> Encoding
LC.toEraCBOR @era Set DRep
dreps

decodeShelleyQuery ::
  forall era proto.
  ShelleyBasedEra era =>
  forall s.
  Decoder s (SomeBlockQuery (BlockQuery (ShelleyBlock proto era)))
decodeShelleyQuery :: forall era proto s.
ShelleyBasedEra era =>
Decoder s (SomeBlockQuery (BlockQuery (ShelleyBlock proto era)))
decodeShelleyQuery = do
  len <- Decoder s Int
forall s. Decoder s Int
CBOR.decodeListLen
  tag <- CBOR.decodeWord8

  let failmsg :: forall s ans. String -> Decoder s ans
      failmsg String
msg =
        String -> Decoder s ans
forall a. String -> Decoder s a
forall (m :: * -> *) a. MonadFail m => String -> m a
fail (String -> Decoder s ans) -> String -> Decoder s ans
forall a b. (a -> b) -> a -> b
$
          String
"decodeShelleyQuery: "
            String -> ShowS
forall a. Semigroup a => a -> a -> a
<> String
msg
            String -> ShowS
forall a. Semigroup a => a -> a -> a
<> String
" (len, tag) = ("
            String -> ShowS
forall a. Semigroup a => a -> a -> a
<> Int -> String
forall a. Show a => a -> String
show Int
len
            String -> ShowS
forall a. Semigroup a => a -> a -> a
<> String
", "
            String -> ShowS
forall a. Semigroup a => a -> a -> a
<> Word8 -> String
forall a. Show a => a -> String
show Word8
tag
            String -> ShowS
forall a. Semigroup a => a -> a -> a
<> String
")"

      requireCG ::
        forall s ans.
        ((CG.ConwayEraGov era, CG.ConwayEraCertState era) => Decoder s ans) ->
        Decoder s ans
      requireCG (ConwayEraGov era, ConwayEraCertState era) => Decoder s ans
k = case Proxy era -> Maybe (ConwayEraGovDict era)
forall era (proxy :: * -> *).
ShelleyBasedEra era =>
proxy era -> Maybe (ConwayEraGovDict era)
forall (proxy :: * -> *). proxy era -> Maybe (ConwayEraGovDict era)
SE.getConwayEraGovDict (forall t. Proxy t
forall {k} (t :: k). Proxy t
Proxy @era) of
        Just ConwayEraGovDict era
SE.ConwayEraGovDict -> Decoder s ans
(ConwayEraGov era, ConwayEraCertState era) => Decoder s ans
k
        Maybe (ConwayEraGovDict era)
Nothing -> String -> Decoder s ans
forall s ans. String -> Decoder s ans
failmsg String
"that query is not supported before Conway,"

  case (len, tag) of
    (Int
1, Word8
0) -> SomeBlockQuery (BlockQuery (ShelleyBlock proto era))
-> Decoder s (SomeBlockQuery (BlockQuery (ShelleyBlock proto era)))
forall a. a -> Decoder s a
forall (m :: * -> *) a. Monad m => a -> m a
return (SomeBlockQuery (BlockQuery (ShelleyBlock proto era))
 -> Decoder
      s (SomeBlockQuery (BlockQuery (ShelleyBlock proto era))))
-> SomeBlockQuery (BlockQuery (ShelleyBlock proto era))
-> Decoder s (SomeBlockQuery (BlockQuery (ShelleyBlock proto era)))
forall a b. (a -> b) -> a -> b
$ BlockQuery
  (ShelleyBlock proto era)
  'QFNoTables
  (Point (ShelleyBlock proto era))
-> SomeBlockQuery (BlockQuery (ShelleyBlock proto era))
forall (q :: QueryFootprint -> * -> *)
       (footprint :: QueryFootprint) result.
SingI footprint =>
q footprint result -> SomeBlockQuery q
SomeBlockQuery BlockQuery
  (ShelleyBlock proto era)
  'QFNoTables
  (Point (ShelleyBlock proto era))
forall proto era.
BlockQuery
  (ShelleyBlock proto era)
  'QFNoTables
  (Point (ShelleyBlock proto era))
GetLedgerTip
    (Int
1, Word8
1) -> SomeBlockQuery (BlockQuery (ShelleyBlock proto era))
-> Decoder s (SomeBlockQuery (BlockQuery (ShelleyBlock proto era)))
forall a. a -> Decoder s a
forall (m :: * -> *) a. Monad m => a -> m a
return (SomeBlockQuery (BlockQuery (ShelleyBlock proto era))
 -> Decoder
      s (SomeBlockQuery (BlockQuery (ShelleyBlock proto era))))
-> SomeBlockQuery (BlockQuery (ShelleyBlock proto era))
-> Decoder s (SomeBlockQuery (BlockQuery (ShelleyBlock proto era)))
forall a b. (a -> b) -> a -> b
$ BlockQuery (ShelleyBlock proto era) 'QFNoTables EpochNo
-> SomeBlockQuery (BlockQuery (ShelleyBlock proto era))
forall (q :: QueryFootprint -> * -> *)
       (footprint :: QueryFootprint) result.
SingI footprint =>
q footprint result -> SomeBlockQuery q
SomeBlockQuery BlockQuery (ShelleyBlock proto era) 'QFNoTables EpochNo
forall proto era.
BlockQuery (ShelleyBlock proto era) 'QFNoTables EpochNo
GetEpochNo
    (Int
2, Word8
2) -> BlockQuery
  (ShelleyBlock proto era) 'QFNoTables NonMyopicMemberRewards
-> SomeBlockQuery (BlockQuery (ShelleyBlock proto era))
forall (q :: QueryFootprint -> * -> *)
       (footprint :: QueryFootprint) result.
SingI footprint =>
q footprint result -> SomeBlockQuery q
SomeBlockQuery (BlockQuery
   (ShelleyBlock proto era) 'QFNoTables NonMyopicMemberRewards
 -> SomeBlockQuery (BlockQuery (ShelleyBlock proto era)))
-> (Set (Either Coin (Credential Staking))
    -> BlockQuery
         (ShelleyBlock proto era) 'QFNoTables NonMyopicMemberRewards)
-> Set (Either Coin (Credential Staking))
-> SomeBlockQuery (BlockQuery (ShelleyBlock proto era))
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Set (Either Coin (Credential Staking))
-> BlockQuery
     (ShelleyBlock proto era) 'QFNoTables NonMyopicMemberRewards
forall proto era.
Set (Either Coin (Credential Staking))
-> BlockQuery
     (ShelleyBlock proto era) 'QFNoTables NonMyopicMemberRewards
GetNonMyopicMemberRewards (Set (Either Coin (Credential Staking))
 -> SomeBlockQuery (BlockQuery (ShelleyBlock proto era)))
-> Decoder s (Set (Either Coin (Credential Staking)))
-> Decoder s (SomeBlockQuery (BlockQuery (ShelleyBlock proto era)))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Decoder s (Set (Either Coin (Credential Staking)))
forall s. Decoder s (Set (Either Coin (Credential Staking)))
forall a s. FromCBOR a => Decoder s a
fromCBOR
    (Int
1, Word8
3) -> SomeBlockQuery (BlockQuery (ShelleyBlock proto era))
-> Decoder s (SomeBlockQuery (BlockQuery (ShelleyBlock proto era)))
forall a. a -> Decoder s a
forall (m :: * -> *) a. Monad m => a -> m a
return (SomeBlockQuery (BlockQuery (ShelleyBlock proto era))
 -> Decoder
      s (SomeBlockQuery (BlockQuery (ShelleyBlock proto era))))
-> SomeBlockQuery (BlockQuery (ShelleyBlock proto era))
-> Decoder s (SomeBlockQuery (BlockQuery (ShelleyBlock proto era)))
forall a b. (a -> b) -> a -> b
$ BlockQuery (ShelleyBlock proto era) 'QFNoTables (PParams era)
-> SomeBlockQuery (BlockQuery (ShelleyBlock proto era))
forall (q :: QueryFootprint -> * -> *)
       (footprint :: QueryFootprint) result.
SingI footprint =>
q footprint result -> SomeBlockQuery q
SomeBlockQuery BlockQuery (ShelleyBlock proto era) 'QFNoTables (PParams era)
forall proto era.
BlockQuery (ShelleyBlock proto era) 'QFNoTables (PParams era)
GetCurrentPParams
    (Int
1, Word8
4) -> SomeBlockQuery (BlockQuery (ShelleyBlock proto era))
-> Decoder s (SomeBlockQuery (BlockQuery (ShelleyBlock proto era)))
forall a. a -> Decoder s a
forall (m :: * -> *) a. Monad m => a -> m a
return (SomeBlockQuery (BlockQuery (ShelleyBlock proto era))
 -> Decoder
      s (SomeBlockQuery (BlockQuery (ShelleyBlock proto era))))
-> SomeBlockQuery (BlockQuery (ShelleyBlock proto era))
-> Decoder s (SomeBlockQuery (BlockQuery (ShelleyBlock proto era)))
forall a b. (a -> b) -> a -> b
$ BlockQuery
  (ShelleyBlock proto era) 'QFNoTables (ProposedPPUpdates era)
-> SomeBlockQuery (BlockQuery (ShelleyBlock proto era))
forall (q :: QueryFootprint -> * -> *)
       (footprint :: QueryFootprint) result.
SingI footprint =>
q footprint result -> SomeBlockQuery q
SomeBlockQuery BlockQuery
  (ShelleyBlock proto era) 'QFNoTables (ProposedPPUpdates era)
forall proto era.
BlockQuery
  (ShelleyBlock proto era) 'QFNoTables (ProposedPPUpdates era)
GetProposedPParamsUpdates
    (Int
1, Word8
5) -> SomeBlockQuery (BlockQuery (ShelleyBlock proto era))
-> Decoder s (SomeBlockQuery (BlockQuery (ShelleyBlock proto era)))
forall a. a -> Decoder s a
forall (m :: * -> *) a. Monad m => a -> m a
return (SomeBlockQuery (BlockQuery (ShelleyBlock proto era))
 -> Decoder
      s (SomeBlockQuery (BlockQuery (ShelleyBlock proto era))))
-> SomeBlockQuery (BlockQuery (ShelleyBlock proto era))
-> Decoder s (SomeBlockQuery (BlockQuery (ShelleyBlock proto era)))
forall a b. (a -> b) -> a -> b
$ BlockQuery
  (ShelleyBlock proto era)
  'QFNoTables
  (PoolDistr (ProtoCrypto proto))
-> SomeBlockQuery (BlockQuery (ShelleyBlock proto era))
forall (q :: QueryFootprint -> * -> *)
       (footprint :: QueryFootprint) result.
SingI footprint =>
q footprint result -> SomeBlockQuery q
SomeBlockQuery BlockQuery
  (ShelleyBlock proto era)
  'QFNoTables
  (PoolDistr (ProtoCrypto proto))
forall proto era.
BlockQuery
  (ShelleyBlock proto era)
  'QFNoTables
  (PoolDistr (ProtoCrypto proto))
GetStakeDistribution
    (Int
2, Word8
6) -> BlockQuery (ShelleyBlock proto era) 'QFTraverseTables (UTxO era)
-> SomeBlockQuery (BlockQuery (ShelleyBlock proto era))
forall (q :: QueryFootprint -> * -> *)
       (footprint :: QueryFootprint) result.
SingI footprint =>
q footprint result -> SomeBlockQuery q
SomeBlockQuery (BlockQuery (ShelleyBlock proto era) 'QFTraverseTables (UTxO era)
 -> SomeBlockQuery (BlockQuery (ShelleyBlock proto era)))
-> (Set Addr
    -> BlockQuery
         (ShelleyBlock proto era) 'QFTraverseTables (UTxO era))
-> Set Addr
-> SomeBlockQuery (BlockQuery (ShelleyBlock proto era))
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Set Addr
-> BlockQuery (ShelleyBlock proto era) 'QFTraverseTables (UTxO era)
forall proto era.
Set Addr
-> BlockQuery (ShelleyBlock proto era) 'QFTraverseTables (UTxO era)
GetUTxOByAddress (Set Addr -> SomeBlockQuery (BlockQuery (ShelleyBlock proto era)))
-> Decoder s (Set Addr)
-> Decoder s (SomeBlockQuery (BlockQuery (ShelleyBlock proto era)))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall era t s. (Era era, DecCBOR t) => Decoder s t
LC.fromEraCBOR @era
    (Int
1, Word8
7) -> SomeBlockQuery (BlockQuery (ShelleyBlock proto era))
-> Decoder s (SomeBlockQuery (BlockQuery (ShelleyBlock proto era)))
forall a. a -> Decoder s a
forall (m :: * -> *) a. Monad m => a -> m a
return (SomeBlockQuery (BlockQuery (ShelleyBlock proto era))
 -> Decoder
      s (SomeBlockQuery (BlockQuery (ShelleyBlock proto era))))
-> SomeBlockQuery (BlockQuery (ShelleyBlock proto era))
-> Decoder s (SomeBlockQuery (BlockQuery (ShelleyBlock proto era)))
forall a b. (a -> b) -> a -> b
$ BlockQuery (ShelleyBlock proto era) 'QFTraverseTables (UTxO era)
-> SomeBlockQuery (BlockQuery (ShelleyBlock proto era))
forall (q :: QueryFootprint -> * -> *)
       (footprint :: QueryFootprint) result.
SingI footprint =>
q footprint result -> SomeBlockQuery q
SomeBlockQuery BlockQuery (ShelleyBlock proto era) 'QFTraverseTables (UTxO era)
forall proto era.
BlockQuery (ShelleyBlock proto era) 'QFTraverseTables (UTxO era)
GetUTxOWhole
    (Int
1, Word8
8) -> SomeBlockQuery (BlockQuery (ShelleyBlock proto era))
-> Decoder s (SomeBlockQuery (BlockQuery (ShelleyBlock proto era)))
forall a. a -> Decoder s a
forall (m :: * -> *) a. Monad m => a -> m a
return (SomeBlockQuery (BlockQuery (ShelleyBlock proto era))
 -> Decoder
      s (SomeBlockQuery (BlockQuery (ShelleyBlock proto era))))
-> SomeBlockQuery (BlockQuery (ShelleyBlock proto era))
-> Decoder s (SomeBlockQuery (BlockQuery (ShelleyBlock proto era)))
forall a b. (a -> b) -> a -> b
$ BlockQuery (ShelleyBlock proto era) 'QFNoTables (EpochState era)
-> SomeBlockQuery (BlockQuery (ShelleyBlock proto era))
forall (q :: QueryFootprint -> * -> *)
       (footprint :: QueryFootprint) result.
SingI footprint =>
q footprint result -> SomeBlockQuery q
SomeBlockQuery BlockQuery (ShelleyBlock proto era) 'QFNoTables (EpochState era)
forall proto era.
BlockQuery (ShelleyBlock proto era) 'QFNoTables (EpochState era)
DebugEpochState
    (Int
2, Word8
9) -> (\(SomeBlockQuery BlockQuery (ShelleyBlock proto era) footprint result
q) -> BlockQuery (ShelleyBlock proto era) footprint (Serialised result)
-> SomeBlockQuery (BlockQuery (ShelleyBlock proto era))
forall (q :: QueryFootprint -> * -> *)
       (footprint :: QueryFootprint) result.
SingI footprint =>
q footprint result -> SomeBlockQuery q
SomeBlockQuery (BlockQuery (ShelleyBlock proto era) footprint result
-> BlockQuery
     (ShelleyBlock proto era) footprint (Serialised result)
forall proto era (fp :: QueryFootprint) result.
BlockQuery (ShelleyBlock proto era) fp result
-> BlockQuery (ShelleyBlock proto era) fp (Serialised result)
GetCBOR BlockQuery (ShelleyBlock proto era) footprint result
q)) (SomeBlockQuery (BlockQuery (ShelleyBlock proto era))
 -> SomeBlockQuery (BlockQuery (ShelleyBlock proto era)))
-> Decoder s (SomeBlockQuery (BlockQuery (ShelleyBlock proto era)))
-> Decoder s (SomeBlockQuery (BlockQuery (ShelleyBlock proto era)))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Decoder s (SomeBlockQuery (BlockQuery (ShelleyBlock proto era)))
forall s.
Decoder s (SomeBlockQuery (BlockQuery (ShelleyBlock proto era)))
forall era proto s.
ShelleyBasedEra era =>
Decoder s (SomeBlockQuery (BlockQuery (ShelleyBlock proto era)))
decodeShelleyQuery
    (Int
2, Word8
10) -> BlockQuery
  (ShelleyBlock proto era)
  'QFNoTables
  (Delegations, Map (Credential Staking) Coin)
-> SomeBlockQuery (BlockQuery (ShelleyBlock proto era))
forall (q :: QueryFootprint -> * -> *)
       (footprint :: QueryFootprint) result.
SingI footprint =>
q footprint result -> SomeBlockQuery q
SomeBlockQuery (BlockQuery
   (ShelleyBlock proto era)
   'QFNoTables
   (Delegations, Map (Credential Staking) Coin)
 -> SomeBlockQuery (BlockQuery (ShelleyBlock proto era)))
-> (Set (Credential Staking)
    -> BlockQuery
         (ShelleyBlock proto era)
         'QFNoTables
         (Delegations, Map (Credential Staking) Coin))
-> Set (Credential Staking)
-> SomeBlockQuery (BlockQuery (ShelleyBlock proto era))
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Set (Credential Staking)
-> BlockQuery
     (ShelleyBlock proto era)
     'QFNoTables
     (Delegations, Map (Credential Staking) Coin)
forall proto era.
Set (Credential Staking)
-> BlockQuery
     (ShelleyBlock proto era)
     'QFNoTables
     (Delegations, Map (Credential Staking) Coin)
GetFilteredDelegationsAndRewardAccounts (Set (Credential Staking)
 -> SomeBlockQuery (BlockQuery (ShelleyBlock proto era)))
-> Decoder s (Set (Credential Staking))
-> Decoder s (SomeBlockQuery (BlockQuery (ShelleyBlock proto era)))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall era t s. (Era era, DecCBOR t) => Decoder s t
LC.fromEraCBOR @era
    (Int
1, Word8
11) -> SomeBlockQuery (BlockQuery (ShelleyBlock proto era))
-> Decoder s (SomeBlockQuery (BlockQuery (ShelleyBlock proto era)))
forall a. a -> Decoder s a
forall (m :: * -> *) a. Monad m => a -> m a
return (SomeBlockQuery (BlockQuery (ShelleyBlock proto era))
 -> Decoder
      s (SomeBlockQuery (BlockQuery (ShelleyBlock proto era))))
-> SomeBlockQuery (BlockQuery (ShelleyBlock proto era))
-> Decoder s (SomeBlockQuery (BlockQuery (ShelleyBlock proto era)))
forall a b. (a -> b) -> a -> b
$ BlockQuery (ShelleyBlock proto era) 'QFNoTables CompactGenesis
-> SomeBlockQuery (BlockQuery (ShelleyBlock proto era))
forall (q :: QueryFootprint -> * -> *)
       (footprint :: QueryFootprint) result.
SingI footprint =>
q footprint result -> SomeBlockQuery q
SomeBlockQuery BlockQuery (ShelleyBlock proto era) 'QFNoTables CompactGenesis
forall proto era.
BlockQuery (ShelleyBlock proto era) 'QFNoTables CompactGenesis
GetGenesisConfig
    (Int
1, Word8
12) -> SomeBlockQuery (BlockQuery (ShelleyBlock proto era))
-> Decoder s (SomeBlockQuery (BlockQuery (ShelleyBlock proto era)))
forall a. a -> Decoder s a
forall (m :: * -> *) a. Monad m => a -> m a
return (SomeBlockQuery (BlockQuery (ShelleyBlock proto era))
 -> Decoder
      s (SomeBlockQuery (BlockQuery (ShelleyBlock proto era))))
-> SomeBlockQuery (BlockQuery (ShelleyBlock proto era))
-> Decoder s (SomeBlockQuery (BlockQuery (ShelleyBlock proto era)))
forall a b. (a -> b) -> a -> b
$ BlockQuery (ShelleyBlock proto era) 'QFNoTables (NewEpochState era)
-> SomeBlockQuery (BlockQuery (ShelleyBlock proto era))
forall (q :: QueryFootprint -> * -> *)
       (footprint :: QueryFootprint) result.
SingI footprint =>
q footprint result -> SomeBlockQuery q
SomeBlockQuery BlockQuery (ShelleyBlock proto era) 'QFNoTables (NewEpochState era)
forall proto era.
BlockQuery (ShelleyBlock proto era) 'QFNoTables (NewEpochState era)
DebugNewEpochState
    (Int
1, Word8
13) -> SomeBlockQuery (BlockQuery (ShelleyBlock proto era))
-> Decoder s (SomeBlockQuery (BlockQuery (ShelleyBlock proto era)))
forall a. a -> Decoder s a
forall (m :: * -> *) a. Monad m => a -> m a
return (SomeBlockQuery (BlockQuery (ShelleyBlock proto era))
 -> Decoder
      s (SomeBlockQuery (BlockQuery (ShelleyBlock proto era))))
-> SomeBlockQuery (BlockQuery (ShelleyBlock proto era))
-> Decoder s (SomeBlockQuery (BlockQuery (ShelleyBlock proto era)))
forall a b. (a -> b) -> a -> b
$ BlockQuery
  (ShelleyBlock proto era) 'QFNoTables (ChainDepState proto)
-> SomeBlockQuery (BlockQuery (ShelleyBlock proto era))
forall (q :: QueryFootprint -> * -> *)
       (footprint :: QueryFootprint) result.
SingI footprint =>
q footprint result -> SomeBlockQuery q
SomeBlockQuery BlockQuery
  (ShelleyBlock proto era) 'QFNoTables (ChainDepState proto)
forall proto era.
BlockQuery
  (ShelleyBlock proto era) 'QFNoTables (ChainDepState proto)
DebugChainDepState
    (Int
1, Word8
14) -> SomeBlockQuery (BlockQuery (ShelleyBlock proto era))
-> Decoder s (SomeBlockQuery (BlockQuery (ShelleyBlock proto era)))
forall a. a -> Decoder s a
forall (m :: * -> *) a. Monad m => a -> m a
return (SomeBlockQuery (BlockQuery (ShelleyBlock proto era))
 -> Decoder
      s (SomeBlockQuery (BlockQuery (ShelleyBlock proto era))))
-> SomeBlockQuery (BlockQuery (ShelleyBlock proto era))
-> Decoder s (SomeBlockQuery (BlockQuery (ShelleyBlock proto era)))
forall a b. (a -> b) -> a -> b
$ BlockQuery (ShelleyBlock proto era) 'QFNoTables RewardProvenance
-> SomeBlockQuery (BlockQuery (ShelleyBlock proto era))
forall (q :: QueryFootprint -> * -> *)
       (footprint :: QueryFootprint) result.
SingI footprint =>
q footprint result -> SomeBlockQuery q
SomeBlockQuery BlockQuery (ShelleyBlock proto era) 'QFNoTables RewardProvenance
forall proto era.
BlockQuery (ShelleyBlock proto era) 'QFNoTables RewardProvenance
GetRewardProvenance
    (Int
2, Word8
15) -> BlockQuery (ShelleyBlock proto era) 'QFLookupTables (UTxO era)
-> SomeBlockQuery (BlockQuery (ShelleyBlock proto era))
forall (q :: QueryFootprint -> * -> *)
       (footprint :: QueryFootprint) result.
SingI footprint =>
q footprint result -> SomeBlockQuery q
SomeBlockQuery (BlockQuery (ShelleyBlock proto era) 'QFLookupTables (UTxO era)
 -> SomeBlockQuery (BlockQuery (ShelleyBlock proto era)))
-> (Set TxIn
    -> BlockQuery (ShelleyBlock proto era) 'QFLookupTables (UTxO era))
-> Set TxIn
-> SomeBlockQuery (BlockQuery (ShelleyBlock proto era))
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Set TxIn
-> BlockQuery (ShelleyBlock proto era) 'QFLookupTables (UTxO era)
forall proto era.
Set TxIn
-> BlockQuery (ShelleyBlock proto era) 'QFLookupTables (UTxO era)
GetUTxOByTxIn (Set TxIn -> SomeBlockQuery (BlockQuery (ShelleyBlock proto era)))
-> Decoder s (Set TxIn)
-> Decoder s (SomeBlockQuery (BlockQuery (ShelleyBlock proto era)))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall era t s. (Era era, DecCBOR t) => Decoder s t
LC.fromEraCBOR @era
    (Int
1, Word8
16) -> SomeBlockQuery (BlockQuery (ShelleyBlock proto era))
-> Decoder s (SomeBlockQuery (BlockQuery (ShelleyBlock proto era)))
forall a. a -> Decoder s a
forall (m :: * -> *) a. Monad m => a -> m a
return (SomeBlockQuery (BlockQuery (ShelleyBlock proto era))
 -> Decoder
      s (SomeBlockQuery (BlockQuery (ShelleyBlock proto era))))
-> SomeBlockQuery (BlockQuery (ShelleyBlock proto era))
-> Decoder s (SomeBlockQuery (BlockQuery (ShelleyBlock proto era)))
forall a b. (a -> b) -> a -> b
$ BlockQuery
  (ShelleyBlock proto era) 'QFNoTables (Set (KeyHash StakePool))
-> SomeBlockQuery (BlockQuery (ShelleyBlock proto era))
forall (q :: QueryFootprint -> * -> *)
       (footprint :: QueryFootprint) result.
SingI footprint =>
q footprint result -> SomeBlockQuery q
SomeBlockQuery BlockQuery
  (ShelleyBlock proto era) 'QFNoTables (Set (KeyHash StakePool))
forall proto era.
BlockQuery
  (ShelleyBlock proto era) 'QFNoTables (Set (KeyHash StakePool))
GetStakePools
    (Int
2, Word8
17) -> BlockQuery
  (ShelleyBlock proto era)
  'QFNoTables
  (Map (KeyHash StakePool) StakePoolParams)
-> SomeBlockQuery (BlockQuery (ShelleyBlock proto era))
forall (q :: QueryFootprint -> * -> *)
       (footprint :: QueryFootprint) result.
SingI footprint =>
q footprint result -> SomeBlockQuery q
SomeBlockQuery (BlockQuery
   (ShelleyBlock proto era)
   'QFNoTables
   (Map (KeyHash StakePool) StakePoolParams)
 -> SomeBlockQuery (BlockQuery (ShelleyBlock proto era)))
-> (Set (KeyHash StakePool)
    -> BlockQuery
         (ShelleyBlock proto era)
         'QFNoTables
         (Map (KeyHash StakePool) StakePoolParams))
-> Set (KeyHash StakePool)
-> SomeBlockQuery (BlockQuery (ShelleyBlock proto era))
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Set (KeyHash StakePool)
-> BlockQuery
     (ShelleyBlock proto era)
     'QFNoTables
     (Map (KeyHash StakePool) StakePoolParams)
forall proto era.
Set (KeyHash StakePool)
-> BlockQuery
     (ShelleyBlock proto era)
     'QFNoTables
     (Map (KeyHash StakePool) StakePoolParams)
GetStakePoolParams (Set (KeyHash StakePool)
 -> SomeBlockQuery (BlockQuery (ShelleyBlock proto era)))
-> Decoder s (Set (KeyHash StakePool))
-> Decoder s (SomeBlockQuery (BlockQuery (ShelleyBlock proto era)))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Decoder s (Set (KeyHash StakePool))
forall s. Decoder s (Set (KeyHash StakePool))
forall a s. FromCBOR a => Decoder s a
fromCBOR
    (Int
1, Word8
18) -> SomeBlockQuery (BlockQuery (ShelleyBlock proto era))
-> Decoder s (SomeBlockQuery (BlockQuery (ShelleyBlock proto era)))
forall a. a -> Decoder s a
forall (m :: * -> *) a. Monad m => a -> m a
return (SomeBlockQuery (BlockQuery (ShelleyBlock proto era))
 -> Decoder
      s (SomeBlockQuery (BlockQuery (ShelleyBlock proto era))))
-> SomeBlockQuery (BlockQuery (ShelleyBlock proto era))
-> Decoder s (SomeBlockQuery (BlockQuery (ShelleyBlock proto era)))
forall a b. (a -> b) -> a -> b
$ BlockQuery
  (ShelleyBlock proto era)
  'QFNoTables
  (RewardParams, Map (KeyHash StakePool) RewardInfoPool)
-> SomeBlockQuery (BlockQuery (ShelleyBlock proto era))
forall (q :: QueryFootprint -> * -> *)
       (footprint :: QueryFootprint) result.
SingI footprint =>
q footprint result -> SomeBlockQuery q
SomeBlockQuery BlockQuery
  (ShelleyBlock proto era)
  'QFNoTables
  (RewardParams, Map (KeyHash StakePool) RewardInfoPool)
forall proto era.
BlockQuery
  (ShelleyBlock proto era)
  'QFNoTables
  (RewardParams, Map (KeyHash StakePool) RewardInfoPool)
GetRewardInfoPools
    (Int
2, Word8
19) -> BlockQuery
  (ShelleyBlock proto era) 'QFNoTables QueryPoolStateResult
-> SomeBlockQuery (BlockQuery (ShelleyBlock proto era))
forall (q :: QueryFootprint -> * -> *)
       (footprint :: QueryFootprint) result.
SingI footprint =>
q footprint result -> SomeBlockQuery q
SomeBlockQuery (BlockQuery
   (ShelleyBlock proto era) 'QFNoTables QueryPoolStateResult
 -> SomeBlockQuery (BlockQuery (ShelleyBlock proto era)))
-> (Maybe (Set (KeyHash StakePool))
    -> BlockQuery
         (ShelleyBlock proto era) 'QFNoTables QueryPoolStateResult)
-> Maybe (Set (KeyHash StakePool))
-> SomeBlockQuery (BlockQuery (ShelleyBlock proto era))
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Maybe (Set (KeyHash StakePool))
-> BlockQuery
     (ShelleyBlock proto era) 'QFNoTables QueryPoolStateResult
forall proto era.
Maybe (Set (KeyHash StakePool))
-> BlockQuery
     (ShelleyBlock proto era) 'QFNoTables QueryPoolStateResult
GetPoolState (Maybe (Set (KeyHash StakePool))
 -> SomeBlockQuery (BlockQuery (ShelleyBlock proto era)))
-> Decoder s (Maybe (Set (KeyHash StakePool)))
-> Decoder s (SomeBlockQuery (BlockQuery (ShelleyBlock proto era)))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Decoder s (Maybe (Set (KeyHash StakePool)))
forall s. Decoder s (Maybe (Set (KeyHash StakePool)))
forall a s. FromCBOR a => Decoder s a
fromCBOR
    (Int
2, Word8
20) -> BlockQuery (ShelleyBlock proto era) 'QFNoTables StakeSnapshots
-> SomeBlockQuery (BlockQuery (ShelleyBlock proto era))
forall (q :: QueryFootprint -> * -> *)
       (footprint :: QueryFootprint) result.
SingI footprint =>
q footprint result -> SomeBlockQuery q
SomeBlockQuery (BlockQuery (ShelleyBlock proto era) 'QFNoTables StakeSnapshots
 -> SomeBlockQuery (BlockQuery (ShelleyBlock proto era)))
-> (Maybe (Set (KeyHash StakePool))
    -> BlockQuery (ShelleyBlock proto era) 'QFNoTables StakeSnapshots)
-> Maybe (Set (KeyHash StakePool))
-> SomeBlockQuery (BlockQuery (ShelleyBlock proto era))
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Maybe (Set (KeyHash StakePool))
-> BlockQuery (ShelleyBlock proto era) 'QFNoTables StakeSnapshots
forall era proto.
EraGov era =>
Maybe (Set (KeyHash StakePool))
-> BlockQuery (ShelleyBlock proto era) 'QFNoTables StakeSnapshots
GetStakeSnapshots (Maybe (Set (KeyHash StakePool))
 -> SomeBlockQuery (BlockQuery (ShelleyBlock proto era)))
-> Decoder s (Maybe (Set (KeyHash StakePool)))
-> Decoder s (SomeBlockQuery (BlockQuery (ShelleyBlock proto era)))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Decoder s (Maybe (Set (KeyHash StakePool)))
forall s. Decoder s (Maybe (Set (KeyHash StakePool)))
forall a s. FromCBOR a => Decoder s a
fromCBOR
    (Int
2, Word8
21) -> BlockQuery
  (ShelleyBlock proto era)
  'QFNoTables
  (PoolDistr (ProtoCrypto proto))
-> SomeBlockQuery (BlockQuery (ShelleyBlock proto era))
forall (q :: QueryFootprint -> * -> *)
       (footprint :: QueryFootprint) result.
SingI footprint =>
q footprint result -> SomeBlockQuery q
SomeBlockQuery (BlockQuery
   (ShelleyBlock proto era)
   'QFNoTables
   (PoolDistr (ProtoCrypto proto))
 -> SomeBlockQuery (BlockQuery (ShelleyBlock proto era)))
-> (Maybe (Set (KeyHash StakePool))
    -> BlockQuery
         (ShelleyBlock proto era)
         'QFNoTables
         (PoolDistr (ProtoCrypto proto)))
-> Maybe (Set (KeyHash StakePool))
-> SomeBlockQuery (BlockQuery (ShelleyBlock proto era))
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Maybe (Set (KeyHash StakePool))
-> BlockQuery
     (ShelleyBlock proto era)
     'QFNoTables
     (PoolDistr (ProtoCrypto proto))
forall proto era.
Maybe (Set (KeyHash StakePool))
-> BlockQuery
     (ShelleyBlock proto era)
     'QFNoTables
     (PoolDistr (ProtoCrypto proto))
GetPoolDistr (Maybe (Set (KeyHash StakePool))
 -> SomeBlockQuery (BlockQuery (ShelleyBlock proto era)))
-> Decoder s (Maybe (Set (KeyHash StakePool)))
-> Decoder s (SomeBlockQuery (BlockQuery (ShelleyBlock proto era)))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Decoder s (Maybe (Set (KeyHash StakePool)))
forall s. Decoder s (Maybe (Set (KeyHash StakePool)))
forall a s. FromCBOR a => Decoder s a
fromCBOR
    (Int
2, Word8
22) -> BlockQuery
  (ShelleyBlock proto era)
  'QFNoTables
  (Map (Credential Staking) Coin)
-> SomeBlockQuery (BlockQuery (ShelleyBlock proto era))
forall (q :: QueryFootprint -> * -> *)
       (footprint :: QueryFootprint) result.
SingI footprint =>
q footprint result -> SomeBlockQuery q
SomeBlockQuery (BlockQuery
   (ShelleyBlock proto era)
   'QFNoTables
   (Map (Credential Staking) Coin)
 -> SomeBlockQuery (BlockQuery (ShelleyBlock proto era)))
-> (Set (Credential Staking)
    -> BlockQuery
         (ShelleyBlock proto era)
         'QFNoTables
         (Map (Credential Staking) Coin))
-> Set (Credential Staking)
-> SomeBlockQuery (BlockQuery (ShelleyBlock proto era))
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Set (Credential Staking)
-> BlockQuery
     (ShelleyBlock proto era)
     'QFNoTables
     (Map (Credential Staking) Coin)
forall proto era.
Set (Credential Staking)
-> BlockQuery
     (ShelleyBlock proto era)
     'QFNoTables
     (Map (Credential Staking) Coin)
GetStakeDelegDeposits (Set (Credential Staking)
 -> SomeBlockQuery (BlockQuery (ShelleyBlock proto era)))
-> Decoder s (Set (Credential Staking))
-> Decoder s (SomeBlockQuery (BlockQuery (ShelleyBlock proto era)))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Decoder s (Set (Credential Staking))
forall s. Decoder s (Set (Credential Staking))
forall a s. FromCBOR a => Decoder s a
fromCBOR
    (Int
1, Word8
23) -> ((ConwayEraGov era, ConwayEraCertState era) =>
 Decoder s (SomeBlockQuery (BlockQuery (ShelleyBlock proto era))))
-> Decoder s (SomeBlockQuery (BlockQuery (ShelleyBlock proto era)))
forall s ans.
((ConwayEraGov era, ConwayEraCertState era) => Decoder s ans)
-> Decoder s ans
requireCG (((ConwayEraGov era, ConwayEraCertState era) =>
  Decoder s (SomeBlockQuery (BlockQuery (ShelleyBlock proto era))))
 -> Decoder
      s (SomeBlockQuery (BlockQuery (ShelleyBlock proto era))))
-> ((ConwayEraGov era, ConwayEraCertState era) =>
    Decoder s (SomeBlockQuery (BlockQuery (ShelleyBlock proto era))))
-> Decoder s (SomeBlockQuery (BlockQuery (ShelleyBlock proto era)))
forall a b. (a -> b) -> a -> b
$ SomeBlockQuery (BlockQuery (ShelleyBlock proto era))
-> Decoder s (SomeBlockQuery (BlockQuery (ShelleyBlock proto era)))
forall a. a -> Decoder s a
forall (m :: * -> *) a. Monad m => a -> m a
return (SomeBlockQuery (BlockQuery (ShelleyBlock proto era))
 -> Decoder
      s (SomeBlockQuery (BlockQuery (ShelleyBlock proto era))))
-> SomeBlockQuery (BlockQuery (ShelleyBlock proto era))
-> Decoder s (SomeBlockQuery (BlockQuery (ShelleyBlock proto era)))
forall a b. (a -> b) -> a -> b
$ BlockQuery (ShelleyBlock proto era) 'QFNoTables (Constitution era)
-> SomeBlockQuery (BlockQuery (ShelleyBlock proto era))
forall (q :: QueryFootprint -> * -> *)
       (footprint :: QueryFootprint) result.
SingI footprint =>
q footprint result -> SomeBlockQuery q
SomeBlockQuery BlockQuery (ShelleyBlock proto era) 'QFNoTables (Constitution era)
forall era proto.
ConwayEraGov era =>
BlockQuery (ShelleyBlock proto era) 'QFNoTables (Constitution era)
GetConstitution
    (Int
1, Word8
24) -> SomeBlockQuery (BlockQuery (ShelleyBlock proto era))
-> Decoder s (SomeBlockQuery (BlockQuery (ShelleyBlock proto era)))
forall a. a -> Decoder s a
forall (m :: * -> *) a. Monad m => a -> m a
return (SomeBlockQuery (BlockQuery (ShelleyBlock proto era))
 -> Decoder
      s (SomeBlockQuery (BlockQuery (ShelleyBlock proto era))))
-> SomeBlockQuery (BlockQuery (ShelleyBlock proto era))
-> Decoder s (SomeBlockQuery (BlockQuery (ShelleyBlock proto era)))
forall a b. (a -> b) -> a -> b
$ BlockQuery (ShelleyBlock proto era) 'QFNoTables (GovState era)
-> SomeBlockQuery (BlockQuery (ShelleyBlock proto era))
forall (q :: QueryFootprint -> * -> *)
       (footprint :: QueryFootprint) result.
SingI footprint =>
q footprint result -> SomeBlockQuery q
SomeBlockQuery BlockQuery (ShelleyBlock proto era) 'QFNoTables (GovState era)
forall proto era.
BlockQuery (ShelleyBlock proto era) 'QFNoTables (GovState era)
GetGovState
    (Int
2, Word8
25) -> ((ConwayEraGov era, ConwayEraCertState era) =>
 Decoder s (SomeBlockQuery (BlockQuery (ShelleyBlock proto era))))
-> Decoder s (SomeBlockQuery (BlockQuery (ShelleyBlock proto era)))
forall s ans.
((ConwayEraGov era, ConwayEraCertState era) => Decoder s ans)
-> Decoder s ans
requireCG (((ConwayEraGov era, ConwayEraCertState era) =>
  Decoder s (SomeBlockQuery (BlockQuery (ShelleyBlock proto era))))
 -> Decoder
      s (SomeBlockQuery (BlockQuery (ShelleyBlock proto era))))
-> ((ConwayEraGov era, ConwayEraCertState era) =>
    Decoder s (SomeBlockQuery (BlockQuery (ShelleyBlock proto era))))
-> Decoder s (SomeBlockQuery (BlockQuery (ShelleyBlock proto era)))
forall a b. (a -> b) -> a -> b
$ BlockQuery
  (ShelleyBlock proto era)
  'QFNoTables
  (Map (Credential DRepRole) DRepState)
-> SomeBlockQuery (BlockQuery (ShelleyBlock proto era))
forall (q :: QueryFootprint -> * -> *)
       (footprint :: QueryFootprint) result.
SingI footprint =>
q footprint result -> SomeBlockQuery q
SomeBlockQuery (BlockQuery
   (ShelleyBlock proto era)
   'QFNoTables
   (Map (Credential DRepRole) DRepState)
 -> SomeBlockQuery (BlockQuery (ShelleyBlock proto era)))
-> (Set (Credential DRepRole)
    -> BlockQuery
         (ShelleyBlock proto era)
         'QFNoTables
         (Map (Credential DRepRole) DRepState))
-> Set (Credential DRepRole)
-> SomeBlockQuery (BlockQuery (ShelleyBlock proto era))
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Set (Credential DRepRole)
-> BlockQuery
     (ShelleyBlock proto era)
     'QFNoTables
     (Map (Credential DRepRole) DRepState)
forall era proto.
(ConwayEraGov era, ConwayEraCertState era) =>
Set (Credential DRepRole)
-> BlockQuery
     (ShelleyBlock proto era)
     'QFNoTables
     (Map (Credential DRepRole) DRepState)
GetDRepState (Set (Credential DRepRole)
 -> SomeBlockQuery (BlockQuery (ShelleyBlock proto era)))
-> Decoder s (Set (Credential DRepRole))
-> Decoder s (SomeBlockQuery (BlockQuery (ShelleyBlock proto era)))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Decoder s (Set (Credential DRepRole))
forall s. Decoder s (Set (Credential DRepRole))
forall a s. FromCBOR a => Decoder s a
fromCBOR
    (Int
2, Word8
26) -> ((ConwayEraGov era, ConwayEraCertState era) =>
 Decoder s (SomeBlockQuery (BlockQuery (ShelleyBlock proto era))))
-> Decoder s (SomeBlockQuery (BlockQuery (ShelleyBlock proto era)))
forall s ans.
((ConwayEraGov era, ConwayEraCertState era) => Decoder s ans)
-> Decoder s ans
requireCG (((ConwayEraGov era, ConwayEraCertState era) =>
  Decoder s (SomeBlockQuery (BlockQuery (ShelleyBlock proto era))))
 -> Decoder
      s (SomeBlockQuery (BlockQuery (ShelleyBlock proto era))))
-> ((ConwayEraGov era, ConwayEraCertState era) =>
    Decoder s (SomeBlockQuery (BlockQuery (ShelleyBlock proto era))))
-> Decoder s (SomeBlockQuery (BlockQuery (ShelleyBlock proto era)))
forall a b. (a -> b) -> a -> b
$ BlockQuery (ShelleyBlock proto era) 'QFNoTables (Map DRep Coin)
-> SomeBlockQuery (BlockQuery (ShelleyBlock proto era))
forall (q :: QueryFootprint -> * -> *)
       (footprint :: QueryFootprint) result.
SingI footprint =>
q footprint result -> SomeBlockQuery q
SomeBlockQuery (BlockQuery (ShelleyBlock proto era) 'QFNoTables (Map DRep Coin)
 -> SomeBlockQuery (BlockQuery (ShelleyBlock proto era)))
-> (Set DRep
    -> BlockQuery (ShelleyBlock proto era) 'QFNoTables (Map DRep Coin))
-> Set DRep
-> SomeBlockQuery (BlockQuery (ShelleyBlock proto era))
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Set DRep
-> BlockQuery (ShelleyBlock proto era) 'QFNoTables (Map DRep Coin)
forall era proto.
ConwayEraGov era =>
Set DRep
-> BlockQuery (ShelleyBlock proto era) 'QFNoTables (Map DRep Coin)
GetDRepStakeDistr (Set DRep -> SomeBlockQuery (BlockQuery (ShelleyBlock proto era)))
-> Decoder s (Set DRep)
-> Decoder s (SomeBlockQuery (BlockQuery (ShelleyBlock proto era)))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall era t s. (Era era, DecCBOR t) => Decoder s t
LC.fromEraCBOR @era
    (Int
4, Word8
27) -> ((ConwayEraGov era, ConwayEraCertState era) =>
 Decoder s (SomeBlockQuery (BlockQuery (ShelleyBlock proto era))))
-> Decoder s (SomeBlockQuery (BlockQuery (ShelleyBlock proto era)))
forall s ans.
((ConwayEraGov era, ConwayEraCertState era) => Decoder s ans)
-> Decoder s ans
requireCG (((ConwayEraGov era, ConwayEraCertState era) =>
  Decoder s (SomeBlockQuery (BlockQuery (ShelleyBlock proto era))))
 -> Decoder
      s (SomeBlockQuery (BlockQuery (ShelleyBlock proto era))))
-> ((ConwayEraGov era, ConwayEraCertState era) =>
    Decoder s (SomeBlockQuery (BlockQuery (ShelleyBlock proto era))))
-> Decoder s (SomeBlockQuery (BlockQuery (ShelleyBlock proto era)))
forall a b. (a -> b) -> a -> b
$ do
      coldCreds <- Decoder s (Set (Credential ColdCommitteeRole))
forall s. Decoder s (Set (Credential ColdCommitteeRole))
forall a s. FromCBOR a => Decoder s a
fromCBOR
      hotCreds <- fromCBOR
      statuses <- LC.fromEraCBOR @era
      return $ SomeBlockQuery $ GetCommitteeMembersState coldCreds hotCreds statuses
    (Int
2, Word8
28) -> ((ConwayEraGov era, ConwayEraCertState era) =>
 Decoder s (SomeBlockQuery (BlockQuery (ShelleyBlock proto era))))
-> Decoder s (SomeBlockQuery (BlockQuery (ShelleyBlock proto era)))
forall s ans.
((ConwayEraGov era, ConwayEraCertState era) => Decoder s ans)
-> Decoder s ans
requireCG (((ConwayEraGov era, ConwayEraCertState era) =>
  Decoder s (SomeBlockQuery (BlockQuery (ShelleyBlock proto era))))
 -> Decoder
      s (SomeBlockQuery (BlockQuery (ShelleyBlock proto era))))
-> ((ConwayEraGov era, ConwayEraCertState era) =>
    Decoder s (SomeBlockQuery (BlockQuery (ShelleyBlock proto era))))
-> Decoder s (SomeBlockQuery (BlockQuery (ShelleyBlock proto era)))
forall a b. (a -> b) -> a -> b
$ do
      BlockQuery
  (ShelleyBlock proto era)
  'QFNoTables
  (Map (Credential Staking) DRep)
-> SomeBlockQuery (BlockQuery (ShelleyBlock proto era))
forall (q :: QueryFootprint -> * -> *)
       (footprint :: QueryFootprint) result.
SingI footprint =>
q footprint result -> SomeBlockQuery q
SomeBlockQuery (BlockQuery
   (ShelleyBlock proto era)
   'QFNoTables
   (Map (Credential Staking) DRep)
 -> SomeBlockQuery (BlockQuery (ShelleyBlock proto era)))
-> (Set (Credential Staking)
    -> BlockQuery
         (ShelleyBlock proto era)
         'QFNoTables
         (Map (Credential Staking) DRep))
-> Set (Credential Staking)
-> SomeBlockQuery (BlockQuery (ShelleyBlock proto era))
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Set (Credential Staking)
-> BlockQuery
     (ShelleyBlock proto era)
     'QFNoTables
     (Map (Credential Staking) DRep)
forall era proto.
ConwayEraGov era =>
Set (Credential Staking)
-> BlockQuery
     (ShelleyBlock proto era)
     'QFNoTables
     (Map (Credential Staking) DRep)
GetFilteredVoteDelegatees (Set (Credential Staking)
 -> SomeBlockQuery (BlockQuery (ShelleyBlock proto era)))
-> Decoder s (Set (Credential Staking))
-> Decoder s (SomeBlockQuery (BlockQuery (ShelleyBlock proto era)))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall era t s. (Era era, DecCBOR t) => Decoder s t
LC.fromEraCBOR @era
    (Int
1, Word8
29) -> SomeBlockQuery (BlockQuery (ShelleyBlock proto era))
-> Decoder s (SomeBlockQuery (BlockQuery (ShelleyBlock proto era)))
forall a. a -> Decoder s a
forall (m :: * -> *) a. Monad m => a -> m a
return (SomeBlockQuery (BlockQuery (ShelleyBlock proto era))
 -> Decoder
      s (SomeBlockQuery (BlockQuery (ShelleyBlock proto era))))
-> SomeBlockQuery (BlockQuery (ShelleyBlock proto era))
-> Decoder s (SomeBlockQuery (BlockQuery (ShelleyBlock proto era)))
forall a b. (a -> b) -> a -> b
$ BlockQuery (ShelleyBlock proto era) 'QFNoTables ChainAccountState
-> SomeBlockQuery (BlockQuery (ShelleyBlock proto era))
forall (q :: QueryFootprint -> * -> *)
       (footprint :: QueryFootprint) result.
SingI footprint =>
q footprint result -> SomeBlockQuery q
SomeBlockQuery BlockQuery (ShelleyBlock proto era) 'QFNoTables ChainAccountState
forall proto era.
BlockQuery (ShelleyBlock proto era) 'QFNoTables ChainAccountState
GetAccountState
    (Int
2, Word8
30) -> ((ConwayEraGov era, ConwayEraCertState era) =>
 Decoder s (SomeBlockQuery (BlockQuery (ShelleyBlock proto era))))
-> Decoder s (SomeBlockQuery (BlockQuery (ShelleyBlock proto era)))
forall s ans.
((ConwayEraGov era, ConwayEraCertState era) => Decoder s ans)
-> Decoder s ans
requireCG (((ConwayEraGov era, ConwayEraCertState era) =>
  Decoder s (SomeBlockQuery (BlockQuery (ShelleyBlock proto era))))
 -> Decoder
      s (SomeBlockQuery (BlockQuery (ShelleyBlock proto era))))
-> ((ConwayEraGov era, ConwayEraCertState era) =>
    Decoder s (SomeBlockQuery (BlockQuery (ShelleyBlock proto era))))
-> Decoder s (SomeBlockQuery (BlockQuery (ShelleyBlock proto era)))
forall a b. (a -> b) -> a -> b
$ BlockQuery
  (ShelleyBlock proto era) 'QFNoTables (Map (KeyHash StakePool) Coin)
-> SomeBlockQuery (BlockQuery (ShelleyBlock proto era))
forall (q :: QueryFootprint -> * -> *)
       (footprint :: QueryFootprint) result.
SingI footprint =>
q footprint result -> SomeBlockQuery q
SomeBlockQuery (BlockQuery
   (ShelleyBlock proto era) 'QFNoTables (Map (KeyHash StakePool) Coin)
 -> SomeBlockQuery (BlockQuery (ShelleyBlock proto era)))
-> (Set (KeyHash StakePool)
    -> BlockQuery
         (ShelleyBlock proto era)
         'QFNoTables
         (Map (KeyHash StakePool) Coin))
-> Set (KeyHash StakePool)
-> SomeBlockQuery (BlockQuery (ShelleyBlock proto era))
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Set (KeyHash StakePool)
-> BlockQuery
     (ShelleyBlock proto era) 'QFNoTables (Map (KeyHash StakePool) Coin)
forall era proto.
ConwayEraGov era =>
Set (KeyHash StakePool)
-> BlockQuery
     (ShelleyBlock proto era) 'QFNoTables (Map (KeyHash StakePool) Coin)
GetSPOStakeDistr (Set (KeyHash StakePool)
 -> SomeBlockQuery (BlockQuery (ShelleyBlock proto era)))
-> Decoder s (Set (KeyHash StakePool))
-> Decoder s (SomeBlockQuery (BlockQuery (ShelleyBlock proto era)))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall era t s. (Era era, DecCBOR t) => Decoder s t
LC.fromEraCBOR @era
    (Int
2, Word8
31) -> ((ConwayEraGov era, ConwayEraCertState era) =>
 Decoder s (SomeBlockQuery (BlockQuery (ShelleyBlock proto era))))
-> Decoder s (SomeBlockQuery (BlockQuery (ShelleyBlock proto era)))
forall s ans.
((ConwayEraGov era, ConwayEraCertState era) => Decoder s ans)
-> Decoder s ans
requireCG (((ConwayEraGov era, ConwayEraCertState era) =>
  Decoder s (SomeBlockQuery (BlockQuery (ShelleyBlock proto era))))
 -> Decoder
      s (SomeBlockQuery (BlockQuery (ShelleyBlock proto era))))
-> ((ConwayEraGov era, ConwayEraCertState era) =>
    Decoder s (SomeBlockQuery (BlockQuery (ShelleyBlock proto era))))
-> Decoder s (SomeBlockQuery (BlockQuery (ShelleyBlock proto era)))
forall a b. (a -> b) -> a -> b
$ BlockQuery
  (ShelleyBlock proto era) 'QFNoTables (Seq (GovActionState era))
-> SomeBlockQuery (BlockQuery (ShelleyBlock proto era))
forall (q :: QueryFootprint -> * -> *)
       (footprint :: QueryFootprint) result.
SingI footprint =>
q footprint result -> SomeBlockQuery q
SomeBlockQuery (BlockQuery
   (ShelleyBlock proto era) 'QFNoTables (Seq (GovActionState era))
 -> SomeBlockQuery (BlockQuery (ShelleyBlock proto era)))
-> (Set GovActionId
    -> BlockQuery
         (ShelleyBlock proto era) 'QFNoTables (Seq (GovActionState era)))
-> Set GovActionId
-> SomeBlockQuery (BlockQuery (ShelleyBlock proto era))
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Set GovActionId
-> BlockQuery
     (ShelleyBlock proto era) 'QFNoTables (Seq (GovActionState era))
forall era proto.
ConwayEraGov era =>
Set GovActionId
-> BlockQuery
     (ShelleyBlock proto era) 'QFNoTables (Seq (GovActionState era))
GetProposals (Set GovActionId
 -> SomeBlockQuery (BlockQuery (ShelleyBlock proto era)))
-> Decoder s (Set GovActionId)
-> Decoder s (SomeBlockQuery (BlockQuery (ShelleyBlock proto era)))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall era t s. (Era era, DecCBOR t) => Decoder s t
LC.fromEraCBOR @era
    (Int
1, Word8
32) -> ((ConwayEraGov era, ConwayEraCertState era) =>
 Decoder s (SomeBlockQuery (BlockQuery (ShelleyBlock proto era))))
-> Decoder s (SomeBlockQuery (BlockQuery (ShelleyBlock proto era)))
forall s ans.
((ConwayEraGov era, ConwayEraCertState era) => Decoder s ans)
-> Decoder s ans
requireCG (((ConwayEraGov era, ConwayEraCertState era) =>
  Decoder s (SomeBlockQuery (BlockQuery (ShelleyBlock proto era))))
 -> Decoder
      s (SomeBlockQuery (BlockQuery (ShelleyBlock proto era))))
-> ((ConwayEraGov era, ConwayEraCertState era) =>
    Decoder s (SomeBlockQuery (BlockQuery (ShelleyBlock proto era))))
-> Decoder s (SomeBlockQuery (BlockQuery (ShelleyBlock proto era)))
forall a b. (a -> b) -> a -> b
$ SomeBlockQuery (BlockQuery (ShelleyBlock proto era))
-> Decoder s (SomeBlockQuery (BlockQuery (ShelleyBlock proto era)))
forall a. a -> Decoder s a
forall (m :: * -> *) a. Monad m => a -> m a
return (SomeBlockQuery (BlockQuery (ShelleyBlock proto era))
 -> Decoder
      s (SomeBlockQuery (BlockQuery (ShelleyBlock proto era))))
-> SomeBlockQuery (BlockQuery (ShelleyBlock proto era))
-> Decoder s (SomeBlockQuery (BlockQuery (ShelleyBlock proto era)))
forall a b. (a -> b) -> a -> b
$ BlockQuery (ShelleyBlock proto era) 'QFNoTables (RatifyState era)
-> SomeBlockQuery (BlockQuery (ShelleyBlock proto era))
forall (q :: QueryFootprint -> * -> *)
       (footprint :: QueryFootprint) result.
SingI footprint =>
q footprint result -> SomeBlockQuery q
SomeBlockQuery BlockQuery (ShelleyBlock proto era) 'QFNoTables (RatifyState era)
forall era proto.
ConwayEraGov era =>
BlockQuery (ShelleyBlock proto era) 'QFNoTables (RatifyState era)
GetRatifyState
    (Int
1, Word8
33) -> ((ConwayEraGov era, ConwayEraCertState era) =>
 Decoder s (SomeBlockQuery (BlockQuery (ShelleyBlock proto era))))
-> Decoder s (SomeBlockQuery (BlockQuery (ShelleyBlock proto era)))
forall s ans.
((ConwayEraGov era, ConwayEraCertState era) => Decoder s ans)
-> Decoder s ans
requireCG (((ConwayEraGov era, ConwayEraCertState era) =>
  Decoder s (SomeBlockQuery (BlockQuery (ShelleyBlock proto era))))
 -> Decoder
      s (SomeBlockQuery (BlockQuery (ShelleyBlock proto era))))
-> ((ConwayEraGov era, ConwayEraCertState era) =>
    Decoder s (SomeBlockQuery (BlockQuery (ShelleyBlock proto era))))
-> Decoder s (SomeBlockQuery (BlockQuery (ShelleyBlock proto era)))
forall a b. (a -> b) -> a -> b
$ SomeBlockQuery (BlockQuery (ShelleyBlock proto era))
-> Decoder s (SomeBlockQuery (BlockQuery (ShelleyBlock proto era)))
forall a. a -> Decoder s a
forall (m :: * -> *) a. Monad m => a -> m a
return (SomeBlockQuery (BlockQuery (ShelleyBlock proto era))
 -> Decoder
      s (SomeBlockQuery (BlockQuery (ShelleyBlock proto era))))
-> SomeBlockQuery (BlockQuery (ShelleyBlock proto era))
-> Decoder s (SomeBlockQuery (BlockQuery (ShelleyBlock proto era)))
forall a b. (a -> b) -> a -> b
$ BlockQuery
  (ShelleyBlock proto era) 'QFNoTables (Maybe (PParams era))
-> SomeBlockQuery (BlockQuery (ShelleyBlock proto era))
forall (q :: QueryFootprint -> * -> *)
       (footprint :: QueryFootprint) result.
SingI footprint =>
q footprint result -> SomeBlockQuery q
SomeBlockQuery BlockQuery
  (ShelleyBlock proto era) 'QFNoTables (Maybe (PParams era))
forall proto era.
BlockQuery
  (ShelleyBlock proto era) 'QFNoTables (Maybe (PParams era))
GetFuturePParams
    -- TODO: remove (1, 34) once NodeToClientV_22 is no longer supported
    (Int
1, Word8
34) -> SomeBlockQuery (BlockQuery (ShelleyBlock proto era))
-> Decoder s (SomeBlockQuery (BlockQuery (ShelleyBlock proto era)))
forall a. a -> Decoder s a
forall (m :: * -> *) a. Monad m => a -> m a
return (SomeBlockQuery (BlockQuery (ShelleyBlock proto era))
 -> Decoder
      s (SomeBlockQuery (BlockQuery (ShelleyBlock proto era))))
-> (BlockQuery
      (ShelleyBlock proto era) 'QFNoTables SomeLedgerPeerSnapshot
    -> SomeBlockQuery (BlockQuery (ShelleyBlock proto era)))
-> BlockQuery
     (ShelleyBlock proto era) 'QFNoTables SomeLedgerPeerSnapshot
-> Decoder s (SomeBlockQuery (BlockQuery (ShelleyBlock proto era)))
forall b c a. (b -> c) -> (a -> b) -> a -> c
. BlockQuery
  (ShelleyBlock proto era) 'QFNoTables SomeLedgerPeerSnapshot
-> SomeBlockQuery (BlockQuery (ShelleyBlock proto era))
forall (q :: QueryFootprint -> * -> *)
       (footprint :: QueryFootprint) result.
SingI footprint =>
q footprint result -> SomeBlockQuery q
SomeBlockQuery (BlockQuery
   (ShelleyBlock proto era) 'QFNoTables SomeLedgerPeerSnapshot
 -> Decoder
      s (SomeBlockQuery (BlockQuery (ShelleyBlock proto era))))
-> BlockQuery
     (ShelleyBlock proto era) 'QFNoTables SomeLedgerPeerSnapshot
-> Decoder s (SomeBlockQuery (BlockQuery (ShelleyBlock proto era)))
forall a b. (a -> b) -> a -> b
$ Bool
-> LedgerPeersKind
-> BlockQuery
     (ShelleyBlock proto era) 'QFNoTables SomeLedgerPeerSnapshot
forall proto era.
Bool
-> LedgerPeersKind
-> BlockQuery
     (ShelleyBlock proto era) 'QFNoTables SomeLedgerPeerSnapshot
GetLedgerPeerSnapshot' Bool
False LedgerPeersKind
BigLedgerPeers
    (Int
2, Word8
34) -> do
      -- >=v15
      peerKind <- Decoder s Word8
forall s. Decoder s Word8
CBOR.decodeWord8
      SomeBlockQuery . GetLedgerPeerSnapshot' True <$> case peerKind of
        Word8
0 -> LedgerPeersKind -> Decoder s LedgerPeersKind
forall a. a -> Decoder s a
forall (f :: * -> *) a. Applicative f => a -> f a
pure LedgerPeersKind
AllLedgerPeers
        Word8
1 -> LedgerPeersKind -> Decoder s LedgerPeersKind
forall a. a -> Decoder s a
forall (f :: * -> *) a. Applicative f => a -> f a
pure LedgerPeersKind
BigLedgerPeers
        Word8
_ -> String -> Decoder s LedgerPeersKind
forall s ans. String -> Decoder s ans
failmsg (String -> Decoder s LedgerPeersKind)
-> String -> Decoder s LedgerPeersKind
forall a b. (a -> b) -> a -> b
$ String
"invalid peer kind tag " String -> ShowS
forall a. Semigroup a => a -> a -> a
<> Word8 -> String
forall a. Show a => a -> String
show Word8
tag
    (Int
2, Word8
35) -> ((ConwayEraGov era, ConwayEraCertState era) =>
 Decoder s (SomeBlockQuery (BlockQuery (ShelleyBlock proto era))))
-> Decoder s (SomeBlockQuery (BlockQuery (ShelleyBlock proto era)))
forall s ans.
((ConwayEraGov era, ConwayEraCertState era) => Decoder s ans)
-> Decoder s ans
requireCG (((ConwayEraGov era, ConwayEraCertState era) =>
  Decoder s (SomeBlockQuery (BlockQuery (ShelleyBlock proto era))))
 -> Decoder
      s (SomeBlockQuery (BlockQuery (ShelleyBlock proto era))))
-> ((ConwayEraGov era, ConwayEraCertState era) =>
    Decoder s (SomeBlockQuery (BlockQuery (ShelleyBlock proto era))))
-> Decoder s (SomeBlockQuery (BlockQuery (ShelleyBlock proto era)))
forall a b. (a -> b) -> a -> b
$ BlockQuery (ShelleyBlock proto era) 'QFNoTables DefaultVote
-> SomeBlockQuery (BlockQuery (ShelleyBlock proto era))
forall (q :: QueryFootprint -> * -> *)
       (footprint :: QueryFootprint) result.
SingI footprint =>
q footprint result -> SomeBlockQuery q
SomeBlockQuery (BlockQuery (ShelleyBlock proto era) 'QFNoTables DefaultVote
 -> SomeBlockQuery (BlockQuery (ShelleyBlock proto era)))
-> (KeyHash StakePool
    -> BlockQuery (ShelleyBlock proto era) 'QFNoTables DefaultVote)
-> KeyHash StakePool
-> SomeBlockQuery (BlockQuery (ShelleyBlock proto era))
forall b c a. (b -> c) -> (a -> b) -> a -> c
. KeyHash StakePool
-> BlockQuery (ShelleyBlock proto era) 'QFNoTables DefaultVote
forall era proto.
ConwayEraGov era =>
KeyHash StakePool
-> BlockQuery (ShelleyBlock proto era) 'QFNoTables DefaultVote
QueryStakePoolDefaultVote (KeyHash StakePool
 -> SomeBlockQuery (BlockQuery (ShelleyBlock proto era)))
-> Decoder s (KeyHash StakePool)
-> Decoder s (SomeBlockQuery (BlockQuery (ShelleyBlock proto era)))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall era t s. (Era era, DecCBOR t) => Decoder s t
LC.fromEraCBOR @era
    (Int
2, Word8
36) -> BlockQuery (ShelleyBlock proto era) 'QFNoTables PoolDistr
-> SomeBlockQuery (BlockQuery (ShelleyBlock proto era))
forall (q :: QueryFootprint -> * -> *)
       (footprint :: QueryFootprint) result.
SingI footprint =>
q footprint result -> SomeBlockQuery q
SomeBlockQuery (BlockQuery (ShelleyBlock proto era) 'QFNoTables PoolDistr
 -> SomeBlockQuery (BlockQuery (ShelleyBlock proto era)))
-> (Maybe (Set (KeyHash StakePool))
    -> BlockQuery (ShelleyBlock proto era) 'QFNoTables PoolDistr)
-> Maybe (Set (KeyHash StakePool))
-> SomeBlockQuery (BlockQuery (ShelleyBlock proto era))
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Maybe (Set (KeyHash StakePool))
-> BlockQuery (ShelleyBlock proto era) 'QFNoTables PoolDistr
forall proto era.
Maybe (Set (KeyHash StakePool))
-> BlockQuery (ShelleyBlock proto era) 'QFNoTables PoolDistr
GetPoolDistr2 (Maybe (Set (KeyHash StakePool))
 -> SomeBlockQuery (BlockQuery (ShelleyBlock proto era)))
-> Decoder s (Maybe (Set (KeyHash StakePool)))
-> Decoder s (SomeBlockQuery (BlockQuery (ShelleyBlock proto era)))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Decoder s (Maybe (Set (KeyHash StakePool)))
forall s. Decoder s (Maybe (Set (KeyHash StakePool)))
forall a s. FromCBOR a => Decoder s a
fromCBOR
    (Int
1, Word8
37) -> SomeBlockQuery (BlockQuery (ShelleyBlock proto era))
-> Decoder s (SomeBlockQuery (BlockQuery (ShelleyBlock proto era)))
forall a. a -> Decoder s a
forall (m :: * -> *) a. Monad m => a -> m a
return (SomeBlockQuery (BlockQuery (ShelleyBlock proto era))
 -> Decoder
      s (SomeBlockQuery (BlockQuery (ShelleyBlock proto era))))
-> SomeBlockQuery (BlockQuery (ShelleyBlock proto era))
-> Decoder s (SomeBlockQuery (BlockQuery (ShelleyBlock proto era)))
forall a b. (a -> b) -> a -> b
$ BlockQuery (ShelleyBlock proto era) 'QFNoTables PoolDistr
-> SomeBlockQuery (BlockQuery (ShelleyBlock proto era))
forall (q :: QueryFootprint -> * -> *)
       (footprint :: QueryFootprint) result.
SingI footprint =>
q footprint result -> SomeBlockQuery q
SomeBlockQuery BlockQuery (ShelleyBlock proto era) 'QFNoTables PoolDistr
forall proto era.
BlockQuery (ShelleyBlock proto era) 'QFNoTables PoolDistr
GetStakeDistribution2
    (Int
1, Word8
38) -> SomeBlockQuery (BlockQuery (ShelleyBlock proto era))
-> Decoder s (SomeBlockQuery (BlockQuery (ShelleyBlock proto era)))
forall a. a -> Decoder s a
forall (m :: * -> *) a. Monad m => a -> m a
return (SomeBlockQuery (BlockQuery (ShelleyBlock proto era))
 -> Decoder
      s (SomeBlockQuery (BlockQuery (ShelleyBlock proto era))))
-> SomeBlockQuery (BlockQuery (ShelleyBlock proto era))
-> Decoder s (SomeBlockQuery (BlockQuery (ShelleyBlock proto era)))
forall a b. (a -> b) -> a -> b
$ BlockQuery (ShelleyBlock proto era) 'QFNoTables MaxMajorProtVer
-> SomeBlockQuery (BlockQuery (ShelleyBlock proto era))
forall (q :: QueryFootprint -> * -> *)
       (footprint :: QueryFootprint) result.
SingI footprint =>
q footprint result -> SomeBlockQuery q
SomeBlockQuery BlockQuery (ShelleyBlock proto era) 'QFNoTables MaxMajorProtVer
forall proto era.
BlockQuery (ShelleyBlock proto era) 'QFNoTables MaxMajorProtVer
GetMaxMajorProtocolVersion
    (Int
2, Word8
39) -> ((ConwayEraGov era, ConwayEraCertState era) =>
 Decoder s (SomeBlockQuery (BlockQuery (ShelleyBlock proto era))))
-> Decoder s (SomeBlockQuery (BlockQuery (ShelleyBlock proto era)))
forall s ans.
((ConwayEraGov era, ConwayEraCertState era) => Decoder s ans)
-> Decoder s ans
requireCG (((ConwayEraGov era, ConwayEraCertState era) =>
  Decoder s (SomeBlockQuery (BlockQuery (ShelleyBlock proto era))))
 -> Decoder
      s (SomeBlockQuery (BlockQuery (ShelleyBlock proto era))))
-> ((ConwayEraGov era, ConwayEraCertState era) =>
    Decoder s (SomeBlockQuery (BlockQuery (ShelleyBlock proto era))))
-> Decoder s (SomeBlockQuery (BlockQuery (ShelleyBlock proto era)))
forall a b. (a -> b) -> a -> b
$ BlockQuery
  (ShelleyBlock proto era)
  'QFNoTables
  (Map DRep (Set (Credential Staking)))
-> SomeBlockQuery (BlockQuery (ShelleyBlock proto era))
forall (q :: QueryFootprint -> * -> *)
       (footprint :: QueryFootprint) result.
SingI footprint =>
q footprint result -> SomeBlockQuery q
SomeBlockQuery (BlockQuery
   (ShelleyBlock proto era)
   'QFNoTables
   (Map DRep (Set (Credential Staking)))
 -> SomeBlockQuery (BlockQuery (ShelleyBlock proto era)))
-> (Set DRep
    -> BlockQuery
         (ShelleyBlock proto era)
         'QFNoTables
         (Map DRep (Set (Credential Staking))))
-> Set DRep
-> SomeBlockQuery (BlockQuery (ShelleyBlock proto era))
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Set DRep
-> BlockQuery
     (ShelleyBlock proto era)
     'QFNoTables
     (Map DRep (Set (Credential Staking)))
forall era proto.
(ConwayEraGov era, ConwayEraCertState era) =>
Set DRep
-> BlockQuery
     (ShelleyBlock proto era)
     'QFNoTables
     (Map DRep (Set (Credential Staking)))
GetDRepDelegations (Set DRep -> SomeBlockQuery (BlockQuery (ShelleyBlock proto era)))
-> Decoder s (Set DRep)
-> Decoder s (SomeBlockQuery (BlockQuery (ShelleyBlock proto era)))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall era t s. (Era era, DecCBOR t) => Decoder s t
LC.fromEraCBOR @era
    (Int, Word8)
_ -> String
-> Decoder s (SomeBlockQuery (BlockQuery (ShelleyBlock proto era)))
forall s ans. String -> Decoder s ans
failmsg String
"invalid"

encodeShelleyResult ::
  forall proto era fp result.
  ShelleyCompatible proto era =>
  ShelleyNodeToClientVersion ->
  BlockQuery (ShelleyBlock proto era) fp result ->
  result ->
  Encoding
encodeShelleyResult :: forall proto era (fp :: QueryFootprint) result.
ShelleyCompatible proto era =>
ShelleyNodeToClientVersion
-> BlockQuery (ShelleyBlock proto era) fp result
-> result
-> Encoding
encodeShelleyResult ShelleyNodeToClientVersion
v BlockQuery (ShelleyBlock proto era) fp result
query = case BlockQuery (ShelleyBlock proto era) fp result
query of
  BlockQuery (ShelleyBlock proto era) fp result
R:BlockQueryShelleyBlockfpresult proto era fp result
GetLedgerTip -> (HeaderHash (ShelleyBlock proto era) -> Encoding)
-> Point (ShelleyBlock proto era) -> Encoding
forall {k} (block :: k).
(HeaderHash block -> Encoding) -> Point block -> Encoding
encodePoint HeaderHash (ShelleyBlock proto era) -> Encoding
ShelleyHash -> Encoding
forall a. Serialise a => a -> Encoding
encode
  BlockQuery (ShelleyBlock proto era) fp result
R:BlockQueryShelleyBlockfpresult proto era fp result
GetEpochNo -> result -> Encoding
forall a. ToCBOR a => a -> Encoding
toCBOR
  GetNonMyopicMemberRewards{} -> result -> Encoding
forall a. ToCBOR a => a -> Encoding
toCBOR
  BlockQuery (ShelleyBlock proto era) fp result
R:BlockQueryShelleyBlockfpresult proto era fp result
GetCurrentPParams -> (result -> Encoding, Decoder (ZonkAny 1) (PParams era))
-> result -> Encoding
forall a b. (a, b) -> a
fst ((result -> Encoding, Decoder (ZonkAny 1) (PParams era))
 -> result -> Encoding)
-> (result -> Encoding, Decoder (ZonkAny 1) (PParams era))
-> result
-> Encoding
forall a b. (a -> b) -> a -> b
$ ShelleyNodeToClientVersion
-> (PParams era -> Encoding, Decoder (ZonkAny 1) (PParams era))
forall era s.
(FromCBOR (PParams era), ToCBOR (PParams era),
 FromCBOR (LegacyPParams era), ToCBOR (LegacyPParams era)) =>
ShelleyNodeToClientVersion
-> (PParams era -> Encoding, Decoder s (PParams era))
currentPParamsEnDecoding ShelleyNodeToClientVersion
v
  BlockQuery (ShelleyBlock proto era) fp result
R:BlockQueryShelleyBlockfpresult proto era fp result
GetProposedPParamsUpdates -> result -> Encoding
forall a. ToCBOR a => a -> Encoding
toCBOR
  BlockQuery (ShelleyBlock proto era) fp result
R:BlockQueryShelleyBlockfpresult proto era fp result
GetStakeDistribution -> forall era t. (Era era, EncCBOR t) => t -> Encoding
LC.toEraCBOR @era
  GetUTxOByAddress{} -> result -> Encoding
forall a. ToCBOR a => a -> Encoding
toCBOR
  BlockQuery (ShelleyBlock proto era) fp result
R:BlockQueryShelleyBlockfpresult proto era fp result
GetUTxOWhole -> result -> Encoding
forall a. ToCBOR a => a -> Encoding
toCBOR
  BlockQuery (ShelleyBlock proto era) fp result
R:BlockQueryShelleyBlockfpresult proto era fp result
DebugEpochState -> result -> Encoding
forall a. ToCBOR a => a -> Encoding
toCBOR
  GetCBOR{} -> result -> Encoding
forall a. Serialise a => a -> Encoding
encode
  GetFilteredDelegationsAndRewardAccounts{} -> forall era t. (Era era, EncCBOR t) => t -> Encoding
LC.toEraCBOR @era
  BlockQuery (ShelleyBlock proto era) fp result
R:BlockQueryShelleyBlockfpresult proto era fp result
GetGenesisConfig -> (result -> Encoding, Decoder (ZonkAny 2) CompactGenesis)
-> result -> Encoding
forall a b. (a, b) -> a
fst ((result -> Encoding, Decoder (ZonkAny 2) CompactGenesis)
 -> result -> Encoding)
-> (result -> Encoding, Decoder (ZonkAny 2) CompactGenesis)
-> result
-> Encoding
forall a b. (a -> b) -> a -> b
$ ShelleyNodeToClientVersion
-> (CompactGenesis -> Encoding, Decoder (ZonkAny 2) CompactGenesis)
forall s.
ShelleyNodeToClientVersion
-> (CompactGenesis -> Encoding, Decoder s CompactGenesis)
genesisConfigEnDecoding ShelleyNodeToClientVersion
v
  BlockQuery (ShelleyBlock proto era) fp result
R:BlockQueryShelleyBlockfpresult proto era fp result
DebugNewEpochState -> result -> Encoding
forall a. ToCBOR a => a -> Encoding
toCBOR
  BlockQuery (ShelleyBlock proto era) fp result
R:BlockQueryShelleyBlockfpresult proto era fp result
DebugChainDepState -> result -> Encoding
forall a. Serialise a => a -> Encoding
encode
  BlockQuery (ShelleyBlock proto era) fp result
R:BlockQueryShelleyBlockfpresult proto era fp result
GetRewardProvenance -> forall era t. (Era era, EncCBOR t) => t -> Encoding
LC.toEraCBOR @era
  GetUTxOByTxIn{} -> result -> Encoding
forall a. ToCBOR a => a -> Encoding
toCBOR
  BlockQuery (ShelleyBlock proto era) fp result
R:BlockQueryShelleyBlockfpresult proto era fp result
GetStakePools -> result -> Encoding
forall a. ToCBOR a => a -> Encoding
toCBOR
  GetStakePoolParams{} -> forall era t. (Era era, EncCBOR t) => t -> Encoding
LC.toEraCBOR @era
  BlockQuery (ShelleyBlock proto era) fp result
R:BlockQueryShelleyBlockfpresult proto era fp result
GetRewardInfoPools -> forall era t. (Era era, EncCBOR t) => t -> Encoding
LC.toEraCBOR @era
  GetPoolState{} -> forall era t. (Era era, EncCBOR t) => t -> Encoding
LC.toEraCBOR @era
  GetStakeSnapshots{} -> forall era t. (Era era, EncCBOR t) => t -> Encoding
LC.toEraCBOR @era
  GetPoolDistr{} -> forall era t. (Era era, EncCBOR t) => t -> Encoding
LC.toEraCBOR @era
  GetStakeDelegDeposits{} -> forall era t. (Era era, EncCBOR t) => t -> Encoding
LC.toEraCBOR @era
  BlockQuery (ShelleyBlock proto era) fp result
R:BlockQueryShelleyBlockfpresult proto era fp result
GetConstitution -> result -> Encoding
forall a. ToCBOR a => a -> Encoding
toCBOR
  BlockQuery (ShelleyBlock proto era) fp result
R:BlockQueryShelleyBlockfpresult proto era fp result
GetGovState -> result -> Encoding
forall a. ToCBOR a => a -> Encoding
toCBOR
  GetDRepState{} -> forall era t. (Era era, EncCBOR t) => t -> Encoding
LC.toEraCBOR @era
  GetDRepStakeDistr{} -> forall era t. (Era era, EncCBOR t) => t -> Encoding
LC.toEraCBOR @era
  GetCommitteeMembersState{} -> forall era t. (Era era, EncCBOR t) => t -> Encoding
LC.toEraCBOR @era
  GetFilteredVoteDelegatees{} -> forall era t. (Era era, EncCBOR t) => t -> Encoding
LC.toEraCBOR @era
  GetAccountState{} -> forall era t. (Era era, EncCBOR t) => t -> Encoding
LC.toEraCBOR @era
  GetSPOStakeDistr{} -> forall era t. (Era era, EncCBOR t) => t -> Encoding
LC.toEraCBOR @era
  GetProposals{} -> forall era t. (Era era, EncCBOR t) => t -> Encoding
LC.toEraCBOR @era
  GetRatifyState{} -> forall era t. (Era era, EncCBOR t) => t -> Encoding
LC.toEraCBOR @era
  GetFuturePParams{} -> forall era t. (Era era, EncCBOR t) => t -> Encoding
LC.toEraCBOR @era
  GetLedgerPeerSnapshot'{} -> LedgerPeerSnapshotSRVSupport -> SomeLedgerPeerSnapshot -> Encoding
encodeLedgerPeerSnapshot' (ShelleyNodeToClientVersion -> LedgerPeerSnapshotSRVSupport
ledgerPeerSnapshotSupportsSRV ShelleyNodeToClientVersion
v)
  QueryStakePoolDefaultVote{} -> result -> Encoding
forall a. ToCBOR a => a -> Encoding
toCBOR
  GetPoolDistr2{} -> forall era t. (Era era, EncCBOR t) => t -> Encoding
LC.toEraCBOR @era
  GetStakeDistribution2{} -> forall era t. (Era era, EncCBOR t) => t -> Encoding
LC.toEraCBOR @era
  BlockQuery (ShelleyBlock proto era) fp result
R:BlockQueryShelleyBlockfpresult proto era fp result
GetMaxMajorProtocolVersion -> result -> Encoding
forall a. ToCBOR a => a -> Encoding
toCBOR
  GetDRepDelegations{} -> forall era t. (Era era, EncCBOR t) => t -> Encoding
LC.toEraCBOR @era

decodeShelleyResult ::
  forall proto era fp result.
  ShelleyCompatible proto era =>
  ShelleyNodeToClientVersion ->
  BlockQuery (ShelleyBlock proto era) fp result ->
  forall s.
  Decoder s result
decodeShelleyResult :: forall proto era (fp :: QueryFootprint) result.
ShelleyCompatible proto era =>
ShelleyNodeToClientVersion
-> BlockQuery (ShelleyBlock proto era) fp result
-> forall s. Decoder s result
decodeShelleyResult ShelleyNodeToClientVersion
v BlockQuery (ShelleyBlock proto era) fp result
query = case BlockQuery (ShelleyBlock proto era) fp result
query of
  BlockQuery (ShelleyBlock proto era) fp result
R:BlockQueryShelleyBlockfpresult proto era fp result
GetLedgerTip -> (forall s. Decoder s (HeaderHash (ShelleyBlock proto era)))
-> forall s. Decoder s (Point (ShelleyBlock proto era))
forall {k} (block :: k).
(forall s. Decoder s (HeaderHash block))
-> forall s. Decoder s (Point block)
decodePoint Decoder s (HeaderHash (ShelleyBlock proto era))
Decoder s ShelleyHash
forall s. Decoder s (HeaderHash (ShelleyBlock proto era))
forall s. Decoder s ShelleyHash
forall a s. Serialise a => Decoder s a
decode
  BlockQuery (ShelleyBlock proto era) fp result
R:BlockQueryShelleyBlockfpresult proto era fp result
GetEpochNo -> Decoder s result
forall s. Decoder s result
forall a s. FromCBOR a => Decoder s a
fromCBOR
  GetNonMyopicMemberRewards{} -> Decoder s result
forall s. Decoder s result
forall a s. FromCBOR a => Decoder s a
fromCBOR
  BlockQuery (ShelleyBlock proto era) fp result
R:BlockQueryShelleyBlockfpresult proto era fp result
GetCurrentPParams -> (PParams era -> Encoding, Decoder s result) -> Decoder s result
forall a b. (a, b) -> b
snd ((PParams era -> Encoding, Decoder s result) -> Decoder s result)
-> (PParams era -> Encoding, Decoder s result) -> Decoder s result
forall a b. (a -> b) -> a -> b
$ ShelleyNodeToClientVersion
-> (PParams era -> Encoding, Decoder s (PParams era))
forall era s.
(FromCBOR (PParams era), ToCBOR (PParams era),
 FromCBOR (LegacyPParams era), ToCBOR (LegacyPParams era)) =>
ShelleyNodeToClientVersion
-> (PParams era -> Encoding, Decoder s (PParams era))
currentPParamsEnDecoding ShelleyNodeToClientVersion
v
  BlockQuery (ShelleyBlock proto era) fp result
R:BlockQueryShelleyBlockfpresult proto era fp result
GetProposedPParamsUpdates -> Decoder s result
forall s. Decoder s result
forall a s. FromCBOR a => Decoder s a
fromCBOR
  BlockQuery (ShelleyBlock proto era) fp result
R:BlockQueryShelleyBlockfpresult proto era fp result
GetStakeDistribution -> forall era t s. (Era era, DecCBOR t) => Decoder s t
LC.fromEraCBOR @era
  GetUTxOByAddress{} -> Decoder s result
forall s. Decoder s result
forall a s. FromCBOR a => Decoder s a
fromCBOR
  BlockQuery (ShelleyBlock proto era) fp result
R:BlockQueryShelleyBlockfpresult proto era fp result
GetUTxOWhole -> Decoder s result
forall s. Decoder s result
forall a s. FromCBOR a => Decoder s a
fromCBOR
  BlockQuery (ShelleyBlock proto era) fp result
R:BlockQueryShelleyBlockfpresult proto era fp result
DebugEpochState -> Decoder s result
forall s. Decoder s result
forall a s. FromCBOR a => Decoder s a
fromCBOR
  GetCBOR{} -> Decoder s result
forall s. Decoder s result
forall a s. Serialise a => Decoder s a
decode
  GetFilteredDelegationsAndRewardAccounts{} -> forall era t s. (Era era, DecCBOR t) => Decoder s t
LC.fromEraCBOR @era
  BlockQuery (ShelleyBlock proto era) fp result
R:BlockQueryShelleyBlockfpresult proto era fp result
GetGenesisConfig -> (CompactGenesis -> Encoding, Decoder s result) -> Decoder s result
forall a b. (a, b) -> b
snd ((CompactGenesis -> Encoding, Decoder s result)
 -> Decoder s result)
-> (CompactGenesis -> Encoding, Decoder s result)
-> Decoder s result
forall a b. (a -> b) -> a -> b
$ ShelleyNodeToClientVersion
-> (CompactGenesis -> Encoding, Decoder s CompactGenesis)
forall s.
ShelleyNodeToClientVersion
-> (CompactGenesis -> Encoding, Decoder s CompactGenesis)
genesisConfigEnDecoding ShelleyNodeToClientVersion
v
  BlockQuery (ShelleyBlock proto era) fp result
R:BlockQueryShelleyBlockfpresult proto era fp result
DebugNewEpochState -> Decoder s result
forall s. Decoder s result
forall a s. FromCBOR a => Decoder s a
fromCBOR
  BlockQuery (ShelleyBlock proto era) fp result
R:BlockQueryShelleyBlockfpresult proto era fp result
DebugChainDepState -> Decoder s result
forall s. Decoder s result
forall a s. Serialise a => Decoder s a
decode
  BlockQuery (ShelleyBlock proto era) fp result
R:BlockQueryShelleyBlockfpresult proto era fp result
GetRewardProvenance -> forall era t s. (Era era, DecCBOR t) => Decoder s t
LC.fromEraCBOR @era
  GetUTxOByTxIn{} -> Decoder s result
forall s. Decoder s result
forall a s. FromCBOR a => Decoder s a
fromCBOR
  BlockQuery (ShelleyBlock proto era) fp result
R:BlockQueryShelleyBlockfpresult proto era fp result
GetStakePools -> Decoder s result
forall s. Decoder s result
forall a s. FromCBOR a => Decoder s a
fromCBOR
  GetStakePoolParams{} -> forall era t s. (Era era, DecCBOR t) => Decoder s t
LC.fromEraCBOR @era
  BlockQuery (ShelleyBlock proto era) fp result
R:BlockQueryShelleyBlockfpresult proto era fp result
GetRewardInfoPools -> forall era t s. (Era era, DecCBOR t) => Decoder s t
LC.fromEraCBOR @era
  GetPoolState{} -> forall era t s. (Era era, DecCBOR t) => Decoder s t
LC.fromEraCBOR @era
  GetStakeSnapshots{} -> forall era t s. (Era era, DecCBOR t) => Decoder s t
LC.fromEraCBOR @era
  GetPoolDistr{} -> forall era t s. (Era era, DecCBOR t) => Decoder s t
LC.fromEraCBOR @era
  GetStakeDelegDeposits{} -> forall era t s. (Era era, DecCBOR t) => Decoder s t
LC.fromEraCBOR @era
  BlockQuery (ShelleyBlock proto era) fp result
R:BlockQueryShelleyBlockfpresult proto era fp result
GetConstitution -> Decoder s result
forall s. Decoder s result
forall a s. FromCBOR a => Decoder s a
fromCBOR
  BlockQuery (ShelleyBlock proto era) fp result
R:BlockQueryShelleyBlockfpresult proto era fp result
GetGovState -> Decoder s result
forall s. Decoder s result
forall a s. FromCBOR a => Decoder s a
fromCBOR
  GetDRepState{} -> forall era t s. (Era era, DecCBOR t) => Decoder s t
LC.fromEraCBOR @era
  GetDRepStakeDistr{} -> forall era t s. (Era era, DecCBOR t) => Decoder s t
LC.fromEraCBOR @era
  GetCommitteeMembersState{} -> forall era t s. (Era era, DecCBOR t) => Decoder s t
LC.fromEraCBOR @era
  GetFilteredVoteDelegatees{} -> forall era t s. (Era era, DecCBOR t) => Decoder s t
LC.fromEraCBOR @era
  GetAccountState{} -> forall era t s. (Era era, DecCBOR t) => Decoder s t
LC.fromEraCBOR @era
  GetSPOStakeDistr{} -> forall era t s. (Era era, DecCBOR t) => Decoder s t
LC.fromEraCBOR @era
  GetProposals{} -> forall era t s. (Era era, DecCBOR t) => Decoder s t
LC.fromEraCBOR @era
  GetRatifyState{} -> forall era t s. (Era era, DecCBOR t) => Decoder s t
LC.fromEraCBOR @era
  GetFuturePParams{} -> forall era t s. (Era era, DecCBOR t) => Decoder s t
LC.fromEraCBOR @era
  GetLedgerPeerSnapshot'{} -> Proxy (ShelleyBlock proto era) -> Decoder s SomeLedgerPeerSnapshot
forall s blk.
(FromCBOR (HeaderHash blk), ToCBOR (HeaderHash blk),
 ToJSON (HeaderHash blk), StandardHash blk, Typeable blk) =>
Proxy blk -> Decoder s SomeLedgerPeerSnapshot
decodeLedgerPeerSnapshot (Proxy (ShelleyBlock proto era)
forall {k} (t :: k). Proxy t
Proxy :: Proxy (ShelleyBlock proto era))
  QueryStakePoolDefaultVote{} -> Decoder s result
forall s. Decoder s result
forall a s. FromCBOR a => Decoder s a
fromCBOR
  GetPoolDistr2{} -> forall era t s. (Era era, DecCBOR t) => Decoder s t
LC.fromEraCBOR @era
  BlockQuery (ShelleyBlock proto era) fp result
R:BlockQueryShelleyBlockfpresult proto era fp result
GetStakeDistribution2 -> forall era t s. (Era era, DecCBOR t) => Decoder s t
LC.fromEraCBOR @era
  BlockQuery (ShelleyBlock proto era) fp result
R:BlockQueryShelleyBlockfpresult proto era fp result
GetMaxMajorProtocolVersion -> Decoder s result
forall s. Decoder s result
forall a s. FromCBOR a => Decoder s a
fromCBOR
  GetDRepDelegations{} -> forall era t s. (Era era, DecCBOR t) => Decoder s t
LC.fromEraCBOR @era

currentPParamsEnDecoding ::
  forall era s.
  ( FromCBOR (LC.PParams era)
  , ToCBOR (LC.PParams era)
  , FromCBOR (LegacyPParams era)
  , ToCBOR (LegacyPParams era)
  ) =>
  ShelleyNodeToClientVersion ->
  (LC.PParams era -> Encoding, Decoder s (LC.PParams era))
currentPParamsEnDecoding :: forall era s.
(FromCBOR (PParams era), ToCBOR (PParams era),
 FromCBOR (LegacyPParams era), ToCBOR (LegacyPParams era)) =>
ShelleyNodeToClientVersion
-> (PParams era -> Encoding, Decoder s (PParams era))
currentPParamsEnDecoding ShelleyNodeToClientVersion
v
  | ShelleyNodeToClientVersion
v ShelleyNodeToClientVersion -> ShelleyNodeToClientVersion -> Bool
forall a. Ord a => a -> a -> Bool
>= ShelleyNodeToClientVersion
ShelleyNodeToClientVersion13 =
      (PParams era -> Encoding
forall a. ToCBOR a => a -> Encoding
toCBOR, Decoder s (PParams era)
forall s. Decoder s (PParams era)
forall a s. FromCBOR a => Decoder s a
fromCBOR)
  | Bool
otherwise =
      (PParams era -> Encoding
forall era. ToCBOR (LegacyPParams era) => PParams era -> Encoding
encodeLegacyPParams, Decoder s (PParams era)
forall era s.
FromCBOR (LegacyPParams era) =>
Decoder s (PParams era)
decodeLegacyPParams)

genesisConfigEnDecoding ::
  forall s.
  ShelleyNodeToClientVersion ->
  (CompactGenesis -> Encoding, Decoder s CompactGenesis)
genesisConfigEnDecoding :: forall s.
ShelleyNodeToClientVersion
-> (CompactGenesis -> Encoding, Decoder s CompactGenesis)
genesisConfigEnDecoding ShelleyNodeToClientVersion
v
  | ShelleyNodeToClientVersion
v ShelleyNodeToClientVersion -> ShelleyNodeToClientVersion -> Bool
forall a. Ord a => a -> a -> Bool
>= ShelleyNodeToClientVersion
ShelleyNodeToClientVersion13 =
      (CompactGenesis -> Encoding
forall a. ToCBOR a => a -> Encoding
toCBOR, Decoder s CompactGenesis
forall s. Decoder s CompactGenesis
forall a s. FromCBOR a => Decoder s a
fromCBOR)
  | Bool
otherwise =
      (ShelleyGenesis -> Encoding
encodeLegacyShelleyGenesis (ShelleyGenesis -> Encoding)
-> (CompactGenesis -> ShelleyGenesis) -> CompactGenesis -> Encoding
forall b c a. (b -> c) -> (a -> b) -> a -> c
. CompactGenesis -> ShelleyGenesis
getCompactGenesis, ShelleyGenesis -> CompactGenesis
compactGenesis (ShelleyGenesis -> CompactGenesis)
-> Decoder s ShelleyGenesis -> Decoder s CompactGenesis
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Decoder s ShelleyGenesis
forall s. Decoder s ShelleyGenesis
decodeLegacyShelleyGenesis)

{-------------------------------------------------------------------------------
 Instances to implement BlockSupportsHFLedgerQuery
-------------------------------------------------------------------------------}

answerShelleyLookupQueries ::
  forall proto era m result blk.
  ( Monad m
  , ShelleyCompatible proto era
  ) =>
  -- | Inject ledger tables
  ( LedgerTables (LedgerState (ShelleyBlock proto era)) KeysMK ->
    LedgerTables (LedgerState blk) KeysMK
  ) ->
  -- | Eject TxOut
  (TxOut (LedgerState blk) -> LC.TxOut era) ->
  -- | Eject TxIn
  (TxIn (LedgerState blk) -> SL.TxIn) ->
  ExtLedgerCfg (ShelleyBlock proto era) ->
  BlockQuery (ShelleyBlock proto era) QFLookupTables result ->
  ReadOnlyForker' m blk ->
  m result
answerShelleyLookupQueries :: forall proto era (m :: * -> *) result blk.
(Monad m, ShelleyCompatible proto era) =>
(LedgerTables (LedgerState (ShelleyBlock proto era)) KeysMK
 -> LedgerTables (LedgerState blk) KeysMK)
-> (TxOut (LedgerState blk) -> TxOut era)
-> (TxIn (LedgerState blk) -> TxIn)
-> ExtLedgerCfg (ShelleyBlock proto era)
-> BlockQuery (ShelleyBlock proto era) 'QFLookupTables result
-> ReadOnlyForker' m blk
-> m result
answerShelleyLookupQueries LedgerTables (LedgerState (ShelleyBlock proto era)) KeysMK
-> LedgerTables (LedgerState blk) KeysMK
injTables TxOut (LedgerState blk) -> TxOut era
ejTxOut TxIn (LedgerState blk) -> TxIn
ejTxIn ExtLedgerCfg (ShelleyBlock proto era)
cfg BlockQuery (ShelleyBlock proto era) 'QFLookupTables result
q ReadOnlyForker' m blk
forker =
  case BlockQuery (ShelleyBlock proto era) 'QFLookupTables result
q of
    GetUTxOByTxIn Set TxIn
txins ->
      Set TxIn -> m (UTxO era)
answerGetUtxOByTxIn Set TxIn
txins
    GetCBOR BlockQuery (ShelleyBlock proto era) 'QFLookupTables result
q' ->
      -- We encode using the latest (@maxBound@) ShelleyNodeToClientVersion,
      -- as the @GetCBOR@ query already is about opportunistically assuming
      -- both client and server are running the same version; cf. the
      -- @GetCBOR@ Haddocks.
      (result -> Encoding) -> result -> Serialised result
forall a. (a -> Encoding) -> a -> Serialised a
mkSerialised (ShelleyNodeToClientVersion
-> BlockQuery (ShelleyBlock proto era) 'QFLookupTables result
-> result
-> Encoding
forall proto era (fp :: QueryFootprint) result.
ShelleyCompatible proto era =>
ShelleyNodeToClientVersion
-> BlockQuery (ShelleyBlock proto era) fp result
-> result
-> Encoding
encodeShelleyResult ShelleyNodeToClientVersion
forall a. Bounded a => a
maxBound BlockQuery (ShelleyBlock proto era) 'QFLookupTables result
q')
        (result -> result) -> m result -> m result
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (LedgerTables (LedgerState (ShelleyBlock proto era)) KeysMK
 -> LedgerTables (LedgerState blk) KeysMK)
-> (TxOut (LedgerState blk) -> TxOut era)
-> (TxIn (LedgerState blk) -> TxIn)
-> ExtLedgerCfg (ShelleyBlock proto era)
-> BlockQuery (ShelleyBlock proto era) 'QFLookupTables result
-> ReadOnlyForker' m blk
-> m result
forall proto era (m :: * -> *) result blk.
(Monad m, ShelleyCompatible proto era) =>
(LedgerTables (LedgerState (ShelleyBlock proto era)) KeysMK
 -> LedgerTables (LedgerState blk) KeysMK)
-> (TxOut (LedgerState blk) -> TxOut era)
-> (TxIn (LedgerState blk) -> TxIn)
-> ExtLedgerCfg (ShelleyBlock proto era)
-> BlockQuery (ShelleyBlock proto era) 'QFLookupTables result
-> ReadOnlyForker' m blk
-> m result
answerShelleyLookupQueries LedgerTables (LedgerState (ShelleyBlock proto era)) KeysMK
-> LedgerTables (LedgerState blk) KeysMK
injTables TxOut (LedgerState blk) -> TxOut era
ejTxOut TxIn (LedgerState blk) -> TxIn
ejTxIn ExtLedgerCfg (ShelleyBlock proto era)
cfg BlockQuery (ShelleyBlock proto era) 'QFLookupTables result
q' ReadOnlyForker' m blk
forker
 where
  answerGetUtxOByTxIn ::
    Set.Set SL.TxIn ->
    m (SL.UTxO era)
  answerGetUtxOByTxIn :: Set TxIn -> m (UTxO era)
answerGetUtxOByTxIn Set TxIn
txins = do
    LedgerTables (ValuesMK values) <-
      ReadOnlyForker' m blk
-> LedgerTables (ExtLedgerState blk) KeysMK
-> m (LedgerTables (ExtLedgerState blk) ValuesMK)
forall (m :: * -> *) (l :: LedgerStateKind).
ReadOnlyForker m l
-> LedgerTables l KeysMK -> m (LedgerTables l ValuesMK)
LedgerDB.roforkerReadTables
        ReadOnlyForker' m blk
forker
        (LedgerTables (LedgerState blk) KeysMK
-> LedgerTables (ExtLedgerState blk) KeysMK
forall (l :: LedgerStateKind) (l' :: LedgerStateKind)
       (mk :: * -> * -> *).
SameUtxoTypes l l' =>
LedgerTables l mk -> LedgerTables l' mk
castLedgerTables (LedgerTables (LedgerState blk) KeysMK
 -> LedgerTables (ExtLedgerState blk) KeysMK)
-> LedgerTables (LedgerState blk) KeysMK
-> LedgerTables (ExtLedgerState blk) KeysMK
forall a b. (a -> b) -> a -> b
$ LedgerTables (LedgerState (ShelleyBlock proto era)) KeysMK
-> LedgerTables (LedgerState blk) KeysMK
injTables (KeysMK
  (TxIn (LedgerState (ShelleyBlock proto era)))
  (TxOut (LedgerState (ShelleyBlock proto era)))
-> LedgerTables (LedgerState (ShelleyBlock proto era)) KeysMK
forall (l :: LedgerStateKind) (mk :: * -> * -> *).
mk (TxIn l) (TxOut l) -> LedgerTables l mk
LedgerTables (KeysMK
   (TxIn (LedgerState (ShelleyBlock proto era)))
   (TxOut (LedgerState (ShelleyBlock proto era)))
 -> LedgerTables (LedgerState (ShelleyBlock proto era)) KeysMK)
-> KeysMK
     (TxIn (LedgerState (ShelleyBlock proto era)))
     (TxOut (LedgerState (ShelleyBlock proto era)))
-> LedgerTables (LedgerState (ShelleyBlock proto era)) KeysMK
forall a b. (a -> b) -> a -> b
$ Set (TxIn (LedgerState (ShelleyBlock proto era)))
-> KeysMK
     (TxIn (LedgerState (ShelleyBlock proto era)))
     (TxOut (LedgerState (ShelleyBlock proto era)))
forall k v. Set k -> KeysMK k v
KeysMK (Set (TxIn (LedgerState (ShelleyBlock proto era)))
 -> KeysMK
      (TxIn (LedgerState (ShelleyBlock proto era)))
      (TxOut (LedgerState (ShelleyBlock proto era))))
-> Set (TxIn (LedgerState (ShelleyBlock proto era)))
-> KeysMK
     (TxIn (LedgerState (ShelleyBlock proto era)))
     (TxOut (LedgerState (ShelleyBlock proto era)))
forall a b. (a -> b) -> a -> b
$ Set TxIn -> Set BigEndianTxIn
forall k1 k2. Coercible k1 k2 => Set k1 -> Set k2
coerceSet Set TxIn
txins))
    pure $
      SL.UTxO $
        Map.mapKeys ejTxIn $
          Map.mapMaybeWithKey
            ( \TxIn (LedgerState blk)
k TxOut (LedgerState blk)
v ->
                if TxIn (LedgerState blk) -> TxIn
ejTxIn TxIn (LedgerState blk)
k TxIn -> Set TxIn -> Bool
forall a. Ord a => a -> Set a -> Bool
`Set.member` Set TxIn
txins
                  then TxOut era -> Maybe (TxOut era)
forall a. a -> Maybe a
Just (TxOut era -> Maybe (TxOut era)) -> TxOut era -> Maybe (TxOut era)
forall a b. (a -> b) -> a -> b
$ TxOut (LedgerState blk) -> TxOut era
ejTxOut TxOut (LedgerState blk)
v
                  else Maybe (TxOut era)
forall a. Maybe a
Nothing
            )
            values

shelleyQFTraverseTablesPredicate ::
  forall proto era proto' era' result.
  (ShelleyBasedEra era, ShelleyBasedEra era') =>
  BlockQuery (ShelleyBlock proto era) QFTraverseTables result ->
  TxOut (LedgerState (ShelleyBlock proto' era')) ->
  Bool
shelleyQFTraverseTablesPredicate :: forall proto era proto' era' result.
(ShelleyBasedEra era, ShelleyBasedEra era') =>
BlockQuery (ShelleyBlock proto era) 'QFTraverseTables result
-> TxOut (LedgerState (ShelleyBlock proto' era')) -> Bool
shelleyQFTraverseTablesPredicate BlockQuery (ShelleyBlock proto era) 'QFTraverseTables result
q = case BlockQuery (ShelleyBlock proto era) 'QFTraverseTables result
q of
  GetUTxOByAddress Set Addr
addr -> Set Addr -> TxOut era' -> Bool
filterGetUTxOByAddressOne Set Addr
addr
  BlockQuery (ShelleyBlock proto era) 'QFTraverseTables result
R:BlockQueryShelleyBlockfpresult proto era 'QFTraverseTables result
GetUTxOWhole -> Bool -> TxOut era' -> Bool
forall a b. a -> b -> a
const Bool
True
  GetCBOR BlockQuery (ShelleyBlock proto era) 'QFTraverseTables result
q' -> BlockQuery (ShelleyBlock proto era) 'QFTraverseTables result
-> TxOut (LedgerState (ShelleyBlock (ZonkAny 0) era')) -> Bool
forall proto era proto' era' result.
(ShelleyBasedEra era, ShelleyBasedEra era') =>
BlockQuery (ShelleyBlock proto era) 'QFTraverseTables result
-> TxOut (LedgerState (ShelleyBlock proto' era')) -> Bool
shelleyQFTraverseTablesPredicate BlockQuery (ShelleyBlock proto era) 'QFTraverseTables result
q'
 where
  filterGetUTxOByAddressOne ::
    Set Addr ->
    LC.TxOut era' ->
    Bool
  filterGetUTxOByAddressOne :: Set Addr -> TxOut era' -> Bool
filterGetUTxOByAddressOne Set Addr
addrs =
    let
      compactAddrSet :: Set CompactAddr
compactAddrSet = (Addr -> CompactAddr) -> Set Addr -> Set CompactAddr
forall b a. Ord b => (a -> b) -> Set a -> Set b
Set.map Addr -> CompactAddr
compactAddr Set Addr
addrs
      checkAddr :: TxOut era' -> Bool
checkAddr TxOut era'
out =
        case TxOut era'
out TxOut era'
-> Getting
     (Either Addr CompactAddr) (TxOut era') (Either Addr CompactAddr)
-> Either Addr CompactAddr
forall s a. s -> Getting a s a -> a
^. Getting
  (Either Addr CompactAddr) (TxOut era') (Either Addr CompactAddr)
forall era.
EraTxOut era =>
Lens' (TxOut era) (Either Addr CompactAddr)
Lens' (TxOut era') (Either Addr CompactAddr)
SL.addrEitherTxOutL of
          Left Addr
addr -> Addr
addr Addr -> Set Addr -> Bool
forall a. Ord a => a -> Set a -> Bool
`Set.member` Set Addr
addrs
          Right CompactAddr
cAddr -> CompactAddr
cAddr CompactAddr -> Set CompactAddr -> Bool
forall a. Ord a => a -> Set a -> Bool
`Set.member` Set CompactAddr
compactAddrSet
     in
      TxOut era' -> Bool
checkAddr

answerShelleyTraversingQueries ::
  forall proto era m result blk.
  ( ShelleyCompatible proto era
  , Ord (TxIn (LedgerState blk))
  , Eq (TxOut (LedgerState blk))
  , MemPack (TxIn (LedgerState blk))
  , IndexedMemPack (LedgerState blk EmptyMK) (TxOut (LedgerState blk))
  ) =>
  Monad m =>
  -- | Eject TxOut
  (TxOut (LedgerState blk) -> LC.TxOut era) ->
  -- | Eject TxIn
  (TxIn (LedgerState blk) -> SL.TxIn) ->
  -- | Get filter by query
  ( forall result'.
    BlockQuery (ShelleyBlock proto era) QFTraverseTables result' ->
    TxOut (LedgerState blk) ->
    Bool
  ) ->
  ExtLedgerCfg (ShelleyBlock proto era) ->
  BlockQuery (ShelleyBlock proto era) QFTraverseTables result ->
  ReadOnlyForker' m blk ->
  m result
answerShelleyTraversingQueries :: forall proto era (m :: * -> *) result blk.
(ShelleyCompatible proto era, Ord (TxIn (LedgerState blk)),
 Eq (TxOut (LedgerState blk)), MemPack (TxIn (LedgerState blk)),
 IndexedMemPack (LedgerState blk EmptyMK) (TxOut (LedgerState blk)),
 Monad m) =>
(TxOut (LedgerState blk) -> TxOut era)
-> (TxIn (LedgerState blk) -> TxIn)
-> (forall result'.
    BlockQuery (ShelleyBlock proto era) 'QFTraverseTables result'
    -> TxOut (LedgerState blk) -> Bool)
-> ExtLedgerCfg (ShelleyBlock proto era)
-> BlockQuery (ShelleyBlock proto era) 'QFTraverseTables result
-> ReadOnlyForker' m blk
-> m result
answerShelleyTraversingQueries TxOut (LedgerState blk) -> TxOut era
ejTxOut TxIn (LedgerState blk) -> TxIn
ejTxIn forall result'.
BlockQuery (ShelleyBlock proto era) 'QFTraverseTables result'
-> TxOut (LedgerState blk) -> Bool
filt ExtLedgerCfg (ShelleyBlock proto era)
cfg BlockQuery (ShelleyBlock proto era) 'QFTraverseTables result
q ReadOnlyForker' m blk
forker = case BlockQuery (ShelleyBlock proto era) 'QFTraverseTables result
q of
  GetUTxOByAddress{} -> (TxOut (LedgerState blk) -> Bool)
-> RangeQueryPrevious (ExtLedgerState blk)
-> UTxO era
-> m (UTxO era)
loop (BlockQuery (ShelleyBlock proto era) 'QFTraverseTables result
-> TxOut (LedgerState blk) -> Bool
forall result'.
BlockQuery (ShelleyBlock proto era) 'QFTraverseTables result'
-> TxOut (LedgerState blk) -> Bool
filt BlockQuery (ShelleyBlock proto era) 'QFTraverseTables result
q) RangeQueryPrevious (ExtLedgerState blk)
forall (l :: LedgerStateKind). RangeQueryPrevious l
NoPreviousQuery UTxO era
forall {era}. UTxO era
emptyUtxo
  BlockQuery (ShelleyBlock proto era) 'QFTraverseTables result
R:BlockQueryShelleyBlockfpresult proto era 'QFTraverseTables result
GetUTxOWhole -> (TxOut (LedgerState blk) -> Bool)
-> RangeQueryPrevious (ExtLedgerState blk)
-> UTxO era
-> m (UTxO era)
loop (BlockQuery (ShelleyBlock proto era) 'QFTraverseTables result
-> TxOut (LedgerState blk) -> Bool
forall result'.
BlockQuery (ShelleyBlock proto era) 'QFTraverseTables result'
-> TxOut (LedgerState blk) -> Bool
filt BlockQuery (ShelleyBlock proto era) 'QFTraverseTables result
q) RangeQueryPrevious (ExtLedgerState blk)
forall (l :: LedgerStateKind). RangeQueryPrevious l
NoPreviousQuery UTxO era
forall {era}. UTxO era
emptyUtxo
  GetCBOR BlockQuery (ShelleyBlock proto era) 'QFTraverseTables result
q' ->
    -- We encode using the latest (@maxBound@) ShelleyNodeToClientVersion,
    -- as the @GetCBOR@ query already is about opportunistically assuming
    -- both client and server are running the same version; cf. the
    -- @GetCBOR@ Haddocks.
    (result -> Encoding) -> result -> Serialised result
forall a. (a -> Encoding) -> a -> Serialised a
mkSerialised (ShelleyNodeToClientVersion
-> BlockQuery (ShelleyBlock proto era) 'QFTraverseTables result
-> result
-> Encoding
forall proto era (fp :: QueryFootprint) result.
ShelleyCompatible proto era =>
ShelleyNodeToClientVersion
-> BlockQuery (ShelleyBlock proto era) fp result
-> result
-> Encoding
encodeShelleyResult ShelleyNodeToClientVersion
forall a. Bounded a => a
maxBound BlockQuery (ShelleyBlock proto era) 'QFTraverseTables result
q')
      (result -> result) -> m result -> m result
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (TxOut (LedgerState blk) -> TxOut era)
-> (TxIn (LedgerState blk) -> TxIn)
-> (forall result'.
    BlockQuery (ShelleyBlock proto era) 'QFTraverseTables result'
    -> TxOut (LedgerState blk) -> Bool)
-> ExtLedgerCfg (ShelleyBlock proto era)
-> BlockQuery (ShelleyBlock proto era) 'QFTraverseTables result
-> ReadOnlyForker' m blk
-> m result
forall proto era (m :: * -> *) result blk.
(ShelleyCompatible proto era, Ord (TxIn (LedgerState blk)),
 Eq (TxOut (LedgerState blk)), MemPack (TxIn (LedgerState blk)),
 IndexedMemPack (LedgerState blk EmptyMK) (TxOut (LedgerState blk)),
 Monad m) =>
(TxOut (LedgerState blk) -> TxOut era)
-> (TxIn (LedgerState blk) -> TxIn)
-> (forall result'.
    BlockQuery (ShelleyBlock proto era) 'QFTraverseTables result'
    -> TxOut (LedgerState blk) -> Bool)
-> ExtLedgerCfg (ShelleyBlock proto era)
-> BlockQuery (ShelleyBlock proto era) 'QFTraverseTables result
-> ReadOnlyForker' m blk
-> m result
answerShelleyTraversingQueries TxOut (LedgerState blk) -> TxOut era
ejTxOut TxIn (LedgerState blk) -> TxIn
ejTxIn BlockQuery (ShelleyBlock proto era) 'QFTraverseTables result'
-> TxOut (LedgerState blk) -> Bool
forall result'.
BlockQuery (ShelleyBlock proto era) 'QFTraverseTables result'
-> TxOut (LedgerState blk) -> Bool
filt ExtLedgerCfg (ShelleyBlock proto era)
cfg BlockQuery (ShelleyBlock proto era) 'QFTraverseTables result
q' ReadOnlyForker' m blk
forker
 where
  emptyUtxo :: UTxO era
emptyUtxo = Map TxIn (TxOut era) -> UTxO era
forall era. Map TxIn (TxOut era) -> UTxO era
SL.UTxO Map TxIn (TxOut era)
forall k a. Map k a
Map.empty

  combUtxo :: UTxO era -> Map TxIn (TxOut era) -> UTxO era
combUtxo (SL.UTxO Map TxIn (TxOut era)
l) Map TxIn (TxOut era)
vs = Map TxIn (TxOut era) -> UTxO era
forall era. Map TxIn (TxOut era) -> UTxO era
SL.UTxO (Map TxIn (TxOut era) -> UTxO era)
-> Map TxIn (TxOut era) -> UTxO era
forall a b. (a -> b) -> a -> b
$ Map TxIn (TxOut era)
-> Map TxIn (TxOut era) -> Map TxIn (TxOut era)
forall k a. Ord k => Map k a -> Map k a -> Map k a
Map.union Map TxIn (TxOut era)
l Map TxIn (TxOut era)
vs

  partial ::
    (TxOut (LedgerState blk) -> Bool) ->
    LedgerTables (ExtLedgerState blk) ValuesMK ->
    Map SL.TxIn (LC.TxOut era)
  partial :: (TxOut (LedgerState blk) -> Bool)
-> LedgerTables (ExtLedgerState blk) ValuesMK
-> Map TxIn (TxOut era)
partial TxOut (LedgerState blk) -> Bool
queryPredicate (LedgerTables (ValuesMK Map (TxIn (ExtLedgerState blk)) (TxOut (ExtLedgerState blk))
vs)) =
    (TxIn (LedgerState blk) -> TxIn)
-> Map (TxIn (LedgerState blk)) (TxOut era) -> Map TxIn (TxOut era)
forall k2 k1 a. Ord k2 => (k1 -> k2) -> Map k1 a -> Map k2 a
Map.mapKeys TxIn (LedgerState blk) -> TxIn
ejTxIn (Map (TxIn (LedgerState blk)) (TxOut era) -> Map TxIn (TxOut era))
-> Map (TxIn (LedgerState blk)) (TxOut era) -> Map TxIn (TxOut era)
forall a b. (a -> b) -> a -> b
$
      (TxIn (LedgerState blk)
 -> TxOut (LedgerState blk) -> Maybe (TxOut era))
-> Map (TxIn (LedgerState blk)) (TxOut (LedgerState blk))
-> Map (TxIn (LedgerState blk)) (TxOut era)
forall k a b. (k -> a -> Maybe b) -> Map k a -> Map k b
Map.mapMaybeWithKey
        ( \TxIn (LedgerState blk)
_k TxOut (LedgerState blk)
v ->
            if TxOut (LedgerState blk) -> Bool
queryPredicate TxOut (LedgerState blk)
v
              then TxOut era -> Maybe (TxOut era)
forall a. a -> Maybe a
Just (TxOut era -> Maybe (TxOut era)) -> TxOut era -> Maybe (TxOut era)
forall a b. (a -> b) -> a -> b
$ TxOut (LedgerState blk) -> TxOut era
ejTxOut TxOut (LedgerState blk)
v
              else Maybe (TxOut era)
forall a. Maybe a
Nothing
        )
        Map (TxIn (LedgerState blk)) (TxOut (LedgerState blk))
Map (TxIn (ExtLedgerState blk)) (TxOut (ExtLedgerState blk))
vs

  loop :: (TxOut (LedgerState blk) -> Bool)
-> RangeQueryPrevious (ExtLedgerState blk)
-> UTxO era
-> m (UTxO era)
loop TxOut (LedgerState blk) -> Bool
queryPredicate !RangeQueryPrevious (ExtLedgerState blk)
prev !UTxO era
acc = do
    (extValues, k) <- ReadOnlyForker' m blk
-> RangeQueryPrevious (ExtLedgerState blk)
-> m (LedgerTables (ExtLedgerState blk) ValuesMK,
      Maybe (TxIn (ExtLedgerState blk)))
forall (m :: * -> *) (l :: LedgerStateKind).
ReadOnlyForker m l
-> RangeQueryPrevious l
-> m (LedgerTables l ValuesMK, Maybe (TxIn l))
LedgerDB.roforkerRangeReadTables ReadOnlyForker' m blk
forker RangeQueryPrevious (ExtLedgerState blk)
prev
    case k of
      Maybe (TxIn (LedgerState blk))
Nothing -> UTxO era -> m (UTxO era)
forall a. a -> m a
forall (f :: * -> *) a. Applicative f => a -> f a
pure UTxO era
acc
      Just TxIn (LedgerState blk)
k' ->
        (TxOut (LedgerState blk) -> Bool)
-> RangeQueryPrevious (ExtLedgerState blk)
-> UTxO era
-> m (UTxO era)
loop
          TxOut (LedgerState blk) -> Bool
queryPredicate
          (TxIn (ExtLedgerState blk)
-> RangeQueryPrevious (ExtLedgerState blk)
forall (l :: LedgerStateKind). TxIn l -> RangeQueryPrevious l
PreviousQueryWasUpTo TxIn (LedgerState blk)
TxIn (ExtLedgerState blk)
k')
          (UTxO era -> Map TxIn (TxOut era) -> UTxO era
forall {era}. UTxO era -> Map TxIn (TxOut era) -> UTxO era
combUtxo UTxO era
acc (Map TxIn (TxOut era) -> UTxO era)
-> Map TxIn (TxOut era) -> UTxO era
forall a b. (a -> b) -> a -> b
$ (TxOut (LedgerState blk) -> Bool)
-> LedgerTables (ExtLedgerState blk) ValuesMK
-> Map TxIn (TxOut era)
partial TxOut (LedgerState blk) -> Bool
queryPredicate LedgerTables (ExtLedgerState blk) ValuesMK
extValues)