Class: BSV::Network::Protocols::Chaintracks

Inherits:
BSV::Network::Protocol show all
Defined in:
lib/bsv/network/protocols/chaintracks.rb

Overview

Note:

Chaintracks is an internal GorillaPool service; no public API documentation is available.

Chaintracks implements the GorillaPool Chaintracks API as a Protocol subclass.

Provides block header lookup and current chain tip height via the GorillaPool Chaintracks v2 REST API. Pure DSL — no escape hatches needed.

Chaintracks does not use a {network} placeholder in the URL. Mainnet and testnet are served from separate base URLs; the provider defaults supply the correct URL for each network.

Usage

ct = BSV::Network::Protocols::Chaintracks.new(base_url: 'https://arcade.gorillapool.io')
result = ct.call(:current_height)
result.data  # => 800000

result = ct.call(:get_block_header, 800_000)
result.data  # => { 'hash' => '...', 'height' => 800000, 'merkleRoot' => '...' }

Instance Attribute Summary

Attributes inherited from BSV::Network::Protocol

#api_key, #auth, #base_url, #http_client, #network

Instance Method Summary collapse

Methods inherited from BSV::Network::Protocol

#call, commands, #default_call, endpoint, endpoints, inherited, subscription, subscriptions

Constructor Details

#initialize(base_url:, api_key: nil, auth: nil, http_client: nil) ⇒ Chaintracks

Returns a new instance of Chaintracks.

Parameters:

  • base_url (String)

    base URL for the Chaintracks API

  • api_key (String, nil) (defaults to: nil)

    legacy Bearer API key shorthand — use auth: for new code

  • auth (Hash, Symbol, nil) (defaults to: nil)

    auth config; takes precedence over api_key:

  • http_client (Object, nil) (defaults to: nil)

    injectable HTTP client for testing



37
38
39
# File 'lib/bsv/network/protocols/chaintracks.rb', line 37

def initialize(base_url:, api_key: nil, auth: nil, http_client: nil)
  super
end