-- | Epoch queries

module Blockfrost.Client.Cardano.Epochs
  ( getLatestEpoch
  , getLatestEpochProtocolParams
  , getEpoch
  , getNextEpochs
  , getNextEpochs'
  , getPreviousEpochs
  , getPreviousEpochs'
  , getEpochStake
  , getEpochStake'
  , getEpochStakeByPool
  , getEpochStakeByPool'
  , getEpochBlocks
  , getEpochBlocks'
  , getEpochBlocksByPool
  , getEpochBlocksByPool'
  , getEpochProtocolParams
  ) where

import Blockfrost.API
import Blockfrost.Client.Types
import Blockfrost.Types


epochsClient :: MonadBlockfrost m => Project -> EpochsAPI (AsClientT m)
epochsClient :: Project -> EpochsAPI (AsClientT m)
epochsClient = (((m EpochInfo :<|> m ProtocolParams)
  :<|> ((Epoch -> m EpochInfo)
        :<|> ((Epoch -> Paged -> m [EpochInfo])
              :<|> (Epoch -> Paged -> m [EpochInfo]))))
 :<|> (((Epoch -> Paged -> m [StakeDistribution])
        :<|> (Epoch -> PoolId -> Paged -> m [PoolStakeDistribution]))
       :<|> ((Epoch -> Paged -> SortOrder -> m [BlockHash])
             :<|> ((Epoch -> PoolId -> Paged -> SortOrder -> m [BlockHash])
                   :<|> (Epoch -> m ProtocolParams)))))
-> EpochsAPI (AsClientT m)
forall (routes :: * -> *) mode.
GenericServant routes mode =>
ToServant routes mode -> routes mode
fromServant ((((m EpochInfo :<|> m ProtocolParams)
   :<|> ((Epoch -> m EpochInfo)
         :<|> ((Epoch -> Paged -> m [EpochInfo])
               :<|> (Epoch -> Paged -> m [EpochInfo]))))
  :<|> (((Epoch -> Paged -> m [StakeDistribution])
         :<|> (Epoch -> PoolId -> Paged -> m [PoolStakeDistribution]))
        :<|> ((Epoch -> Paged -> SortOrder -> m [BlockHash])
              :<|> ((Epoch -> PoolId -> Paged -> SortOrder -> m [BlockHash])
                    :<|> (Epoch -> m ProtocolParams)))))
 -> EpochsAPI (AsClientT m))
-> (Project
    -> ((m EpochInfo :<|> m ProtocolParams)
        :<|> ((Epoch -> m EpochInfo)
              :<|> ((Epoch -> Paged -> m [EpochInfo])
                    :<|> (Epoch -> Paged -> m [EpochInfo]))))
       :<|> (((Epoch -> Paged -> m [StakeDistribution])
              :<|> (Epoch -> PoolId -> Paged -> m [PoolStakeDistribution]))
             :<|> ((Epoch -> Paged -> SortOrder -> m [BlockHash])
                   :<|> ((Epoch -> PoolId -> Paged -> SortOrder -> m [BlockHash])
                         :<|> (Epoch -> m ProtocolParams)))))
-> Project
-> EpochsAPI (AsClientT m)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. CardanoAPI (AsClientT m)
-> ((m EpochInfo :<|> m ProtocolParams)
    :<|> ((Epoch -> m EpochInfo)
          :<|> ((Epoch -> Paged -> m [EpochInfo])
                :<|> (Epoch -> Paged -> m [EpochInfo]))))
   :<|> (((Epoch -> Paged -> m [StakeDistribution])
          :<|> (Epoch -> PoolId -> Paged -> m [PoolStakeDistribution]))
         :<|> ((Epoch -> Paged -> SortOrder -> m [BlockHash])
               :<|> ((Epoch -> PoolId -> Paged -> SortOrder -> m [BlockHash])
                     :<|> (Epoch -> m ProtocolParams))))
