blockfrost-api: API definitions for

[ apache, library, web ] [ Propose Tags ]

Core types and Servant API description

[Skip to Readme]
Versions [RSS] [faq]
Change log
Dependencies aeson, base (>=4.7 && <5), bytestring, data-default-class, deriving-aeson, lens, QuickCheck, quickcheck-instances, safe-money, servant (==0.18.*), servant-docs, servant-multipart-api, template-haskell, text, time [details]
License Apache-2.0
Copyright 2021
Category Web
Home page
Source repo head: git clone
Uploaded by srk at 2021-09-14T12:23:24Z
Distributions NixOS:
Downloads 32 total (5 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Hackage Matrix CI
Docs available [build log]
Last success reported on 2021-09-14 [all 1 reports]


[Index] [Quick Jump]

Manual Flags


Production build

Automatic Flags

Turn off optimizations


Use -f <flag> to enable a flag, or -f -<flag> to disable that flag. More info


Maintainer's Corner

For package maintainers and hackage trustees


Readme for blockfrost-api-

[back to package description]


Core types and Servant API definitions.

Exploring data types

All data types have a ToSample instance for servant-docs which can be used to get a sample response in cabal repl:

λ: import Data.Proxy
λ: import Servant.Docs
λ: Just block = toSample (Proxy :: Proxy Block)
λ: _blockHash block
BlockHash "4ea1ba291e8eef538635a53e59fddba7810d1679631cc3aed7c8e6c4091a516a"


Instead of using long record names, it is recommended to use provided lenses and a lens or similar package.

λ: import Control.Lens (^.)
λ: import Blockfrost.Lens
λ: block ^. epoch
Just (Epoch 425)

Monetary values

Ada values and values of assets are represented using Discrete type from safe-money library.

We use a type alias type Lovelaces = Money.Discrete "ADA" "lovelace" for Ada values and SomeDiscrete for asset values. This should allow working with monetary values safely, preventing summing different currencies. See the blog post by the library author.

λ: block ^. fees
Just (Discrete "ADA" 1000000%1 592661)