module

Blockfrost

Inherits Habitat::SettingsHelpers < Habitat::TempConfig

Constants

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 = {{ (`shards version \"/tmp/tmp.cBIeFi/src/src/blockfrost\"`).chomp.stringify }}

Class methods

configure
Source
settings
Source

Instance methods

api_key_for_path(path : String) : String
Source
api_version_for_path(path : String) : String
Source
cardano_mainnet?
Source
cardano_network
Source
cardano_preprod?
Source
cardano_preview?
Source
cardano_testnet?
Source
host_for_path(path : String) : String
Source
settings
Source
validate_api_version(value : String)
Source
validate_cardano_api_key(value : String | Nil)
Source
validate_count_per_page(value : Int32 | Nil)
Source
validate_default_order(value : QueryOrder | String | Nil)
Source
validate_ipfs_api_key(value : String | Nil)
Source
validate_retries_in_concurrent_requests(value : Int32)
Source
validate_sleep_between_retries_ms(value : Int32)
Source

Macros

enum_castable_from_string(name, types, stringify = underscore)
Source
gets_all_scoped_with_order_and_pagination(method_name, return_type, resource_path, argument_type_declaration, scope_argument_type_declaration)
Source
gets_all_scoped_with_pagination(method_name, return_type, resource_path, argument_type_declaration, scope_argument_type_declaration)
Source
gets_all_with_order_and_pagination(method_name, return_type, resource_path, argument_type_declaration = nil)
Source
gets_all_with_order_and_pagination_and_from_to(method_name, return_type, resource_path, argument_type_declaration = nil)
Source
gets_all_with_pagination(method_name, return_type, resource_path, argument_type_declaration)
Source
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.

Source

Nested types