forall route.
CardanoAPI route
-> route
   :- ("epochs"
       :> (Tag "Cardano \187 Epochs" :> ToServantApi EpochsAPI))
_epochs (CardanoAPI (AsClientT m)
 -> ((m EpochInfo :<|> m ProtocolParams)
     :<|> ((Epoch -> m EpochInfo)
           :<|> ((Epoch -> Paged -> m [EpochInfo])
                 :<|> (Epoch -> Paged -> m [EpochInfo]))))
    :<|> (((Epoch -> Paged -> m [StakeDistribution])
           :<|> (Epoch -> PoolId -> Paged -> m [PoolStakeDistribution]))
          :<|> ((Epoch -> Paged -> SortOrder -> m [BlockHash])
                :<|> ((Epoch -> PoolId -> Paged -> SortOrder -> m [BlockHash])
                      :<|> (Epoch -> m ProtocolParams)))))
-> (Project -> CardanoAPI (AsClientT m))
-> Project
-> ((m EpochInfo :<|> m ProtocolParams)
    :<|> ((Epoch -> m EpochInfo)
          :<|> ((Epoch -> Paged -> m [EpochInfo])
                :<|> (Epoch -> Paged -> m [EpochInfo]))))
   :<|> (((Epoch -> Paged -> m [StakeDistribution])
          :<|> (Epoch -> PoolId -> Paged -> m [PoolStakeDistribution]))
         :<|> ((Epoch -> Paged -> SortOrder -> m [BlockHash])
               :<|> ((Epoch -> PoolId -> Paged -> SortOrder -> m [BlockHash])
                     :<|> (Epoch -> m ProtocolParams))))
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Project -> CardanoAPI (AsClientT m)
forall (m :: * -> *).
MonadBlockfrost m =>
Project -> CardanoAPI (AsClientT m)
cardanoClient

