Skip to content

Class BSV::Network::Providers::WhatsOnChain

Inherits: Object

WhatsOnChain returns pre-configured Provider instances using the WhatsOnChain REST API (WoCREST protocol).

The base URL is fully resolved per network — no +{network}+ template is used in provider defaults. The WoCREST protocol's network: param is omitted since the URL already encodes the network segment.

Example

provider = BSV::Network::Providers::WhatsOnChain.mainnet
provider.call(:get_tx, 'abc123...')

provider = BSV::Network::Providers::WhatsOnChain.testnet(api_key: 'my-key')
provider.call(:broadcast, tx)

Public Class Methods

default(testnet: = false, network: = nil, **opts)

Returns a Provider for the given network. - @param testnet [Boolean] when true, returns the testnet Provider - @param network [Symbol, nil] explicit network (:main, :test, :stn) — overrides +testnet:+ - @param opts [Hash] keyword arguments forwarded to each protocol constructor - @return [Provider]

mainnet(**opts)

Returns a mainnet Provider configured with WoCREST. - @param opts [Hash] keyword arguments forwarded to each protocol constructor - @return [Provider]

stn(**opts)

Returns a Provider for the BSV Scaling Test Network (STN). - @param opts [Hash] keyword arguments forwarded to each protocol constructor - @return [Provider]

testnet(**opts)

Returns a testnet Provider configured with WoCREST. - @param opts [Hash] keyword arguments forwarded to each protocol constructor - @return [Provider]