Class: BSV::Network::Protocols::Chaintracks
- Inherits:
-
BSV::Network::Protocol
- Object
- BSV::Network::Protocol
- BSV::Network::Protocols::Chaintracks
- Defined in:
- lib/bsv/network/protocols/chaintracks.rb
Overview
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, #base_url, #http_client, #network
Instance Method Summary collapse
-
#initialize(base_url:, api_key: nil, http_client: nil) ⇒ Chaintracks
constructor
A new instance of Chaintracks.
Methods inherited from BSV::Network::Protocol
#call, commands, #default_call, endpoint, endpoints, inherited, subscription, subscriptions
Constructor Details
#initialize(base_url:, api_key: nil, http_client: nil) ⇒ Chaintracks
Returns a new instance of Chaintracks.
33 34 35 |
# File 'lib/bsv/network/protocols/chaintracks.rb', line 33 def initialize(base_url:, api_key: nil, http_client: nil) super end |