getLatestEpoch_ :: MonadBlockfrost m => Project -> m EpochInfo
getLatestEpoch_ :: Project -> m EpochInfo
getLatestEpoch_ = EpochsAPI (AsClientT m) -> m EpochInfo
forall route.
EpochsAPI route
-> route
   :- (Summary "Latest epoch"
       :> (Description
             "Return the information about the latest, therefore current, epoch."
           :> ("latest" :> Get '[JSON] EpochInfo)))
_latestEpoch (EpochsAPI (AsClientT m) -> m EpochInfo)
-> (Project -> EpochsAPI (AsClientT m)) -> Project -> m EpochInfo
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Project -> EpochsAPI (AsClientT m)
forall (m :: * -> *).
MonadBlockfrost m =>
Project -> EpochsAPI (AsClientT m)
epochsClient

-- | Get the information about the latest, therefore current, epoch.
getLatestEpoch :: MonadBlockfrost m => m EpochInfo
getLatestEpoch :: m EpochInfo
getLatestEpoch = (Project -> m EpochInfo) -> m EpochInfo
forall (m :: * -> *) a.
MonadBlockfrost m =>
(Project -> m a) -> m a
go Project -> m EpochInfo
forall (m :: * -> *). MonadBlockfrost m => Project -> m EpochInfo
getLatestEpoch_

getLatestEpochProtocolParams_ :: MonadBlockfrost m => Project -> m ProtocolParams
getLatestEpochProtocolParams_ :: Project -> m ProtocolParams
getLatestEpochProtocolParams_ = EpochsAPI (AsClientT m) -> m ProtocolParams
forall route.
EpochsAPI route
-> route
   :- (Summary "Latest epoch protocol parameters"
       :> (Description
             "Return the protocol parameters for the latest epoch."
           :> ("latest" :> ("parameters" :> Get '[JSON] ProtocolParams))))
_latestEpochProtocolParams (EpochsAPI (AsClientT m) -> m ProtocolParams)
-> (Project -> EpochsAPI (AsClientT m))
-> Project
-> m ProtocolParams
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Project -> EpochsAPI (AsClientT m)
forall (m :: * -> *).
MonadBlockfrost m =>
Project -> EpochsAPI (AsClientT m)
epochsClient

-- | Get the protocol parameters for the latest epoch.
getLatestEpochProtocolParams :: MonadBlockfrost m => m ProtocolParams
getLatestEpochProtocolParams :: m ProtocolParams
getLatestEpochProtocolParams = (Project -> m ProtocolParams) -> m ProtocolParams
forall (m :: * -> *) a.
MonadBlockfrost m =>
(Project -> m a) -> m a
go Project -> m ProtocolParams
forall (m :: * -> *).
MonadBlockfrost m =>
Project -> m ProtocolParams
getLatestEpochProtocolParams_

getEpoch_ :: MonadBlockfrost m => Project -> Epoch -> m EpochInfo
getEpoch_ :: Project -> Epoch -> m EpochInfo
getEpoch_ = EpochsAPI (AsClientT m) -> Epoch -> m EpochInfo
forall route.
EpochsAPI route
-> route
   :- (Summary "Specific epoch"
       :> (Description "Return the content of the requested epoch."
           :> (Capture "epoch_number" Epoch :> Get '[JSON] EpochInfo)))
_getEpoch (EpochsAPI (AsClientT m) -> Epoch -> m EpochInfo)
-> (Project -> EpochsAPI (AsClientT m))
-> Project
-> Epoch
-> m EpochInfo
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Project -> EpochsAPI (AsClientT m)
forall (m :: * -> *).
MonadBlockfrost m =>
Project -> EpochsAPI (AsClientT m)
epochsClient

-- | Get the information about specific epoch.
getEpoch :: MonadBlockfrost m => Epoch -> m EpochInfo
getEpoch :: Epoch -> m EpochInfo
getEpoch Epoch
e = (Project -> m EpochInfo) -> m EpochInfo
forall (m :: * -> *) a.
MonadBlockfrost m =>
(Project -> m a) -> m a
go (Project -> Epoch -> m EpochInfo
forall (m :: * -> *).
MonadBlockfrost m =>
Project -> Epoch -> m EpochInfo
`getEpoch_` Epoch
e)

getNextEpochs_ :: MonadBlockfrost m => Project -> Epoch -> Paged -> m [EpochInfo]
getNextEpochs_ :: Project -> Epoch -> Paged -> m [EpochInfo]
getNextEpochs_ = EpochsAPI (AsClientT m) -> Epoch -> Paged -> m [EpochInfo]
forall route.
EpochsAPI route
-> route
   :- (Summary "List of next epochs"
       :> (Description
             "Return the list of epochs following a specific epoch."
           :> (Capture "epoch_number" Epoch
               :> ("next" :> (Pagination :> Get '[JSON] [EpochInfo])))))
_getNextEpochs (EpochsAPI (AsClientT m) -> Epoch -> Paged -> m [EpochInfo])
-> (Project -> EpochsAPI (AsClientT m))
-> Project
-> Epoch
-> Paged
-> m [EpochInfo]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Project -> EpochsAPI (AsClientT m)
forall (m :: * -> *).
MonadBlockfrost m =>
Project -> EpochsAPI (AsClientT m)
epochsClient

-- | Return the list of epochs following a specific epoch.
-- Allows custom paging using @Paged@.
getNextEpochs' :: MonadBlockfrost m => Epoch -> Paged -> m [EpochInfo]
getNextEpochs' :: Epoch -> Paged -> m [EpochInfo]
getNextEpochs' Epoch
e Paged
pg = (Project -> m [EpochInfo]) -> m [EpochInfo]
forall (m :: * -> *) a.
MonadBlockfrost m =>
(Project -> m a) -> m a
go (\Project
p -> Project -> Epoch -> Paged -> m [EpochInfo]
forall (m :: * -> *).
MonadBlockfrost m =>
Project -> Epoch -> Paged -> m [EpochInfo]
getNextEpochs_ Project
p Epoch
e Paged
pg)

-- | Return the list of epochs following a specific epoch.
getNextEpochs :: MonadBlockfrost m => Epoch -> m [EpochInfo]
getNextEpochs :: Epoch -> m [EpochInfo]
getNextEpochs Epoch
e = Epoch -> Paged -> m [EpochInfo]
forall (m :: * -> *).
MonadBlockfrost m =>
Epoch -> Paged -> m [EpochInfo]
getNextEpochs' Epoch
e Paged
forall a. Default a => a
def

getPreviousEpochs_ :: MonadBlockfrost m => Project -> Epoch -> Paged -> m [EpochInfo]
getPreviousEpochs_ :: Project -> Epoch -> Paged -> m [EpochInfo]
getPreviousEpochs_ = EpochsAPI (AsClientT m) -> Epoch -> Paged -> m [EpochInfo]
forall route.
EpochsAPI route
-> route
   :- (Summary "List of previous epochs"
       :> (Description
             "Return the list of epochs preceding a specific epoch."
           :> (Capture "epoch_number" Epoch
               :> ("previous" :> (Pagination :> Get '[JSON] [EpochInfo])))))
_getPreviousEpochs (EpochsAPI (AsClientT m) -> Epoch -> Paged -> m [EpochInfo])
-> (Project -> EpochsAPI (AsClientT m))
-> Project
-> Epoch
-> Paged
-> m [EpochInfo]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Project -> EpochsAPI (AsClientT m)
forall (m :: * -> *).
MonadBlockfrost m =>
Project -> EpochsAPI (AsClientT m)
epochsClient

-- | Return the list of epochs preceding a specific epoch.
-- Allows custom paging using @Paged@.
getPreviousEpochs' :: MonadBlockfrost m => Epoch -> Paged -> m [EpochInfo]
getPreviousEpochs' :: Epoch -> Paged -> m [EpochInfo]
getPreviousEpochs' Epoch
e Paged
pg = (Project -> m [EpochInfo]) -> m [EpochInfo]
forall (m :: * -> *) a.
MonadBlockfrost m =>
(Project -> m a) -> m a
go (\Project
p -> Project -> Epoch -> Paged -> m [EpochInfo]
forall (m :: * -> *).
MonadBlockfrost m =>
Project -> Epoch -> Paged -> m [EpochInfo]
getPreviousEpochs_ Project
p Epoch
e Paged
pg)

-- | Return the list of epochs preceding a specific epoch.
getPreviousEpochs :: MonadBlockfrost m => Epoch -> m [EpochInfo]
getPreviousEpochs :: Epoch -> m [EpochInfo]
getPreviousEpochs Epoch
e = Epoch -> Paged -> m [EpochInfo]
forall (m :: * -> *).
MonadBlockfrost m =>
Epoch -> Paged -> m [EpochInfo]
getPreviousEpochs' Epoch
e Paged
forall a. Default a => a
def

getEpochStake_ :: MonadBlockfrost m => Project -> Epoch -> Paged -> m [StakeDistribution]
getEpochStake_ :: Project -> Epoch -> Paged -> m [StakeDistribution]
getEpochStake_ = EpochsAPI (AsClientT m) -> Epoch -> Paged -> m [StakeDistribution]
forall route.
EpochsAPI route
-> route
   :- (Summary "Stake distribution"
       :> (Description
             "Return the active stake distribution for the specified epoch."
           :> (Capture "epoch_number" Epoch
               :> ("stakes" :> (Pagination :> Get '[JSON] [StakeDistribution])))))
_getEpochStake (EpochsAPI (AsClientT m)
 -> Epoch -> Paged -> m [StakeDistribution])
-> (Project -> EpochsAPI (AsClientT m))
-> Project
-> Epoch
-> Paged
-> m [StakeDistribution]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Project -> EpochsAPI (AsClientT m)
forall (m :: * -> *).
MonadBlockfrost m =>
Project -> EpochsAPI (AsClientT m)
epochsClient

-- | Return the active stake distribution for the specified epoch.
-- Allows custom paging using @Paged@.
getEpochStake' :: MonadBlockfrost m => Epoch -> Paged -> m [StakeDistribution]
getEpochStake' :: Epoch -> Paged -> m [StakeDistribution]
getEpochStake' Epoch
e Paged
pg = (Project -> m [StakeDistribution]) -> m [StakeDistribution]
forall (m :: * -> *) a.
MonadBlockfrost m =>
(Project -> m a) -> m a
go (\Project
p -> Project -> Epoch -> Paged -> m [StakeDistribution]
forall (m :: * -> *).
MonadBlockfrost m =>
Project -> Epoch -> Paged -> m [StakeDistribution]
getEpochStake_ Project
p Epoch
e Paged
pg)

-- | Return the active stake distribution for the specified epoch.
getEpochStake :: MonadBlockfrost m => Epoch -> m [StakeDistribution]
getEpochStake :: Epoch -> m [StakeDistribution]
getEpochStake Epoch
e = Epoch -> Paged -> m [StakeDistribution]
forall (m :: * -> *).
MonadBlockfrost m =>
Epoch -> Paged -> m [StakeDistribution]
getEpochStake' Epoch
e Paged
forall a. Default a => a
def

getEpochStakeByPool_ :: MonadBlockfrost m => Project -> Epoch -> PoolId -> Paged -> m [PoolStakeDistribution]
getEpochStakeByPool_ :: Project -> Epoch -> PoolId -> Paged -> m [PoolStakeDistribution]
getEpochStakeByPool_ = EpochsAPI (AsClientT m)
-> Epoch -> PoolId -> Paged -> m [PoolStakeDistribution]
forall route.
EpochsAPI route
-> route
   :- (Summary "Stake distribution by pool"
       :> (Description
             "Return the active stake distribution for the epoch specified by stake pool."
           :> (Capture "epoch_number" Epoch
               :> ("stakes"
                   :> (Capture "pool_id" PoolId
                       :> (Pagination :> Get '[JSON] [PoolStakeDistribution]))))))
_getEpochStakeByPool (EpochsAPI (AsClientT m)
 -> Epoch -> PoolId -> Paged -> m [PoolStakeDistribution])
-> (Project -> EpochsAPI (AsClientT m))
-> Project
-> Epoch
-> PoolId
-> Paged
-> m [PoolStakeDistribution]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Project -> EpochsAPI (AsClientT m)
forall (m :: * -> *).
MonadBlockfrost m =>
Project -> EpochsAPI (AsClientT m)
epochsClient

-- | Return the active stake distribution for the epoch specified by stake pool.
-- Allows custom paging using @Paged@.
getEpochStakeByPool' :: MonadBlockfrost m => Epoch -> PoolId -> Paged -> m [PoolStakeDistribution]
getEpochStakeByPool' :: Epoch -> PoolId -> Paged -> m [PoolStakeDistribution]
getEpochStakeByPool' Epoch
e PoolId
i Paged
pg = (Project -> m [PoolStakeDistribution]) -> m [PoolStakeDistribution]
forall (m :: * -> *) a.
MonadBlockfrost m =>
(Project -> m a) -> m a
go (\Project
p -> Project -> Epoch -> PoolId -> Paged -> m [PoolStakeDistribution]
forall (m :: * -> *).
MonadBlockfrost m =>
Project -> Epoch -> PoolId -> Paged -> m [PoolStakeDistribution]
getEpochStakeByPool_ Project
p Epoch
e PoolId
i Paged
pg)

-- | Return the active stake distribution for the epoch specified by stake pool.
getEpochStakeByPool :: MonadBlockfrost m => Epoch -> PoolId -> m [PoolStakeDistribution]
getEpochStakeByPool :: Epoch -> PoolId -> m [PoolStakeDistribution]
getEpochStakeByPool Epoch
e PoolId
i = Epoch -> PoolId -> Paged -> m [PoolStakeDistribution]
forall (m :: * -> *).
MonadBlockfrost m =>
Epoch -> PoolId -> Paged -> m [PoolStakeDistribution]
getEpochStakeByPool' Epoch
e PoolId
i Paged
forall a. Default a => a
def

getEpochBlocks_ :: MonadBlockfrost m => Project -> Epoch -> Paged -> SortOrder -> m [BlockHash]
getEpochBlocks_ :: Project -> Epoch -> Paged -> SortOrder -> m [BlockHash]
getEpochBlocks_ = EpochsAPI (AsClientT m)
-> Epoch -> Paged -> SortOrder -> m [BlockHash]
forall route.
EpochsAPI route
-> route
   :- (Summary "Block distribution"
       :> (Description "Return the blocks minted for the epoch specified."
           :> (Capture "epoch_number" Epoch
               :> ("blocks"
                   :> (Pagination :> (Sorting :> Get '[JSON] [BlockHash]))))))
_getEpochBlocks (EpochsAPI (AsClientT m)
 -> Epoch -> Paged -> SortOrder -> m [BlockHash])
-> (Project -> EpochsAPI (AsClientT m))
-> Project
-> Epoch
-> Paged
-> SortOrder
-> m [BlockHash]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Project -> EpochsAPI (AsClientT m)
forall (m :: * -> *).
MonadBlockfrost m =>
Project -> EpochsAPI (AsClientT m)
epochsClient

-- | Return the blocks minted for the epoch specified.
-- Allows custom paging and ordering using @Paged@ and @SortOrder@.
getEpochBlocks' :: MonadBlockfrost m => Epoch -> Paged -> SortOrder -> m [BlockHash]
getEpochBlocks' :: Epoch -> Paged -> SortOrder -> m [BlockHash]
getEpochBlocks' Epoch
e Paged
pg SortOrder
s = (Project -> m [BlockHash]) -> m [BlockHash]
forall (m :: * -> *) a.
MonadBlockfrost m =>
(Project -> m a) -> m a
go (\Project
p -> Project -> Epoch -> Paged -> SortOrder -> m [BlockHash]
forall (m :: * -> *).
MonadBlockfrost m =>
Project -> Epoch -> Paged -> SortOrder -> m [BlockHash]
getEpochBlocks_ Project
p Epoch
e Paged
pg SortOrder
s)

-- | Return the blocks minted for the epoch specified.
getEpochBlocks :: MonadBlockfrost m => Epoch -> m [BlockHash]
getEpochBlocks :: Epoch -> m [BlockHash]
getEpochBlocks Epoch
e = Epoch -> Paged -> SortOrder -> m [BlockHash]
forall (m :: * -> *).
MonadBlockfrost m =>
Epoch -> Paged -> SortOrder -> m [BlockHash]
getEpochBlocks' Epoch
e Paged
forall a. Default a => a
def SortOrder
forall a. Default a => a
def

getEpochBlocksByPool_ :: MonadBlockfrost m => Project -> Epoch -> PoolId -> Paged -> SortOrder -> m [BlockHash]
getEpochBlocksByPool_ :: Project -> Epoch -> PoolId -> Paged -> SortOrder -> m [BlockHash]
getEpochBlocksByPool_ = EpochsAPI (AsClientT m)
-> Epoch -> PoolId -> Paged -> SortOrder -> m [BlockHash]
forall route.
EpochsAPI route
-> route
   :- (Summary "Block distribution by pool"
       :> (Description
             "Return the block minted for the epoch specified by stake pool."
           :> (Capture "epoch_number" Epoch
               :> ("blocks"
                   :> (Capture "pool_id" PoolId
                       :> (Pagination :> (Sorting :> Get '[JSON] [BlockHash])))))))
_getEpochBlocksByPool (EpochsAPI (AsClientT m)
 -> Epoch -> PoolId -> Paged -> SortOrder -> m [BlockHash])
-> (Project -> EpochsAPI (AsClientT m))
-> Project
-> Epoch
-> PoolId
-> Paged
-> SortOrder
-> m [BlockHash]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Project -> EpochsAPI (AsClientT m)
forall (m :: * -> *).
MonadBlockfrost m =>
Project -> EpochsAPI (AsClientT m)
epochsClient

-- | Return the block minted for the epoch specified by stake pool.
-- Allows custom paging and ordering using @Paged@ and @SortOrder@.
getEpochBlocksByPool' :: MonadBlockfrost m => Epoch -> PoolId -> Paged -> SortOrder -> m [BlockHash]
getEpochBlocksByPool' :: Epoch -> PoolId -> Paged -> SortOrder -> m [BlockHash]
getEpochBlocksByPool' Epoch
e PoolId
i Paged
pg SortOrder
s = (Project -> m [BlockHash]) -> m [BlockHash]
forall (m :: * -> *) a.
MonadBlockfrost m =>
(Project -> m a) -> m a
go (\Project
p -> Project -> Epoch -> PoolId -> Paged -> SortOrder -> m [BlockHash]
forall (m :: * -> *).
MonadBlockfrost m =>
Project -> Epoch -> PoolId -> Paged -> SortOrder -> m [BlockHash]
getEpochBlocksByPool_ Project
p Epoch
e PoolId
i Paged
pg SortOrder
s)

-- | Return the block minted for the epoch specified by stake pool.
getEpochBlocksByPool :: MonadBlockfrost m => Epoch -> PoolId -> m [BlockHash]
getEpochBlocksByPool :: Epoch -> PoolId -> m [BlockHash]
getEpochBlocksByPool Epoch
e PoolId
i = Epoch -> PoolId -> Paged -> SortOrder -> m [BlockHash]
forall (m :: * -> *).
MonadBlockfrost m =>
Epoch -> PoolId -> Paged -> SortOrder -> m [BlockHash]
getEpochBlocksByPool' Epoch
e PoolId
i Paged
forall a. Default a => a
def SortOrder
forall a. Default a => a
def

getEpochProtocolParams_ :: MonadBlockfrost m => Project -> Epoch -> m ProtocolParams
getEpochProtocolParams_ :: Project -> Epoch -> m ProtocolParams
getEpochProtocolParams_ = EpochsAPI (AsClientT m) -> Epoch -> m ProtocolParams
forall route.
EpochsAPI route
-> route
   :- (Summary "Protocol parameters"
       :> (Description
             "Return the protocol parameters for the specified epoch."
           :> (Capture "epoch_number" Epoch
               :> ("parameters" :> Get '[JSON] ProtocolParams))))
_getEpochProtocolParams (EpochsAPI (AsClientT m) -> Epoch -> m ProtocolParams)
-> (Project -> EpochsAPI (AsClientT m))
-> Project
-> Epoch
-> m ProtocolParams
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Project -> EpochsAPI (AsClientT m)
forall (m :: * -> *).
MonadBlockfrost m =>
Project -> EpochsAPI (AsClientT m)
epochsClient

-- | Return the protocol parameters for the specified epoch.
getEpochProtocolParams :: MonadBlockfrost m => Epoch -> m ProtocolParams
getEpochProtocolParams :: Epoch -> m ProtocolParams
getEpochProtocolParams Epoch
e = (Project -> m ProtocolParams) -> m ProtocolParams
forall (m :: * -> *) a.
MonadBlockfrost m =>
(Project -> m a) -> m a
go (Project -> Epoch -> m ProtocolParams
forall (m :: * -> *).
MonadBlockfrost m =>
Project -> Epoch -> m ProtocolParams
`getEpochProtocolParams_` Epoch
e)