-- | Client Types
{-# LANGUAGE CPP #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}

module Blockfrost.Client.Types
  ( BlockfrostClient
  , BlockfrostError (..)
  , ClientConfig
  , runBlockfrost
  , apiClient
  , api0Client
  , commonClient
  , cardanoClient
  , ipfsClient
  , nutLinkClient
  , Project (..)
  , Paged (..)
  , SortOrder (..)
  , go
  , AsClientT
  , fromServant
  , tryError
  , def
  , BlockfrostClientT (..)
  , MonadBlockfrost (..)
  , runBlockfrostClientT
  , newClientConfig
  ) where

import Control.Monad.Except
import Control.Monad.Reader
import Data.Default

import Servant.API.Generic
import Servant.Client
import Servant.Client.Generic

import Blockfrost.API
import Blockfrost.Client.Core

type ClientConfig = (ClientEnv, Project)

newtype BlockfrostClientT m a = BlockfrostClientT {
  BlockfrostClientT m a
-> ExceptT BlockfrostError (ReaderT ClientConfig m) a
unBlockfrostClientT
    :: ExceptT BlockfrostError
        (ReaderT ClientConfig m) a
  } deriving
      ( a -> BlockfrostClientT m b -> BlockfrostClientT m a
(a -> b) -> BlockfrostClientT m a -> BlockfrostClientT m b
(forall a b.
 (a -> b) -> BlockfrostClientT m a -> BlockfrostClientT m b)
-> (forall a b.
    a -> BlockfrostClientT m b -> BlockfrostClientT m a)
-> Functor (BlockfrostClientT m)
forall a b. a -> BlockfrostClientT m b -> BlockfrostClientT m a
forall a b.
(a -> b) -> BlockfrostClientT m a -> BlockfrostClientT m b
forall (m :: * -> *) a b.
Functor m =>
a -> BlockfrostClientT m b -> BlockfrostClientT m a
forall (m :: * -> *) a b.
Functor m =>
(a -> b) -> BlockfrostClientT m a -> BlockfrostClientT m b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
<$ :: a -> BlockfrostClientT m b -> BlockfrostClientT m a
$c<$ :: forall (m :: * -> *) a b.
Functor m =>
a -> BlockfrostClientT m b -> BlockfrostClientT m a
fmap :: (a -> b) -> BlockfrostClientT m a -> BlockfrostClientT m b
$cfmap :: forall (m :: * -> *) a b.
Functor m =>
(a -> b) -> BlockfrostClientT m a -> BlockfrostClientT m b
Functor
      , Functor (BlockfrostClientT m)
a -> BlockfrostClientT m a
Functor (BlockfrostClientT m)
-> (forall a. a -> BlockfrostClientT m a)
-> (forall a b.
    BlockfrostClientT m (a -> b)
    -> BlockfrostClientT m a -> BlockfrostClientT m b)
-> (forall a b c.
    (a -> b -> c)
    -> BlockfrostClientT m a
    -> BlockfrostClientT m b
    -> BlockfrostClientT m c)
-> (forall a b.
    BlockfrostClientT m a
    -> BlockfrostClientT m b -> BlockfrostClientT m b)
-> (forall a b.
    BlockfrostClientT m a
    -> BlockfrostClientT m b -> BlockfrostClientT m a)
-> Applicative (BlockfrostClientT m)
BlockfrostClientT m a
-> BlockfrostClientT m b -> BlockfrostClientT m b
BlockfrostClientT m a
-> BlockfrostClientT m b -> BlockfrostClientT m a
BlockfrostClientT m (a -> b)
-> BlockfrostClientT m a -> BlockfrostClientT m b
(a -> b -> c)
-> BlockfrostClientT m a
-> BlockfrostClientT m b
-> BlockfrostClientT m c
forall a. a -> BlockfrostClientT m a
forall a b.
BlockfrostClientT m a
-> BlockfrostClientT m b -> BlockfrostClientT m a
forall a b.
BlockfrostClientT m a
-> BlockfrostClientT m b -> BlockfrostClientT m b
forall a b.
BlockfrostClientT m (a -> b)
-> BlockfrostClientT m a -> BlockfrostClientT m b
forall a b c.
(a -> b -> c)
-> BlockfrostClientT m a
-> BlockfrostClientT m b
-> BlockfrostClientT m c
forall (m :: * -> *). Monad m => Functor (BlockfrostClientT m)
forall (m :: * -> *) a. Monad m => a -> BlockfrostClientT m a
forall (m :: * -> *) a b.
Monad m =>
BlockfrostClientT m a
-> BlockfrostClientT m b -> BlockfrostClientT m a
forall (m :: * -> *) a b.
Monad m =>
BlockfrostClientT m a
-> BlockfrostClientT m b -> BlockfrostClientT m b
forall (m :: * -> *) a b.
Monad m =>
BlockfrostClientT m (a -> b)
-> BlockfrostClientT m a -> BlockfrostClientT m b
forall (m :: * -> *) a b c.
Monad m =>
(a -> b -> c)
-> BlockfrostClientT m a
-> BlockfrostClientT m b
-> BlockfrostClientT m c
forall (f :: * -> *).
Functor f
-> (forall a. a -> f a)
-> (forall a b. f (a -> b) -> f a -> f b)
-> (forall a b c. (a -> b -> c) -> f a -> f b -> f c)
-> (forall a b. f a -> f b -> f b)
-> (forall a b. f a -> f b -> f a)
-> Applicative f
<* :: BlockfrostClientT m a
-> BlockfrostClientT m b -> BlockfrostClientT m a
$c<* :: forall (m :: * -> *) a b.
Monad m =>
BlockfrostClientT m a
-> BlockfrostClientT m b -> BlockfrostClientT m a
*> :: BlockfrostClientT m a
-> BlockfrostClientT m b -> BlockfrostClientT m b
$c*> :: forall (m :: * -> *) a b.
Monad m =>
BlockfrostClientT m a
-> BlockfrostClientT m b -> BlockfrostClientT m b
liftA2 :: (a -> b -> c)
-> BlockfrostClientT m a
-> BlockfrostClientT m b
-> BlockfrostClientT m c
$cliftA2 :: forall (m :: * -> *) a b c.
Monad m =>
(a -> b -> c)
-> BlockfrostClientT m a
-> BlockfrostClientT m b
-> BlockfrostClientT m c
<*> :: BlockfrostClientT m (a -> b)
-> BlockfrostClientT m a -> BlockfrostClientT m b
$c<*> :: forall (m :: * -> *) a b.
Monad m =>
BlockfrostClientT m (a -> b)
-> BlockfrostClientT m a -> BlockfrostClientT m b
pure :: a -> BlockfrostClientT m a
$cpure :: forall (m :: * -> *) a. Monad m => a -> BlockfrostClientT m a
$cp1Applicative :: forall (m :: * -> *). Monad m => Functor (BlockfrostClientT m)
Applicative
      , Applicative (BlockfrostClientT m)
a -> BlockfrostClientT m a
Applicative (BlockfrostClientT m)
-> (forall a b.
    BlockfrostClientT m a
    -> (a -> BlockfrostClientT m b) -> BlockfrostClientT m b)
-> (forall a b.
    BlockfrostClientT m a
    -> BlockfrostClientT m b -> BlockfrostClientT m b)
-> (forall a. a -> BlockfrostClientT m a)
-> Monad (BlockfrostClientT m)
BlockfrostClientT m a
-> (a -> BlockfrostClientT m b) -> BlockfrostClientT m b
BlockfrostClientT m a
-> BlockfrostClientT m b -> BlockfrostClientT m b
forall a. a -> BlockfrostClientT m a
forall a b.
BlockfrostClientT m a
-> BlockfrostClientT m b -> BlockfrostClientT m b
forall a b.
BlockfrostClientT m a
-> (a -> BlockfrostClientT m b) -> BlockfrostClientT m b
forall (m :: * -> *). Monad m => Applicative (BlockfrostClientT m)
forall (m :: * -> *) a. Monad m => a -> BlockfrostClientT m a
forall (m :: * -> *) a b.
Monad m =>
BlockfrostClientT m a
-> BlockfrostClientT m b -> BlockfrostClientT m b
forall (m :: * -> *) a b.
Monad m =>
BlockfrostClientT m a
-> (a -> BlockfrostClientT m b) -> BlockfrostClientT m b
forall (m :: * -> *).
Applicative m
-> (forall a b. m a -> (a -> m b) -> m b)
-> (forall a b. m a -> m b -> m b)
-> (forall a. a -> m a)
-> Monad m
return :: a -> BlockfrostClientT m a
$creturn :: forall (m :: * -> *) a. Monad m => a -> BlockfrostClientT m a
>> :: BlockfrostClientT m a
-> BlockfrostClientT m b -> BlockfrostClientT m b
$c>> :: forall (m :: * -> *) a b.
Monad m =>
BlockfrostClientT m a
-> BlockfrostClientT m b -> BlockfrostClientT m b
>>= :: BlockfrostClientT m a
-> (a -> BlockfrostClientT m b) -> BlockfrostClientT m b
$c>>= :: forall (m :: * -> *) a b.
Monad m =>
BlockfrostClientT m a
-> (a -> BlockfrostClientT m b) -> BlockfrostClientT m b
$cp1Monad :: forall (m :: * -> *). Monad m => Applicative (BlockfrostClientT m)
Monad
      , Monad (BlockfrostClientT m)
Monad (BlockfrostClientT m)
-> (forall a. IO a -> BlockfrostClientT m a)
-> MonadIO (BlockfrostClientT m)
IO a -> BlockfrostClientT m a
forall a. IO a -> BlockfrostClientT m a
forall (m :: * -> *).
Monad m -> (forall a. IO a -> m a) -> MonadIO m
forall (m :: * -> *). MonadIO m => Monad (BlockfrostClientT m)
forall (m :: * -> *) a. MonadIO m => IO a -> BlockfrostClientT m a
liftIO :: IO a -> BlockfrostClientT m a
$cliftIO :: forall (m :: * -> *) a. MonadIO m => IO a -> BlockfrostClientT m a
$cp1MonadIO :: forall (m :: * -> *). MonadIO m => Monad (BlockfrostClientT m)
MonadIO
      , MonadReader ClientConfig
      , MonadError BlockfrostError
      )

type BlockfrostClient = BlockfrostClientT IO

class MonadIO m => MonadBlockfrost m where
  liftBlockfrostClient :: ClientM a -> m a
  getConf :: m ClientConfig

instance MonadIO m => MonadBlockfrost (BlockfrostClientT m) where
  liftBlockfrostClient :: ClientM a -> BlockfrostClientT m a
liftBlockfrostClient ClientM a
act = ExceptT BlockfrostError (ReaderT ClientConfig m) a
-> BlockfrostClientT m a
forall (m :: * -> *) a.
ExceptT BlockfrostError (ReaderT ClientConfig m) a
-> BlockfrostClientT m a
BlockfrostClientT (ExceptT BlockfrostError (ReaderT ClientConfig m) a
 -> BlockfrostClientT m a)
-> ExceptT BlockfrostError (ReaderT ClientConfig m) a
-> BlockfrostClientT m a
forall a b. (a -> b) -> a -> b
$ do
    (ClientEnv
env, Project
_proj) <- ExceptT BlockfrostError (ReaderT ClientConfig m) ClientConfig
forall r (m :: * -> *). MonadReader r m => m r
ask
    IO (Either ClientError a)
-> ExceptT
     BlockfrostError (ReaderT ClientConfig m) (Either ClientError a)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (ClientM a -> ClientEnv -> IO (Either ClientError a)
forall a. ClientM a -> ClientEnv -> IO (Either ClientError a)
runClientM ClientM a
act ClientEnv
env)
      ExceptT
  BlockfrostError (ReaderT ClientConfig m) (Either ClientError a)
-> (Either ClientError a
    -> ExceptT BlockfrostError (ReaderT ClientConfig m) a)
-> ExceptT BlockfrostError (ReaderT ClientConfig m) a
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= (ClientError -> ExceptT BlockfrostError (ReaderT ClientConfig m) a)
-> (a -> ExceptT BlockfrostError (ReaderT ClientConfig m) a)
-> Either ClientError a
-> ExceptT BlockfrostError (ReaderT ClientConfig m) a
forall a c b. (a -> c) -> (b -> c) -> Either a b -> c
either (BlockfrostError
-> ExceptT BlockfrostError (ReaderT ClientConfig m) a
forall e (m :: * -> *) a. MonadError e m => e -> m a
throwError (BlockfrostError
 -> ExceptT BlockfrostError (ReaderT ClientConfig m) a)
-> (ClientError -> BlockfrostError)
-> ClientError
-> ExceptT BlockfrostError (ReaderT ClientConfig m) a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ClientError -> BlockfrostError
fromServantClientError) a -> ExceptT BlockfrostError (ReaderT ClientConfig m) a
forall (f :: * -> *) a. Applicative f => a -> f a
pure
  getConf :: BlockfrostClientT m ClientConfig
getConf = ExceptT BlockfrostError (ReaderT ClientConfig m) ClientConfig
-> BlockfrostClientT m ClientConfig
forall (m :: * -> *) a.
ExceptT BlockfrostError (ReaderT ClientConfig m) a
-> BlockfrostClientT m a
BlockfrostClientT ExceptT BlockfrostError (ReaderT ClientConfig m) ClientConfig
forall r (m :: * -> *). MonadReader r m => m r
ask

instance MonadBlockfrost ClientM where
  liftBlockfrostClient :: ClientM a -> ClientM a
liftBlockfrostClient = ClientM a -> ClientM a
forall a. a -> a
id
  getConf :: ClientM ClientConfig
getConf = ClientM ClientConfig
forall (m :: * -> *). MonadIO m => m ClientConfig
newClientConfig

instance MonadBlockfrost IO where
  liftBlockfrostClient :: ClientM a -> IO a
liftBlockfrostClient ClientM a
act = IO ClientConfig
forall (m :: * -> *). MonadBlockfrost m => m ClientConfig
getConf IO ClientConfig -> (ClientConfig -> IO a) -> IO a
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \(ClientEnv
env, Project
_prj) -> ClientM a -> ClientEnv -> IO (Either ClientError a)
forall a. ClientM a -> ClientEnv -> IO (Either ClientError a)
runClientM ClientM a
act ClientEnv
env IO (Either ClientError a) -> (Either ClientError a -> IO a) -> IO a
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= (ClientError -> IO a)
-> (a -> IO a) -> Either ClientError a -> IO a
forall a c b. (a -> c) -> (b -> c) -> Either a b -> c
either ([Char] -> IO a
forall a. HasCallStack => [Char] -> a
error ([Char] -> IO a) -> (ClientError -> [Char]) -> ClientError -> IO a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ClientError -> [Char]
forall a. Show a => a -> [Char]
show) a -> IO a
forall (f :: * -> *) a. Applicative f => a -> f a
pure
  getConf :: IO ClientConfig
getConf = IO ClientConfig
forall (m :: * -> *). MonadIO m => m ClientConfig
newClientConfig

apiClient :: MonadBlockfrost m => BlockfrostAPI (AsClientT m)
apiClient :: BlockfrostAPI (AsClientT m)
apiClient = (forall x. ClientM x -> m x) -> BlockfrostAPI (AsClientT m)
forall (routes :: * -> *) (m :: * -> *) (n :: * -> *).
(HasClient m (ToServantApi routes),
 GenericServant routes (AsClientT n),
 Client n (ToServantApi routes) ~ ToServant routes (AsClientT n)) =>
(forall x. m x -> n x) -> routes (AsClientT n)
genericClientHoist forall x. ClientM x -> m x
forall (m :: * -> *) a. MonadBlockfrost m => ClientM a -> m a
liftBlockfrostClient

api0Client :: MonadBlockfrost m => Project -> BlockfrostV0API (AsClientT m)
api0Client :: Project -> BlockfrostV0API (AsClientT m)
api0Client = ((((m URLVersion :<|> m Healthy)
   :<|> (m ServerTime :<|> (m [Metric] :<|> m [(Text, Metric)])))
  :<|> (((((((Address -> m AccountInfo)
             :<|> (Address -> Paged -> SortOrder -> m [AccountReward]))
            :<|> ((Address -> Paged -> SortOrder -> m [AccountHistory])
                  :<|> (Address -> Paged -> SortOrder -> m [AccountDelegation])))
           :<|> (((Address -> Paged -> SortOrder -> m [AccountRegistration])
                  :<|> (Address -> Paged -> SortOrder -> m [AccountWithdrawal]))
                 :<|> ((Address -> Paged -> SortOrder -> m [AccountMir])
                       :<|> ((Address -> Paged -> SortOrder -> m [AddressAssociated])
                             :<|> (Address -> Paged -> SortOrder -> m [Amount])))))
          :<|> ((((Address -> m AddressInfo)
                  :<|> (Address -> m AddressDetails))
                 :<|> ((Address -> Paged -> SortOrder -> m [AddressUtxo])
                       :<|> ((Address -> AssetId -> Paged -> SortOrder -> m [AddressUtxo])
                             :<|> (Address
                                   -> Paged
                                   -> SortOrder
                                   -> Maybe BlockIndex
                                   -> Maybe BlockIndex
                                   -> m [AddressTransaction]))))
                :<|> (((Paged -> SortOrder -> m [AssetInfo])
                       :<|> ((AssetId -> m AssetDetails)
                             :<|> (AssetId -> Paged -> SortOrder -> m [AssetHistory])))
                      :<|> ((AssetId -> Paged -> SortOrder -> m [AssetTransaction])
                            :<|> ((AssetId -> Paged -> SortOrder -> m [AssetAddress])
                                  :<|> (PolicyId -> Paged -> SortOrder -> m [AssetInfo]))))))
         :<|> ((((m Block :<|> (Paged -> SortOrder -> m [TxHash]))
                 :<|> ((Either Integer BlockHash -> m Block)
                       :<|> (Slot -> m Block)))
                :<|> (((Epoch -> Slot -> m Block)
                       :<|> (Either Integer BlockHash -> Paged -> m [Block]))
                      :<|> ((Either Integer BlockHash -> Paged -> m [Block])
                            :<|> (Either Integer BlockHash
                                  -> Paged -> SortOrder -> m [TxHash]))))
               :<|> ((((m EpochInfo :<|> m ProtocolParams)
                       :<|> ((Epoch -> m EpochInfo)
                             :<|> ((Epoch -> Paged -> m [EpochInfo])
                                   :<|> (Epoch -> Paged -> m [EpochInfo]))))
                      :<|> (((Epoch -> Paged -> m [StakeDistribution])
                             :<|> (Epoch -> PoolId -> Paged -> m [StakeDistribution]))
                            :<|> ((Epoch -> Paged -> SortOrder -> m [BlockHash])
                                  :<|> ((Epoch -> PoolId -> Paged -> SortOrder -> m [BlockHash])
                                        :<|> (Epoch -> m ProtocolParams)))))
                     :<|> m Genesis)))
        :<|> ((((Paged -> SortOrder -> m [TxMeta])
                :<|> ((Text -> Paged -> SortOrder -> m [TxMetaJSON])
                      :<|> (Text -> Paged -> SortOrder -> m [TxMetaCBOR])))
               :<|> (m Network
                     :<|> ((((Paged -> SortOrder -> m [PoolId])
                             :<|> (Paged -> SortOrder -> m [PoolEpoch]))
                            :<|> ((Paged -> SortOrder -> m [PoolEpoch])
                                  :<|> ((PoolId -> m PoolInfo)
                                        :<|> (PoolId -> Paged -> SortOrder -> m [PoolHistory]))))
                           :<|> (((PoolId -> m (Maybe PoolMetadata))
                                  :<|> (PoolId -> m [PoolRelay]))
                                 :<|> ((PoolId -> Paged -> SortOrder -> m [PoolDelegator])
                                       :<|> ((PoolId -> Paged -> SortOrder -> m [BlockHash])
                                             :<|> (PoolId
                                                   -> Paged -> SortOrder -> m [PoolUpdate])))))))
              :<|> ((((Paged -> SortOrder -> m [ScriptHash])
                      :<|> ((ScriptHash -> m Script)
                            :<|> (ScriptHash -> Paged -> SortOrder -> m [ScriptRedeemer])))
                     :<|> ((DatumHash -> m ScriptDatum)
                           :<|> ((ScriptHash -> m ScriptJSON)
                                 :<|> (ScriptHash -> m ScriptCBOR))))
                    :<|> (((((TxHash -> m Transaction)
                             :<|> (TxHash -> m TransactionUtxos))
                            :<|> ((TxHash -> m [TransactionRedeemer])
                                  :<|> ((TxHash -> m [TransactionStake])
                                        :<|> (TxHash -> m [TransactionDelegation]))))
                           :<|> (((TxHash -> m [TransactionWithdrawal])
                                  :<|> ((TxHash -> m [TransactionMir])
                                        :<|> (TxHash -> m [TransactionPoolUpdate])))
                                 :<|> ((TxHash -> m [TransactionPoolRetiring])
                                       :<|> ((TxHash -> m [TransactionMetaJSON])
                                             :<|> (TxHash -> m [TransactionMetaCBOR])))))
                          :<|> (CBORString -> m TxHash))))))
 :<|> (((((ByteString, Form) -> m IPFSAdd)
         :<|> ((Text -> m IPFSData) :<|> (Text -> m IPFSPinChange)))
        :<|> ((Paged -> SortOrder -> m [IPFSPin])
              :<|> ((Text -> m IPFSPin) :<|> (Text -> m IPFSPinChange))))
       :<|> (((Address -> m NutlinkAddress)
              :<|> (Address -> Paged -> SortOrder -> m [NutlinkAddressTicker]))
             :<|> ((Address -> Text -> Paged -> SortOrder -> m [NutlinkTicker])
                   :<|> (Text
                         -> Paged -> SortOrder -> m [(Address, NutlinkTicker)])))))
-> BlockfrostV0API (AsClientT m)
forall (routes :: * -> *) mode.
GenericServant routes mode =>
ToServant routes mode -> routes mode
fromServant (((((m URLVersion :<|> m Healthy)
    :<|> (m ServerTime :<|> (m [Metric] :<|> m [(Text, Metric)])))
   :<|> (((((((Address -> m AccountInfo)
              :<|> (Address -> Paged -> SortOrder -> m [AccountReward]))
             :<|> ((Address -> Paged -> SortOrder -> m [AccountHistory])
                   :<|> (Address -> Paged -> SortOrder -> m [AccountDelegation])))
            :<|> (((Address -> Paged -> SortOrder -> m [AccountRegistration])
                   :<|> (Address -> Paged -> SortOrder -> m [AccountWithdrawal]))
                  :<|> ((Address -> Paged -> SortOrder -> m [AccountMir])
                        :<|> ((Address -> Paged -> SortOrder -> m [AddressAssociated])
                              :<|> (Address -> Paged -> SortOrder -> m [Amount])))))
           :<|> ((((Address -> m AddressInfo)
                   :<|> (Address -> m AddressDetails))
                  :<|> ((Address -> Paged -> SortOrder -> m [AddressUtxo])
                        :<|> ((Address -> AssetId -> Paged -> SortOrder -> m [AddressUtxo])
                              :<|> (Address
                                    -> Paged
                                    -> SortOrder
                                    -> Maybe BlockIndex
                                    -> Maybe BlockIndex
                                    -> m [AddressTransaction]))))
                 :<|> (((Paged -> SortOrder -> m [AssetInfo])
                        :<|> ((AssetId -> m AssetDetails)
                              :<|> (AssetId -> Paged -> SortOrder -> m [AssetHistory])))
                       :<|> ((AssetId -> Paged -> SortOrder -> m [AssetTransaction])
                             :<|> ((AssetId -> Paged -> SortOrder -> m [AssetAddress])
                                   :<|> (PolicyId -> Paged -> SortOrder -> m [AssetInfo]))))))
          :<|> ((((m Block :<|> (Paged -> SortOrder -> m [TxHash]))
                  :<|> ((Either Integer BlockHash -> m Block)
                        :<|> (Slot -> m Block)))
                 :<|> (((Epoch -> Slot -> m Block)
                        :<|> (Either Integer BlockHash -> Paged -> m [Block]))
                       :<|> ((Either Integer BlockHash -> Paged -> m [Block])
                             :<|> (Either Integer BlockHash
                                   -> Paged -> SortOrder -> m [TxHash]))))
                :<|> ((((m EpochInfo :<|> m ProtocolParams)
                        :<|> ((Epoch -> m EpochInfo)
                              :<|> ((Epoch -> Paged -> m [EpochInfo])
                                    :<|> (Epoch -> Paged -> m [EpochInfo]))))
                       :<|> (((Epoch -> Paged -> m [StakeDistribution])
                              :<|> (Epoch -> PoolId -> Paged -> m [StakeDistribution]))
                             :<|> ((Epoch -> Paged -> SortOrder -> m [BlockHash])
                                   :<|> ((Epoch -> PoolId -> Paged -> SortOrder -> m [BlockHash])
                                         :<|> (Epoch -> m ProtocolParams)))))
                      :<|> m Genesis)))
         :<|> ((((Paged -> SortOrder -> m [TxMeta])
                 :<|> ((Text -> Paged -> SortOrder -> m [TxMetaJSON])
                       :<|> (Text -> Paged -> SortOrder -> m [TxMetaCBOR])))
                :<|> (m Network
                      :<|> ((((Paged -> SortOrder -> m [PoolId])
                              :<|> (Paged -> SortOrder -> m [PoolEpoch]))
                             :<|> ((Paged -> SortOrder -> m [PoolEpoch])
                                   :<|> ((PoolId -> m PoolInfo)
                                         :<|> (PoolId -> Paged -> SortOrder -> m [PoolHistory]))))
                            :<|> (((PoolId -> m (Maybe PoolMetadata))
                                   :<|> (PoolId -> m [PoolRelay]))
                                  :<|> ((PoolId -> Paged -> SortOrder -> m [PoolDelegator])
                                        :<|> ((PoolId -> Paged -> SortOrder -> m [BlockHash])
                                              :<|> (PoolId
                                                    -> Paged -> SortOrder -> m [PoolUpdate])))))))
               :<|> ((((Paged -> SortOrder -> m [ScriptHash])
                       :<|> ((ScriptHash -> m Script)
                             :<|> (ScriptHash -> Paged -> SortOrder -> m [ScriptRedeemer])))
                      :<|> ((DatumHash -> m ScriptDatum)
                            :<|> ((ScriptHash -> m ScriptJSON)
                                  :<|> (ScriptHash -> m ScriptCBOR))))
                     :<|> (((((TxHash -> m Transaction)
                              :<|> (TxHash -> m TransactionUtxos))
                             :<|> ((TxHash -> m [TransactionRedeemer])
                                   :<|> ((TxHash -> m [TransactionStake])
                                         :<|> (TxHash -> m [TransactionDelegation]))))
                            :<|> (((TxHash -> m [TransactionWithdrawal])
                                   :<|> ((TxHash -> m [TransactionMir])
                                         :<|> (TxHash -> m [TransactionPoolUpdate])))
                                  :<|> ((TxHash -> m [TransactionPoolRetiring])
                                        :<|> ((TxHash -> m [TransactionMetaJSON])
                                              :<|> (TxHash -> m [TransactionMetaCBOR])))))
                           :<|> (CBORString -> m TxHash))))))
  :<|> (((((ByteString, Form) -> m IPFSAdd)
          :<|> ((Text -> m IPFSData) :<|> (Text -> m IPFSPinChange)))
         :<|> ((Paged -> SortOrder -> m [IPFSPin])
               :<|> ((Text -> m IPFSPin) :<|> (Text -> m IPFSPinChange))))
        :<|> (((Address -> m NutlinkAddress)
               :<|> (Address -> Paged -> SortOrder -> m [NutlinkAddressTicker]))
              :<|> ((Address -> Text -> Paged -> SortOrder -> m [NutlinkTicker])
                    :<|> (Text
                          -> Paged -> SortOrder -> m [(Address, NutlinkTicker)])))))
 -> BlockfrostV0API (AsClientT m))
-> (Project
    -> (((m URLVersion :<|> m Healthy)
         :<|> (m ServerTime :<|> (m [Metric] :<|> m [(Text, Metric)])))
        :<|> (((((((Address -> m AccountInfo)
                   :<|> (Address -> Paged -> SortOrder -> m [AccountReward]))
                  :<|> ((Address -> Paged -> SortOrder -> m [AccountHistory])
                        :<|> (Address -> Paged -> SortOrder -> m [AccountDelegation])))
                 :<|> (((Address -> Paged -> SortOrder -> m [AccountRegistration])
                        :<|> (Address -> Paged -> SortOrder -> m [AccountWithdrawal]))
                       :<|> ((Address -> Paged -> SortOrder -> m [AccountMir])
                             :<|> ((Address -> Paged -> SortOrder -> m [AddressAssociated])
                                   :<|> (Address -> Paged -> SortOrder -> m [Amount])))))
                :<|> ((((Address -> m AddressInfo)
                        :<|> (Address -> m AddressDetails))
                       :<|> ((Address -> Paged -> SortOrder -> m [AddressUtxo])
                             :<|> ((Address -> AssetId -> Paged -> SortOrder -> m [AddressUtxo])
                                   :<|> (Address
                                         -> Paged
                                         -> SortOrder
                                         -> Maybe BlockIndex
                                         -> Maybe BlockIndex
                                         -> m [AddressTransaction]))))
                      :<|> (((Paged -> SortOrder -> m [AssetInfo])
                             :<|> ((AssetId -> m AssetDetails)
                                   :<|> (AssetId -> Paged -> SortOrder -> m [AssetHistory])))
                            :<|> ((AssetId -> Paged -> SortOrder -> m [AssetTransaction])
                                  :<|> ((AssetId -> Paged -> SortOrder -> m [AssetAddress])
                                        :<|> (PolicyId -> Paged -> SortOrder -> m [AssetInfo]))))))
               :<|> ((((m Block :<|> (Paged -> SortOrder -> m [TxHash]))
                       :<|> ((Either Integer BlockHash -> m Block)
                             :<|> (Slot -> m Block)))
                      :<|> (((Epoch -> Slot -> m Block)
                             :<|> (Either Integer BlockHash -> Paged -> m [Block]))
                            :<|> ((Either Integer BlockHash -> Paged -> m [Block])
                                  :<|> (Either Integer BlockHash
                                        -> Paged -> SortOrder -> m [TxHash]))))
                     :<|> ((((m EpochInfo :<|> m ProtocolParams)
                             :<|> ((Epoch -> m EpochInfo)
                                   :<|> ((Epoch -> Paged -> m [EpochInfo])
                                         :<|> (Epoch -> Paged -> m [EpochInfo]))))
                            :<|> (((Epoch -> Paged -> m [StakeDistribution])
                                   :<|> (Epoch -> PoolId -> Paged -> m [StakeDistribution]))
                                  :<|> ((Epoch -> Paged -> SortOrder -> m [BlockHash])
                                        :<|> ((Epoch
                                               -> PoolId -> Paged -> SortOrder -> m [BlockHash])
                                              :<|> (Epoch -> m ProtocolParams)))))
                           :<|> m Genesis)))
              :<|> ((((Paged -> SortOrder -> m [TxMeta])
                      :<|> ((Text -> Paged -> SortOrder -> m [TxMetaJSON])
                            :<|> (Text -> Paged -> SortOrder -> m [TxMetaCBOR])))
                     :<|> (m Network
                           :<|> ((((Paged -> SortOrder -> m [PoolId])
                                   :<|> (Paged -> SortOrder -> m [PoolEpoch]))
                                  :<|> ((Paged -> SortOrder -> m [PoolEpoch])
                                        :<|> ((PoolId -> m PoolInfo)
                                              :<|> (PoolId
                                                    -> Paged -> SortOrder -> m [PoolHistory]))))
                                 :<|> (((PoolId -> m (Maybe PoolMetadata))
                                        :<|> (PoolId -> m [PoolRelay]))
                                       :<|> ((PoolId -> Paged -> SortOrder -> m [PoolDelegator])
                                             :<|> ((PoolId -> Paged -> SortOrder -> m [BlockHash])
                                                   :<|> (PoolId
                                                         -> Paged
                                                         -> SortOrder
                                                         -> m [PoolUpdate])))))))
                    :<|> ((((Paged -> SortOrder -> m [ScriptHash])
                            :<|> ((ScriptHash -> m Script)
                                  :<|> (ScriptHash -> Paged -> SortOrder -> m [ScriptRedeemer])))
                           :<|> ((DatumHash -> m ScriptDatum)
                                 :<|> ((ScriptHash -> m ScriptJSON)
                                       :<|> (ScriptHash -> m ScriptCBOR))))
                          :<|> (((((TxHash -> m Transaction)
                                   :<|> (TxHash -> m TransactionUtxos))
                                  :<|> ((TxHash -> m [TransactionRedeemer])
                                        :<|> ((TxHash -> m [TransactionStake])
                                              :<|> (TxHash -> m [TransactionDelegation]))))
                                 :<|> (((TxHash -> m [TransactionWithdrawal])
                                        :<|> ((TxHash -> m [TransactionMir])
                                              :<|> (TxHash -> m [TransactionPoolUpdate])))
                                       :<|> ((TxHash -> m [TransactionPoolRetiring])
                                             :<|> ((TxHash -> m [TransactionMetaJSON])
                                                   :<|> (TxHash -> m [TransactionMetaCBOR])))))
                                :<|> (CBORString -> m TxHash))))))
       :<|> (((((ByteString, Form) -> m IPFSAdd)
               :<|> ((Text -> m IPFSData) :<|> (Text -> m IPFSPinChange)))
              :<|> ((Paged -> SortOrder -> m [IPFSPin])
                    :<|> ((Text -> m IPFSPin) :<|> (Text -> m IPFSPinChange))))
             :<|> (((Address -> m NutlinkAddress)
                    :<|> (Address -> Paged -> SortOrder -> m [NutlinkAddressTicker]))
                   :<|> ((Address -> Text -> Paged -> SortOrder -> m [NutlinkTicker])
                         :<|> (Text
                               -> Paged -> SortOrder -> m [(Address, NutlinkTicker)])))))
-> Project
-> BlockfrostV0API (AsClientT m)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. BlockfrostAPI (AsClientT m)
-> AsClientT m
   :- ("api"
       :> ("v0"
           :> (BlockfrostAuth
               :> (UserAgent :> ToServantApi BlockfrostV0API))))
forall route.
BlockfrostAPI route
-> route
   :- ("api"
       :> ("v0"
           :> (BlockfrostAuth
               :> (UserAgent :> ToServantApi BlockfrostV0API))))
_apiV0 BlockfrostAPI (AsClientT m)
forall (m :: * -> *).
MonadBlockfrost m =>
BlockfrostAPI (AsClientT m)
apiClient

-- ** Client runner

-- | Run @BlockfrostClientT@ monad in @IO@, using provided @Project@
runBlockfrost
  :: Project
  -> BlockfrostClientT IO a
  -> IO (Either BlockfrostError a)
runBlockfrost :: Project -> BlockfrostClientT IO a -> IO (Either BlockfrostError a)
runBlockfrost = Project -> BlockfrostClientT IO a -> IO (Either BlockfrostError a)
forall (m :: * -> *) a.
MonadIO m =>
Project -> BlockfrostClientT m a -> m (Either BlockfrostError a)
runBlockfrostClientT

-- | Run @BlockfrostClientT@, using provided @Project@
runBlockfrostClientT
  :: MonadIO m => Project
  -> BlockfrostClientT m a
  -> m (Either BlockfrostError a)
runBlockfrostClientT :: Project -> BlockfrostClientT m a -> m (Either BlockfrostError a)
runBlockfrostClientT Project
proj BlockfrostClientT m a
act = do
  ClientEnv
env <- IO ClientEnv -> m ClientEnv
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO ClientEnv -> m ClientEnv) -> IO ClientEnv -> m ClientEnv
forall a b. (a -> b) -> a -> b
$ Project -> IO ClientEnv
newEnvByProject Project
proj
  (ReaderT ClientConfig m (Either BlockfrostError a)
 -> ClientConfig -> m (Either BlockfrostError a))
