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.mainnet(auth: { api_key: 'my-key' })
provider.call(:broadcast, tx)
# Legacy api_key: shorthand — still supported
provider = BSV::Network::Providers::WhatsOnChain.testnet(api_key: 'my-key')
Constants¶
DEFAULT_RATE_LIMIT ¶
Default requests-per-second limit for unauthenticated use.
Public Class Methods¶
default(testnet: = false, network: = nil, auth: = nil, rate_limit: = DEFAULT_RATE_LIMIT, **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 auth [Hash, Symbol, nil] auth config forwarded to Provider and WoCREST protocol - @param rate_limit [Numeric, nil] requests per second; defaults to +DEFAULT_RATE_LIMIT+ - @param opts [Hash] keyword arguments forwarded to the WoCREST protocol constructor - @return [Provider]
mainnet(auth: = nil, rate_limit: = DEFAULT_RATE_LIMIT, **opts) ¶
Returns a mainnet Provider configured with WoCREST. - @param auth [Hash, Symbol, nil] auth config forwarded to Provider and WoCREST protocol - @param rate_limit [Numeric, nil] requests per second; defaults to +DEFAULT_RATE_LIMIT+ - @param opts [Hash] keyword arguments forwarded to the WoCREST protocol constructor - @return [Provider]
stn(auth: = nil, rate_limit: = DEFAULT_RATE_LIMIT, **opts) ¶
Returns a Provider for the BSV Scaling Test Network (STN). - @param auth [Hash, Symbol, nil] auth config forwarded to Provider and WoCREST protocol - @param rate_limit [Numeric, nil] requests per second; defaults to +DEFAULT_RATE_LIMIT+ - @param opts [Hash] keyword arguments forwarded to the WoCREST protocol constructor - @return [Provider]
testnet(auth: = nil, rate_limit: = DEFAULT_RATE_LIMIT, **opts) ¶
Returns a testnet Provider configured with WoCREST. - @param auth [Hash, Symbol, nil] auth config forwarded to Provider and WoCREST protocol - @param rate_limit [Numeric, nil] requests per second; defaults to +DEFAULT_RATE_LIMIT+ - @param opts [Hash] keyword arguments forwarded to the WoCREST protocol constructor - @return [Provider]