module Blockfrost.Client.Cardano.Blocks
( getLatestBlock
, getLatestBlockTxs
, getLatestBlockTxs'
, getBlock
, getBlockSlot
, getBlockEpochSlot
, getNextBlocks
, getNextBlocks'
, getPreviousBlocks
, getPreviousBlocks'
, getBlockTxs
, getBlockTxs'
, getBlockAffectedAddresses'
, getBlockAffectedAddresses
) where
import Blockfrost.API
import Blockfrost.Client.Types
import Blockfrost.Types
blocksClient :: MonadBlockfrost m => Project -> BlocksAPI (AsClientT m)
blocksClient :: forall (m :: * -> *).
MonadBlockfrost m =>
Project -> BlocksAPI (AsClientT m)
blocksClient = forall (routes :: * -> *) mode.
GenericServant routes mode =>
ToServant routes mode -> routes mode
fromServant forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall route.
CardanoAPI route
-> route
:- ("blocks"
:> (Tag "Cardano \187 Blocks" :> ToServantApi BlocksAPI))
_blocks forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (m :: * -> *).
MonadBlockfrost m =>
Project -> CardanoAPI (AsClientT m)
cardanoClient
getLatestBlock_ :: MonadBlockfrost m => Project -> m Block
getLatestBlock_ :: forall (m :: * -> *). MonadBlockfrost m => Project -> m Block
getLatestBlock_ = forall route.
BlocksAPI route
-> route
:- (Summary "Latest block"
:> (Description
"Return the latest block available to the backends, also known as the tip of the blockchain."
:> ("latest" :> Get '[JSON] Block)))
_latest forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (m :: * -> *).
MonadBlockfrost m =>
Project -> BlocksAPI (AsClientT m)
blocksClient
getLatestBlock :: MonadBlockfrost m => m Block
getLatestBlock :: forall (m :: * -> *). MonadBlockfrost m => m Block
getLatestBlock = forall (m :: * -> *) a.
MonadBlockfrost m =>
(Project -> m a) -> m a
go forall (m :: * -> *). MonadBlockfrost m => Project -> m Block
getLatestBlock_
getLatestBlockTxs_ :: MonadBlockfrost m => Project -> Paged -> SortOrder -> m [TxHash]
getLatestBlockTxs_ :: forall (m :: * -> *).
MonadBlockfrost m =>
Project -> Paged -> SortOrder -> m [TxHash]
getLatestBlockTxs_ = forall route.
BlocksAPI route
-> route
:- (Summary "Latest block transactions"
:> (Description "Return the transactions within the latest block."
:> ("latest"
:> ("txs" :> (Pagination :> (Sorting :> Get '[JSON] [TxHash]))))))
_latestTxs forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (m :: * -> *).
MonadBlockfrost m =>
Project -> BlocksAPI (AsClientT m)
blocksClient
getLatestBlockTxs' :: MonadBlockfrost m => Paged -> SortOrder -> m [TxHash]
getLatestBlockTxs' :: forall (m :: * -> *).
MonadBlockfrost m =>
Paged -> SortOrder -> m [TxHash]
getLatestBlockTxs' Paged
pg SortOrder
s = forall (m :: * -> *) a.
MonadBlockfrost m =>
(Project -> m a) -> m a
go (\Project
p -> forall (m :: * -> *).
MonadBlockfrost m =>
Project -> Paged -> SortOrder -> m [TxHash]
getLatestBlockTxs_ Project
p Paged
pg SortOrder
s)
getLatestBlockTxs :: MonadBlockfrost m => m [TxHash]
getLatestBlockTxs :: forall (m :: * -> *). MonadBlockfrost m => m [TxHash]
getLatestBlockTxs = forall (m :: * -> *).
MonadBlockfrost m =>
Paged -> SortOrder -> m [TxHash]
getLatestBlockTxs' forall a. Default a => a
def forall a. Default a => a
def
getBlock_ :: MonadBlockfrost m => Project -> Either Integer BlockHash -> m Block
getBlock_ :: forall (m :: * -> *).
MonadBlockfrost m =>
Project -> Either Integer BlockHash -> m Block
getBlock_ = forall route.
BlocksAPI route
-> route
:- (Summary "Latest block transactions"
:> (Description "Return the transactions within the latest block."
:> (Capture "hash_or_number" (Either Integer BlockHash)
:> Get '[JSON] Block)))
_block forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (m :: * -> *).
MonadBlockfrost m =>
Project -> BlocksAPI (AsClientT m)
blocksClient
getBlock :: MonadBlockfrost m => Either Integer BlockHash -> m Block
getBlock :: forall (m :: * -> *).
MonadBlockfrost m =>
Either Integer BlockHash -> m Block
getBlock Either Integer BlockHash
a = forall (m :: * -> *) a.
MonadBlockfrost m =>
(Project -> m a) -> m a
go (forall (m :: * -> *).
MonadBlockfrost m =>
Project -> Either Integer BlockHash -> m Block
`getBlock_` Either Integer BlockHash
a)
getBlockSlot_ :: MonadBlockfrost m => Project -> Slot -> m Block
getBlockSlot_ :: forall (m :: * -> *).
MonadBlockfrost m =>
Project -> Slot -> m Block
getBlockSlot_ = forall route.
BlocksAPI route
-> route
:- (Summary "Specific block in a slot"
:> (Description
"Return the content of a requested block for a specific slot."
:> ("slot" :> (Capture "slot_number" Slot :> Get '[JSON] Block))))
__blockSlot forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (m :: * -> *).
MonadBlockfrost m =>
Project -> BlocksAPI (AsClientT m)
blocksClient
getBlockSlot :: MonadBlockfrost m => Slot -> m Block
getBlockSlot :: forall (m :: * -> *). MonadBlockfrost m => Slot -> m Block
getBlockSlot Slot
i = forall (m :: * -> *) a.
MonadBlockfrost m =>
(Project -> m a) -> m a
go (forall (m :: * -> *).
MonadBlockfrost m =>
Project -> Slot -> m Block
`getBlockSlot_` Slot
i)
getBlockEpochSlot_ :: MonadBlockfrost m => Project -> Epoch -> Slot -> m Block
getBlockEpochSlot_ :: forall (m :: * -> *).
MonadBlockfrost m =>
Project -> Epoch -> Slot -> m Block
getBlockEpochSlot_ = forall route.
BlocksAPI route
-> route
:- (Summary "Specific block in a slot in an epoch"
:> (Description
"Return the content of a requested block for a specific slot in an epoch."
:> ("epoch"
:> (Capture "epoch_number" Epoch
:> ("slot"
:> (Capture "slot_number" Slot :> Get '[JSON] Block))))))
__blockEpochSlot forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (m :: * -> *).
MonadBlockfrost m =>
Project -> BlocksAPI (AsClientT m)
blocksClient
getBlockEpochSlot :: MonadBlockfrost m => Epoch -> Slot -> m Block
getBlockEpochSlot :: forall (m :: * -> *). MonadBlockfrost m => Epoch -> Slot -> m Block
getBlockEpochSlot Epoch
ep Slot
sl = forall (m :: * -> *) a.
MonadBlockfrost m =>
(Project -> m a) -> m a
go (\Project
p -> forall (m :: * -> *).
MonadBlockfrost m =>
Project -> Epoch -> Slot -> m Block
getBlockEpochSlot_ Project
p Epoch
ep Slot
sl)
getNextBlocks_ :: MonadBlockfrost m => Project -> Either Integer BlockHash -> Paged -> m [Block]
getNextBlocks_ :: forall (m :: * -> *).
MonadBlockfrost m =>
Project -> Either Integer BlockHash -> Paged -> m [Block]
getNextBlocks_ = forall route.
BlocksAPI route
-> route
:- (Summary "Listing of next blocks"
:> (Description
"Return the list of blocks following a specific block."
:> (Capture "hash_or_number" (Either Integer BlockHash)
:> ("next" :> (Pagination :> Get '[JSON] [Block])))))
_blockNext forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (m :: * -> *).
MonadBlockfrost m =>
Project -> BlocksAPI (AsClientT m)
blocksClient
getNextBlocks' :: MonadBlockfrost m => Either Integer BlockHash -> Paged -> m [Block]
getNextBlocks' :: forall (m :: * -> *).
MonadBlockfrost m =>
Either Integer BlockHash -> Paged -> m [Block]
getNextBlocks' Either Integer BlockHash
a Paged
pg = forall (m :: * -> *) a.
MonadBlockfrost m =>
(Project -> m a) -> m a
go (\Project
p -> forall (m :: * -> *).
MonadBlockfrost m =>
Project -> Either Integer BlockHash -> Paged -> m [Block]
getNextBlocks_ Project
p Either Integer BlockHash
a Paged
pg)
getNextBlocks :: MonadBlockfrost m => Either Integer BlockHash -> m [Block]
getNextBlocks :: forall (m :: * -> *).
MonadBlockfrost m =>
Either Integer BlockHash -> m [Block]
getNextBlocks Either Integer BlockHash
a = forall (m :: * -> *).
MonadBlockfrost m =>
Either Integer BlockHash -> Paged -> m [Block]
getNextBlocks' Either Integer BlockHash
a forall a. Default a => a
def
getPreviousBlocks_ :: MonadBlockfrost m => Project -> Either Integer BlockHash -> Paged -> m [Block]
getPreviousBlocks_ :: forall (m :: * -> *).
MonadBlockfrost m =>
Project -> Either Integer BlockHash -> Paged -> m [Block]
getPreviousBlocks_ = forall route.
BlocksAPI route
-> route
:- (Summary "Listing of preious blocks"
:> (Description
"Return the list of blocks preceeding a specific block."
:> (Capture "hash_or_number" (Either Integer BlockHash)
:> ("previous" :> (Pagination :> Get '[JSON] [Block])))))
_blockPrevious forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (m :: * -> *).
MonadBlockfrost m =>
Project -> BlocksAPI (AsClientT m)
blocksClient
getPreviousBlocks' :: MonadBlockfrost m => Either Integer BlockHash -> Paged -> m [Block]
getPreviousBlocks' :: forall (m :: * -> *).
MonadBlockfrost m =>
Either Integer BlockHash -> Paged -> m [Block]
getPreviousBlocks' Either Integer BlockHash
a Paged
pg = forall (m :: * -> *) a.
MonadBlockfrost m =>
(Project -> m a) -> m a
go (\Project
p -> forall (m :: * -> *).
MonadBlockfrost m =>
Project -> Either Integer BlockHash -> Paged -> m [Block]
getPreviousBlocks_ Project
p Either Integer BlockHash
a Paged
pg)
getPreviousBlocks :: MonadBlockfrost m => Either Integer BlockHash -> m [Block]
getPreviousBlocks :: forall (m :: * -> *).
MonadBlockfrost m =>
Either Integer BlockHash -> m [Block]
getPreviousBlocks Either Integer BlockHash
a = forall (m :: * -> *).
MonadBlockfrost m =>
Either Integer BlockHash -> Paged -> m [Block]
getPreviousBlocks' Either Integer BlockHash
a forall a. Default a => a
def
getBlockTxs_ :: MonadBlockfrost m => Project -> Either Integer BlockHash -> Paged -> SortOrder -> m [TxHash]
getBlockTxs_ :: forall (m :: * -> *).
MonadBlockfrost m =>
Project
-> Either Integer BlockHash -> Paged -> SortOrder -> m [TxHash]
getBlockTxs_ = forall route.
BlocksAPI route
-> route
:- (Summary "Block transactions"
:> (Description "Return the transactions within the block."
:> (Capture "hash_or_number" (Either Integer BlockHash)
:> ("txs" :> (Pagination :> (Sorting :> Get '[JSON] [TxHash]))))))
_blockTxs forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (m :: * -> *).
MonadBlockfrost m =>
Project -> BlocksAPI (AsClientT m)
blocksClient
getBlockTxs' :: MonadBlockfrost m => Either Integer BlockHash -> Paged -> SortOrder -> m [TxHash]
getBlockTxs' :: forall (m :: * -> *).
MonadBlockfrost m =>
Either Integer BlockHash -> Paged -> SortOrder -> m [TxHash]
getBlockTxs' Either Integer BlockHash
a Paged
pg SortOrder
s = forall (m :: * -> *) a.
MonadBlockfrost m =>
(Project -> m a) -> m a
go (\Project
p -> forall (m :: * -> *).
MonadBlockfrost m =>
Project
-> Either Integer BlockHash -> Paged -> SortOrder -> m [TxHash]
getBlockTxs_ Project
p Either Integer BlockHash
a Paged
pg SortOrder
s)
getBlockTxs :: MonadBlockfrost m => Either Integer BlockHash -> m [TxHash]
getBlockTxs :: forall (m :: * -> *).
MonadBlockfrost m =>
Either Integer BlockHash -> m [TxHash]
getBlockTxs Either Integer BlockHash
a = forall (m :: * -> *).
MonadBlockfrost m =>
Either Integer BlockHash -> Paged -> SortOrder -> m [TxHash]
getBlockTxs' Either Integer BlockHash
a forall a. Default a => a
def forall a. Default a => a
def
getBlockAffectedAddresses_ :: MonadBlockfrost m => Project -> Either Integer BlockHash -> Paged -> m [(Address, [TxHash])]
getBlockAffectedAddresses_ :: forall (m :: * -> *).
MonadBlockfrost m =>
Project
-> Either Integer BlockHash -> Paged -> m [(Address, [TxHash])]
getBlockAffectedAddresses_ = forall route.
BlocksAPI route
-> route
:- (Summary "Addresses affected in a specific block"
:> (Description
"Return list of addresses affected in the specified block with additional information, sorted by the bech32 address, ascending."
:> (Capture "hash_or_number" (Either Integer BlockHash)
:> ("addresses"
:> (Pagination :> Get '[JSON] [(Address, [TxHash])])))))
_blockAffectedAddresses forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (m :: * -> *).
MonadBlockfrost m =>
Project -> BlocksAPI (AsClientT m)
blocksClient
getBlockAffectedAddresses' :: MonadBlockfrost m => Either Integer BlockHash -> Paged -> m [(Address, [TxHash])]
getBlockAffectedAddresses' :: forall (m :: * -> *).
MonadBlockfrost m =>
Either Integer BlockHash -> Paged -> m [(Address, [TxHash])]
getBlockAffectedAddresses' Either Integer BlockHash
a Paged
pg = forall (m :: * -> *) a.
MonadBlockfrost m =>
(Project -> m a) -> m a
go (\Project
p -> forall (m :: * -> *).
MonadBlockfrost m =>
Project
-> Either Integer BlockHash -> Paged -> m [(Address, [TxHash])]
getBlockAffectedAddresses_ Project
p Either Integer BlockHash
a Paged
pg)
getBlockAffectedAddresses :: MonadBlockfrost m => Either Integer BlockHash -> m [(Address, [TxHash])]
getBlockAffectedAddresses :: forall (m :: * -> *).
MonadBlockfrost m =>
Either Integer BlockHash -> m [(Address, [TxHash])]
getBlockAffectedAddresses Either Integer BlockHash
a = forall (m :: * -> *).
MonadBlockfrost m =>
Either Integer BlockHash -> Paged -> m [(Address, [TxHash])]
getBlockAffectedAddresses' Either Integer BlockHash
a forall a. Default a => a
def