module Blockfrost

Included Modules

Extended Modules

Defined in:

blockfrost/converters/int128_from_string.cr
blockfrost/converters/int32_from_string.cr
blockfrost/converters/time_from_int.cr
blockfrost/converters/time_ms_from_int.cr
blockfrost/exception.cr
blockfrost/macros.cr
blockfrost/settings.cr:1
blockfrost/settings.cr:22
blockfrost/types.cr
blockfrost/version.cr

Constant Summary

DEFAULT_API_COUNT_PER_PAGE = 100
DEFAULT_API_ORDER = Blockfrost::QueryOrder::ASC
HABITAT_SETTINGS = [{decl: cardano_api_key : String | ::Nil, example: nil, validation: :validate_cardano_api_key}, {decl: cardano_api_version : String = "v0", example: nil, validation: :validate_api_version}, {decl: ipfs_api_key : String | ::Nil, example: nil, validation: :validate_ipfs_api_key}, {decl: ipfs_api_version : String = "v0", example: nil, validation: :validate_api_version}, {decl: default_order : QueryOrder | ::Nil = nil, example: nil, validation: nil}, {decl: default_count_per_page : Int32 | ::Nil = nil, example: nil, validation: :validate_count_per_page}, {decl: retries_in_concurrent_requests : Int32 = 5, example: nil, validation: :validate_retries_in_concurrent_requests}, {decl: sleep_between_retries_ms : Int32 = 500, example: nil, validation: :validate_sleep_between_retries_ms}] of Nil
MAX_COUNT_PER_PAGE = 100
MAX_NUMBER_OF_CONCURRENT_REQUESTS = 200
MAX_PAGINATION_PAGES = 21474836
MAX_RETRIES_IN_CONCURRENT_REQUESTS = 10
VERSION = "0.4.0"

Class Method Summary

Instance Method Summary

Macro Summary

Class Method Detail

def self.configure(&) #

[View source]
def self.settings #

[View source]

Instance Method Detail

def api_key_for_path(path : String) : String #

[View source]
def api_version_for_path(path : String) : String #

[View source]
def cardano_mainnet? : Bool #

[View source]
def cardano_network : String #

[View source]
def cardano_preprod? : Bool #

[View source]
def cardano_preview? : Bool #

[View source]
def cardano_testnet? : Bool #

[View source]
def host_for_path(path : String) : String #

[View source]
def settings #

[View source]
def validate_api_version(value : String) #

[View source]
def validate_cardano_api_key(value : String?) #

[View source]
def validate_count_per_page(value : Int32?) #

[View source]
def validate_default_order(value : QueryOrder | String?) #

[View source]
def validate_ipfs_api_key(value : String?) #

[View source]
def validate_retries_in_concurrent_requests(value : Int32) #

[View source]
def validate_sleep_between_retries_ms(value : Int32) #

[View source]

Macro Detail

macro enum_castable_from_string(name, types, stringify = underscore) #

[View source]
macro gets_all_scoped_with_order_and_pagination(method_name, return_type, resource_path, argument_type_declaration, scope_argument_type_declaration) #

[View source]
macro gets_all_scoped_with_pagination(method_name, return_type, resource_path, argument_type_declaration, scope_argument_type_declaration) #

[View source]
macro gets_all_with_order_and_pagination(method_name, return_type, resource_path, argument_type_declaration = nil) #

[View source]
macro gets_all_with_order_and_pagination_and_from_to(method_name, return_type, resource_path, argument_type_declaration = nil) #

[View source]
macro gets_all_with_pagination(method_name, return_type, resource_path, argument_type_declaration) #

[View source]
macro within_page_range(pages, return_type, method_name, method_arguments) #

The Blockfrost API imposes a limit of 100 records per page for a single request. This macro allows fetching multiple pages concurrently. It then concatenates all results in the correct order and returns an array of records as if fetched in one go.

It also handles all possible exceptions. If the account is temporarily rate-limited, it will retry several times, as defined by the retries_in_concurrent_requests setting. All other exceptions will cause immediate failure by raising the first encountered exception.


[View source]