blockfrost-api: API definitions for blockfrost.io

This is a package candidate release! Here you can preview how this package release will appear once published to the main package index (which can be accomplished via the 'maintain' link below). Please note that once a package has been published to the main package index it cannot be undone! Please consult the package uploading documentation for more information.

[maintain] [Publish]

Warnings:

Core types and Servant API description


[Skip to Readme]

Properties

Versions 0.1.0.0, 0.2.0.0, 0.2.1.0, 0.3.0.0, 0.3.1.0, 0.4.0.0, 0.4.0.1, 0.5.0.0, 0.5.0.0, 0.6.0.0, 0.7.0.0, 0.7.1.0, 0.8.0.0, 0.8.1.0, 0.9.0.0, 0.10.0.0, 0.11.0.0, 0.12.0.0, 0.12.1.0
Change log CHANGELOG.md
Dependencies aeson, base (>=4.7 && <5), bytestring, data-default-class, deriving-aeson, lens (>=5.0 && <5.1), QuickCheck, quickcheck-instances, safe-money (>=0.9 && <0.10), servant (>=0.18 && <0.20), servant-docs, servant-multipart-api, template-haskell, text, time, vector [details]
License Apache-2.0
Copyright 2021 blockfrost.io
Author blockfrost.io
Maintainer srk@48.io
Category Cardano
Home page https://github.com/blockfrost/blockfrost-haskell
Source repo head: git clone https://github.com/blockfrost/blockfrost-haskell
Uploaded by srk at 2022-06-06T09:21:55Z

Modules

[Index] [Quick Jump]

Flags

Manual Flags

NameDescriptionDefault
production

Production build

Disabled
Automatic Flags
NameDescriptionDefault
buildfast

Turn off optimizations

Enabled

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

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees


Readme for blockfrost-api-0.5.0.0

[back to package description]

blockfrost-api

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"

Lenses

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)