-> ClientConfig
-> ReaderT ClientConfig m (Either BlockfrostError a)
-> m (Either BlockfrostError a)
forall a b c. (a -> b -> c) -> b -> a -> c
flip ReaderT ClientConfig m (Either BlockfrostError a)
-> ClientConfig -> m (Either BlockfrostError a)
forall r (m :: * -> *) a. ReaderT r m a -> r -> m a
runReaderT (ClientEnv
env, Project
proj)
    (ReaderT ClientConfig m (Either BlockfrostError a)
 -> m (Either BlockfrostError a))
-> ReaderT ClientConfig m (Either BlockfrostError a)
-> m (Either BlockfrostError a)
forall a b. (a -> b) -> a -> b
$ ExceptT BlockfrostError (ReaderT ClientConfig m) a
-> ReaderT ClientConfig m (Either BlockfrostError a)
forall e (m :: * -> *) a. ExceptT e m a -> m (Either e a)
runExceptT (ExceptT BlockfrostError (ReaderT ClientConfig m) a
 -> ReaderT ClientConfig m (Either BlockfrostError a))
-> ExceptT BlockfrostError (ReaderT ClientConfig m) a
-> ReaderT ClientConfig m (Either BlockfrostError a)
forall a b. (a -> b) -> a -> b
$ BlockfrostClientT m a
-> ExceptT BlockfrostError (ReaderT ClientConfig m) a
forall (m :: * -> *) a.
BlockfrostClientT m a
-> ExceptT BlockfrostError (ReaderT ClientConfig m) a
unBlockfrostClientT BlockfrostClientT m a
act

