-- | Cardano Mempool endpoints

{-# OPTIONS_HADDOCK hide #-}

module Blockfrost.API.Cardano.Mempool
  where

import Servant.API
import Servant.API.Generic

import Blockfrost.Types
import Blockfrost.Util.Pagination
import Blockfrost.Util.Sorting

data MempoolAPI route =
  MempoolAPI
    {
      forall route.
MempoolAPI route
-> route
   :- (Summary "Transactions in Mempool."
       :> (Description
             "Tx hash list of all transactions that are currently stored in the mempool."
           :> (Pagination :> (Sorting :> Get '[JSON] [TxHashObject]))))
_mempoolTransactions
        :: route
        :- Summary "Transactions in Mempool."
        :> Description "Tx hash list of all transactions that are currently stored in the mempool."
        :> Pagination
        :> Sorting
        :> Get '[JSON] [TxHashObject]
    , forall route.
MempoolAPI route
-> route
   :- (Summary "Transaction in mempoool."
       :> (Description "Content of a specific transaction in the mempool."
           :> (Capture "hash" TxHash :> Get '[JSON] MempoolTransaction)))
_specificTransaction
        :: route
        :- Summary "Transaction in mempoool."
        :> Description "Content of a specific transaction in the mempool."
        :> Capture "hash" TxHash
        :> Get '[JSON] MempoolTransaction
    , forall route.
MempoolAPI route
-> route
   :- (Summary "Transactions involving an address in mempool."
       :> (Description
             "List of transactions in the mempool that involves a specific address."
           :> ("addresses"
               :> (Capture "address" Address
                   :> (Pagination :> (Sorting :> Get '[JSON] [TxHashObject]))))))
_specificAddress
        :: route
        :- Summary "Transactions involving an address in mempool."
        :> Description "List of transactions in the mempool that involves a specific address."
        :> "addresses"
        :> Capture "address" Address
        :> Pagination
        :> Sorting
        :> Get '[JSON] [TxHashObject]
    } deriving ((forall x. MempoolAPI route -> Rep (MempoolAPI route) x)
-> (forall x. Rep (MempoolAPI route) x -> MempoolAPI route)
-> Generic (MempoolAPI route)
forall x. Rep (MempoolAPI route) x -> MempoolAPI route
forall x. MempoolAPI route -> Rep (MempoolAPI route) x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall route x. Rep (MempoolAPI route) x -> MempoolAPI route
forall route x. MempoolAPI route -> Rep (MempoolAPI route) x
$cfrom :: forall route x. MempoolAPI route -> Rep (MempoolAPI route) x
from :: forall x. MempoolAPI route -> Rep (MempoolAPI route) x
$cto :: forall route x. Rep (MempoolAPI route) x -> MempoolAPI route
to :: forall x. Rep (MempoolAPI route) x -> MempoolAPI route
Generic)