Class BSV::Network::Protocols::WoCREST ¶
Inherits: BSV::Network::Protocol
WoCREST implements the WhatsOnChain REST API as a Protocol subclass.
Provides 30 endpoints covering chain info, block headers, transactions, UTXOs, scripts, address queries, broadcast, and health. Seven escape hatches handle WoC-specific body formats and field remapping.
Network resolution¶
WoC uses main and test in its URL paths. The constructor accepts symbolic aliases (:mainnet, :testnet, :stn) and resolves them to the correct string.
Usage¶
woc = BSV::Network::Protocols::WoCREST.new(network: :main)
result = woc.call(:get_tx, 'abc123...')
puts result.data if result.success?
Constants¶
NETWORKS ¶
Not documented.
Attributes¶
network_name [R] ¶
Returns the value of attribute network_name.
Public Instance Methods¶
build_request(http_method, uri, body) ¶
WoC expects a raw Authorization header (no Bearer prefix). Override the base class which adds "Bearer ".
initialize(base_url:, network: = :main, api_key: = nil, http_client: = nil) ¶
- @param
base_url[String] base URL for the WoC API; may contain +{network}+ which will be interpolated with the resolved network name - @param
network[Symbol, String] :main, :mainnet, :test, :testnet, :stn - @param
api_key[String, nil] optional Bearer API key - @param
http_client[Object, nil] injectable HTTP client for testing - @return [WoCREST] a new instance of WoCREST