-- | Build default `ClientConfig` using BLOCKFROST_TOKEN_PATH environment variable
newClientConfig
  :: MonadIO m
  => m ClientConfig
newClientConfig :: m ClientConfig
newClientConfig = IO ClientConfig -> m ClientConfig
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO ClientConfig -> m ClientConfig)
-> IO ClientConfig -> m ClientConfig
forall a b. (a -> b) -> a -> b
$ do
  Project
prj <- IO Project
projectFromEnv
  ClientEnv
env <- Project -> IO ClientEnv
newEnvByProject Project
prj
  ClientConfig -> IO ClientConfig
forall (f :: * -> *) a. Applicative f => a -> f a
pure (ClientEnv
env, Project
prj)

-- | Helper
go :: MonadBlockfrost m
   => (Project -> m a)
   -> m a
go :: (Project -> m a) -> m a
go Project -> m a
act = m ClientConfig
forall (m :: * -> *). MonadBlockfrost m => m ClientConfig
getConf m ClientConfig -> (ClientConfig -> m a) -> m a
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= Project -> m a
act (Project -> m a)
-> (ClientConfig -> Project) -> ClientConfig -> m a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ClientConfig -> Project
forall a b. (a, b) -> b
snd

-- Until mtl > 2.2.2
-- https://github.com/haskell/mtl/pull/66
#if !MIN_VERSION_mtl(2,3,0)
-- | 'MonadError' analogue to the 'Control.Exception.try' function.
tryError :: MonadError e m => m a -> m (Either e a)
tryError :: m a -> m (Either e a)
tryError m a
action = (a -> Either e a
forall a b. b -> Either a b
Right (a -> Either e a) -> m a -> m (Either e a)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> m a
action) m (Either e a) -> (e -> m (Either e a)) -> m (Either e a)
forall e (m :: * -> *) a.
MonadError e m =>
m a -> (e -> m a) -> m a
`catchError` (Either e a -> m (Either e a)
forall (f :: * -> *) a. Applicative f => a -> f a
pure (Either e a -> m (Either e a))
-> (e -> Either e a) -> e -> m (Either e a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. e -> Either e a
forall a b. a -> Either a b
Left)
#endif

-- ** Service clients

commonClient :: MonadBlockfrost m => Project -> CommonAPI (AsClientT m)
commonClient :: Project -> CommonAPI (AsClientT m)
commonClient = ((m URLVersion :<|> m Healthy)
 :<|> (m ServerTime :<|> (m [Metric] :<|> m [(Text, Metric)])))
-> CommonAPI (AsClientT m)
forall (routes :: * -> *) mode.
GenericServant routes mode =>
ToServant routes mode -> routes mode
fromServant (((m URLVersion :<|> m Healthy)
  :<|> (m ServerTime :<|> (m [Metric] :<|> m [(Text, Metric)])))
 -> CommonAPI (AsClientT m))
-> (Project
    -> (m URLVersion :<|> m Healthy)
       :<|> (m ServerTime :<|> (m [Metric] :<|> m [(Text, Metric)])))
-> Project
-> CommonAPI (AsClientT m)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. BlockfrostV0API (AsClientT m)
-> (m URLVersion :<|> m Healthy)
   :<|> (m ServerTime :<|> (m [Metric] :<|> m [(Text, Metric)]))
forall route.
BlockfrostV0API route -> route :- ToServantApi CommonAPI
_common (BlockfrostV0API (AsClientT m)
 -> (m URLVersion :<|> m Healthy)
    :<|> (m ServerTime :<|> (m [Metric] :<|> m [(Text, Metric)])))
-> (Project -> BlockfrostV0API (AsClientT m))
-> Project
-> (m URLVersion :<|> m Healthy)
   :<|> (m ServerTime :<|> (m [Metric] :<|> m [(Text, Metric)]))
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Project -> BlockfrostV0API (AsClientT m)
forall (m :: * -> *).
MonadBlockfrost m =>
Project -> BlockfrostV0API (AsClientT m)
api0Client

cardanoClient :: MonadBlockfrost m => Project -> CardanoAPI (AsClientT m)
cardanoClient :: Project -> CardanoAPI (AsClientT m)
cardanoClient = (((((((Address -> m AccountInfo)
      :<|> (Address -> Paged -> SortOrder -> m [AccountReward]))
     :<|> ((Address -> Paged -> SortOrder -> m [AccountHistory])
           :<|> (Address -> Paged -> SortOrder -> m [AccountDelegation])))
    :<|> (((Address -> Paged -> SortOrder -> m [AccountRegistration])
           :<|> (Address -> Paged -> SortOrder -> m [AccountWithdrawal]))
          :<|> ((Address -> Paged -> SortOrder -> m [AccountMir])
                :<|> ((Address -> Paged -> SortOrder -> m [AddressAssociated])
                      :<|> (Address -> Paged -> SortOrder -> m [Amount])))))
   :<|> ((((Address -> m AddressInfo)
           :<|> (Address -> m AddressDetails))
          :<|> ((Address -> Paged -> SortOrder -> m [AddressUtxo])
                :<|> ((Address -> AssetId -> Paged -> SortOrder -> m [AddressUtxo])
                      :<|> (Address
                            -> Paged
                            -> SortOrder
                            -> Maybe BlockIndex
                            -> Maybe BlockIndex
                            -> m [AddressTransaction]))))
         :<|> (((Paged -> SortOrder -> m [AssetInfo])
                :<|> ((AssetId -> m AssetDetails)
                      :<|> (AssetId -> Paged -> SortOrder -> m [AssetHistory])))
               :<|> ((AssetId -> Paged -> SortOrder -> m [AssetTransaction])
                     :<|> ((AssetId -> Paged -> SortOrder -> m [AssetAddress])
                           :<|> (PolicyId -> Paged -> SortOrder -> m [AssetInfo]))))))
  :<|> ((((m Block :<|> (Paged -> SortOrder -> m [TxHash]))
          :<|> ((Either Integer BlockHash -> m Block)
                :<|> (Slot -> m Block)))
         :<|> (((Epoch -> Slot -> m Block)
                :<|> (Either Integer BlockHash -> Paged -> m [Block]))
               :<|> ((Either Integer BlockHash -> Paged -> m [Block])
                     :<|> (Either Integer BlockHash
                           -> Paged -> SortOrder -> m [TxHash]))))
        :<|> ((((m EpochInfo :<|> m ProtocolParams)
                :<|> ((Epoch -> m EpochInfo)
                      :<|> ((Epoch -> Paged -> m [EpochInfo])
                            :<|> (Epoch -> Paged -> m [EpochInfo]))))
               :<|> (((Epoch -> Paged -> m [StakeDistribution])
                      :<|> (Epoch -> PoolId -> Paged -> m [StakeDistribution]))
                     :<|> ((Epoch -> Paged -> SortOrder -> m [BlockHash])
                           :<|> ((Epoch -> PoolId -> Paged -> SortOrder -> m [BlockHash])
                                 :<|> (Epoch -> m ProtocolParams)))))
              :<|> m Genesis)))
 :<|> ((((Paged -> SortOrder -> m [TxMeta])
         :<|> ((Text -> Paged -> SortOrder -> m [TxMetaJSON])
               :<|> (Text -> Paged -> SortOrder -> m [TxMetaCBOR])))
        :<|> (m Network
              :<|> ((((Paged -> SortOrder -> m [PoolId])
                      :<|> (Paged -> SortOrder -> m [PoolEpoch]))
                     :<|> ((Paged -> SortOrder -> m [PoolEpoch])
                           :<|> ((PoolId -> m PoolInfo)
                                 :<|> (PoolId -> Paged -> SortOrder -> m [PoolHistory]))))
                    :<|> (((PoolId -> m (Maybe PoolMetadata))
                           :<|> (PoolId -> m [PoolRelay]))
                          :<|> ((PoolId -> Paged -> SortOrder -> m [PoolDelegator])
                                :<|> ((PoolId -> Paged -> SortOrder -> m [BlockHash])
                                      :<|> (PoolId -> Paged -> SortOrder -> m [PoolUpdate])))))))
       :<|> ((((Paged -> SortOrder -> m [ScriptHash])
               :<|> ((ScriptHash -> m Script)
                     :<|> (ScriptHash -> Paged -> SortOrder -> m [ScriptRedeemer])))
              :<|> ((DatumHash -> m ScriptDatum)
                    :<|> ((ScriptHash -> m ScriptJSON)
                          :<|> (ScriptHash -> m ScriptCBOR))))
             :<|> (((((TxHash -> m Transaction)
                      :<|> (TxHash -> m TransactionUtxos))
                     :<|> ((TxHash -> m [TransactionRedeemer])
                           :<|> ((TxHash -> m [TransactionStake])
                                 :<|> (TxHash -> m [TransactionDelegation]))))
                    :<|> (((TxHash -> m [TransactionWithdrawal])
                           :<|> ((TxHash -> m [TransactionMir])
                                 :<|> (TxHash -> m [TransactionPoolUpdate])))
                          :<|> ((TxHash -> m [TransactionPoolRetiring])
                                :<|> ((TxHash -> m [TransactionMetaJSON])
                                      :<|> (TxHash -> m [TransactionMetaCBOR])))))
                   :<|> (CBORString -> m TxHash)))))
-> CardanoAPI (AsClientT m)
forall (routes :: * -> *) mode.
GenericServant routes mode =>
ToServant routes mode -> routes mode
fromServant ((((((((Address -> m AccountInfo)
       :<|> (Address -> Paged -> SortOrder -> m [AccountReward]))
      :<|> ((Address -> Paged -> SortOrder -> m [AccountHistory])
            :<|> (Address -> Paged -> SortOrder -> m [AccountDelegation])))
     :<|> (((Address -> Paged -> SortOrder -> m [AccountRegistration])
            :<|> (Address -> Paged -> SortOrder -> m [AccountWithdrawal]))
           :<|> ((Address -> Paged -> SortOrder -> m [AccountMir])
                 :<|> ((Address -> Paged -> SortOrder -> m [AddressAssociated])
                       :<|> (Address -> Paged -> SortOrder -> m [Amount])))))
    :<|> ((((Address -> m AddressInfo)
            :<|> (Address -> m AddressDetails))
           :<|> ((Address -> Paged -> SortOrder -> m [AddressUtxo])
                 :<|> ((Address -> AssetId -> Paged -> SortOrder -> m [AddressUtxo])
                       :<|> (Address
                             -> Paged
                             -> SortOrder
                             -> Maybe BlockIndex
                             -> Maybe BlockIndex
                             -> m [AddressTransaction]))))
          :<|> (((Paged -> SortOrder -> m [AssetInfo])
                 :<|> ((AssetId -> m AssetDetails)
                       :<|> (AssetId -> Paged -> SortOrder -> m [AssetHistory])))
                :<|> ((AssetId -> Paged -> SortOrder -> m [AssetTransaction])
                      :<|> ((AssetId -> Paged -> SortOrder -> m [AssetAddress])
                            :<|> (PolicyId -> Paged -> SortOrder -> m [AssetInfo]))))))
   :<|> ((((m Block :<|> (Paged -> SortOrder -> m [TxHash]))
           :<|> ((Either Integer BlockHash -> m Block)
                 :<|> (Slot -> m Block)))
          :<|> (((Epoch -> Slot -> m Block)
                 :<|> (Either Integer BlockHash -> Paged -> m [Block]))
                :<|> ((Either Integer BlockHash -> Paged -> m [Block])
                      :<|> (Either Integer BlockHash
                            -> Paged -> SortOrder -> m [TxHash]))))
         :<|> ((((m EpochInfo :<|> m ProtocolParams)
                 :<|> ((Epoch -> m EpochInfo)
                       :<|> ((Epoch -> Paged -> m [EpochInfo])
                             :<|> (Epoch -> Paged -> m [EpochInfo]))))
                :<|> (((Epoch -> Paged -> m [StakeDistribution])
                       :<|> (Epoch -> PoolId -> Paged -> m [StakeDistribution]))
                      :<|> ((Epoch -> Paged -> SortOrder -> m [BlockHash])
                            :<|> ((Epoch -> PoolId -> Paged -> SortOrder -> m [BlockHash])
                                  :<|> (Epoch -> m ProtocolParams)))))
               :<|> m Genesis)))
  :<|> ((((Paged -> SortOrder -> m [TxMeta])
          :<|> ((Text -> Paged -> SortOrder -> m [TxMetaJSON])
                :<|> (Text -> Paged -> SortOrder -> m [TxMetaCBOR])))
         :<|> (m Network
               :<|> ((((Paged -> SortOrder -> m [PoolId])
                       :<|> (Paged -> SortOrder -> m [PoolEpoch]))
                      :<|> ((Paged -> SortOrder -> m [PoolEpoch])
                            :<|> ((PoolId -> m PoolInfo)
                                  :<|> (PoolId -> Paged -> SortOrder -> m [PoolHistory]))))
                     :<|> (((PoolId -> m (Maybe PoolMetadata))
                            :<|> (PoolId -> m [PoolRelay]))
                           :<|> ((PoolId -> Paged -> SortOrder -> m [PoolDelegator])
                                 :<|> ((PoolId -> Paged -> SortOrder -> m [BlockHash])
                                       :<|> (PoolId -> Paged -> SortOrder -> m [PoolUpdate])))))))
        :<|> ((((Paged -> SortOrder -> m [ScriptHash])
                :<|> ((ScriptHash -> m Script)
                      :<|> (ScriptHash -> Paged -> SortOrder -> m [ScriptRedeemer])))
               :<|> ((DatumHash -> m ScriptDatum)
                     :<|> ((ScriptHash -> m ScriptJSON)
                           :<|> (ScriptHash -> m ScriptCBOR))))
              :<|> (((((TxHash -> m Transaction)
                       :<|> (TxHash -> m TransactionUtxos))
                      :<|> ((TxHash -> m [TransactionRedeemer])
                            :<|> ((TxHash -> m [TransactionStake])
                                  :<|> (TxHash -> m [TransactionDelegation]))))
                     :<|> (((TxHash -> m [TransactionWithdrawal])
                            :<|> ((TxHash -> m [TransactionMir])
                                  :<|> (TxHash -> m [TransactionPoolUpdate])))
                           :<|> ((TxHash -> m [TransactionPoolRetiring])
                                 :<|> ((TxHash -> m [TransactionMetaJSON])
                                       :<|> (TxHash -> m [TransactionMetaCBOR])))))
                    :<|> (CBORString -> m TxHash)))))
 -> CardanoAPI (AsClientT m))
-> (Project
    -> ((((((Address -> m AccountInfo)
            :<|> (Address -> Paged -> SortOrder -> m [AccountReward]))
           :<|> ((Address -> Paged -> SortOrder -> m [AccountHistory])
                 :<|> (Address -> Paged -> SortOrder -> m [AccountDelegation])))
          :<|> (((Address -> Paged -> SortOrder -> m [AccountRegistration])
                 :<|> (Address -> Paged -> SortOrder -> m [AccountWithdrawal]))
                :<|> ((Address -> Paged -> SortOrder -> m [AccountMir])
                      :<|> ((Address -> Paged -> SortOrder -> m [AddressAssociated])
                            :<|> (Address -> Paged -> SortOrder -> m [Amount])))))
         :<|> ((((Address -> m AddressInfo)
                 :<|> (Address -> m AddressDetails))
                :<|> ((Address -> Paged -> SortOrder -> m [AddressUtxo])
                      :<|> ((Address -> AssetId -> Paged -> SortOrder -> m [AddressUtxo])
                            :<|> (Address
                                  -> Paged
                                  -> SortOrder
                                  -> Maybe BlockIndex
                                  -> Maybe BlockIndex
                                  -> m [AddressTransaction]))))
               :<|> (((Paged -> SortOrder -> m [AssetInfo])
                      :<|> ((AssetId -> m AssetDetails)
                            :<|> (AssetId -> Paged -> SortOrder -> m [AssetHistory])))
                     :<|> ((AssetId -> Paged -> SortOrder -> m [AssetTransaction])
                           :<|> ((AssetId -> Paged -> SortOrder -> m [AssetAddress])
                                 :<|> (PolicyId -> Paged -> SortOrder -> m [AssetInfo]))))))
        :<|> ((((m Block :<|> (Paged -> SortOrder -> m [TxHash]))
                :<|> ((Either Integer BlockHash -> m Block)
                      :<|> (Slot -> m Block)))
               :<|> (((Epoch -> Slot -> m Block)
                      :<|> (Either Integer BlockHash -> Paged -> m [Block]))
                     :<|> ((Either Integer BlockHash -> Paged -> m [Block])
                           :<|> (Either Integer BlockHash
                                 -> Paged -> SortOrder -> m [TxHash]))))
              :<|> ((((m EpochInfo :<|> m ProtocolParams)
                      :<|> ((Epoch -> m EpochInfo)
                            :<|> ((Epoch -> Paged -> m [EpochInfo])
                                  :<|> (Epoch -> Paged -> m [EpochInfo]))))
                     :<|> (((Epoch -> Paged -> m [StakeDistribution])
                            :<|> (Epoch -> PoolId -> Paged -> m [StakeDistribution]))
                           :<|> ((Epoch -> Paged -> SortOrder -> m [BlockHash])
                                 :<|> ((Epoch -> PoolId -> Paged -> SortOrder -> m [BlockHash])
                                       :<|> (Epoch -> m ProtocolParams)))))
                    :<|> m Genesis)))
       :<|> ((((Paged -> SortOrder -> m [TxMeta])
               :<|> ((Text -> Paged -> SortOrder -> m [TxMetaJSON])
                     :<|> (Text -> Paged -> SortOrder -> m [TxMetaCBOR])))
              :<|> (m Network
                    :<|> ((((Paged -> SortOrder -> m [PoolId])
                            :<|> (Paged -> SortOrder -> m [PoolEpoch]))
                           :<|> ((Paged -> SortOrder -> m [PoolEpoch])
                                 :<|> ((PoolId -> m PoolInfo)
                                       :<|> (PoolId -> Paged -> SortOrder -> m [PoolHistory]))))
                          :<|> (((PoolId -> m (Maybe PoolMetadata))
                                 :<|> (PoolId -> m [PoolRelay]))
                                :<|> ((PoolId -> Paged -> SortOrder -> m [PoolDelegator])
                                      :<|> ((PoolId -> Paged -> SortOrder -> m [BlockHash])
                                            :<|> (PoolId
                                                  -> Paged -> SortOrder -> m [PoolUpdate])))))))
             :<|> ((((Paged -> SortOrder -> m [ScriptHash])
                     :<|> ((ScriptHash -> m Script)
                           :<|> (ScriptHash -> Paged -> SortOrder -> m [ScriptRedeemer])))
                    :<|> ((DatumHash -> m ScriptDatum)
                          :<|> ((ScriptHash -> m ScriptJSON)
                                :<|> (ScriptHash -> m ScriptCBOR))))
                   :<|> (((((TxHash -> m Transaction)
                            :<|> (TxHash -> m TransactionUtxos))
                           :<|> ((TxHash -> m [TransactionRedeemer])
                                 :<|> ((TxHash -> m [TransactionStake])
                                       :<|> (TxHash -> m [TransactionDelegation]))))
                          :<|> (((TxHash -> m [TransactionWithdrawal])
                                 :<|> ((TxHash -> m [TransactionMir])
                                       :<|> (TxHash -> m [TransactionPoolUpdate])))
                                :<|> ((TxHash -> m [TransactionPoolRetiring])
                                      :<|> ((TxHash -> m [TransactionMetaJSON])
                                            :<|> (TxHash -> m [TransactionMetaCBOR])))))
                         :<|> (CBORString -> m TxHash)))))
-> Project
-> CardanoAPI (AsClientT m)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. BlockfrostV0API (AsClientT m)
-> ((((((Address -> m AccountInfo)
        :<|> (Address -> Paged -> SortOrder -> m [AccountReward]))
       :<|> ((Address -> Paged -> SortOrder -> m [AccountHistory])
             :<|> (Address -> Paged -> SortOrder -> m [AccountDelegation])))
      :<|> (((Address -> Paged -> SortOrder -> m [AccountRegistration])
             :<|> (Address -> Paged -> SortOrder -> m [AccountWithdrawal]))
            :<|> ((Address -> Paged -> SortOrder -> m [AccountMir])
                  :<|> ((Address -> Paged -> SortOrder -> m [AddressAssociated])
                        :<|> (Address -> Paged -> SortOrder -> m [Amount])))))
     :<|> ((((Address -> m AddressInfo)
             :<|> (Address -> m AddressDetails))
            :<|> ((Address -> Paged -> SortOrder -> m [AddressUtxo])
                  :<|> ((Address -> AssetId -> Paged -> SortOrder -> m [AddressUtxo])
                        :<|> (Address
                              -> Paged
                              -> SortOrder
                              -> Maybe BlockIndex
                              -> Maybe BlockIndex
                              -> m [AddressTransaction]))))
           :<|> (((Paged -> SortOrder -> m [AssetInfo])
                  :<|> ((AssetId -> m AssetDetails)
                        :<|> (AssetId -> Paged -> SortOrder -> m [AssetHistory])))
                 :<|> ((AssetId -> Paged -> SortOrder -> m [AssetTransaction])
                       :<|> ((AssetId -> Paged -> SortOrder -> m [AssetAddress])
                             :<|> (PolicyId -> Paged -> SortOrder -> m [AssetInfo]))))))
    :<|> ((((m Block :<|> (Paged -> SortOrder -> m [TxHash]))
            :<|> ((Either Integer BlockHash -> m Block)
                  :<|> (Slot -> m Block)))
           :<|> (((Epoch -> Slot -> m Block)
                  :<|> (Either Integer BlockHash -> Paged -> m [Block]))
                 :<|> ((Either Integer BlockHash -> Paged -> m [Block])
                       :<|> (Either Integer BlockHash
                             -> Paged -> SortOrder -> m [TxHash]))))
          :<|> ((((m EpochInfo :<|> m ProtocolParams)
                  :<|> ((Epoch -> m EpochInfo)
                        :<|> ((Epoch -> Paged -> m [EpochInfo])
                              :<|> (Epoch -> Paged -> m [EpochInfo]))))
                 :<|> (((Epoch -> Paged -> m [StakeDistribution])
                        :<|> (Epoch -> PoolId -> Paged -> m [StakeDistribution]))
                       :<|> ((Epoch -> Paged -> SortOrder -> m [BlockHash])
                             :<|> ((Epoch -> PoolId -> Paged -> SortOrder -> m [BlockHash])
                                   :<|> (Epoch -> m ProtocolParams)))))
                :<|> m Genesis)))
   :<|> ((((Paged -> SortOrder -> m [TxMeta])
           :<|> ((Text -> Paged -> SortOrder -> m [TxMetaJSON])
                 :<|> (Text -> Paged -> SortOrder -> m [TxMetaCBOR])))
          :<|> (m Network
                :<|> ((((Paged -> SortOrder -> m [PoolId])
                        :<|> (Paged -> SortOrder -> m [PoolEpoch]))
                       :<|> ((Paged -> SortOrder -> m [PoolEpoch])
                             :<|> ((PoolId -> m PoolInfo)
                                   :<|> (PoolId -> Paged -> SortOrder -> m [PoolHistory]))))
                      :<|> (((PoolId -> m (Maybe PoolMetadata))
                             :<|> (PoolId -> m [PoolRelay]))
                            :<|> ((PoolId -> Paged -> SortOrder -> m [PoolDelegator])
                                  :<|> ((PoolId -> Paged -> SortOrder -> m [BlockHash])
                                        :<|> (PoolId -> Paged -> SortOrder -> m [PoolUpdate])))))))
         :<|> ((((Paged -> SortOrder -> m [ScriptHash])
                 :<|> ((ScriptHash -> m Script)
                       :<|> (ScriptHash -> Paged -> SortOrder -> m [ScriptRedeemer])))
                :<|> ((DatumHash -> m ScriptDatum)
                      :<|> ((ScriptHash -> m ScriptJSON)
                            :<|> (ScriptHash -> m ScriptCBOR))))
               :<|> (((((TxHash -> m Transaction)
                        :<|> (TxHash -> m TransactionUtxos))
                       :<|> ((TxHash -> m [TransactionRedeemer])
                             :<|> ((TxHash -> m [TransactionStake])
                                   :<|> (TxHash -> m [TransactionDelegation]))))
                      :<|> (((TxHash -> m [TransactionWithdrawal])
                             :<|> ((TxHash -> m [TransactionMir])
                                   :<|> (TxHash -> m [TransactionPoolUpdate])))
                            :<|> ((TxHash -> m [TransactionPoolRetiring])
                                  :<|> ((TxHash -> m [TransactionMetaJSON])
                                        :<|> (TxHash -> m [TransactionMetaCBOR])))))
                     :<|> (CBORString -> m TxHash))))
forall route.
BlockfrostV0API route -> route :- ToServantApi CardanoAPI
_cardano (BlockfrostV0API (AsClientT m)
 -> ((((((Address -> m AccountInfo)
         :<|> (Address -> Paged -> SortOrder -> m [AccountReward]))
        :<|> ((Address -> Paged -> SortOrder -> m [AccountHistory])
              :<|> (Address -> Paged -> SortOrder -> m [AccountDelegation])))
       :<|> (((Address -> Paged -> SortOrder -> m [AccountRegistration])
              :<|> (Address -> Paged -> SortOrder -> m [AccountWithdrawal]))
             :<|> ((Address -> Paged -> SortOrder -> m [AccountMir])
                   :<|> ((Address -> Paged -> SortOrder -> m [AddressAssociated])
                         :<|> (Address -> Paged -> SortOrder -> m [Amount])))))
      :<|> ((((Address -> m AddressInfo)
              :<|> (Address -> m AddressDetails))
             :<|> ((Address -> Paged -> SortOrder -> m [AddressUtxo])
                   :<|> ((Address -> AssetId -> Paged -> SortOrder -> m [AddressUtxo])
                         :<|> (Address
                               -> Paged
                               -> SortOrder
                               -> Maybe BlockIndex
                               -> Maybe BlockIndex
                               -> m [AddressTransaction]))))
            :<|> (((Paged -> SortOrder -> m [AssetInfo])
                   :<|> ((AssetId -> m AssetDetails)
                         :<|> (AssetId -> Paged -> SortOrder -> m [AssetHistory])))
                  :<|> ((AssetId -> Paged -> SortOrder -> m [AssetTransaction])
                        :<|> ((AssetId -> Paged -> SortOrder -> m [AssetAddress])
                              :<|> (PolicyId -> Paged -> SortOrder -> m [AssetInfo]))))))
     :<|> ((((m Block :<|> (Paged -> SortOrder -> m [TxHash]))
             :<|> ((Either Integer BlockHash -> m Block)
                   :<|> (Slot -> m Block)))
            :<|> (((Epoch -> Slot -> m Block)
                   :<|> (Either Integer BlockHash -> Paged -> m [Block]))
                  :<|> ((Either Integer BlockHash -> Paged -> m [Block])
                        :<|> (Either Integer BlockHash
                              -> Paged -> SortOrder -> m [TxHash]))))
           :<|> ((((m EpochInfo :<|> m ProtocolParams)
                   :<|> ((Epoch -> m EpochInfo)
                         :<|> ((Epoch -> Paged -> m [EpochInfo])
                               :<|> (Epoch -> Paged -> m [EpochInfo]))))
                  :<|> (((Epoch -> Paged -> m [StakeDistribution])
                         :<|> (Epoch -> PoolId -> Paged -> m [StakeDistribution]))
                        :<|> ((Epoch -> Paged -> SortOrder -> m [BlockHash])
                              :<|> ((Epoch -> PoolId -> Paged -> SortOrder -> m [BlockHash])
                                    :<|> (Epoch -> m ProtocolParams)))))
                 :<|> m Genesis)))
    :<|> ((((Paged -> SortOrder -> m [TxMeta])
            :<|> ((Text -> Paged -> SortOrder -> m [TxMetaJSON])
                  :<|> (Text -> Paged -> SortOrder -> m [TxMetaCBOR])))
           :<|> (m Network
                 :<|> ((((Paged -> SortOrder -> m [PoolId])
                         :<|> (Paged -> SortOrder -> m [PoolEpoch]))
                        :<|> ((Paged -> SortOrder -> m [PoolEpoch])
                              :<|> ((PoolId -> m PoolInfo)
                                    :<|> (PoolId -> Paged -> SortOrder -> m [PoolHistory]))))
                       :<|> (((PoolId -> m (Maybe PoolMetadata))
                              :<|> (PoolId -> m [PoolRelay]))
                             :<|> ((PoolId -> Paged -> SortOrder -> m [PoolDelegator])
                                   :<|> ((PoolId -> Paged -> SortOrder -> m [BlockHash])
                                         :<|> (PoolId -> Paged -> SortOrder -> m [PoolUpdate])))))))
          :<|> ((((Paged -> SortOrder -> m [ScriptHash])
                  :<|> ((ScriptHash -> m Script)
                        :<|> (ScriptHash -> Paged -> SortOrder -> m [ScriptRedeemer])))
                 :<|> ((DatumHash -> m ScriptDatum)
                       :<|> ((ScriptHash -> m ScriptJSON)
                             :<|> (ScriptHash -> m ScriptCBOR))))
                :<|> (((((TxHash -> m Transaction)
                         :<|> (TxHash -> m TransactionUtxos))
                        :<|> ((TxHash -> m [TransactionRedeemer])
                              :<|> ((TxHash -> m [TransactionStake])
                                    :<|> (TxHash -> m [TransactionDelegation]))))
                       :<|> (((TxHash -> m [TransactionWithdrawal])
                              :<|> ((TxHash -> m [TransactionMir])
                                    :<|> (TxHash -> m [TransactionPoolUpdate])))
                             :<|> ((TxHash -> m [TransactionPoolRetiring])
                                   :<|> ((TxHash -> m [TransactionMetaJSON])
                                         :<|> (TxHash -> m [TransactionMetaCBOR])))))
                      :<|> (CBORString -> m TxHash)))))
-> (Project -> BlockfrostV0API (AsClientT m))
-> Project
-> ((((((Address -> m AccountInfo)
        :<|> (Address -> Paged -> SortOrder -> m [AccountReward]))
       :<|> ((Address -> Paged -> SortOrder -> m [AccountHistory])
             :<|> (Address -> Paged -> SortOrder -> m [AccountDelegation])))
      :<|> (((Address -> Paged -> SortOrder -> m [AccountRegistration])
             :<|> (Address -> Paged -> SortOrder -> m [AccountWithdrawal]))
            :<|> ((Address -> Paged -> SortOrder -> m [AccountMir])
                  :<|> ((Address -> Paged -> SortOrder -> m [AddressAssociated])
                        :<|> (Address -> Paged -> SortOrder -> m [Amount])))))
     :<|> ((((Address -> m AddressInfo)
             :<|> (Address -> m AddressDetails))
            :<|> ((Address -> Paged -> SortOrder -> m [AddressUtxo])
                  :<|> ((Address -> AssetId -> Paged -> SortOrder -> m [AddressUtxo])
                        :<|> (Address
                              -> Paged
                              -> SortOrder
                              -> Maybe BlockIndex
                              -> Maybe BlockIndex
                              -> m [AddressTransaction]))))
           :<|> (((Paged -> SortOrder -> m [AssetInfo])
                  :<|> ((AssetId -> m AssetDetails)
                        :<|> (AssetId -> Paged -> SortOrder -> m [AssetHistory])))
                 :<|> ((AssetId -> Paged -> SortOrder -> m [AssetTransaction])
                       :<|> ((AssetId -> Paged -> SortOrder -> m [AssetAddress])
                             :<|> (PolicyId -> Paged -> SortOrder -> m [AssetInfo]))))))
    :<|> ((((m Block :<|> (Paged -> SortOrder -> m [TxHash]))
            :<|> ((Either Integer BlockHash -> m Block)
                  :<|> (Slot -> m Block)))
           :<|> (((Epoch -> Slot -> m Block)
                  :<|> (Either Integer BlockHash -> Paged -> m [Block]))
                 :<|> ((Either Integer BlockHash -> Paged -> m [Block])
                       :<|> (Either Integer BlockHash
                             -> Paged -> SortOrder -> m [TxHash]))))
          :<|> ((((m EpochInfo :<|> m ProtocolParams)
                  :<|> ((Epoch -> m EpochInfo)
                        :<|> ((Epoch -> Paged -> m [EpochInfo])
                              :<|> (Epoch -> Paged -> m [EpochInfo]))))
                 :<|> (((Epoch -> Paged -> m [StakeDistribution])
                        :<|> (Epoch -> PoolId -> Paged -> m [StakeDistribution]))
                       :<|> ((Epoch -> Paged -> SortOrder -> m [BlockHash])
                             :<|> ((Epoch -> PoolId -> Paged -> SortOrder -> m [BlockHash])
                                   :<|> (Epoch -> m ProtocolParams)))))
                :<|> m Genesis)))
   :<|> ((((Paged -> SortOrder -> m [TxMeta])
           :<|> ((Text -> Paged -> SortOrder -> m [TxMetaJSON])
                 :<|> (Text -> Paged -> SortOrder -> m [TxMetaCBOR])))
          :<|> (m Network
                :<|> ((((Paged -> SortOrder -> m [PoolId])
                        :<|> (Paged -> SortOrder -> m [PoolEpoch]))
                       :<|> ((Paged -> SortOrder -> m [PoolEpoch])
                             :<|> ((PoolId -> m PoolInfo)
                                   :<|> (PoolId -> Paged -> SortOrder -> m [PoolHistory]))))
                      :<|> (((PoolId -> m (Maybe PoolMetadata))
                             :<|> (PoolId -> m [PoolRelay]))
                            :<|> ((PoolId -> Paged -> SortOrder -> m [PoolDelegator])
                                  :<|> ((PoolId -> Paged -> SortOrder -> m [BlockHash])
                                        :<|> (PoolId -> Paged -> SortOrder -> m [PoolUpdate])))))))
         :<|> ((((Paged -> SortOrder -> m [ScriptHash])
                 :<|> ((ScriptHash -> m Script)
                       :<|> (ScriptHash -> Paged -> SortOrder -> m [ScriptRedeemer])))
                :<|> ((DatumHash -> m ScriptDatum)
                      :<|> ((ScriptHash -> m ScriptJSON)
                            :<|> (ScriptHash -> m ScriptCBOR))))
               :<|> (((((TxHash -> m Transaction)
                        :<|> (TxHash -> m TransactionUtxos))
                       :<|> ((TxHash -> m [TransactionRedeemer])
                             :<|> ((TxHash -> m [TransactionStake])
                                   :<|> (TxHash -> m [TransactionDelegation]))))
                      :<|> (((TxHash -> m [TransactionWithdrawal])
                             :<|> ((TxHash -> m [TransactionMir])
                                   :<|> (TxHash -> m [TransactionPoolUpdate])))
                            :<|> ((TxHash -> m [TransactionPoolRetiring])
                                  :<|> ((TxHash -> m [TransactionMetaJSON])
                                        :<|> (TxHash -> m [TransactionMetaCBOR])))))
                     :<|> (CBORString -> m TxHash))))
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Project -> BlockfrostV0API (AsClientT m)
forall (m :: * -> *).
MonadBlockfrost m =>
Project -> BlockfrostV0API (AsClientT m)
api0Client

ipfsClient :: MonadBlockfrost m => Project -> IPFSAPI (AsClientT m)
ipfsClient :: Project -> IPFSAPI (AsClientT m)
ipfsClient = ((((ByteString, Form) -> m IPFSAdd)
  :<|> ((Text -> m IPFSData) :<|> (Text -> m IPFSPinChange)))
 :<|> ((Paged -> SortOrder -> m [IPFSPin])
       :<|> ((Text -> m IPFSPin) :<|> (Text -> m IPFSPinChange))))
-> IPFSAPI (AsClientT m)
forall (routes :: * -> *) mode.
GenericServant routes mode =>
ToServant routes mode -> routes mode
fromServant (((((ByteString, Form) -> m IPFSAdd)
   :<|> ((Text -> m IPFSData) :<|> (Text -> m IPFSPinChange)))
  :<|> ((Paged -> SortOrder -> m [IPFSPin])
        :<|> ((Text -> m IPFSPin) :<|> (Text -> m IPFSPinChange))))
 -> IPFSAPI (AsClientT m))
-> (Project
    -> (((ByteString, Form) -> m IPFSAdd)
        :<|> ((Text -> m IPFSData) :<|> (Text -> m IPFSPinChange)))
       :<|> ((Paged -> SortOrder -> m [IPFSPin])
             :<|> ((Text -> m IPFSPin) :<|> (Text -> m IPFSPinChange))))
-> Project
-> IPFSAPI (AsClientT m)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. BlockfrostV0API (AsClientT m)
-> (((ByteString, Form) -> m IPFSAdd)
    :<|> ((Text -> m IPFSData) :<|> (Text -> m IPFSPinChange)))
   :<|> ((Paged -> SortOrder -> m [IPFSPin])
         :<|> ((Text -> m IPFSPin) :<|> (Text -> m IPFSPinChange)))
forall route.
BlockfrostV0API route -> route :- ("ipfs" :> ToServantApi IPFSAPI)
_ipfs (BlockfrostV0API (AsClientT m)
 -> (((ByteString, Form) -> m IPFSAdd)
     :<|> ((Text -> m IPFSData) :<|> (Text -> m IPFSPinChange)))
    :<|> ((Paged -> SortOrder -> m [IPFSPin])
          :<|> ((Text -> m IPFSPin) :<|> (Text -> m IPFSPinChange))))
-> (Project -> BlockfrostV0API (AsClientT m))
-> Project
-> (((ByteString, Form) -> m IPFSAdd)
    :<|> ((Text -> m IPFSData) :<|> (Text -> m IPFSPinChange)))
   :<|> ((Paged -> SortOrder -> m [IPFSPin])
         :<|> ((Text -> m IPFSPin) :<|> (Text -> m IPFSPinChange)))
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Project -> BlockfrostV0API (AsClientT m)
forall (m :: * -> *).
MonadBlockfrost m =>
Project -> BlockfrostV0API (AsClientT m)
api0Client

nutLinkClient :: MonadBlockfrost m => Project -> NutLinkAPI (AsClientT m)
nutLinkClient :: Project -> NutLinkAPI (AsClientT m)
nutLinkClient = (((Address -> m NutlinkAddress)
  :<|> (Address -> Paged -> SortOrder -> m [NutlinkAddressTicker]))
 :<|> ((Address -> Text -> Paged -> SortOrder -> m [NutlinkTicker])
       :<|> (Text -> Paged -> SortOrder -> m [(Address, NutlinkTicker)])))
-> NutLinkAPI (AsClientT m)
forall (routes :: * -> *) mode.
GenericServant routes mode =>
ToServant routes mode -> routes mode
fromServant ((((Address -> m NutlinkAddress)
   :<|> (Address -> Paged -> SortOrder -> m [NutlinkAddressTicker]))
  :<|> ((Address -> Text -> Paged -> SortOrder -> m [NutlinkTicker])
        :<|> (Text -> Paged -> SortOrder -> m [(Address, NutlinkTicker)])))
 -> NutLinkAPI (AsClientT m))
-> (Project
    -> ((Address -> m NutlinkAddress)
        :<|> (Address -> Paged -> SortOrder -> m [NutlinkAddressTicker]))
       :<|> ((Address -> Text -> Paged -> SortOrder -> m [NutlinkTicker])
             :<|> (Text -> Paged -> SortOrder -> m [(Address, NutlinkTicker)])))
-> Project
-> NutLinkAPI (AsClientT m)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. BlockfrostV0API (AsClientT m)
-> ((Address -> m NutlinkAddress)
    :<|> (Address -> Paged -> SortOrder -> m [NutlinkAddressTicker]))
   :<|> ((Address -> Text -> Paged -> SortOrder -> m [NutlinkTicker])
         :<|> (Text -> Paged -> SortOrder -> m [(Address, NutlinkTicker)]))
forall route.
BlockfrostV0API route
-> route
   :- ("nutlink" :> (Tag "Nut.link" :> ToServantApi NutLinkAPI))
_nutLink (BlockfrostV0API (AsClientT m)
 -> ((Address -> m NutlinkAddress)
     :<|> (Address -> Paged -> SortOrder -> m [NutlinkAddressTicker]))
    :<|> ((Address -> Text -> Paged -> SortOrder -> m [NutlinkTicker])
          :<|> (Text -> Paged -> SortOrder -> m [(Address, NutlinkTicker)])))
-> (Project -> BlockfrostV0API (AsClientT m))
-> Project
-> ((Address -> m NutlinkAddress)
    :<|> (Address -> Paged -> SortOrder -> m [NutlinkAddressTicker]))
   :<|> ((Address -> Text -> Paged -> SortOrder -> m [NutlinkTicker])
         :<|> (Text -> Paged -> SortOrder -> m [(Address, NutlinkTicker)]))
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Project -> BlockfrostV0API (AsClientT m)
forall (m :: * -> *).
MonadBlockfrost m =>
Project -> BlockfrostV0API (AsClientT m)
api0Client