Class BSV::Network::Protocols::Chaintracks ¶
Inherits: BSV::Network::Protocol
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' => '...' }
Public Instance Methods¶
initialize(base_url:, api_key: = nil, http_client: = nil) ¶
- @param
base_url[String] base URL for the Chaintracks API - @param
api_key[String, nil] optional Bearer API key - @param
http_client[Object, nil] injectable HTTP client for testing - @return [Chaintracks] a new instance of Chaintracks