blockfrost-elixir

Installation

To install, add in your mix dependencies:

{:blockfrost, "~> 0.2"}

Run mix deps.get and see the usage section on more information about how to start using it.

Usage

Blockfrost is an Elixir client for the Blockfrost API.

Each client is a supervision tree, and you can start more than one supervision tree if you want to query more than a network or use more than one project.

For example, if you want to start a Cardano main net and an IPFS client:

defmodule MyApp.Application do
  def start(_type, _args) do
    children = [
      {Blockfrost, [
        network: :cardano_mainnet,
        name: CardanoMainNet,
        api_key: System.get_env("CARDANO_API_KEY"),
        retry_enabled?: true,
        retry_max_attempts: 3
      ]},
      {Blockfrost, [
        network: :ipfs,
        name: IPFS,
        api_key: System.get_env("IPFS_API_KEY"),
        retry_enabled?: false
      ]}
    ]

    Supervisor.start_link(children, strategy: :one_for_one, name: MyApp.Supervisor)
  end
end

Then you're ready to use your clients:

{:ok, pools} = Blockfrost.Cardano.Pools.list_of_stake_pools(CardanoMainNet)

Shared Options

Pagination Options

Unless specified otherwise, all Blockfrost functions that support pagination support the following options:

HTTP Options

All Blockfrost API call functions support the following options:

If some of these options is not given, they default to the configured values.