Class BSV::Network::WhatsOnChain ¶
Inherits: Object
WhatsOnChain chain data provider for reading transactions and UTXOs from the BSV network.
Any object responding to #fetch_utxos(address) and #fetch_transaction(txid) can serve as a chain data provider; this class implements that contract using the WhatsOnChain API.
The HTTP client is injectable for testability. It must respond to
request(uri, request) and return an object with #code and #body.¶
Constants¶
BASE_URL ¶
Not documented.
Public Instance Methods¶
fetch_transaction(txid) ¶
Fetch a raw transaction by its txid and parse it. - @param txid [String] transaction ID (hex) - @return [BSV::Transaction::Transaction]
fetch_utxos(address) ¶
Fetch unspent transaction outputs for an address. - @param address [String] BSV address - @return [Array
initialize(network: = :mainnet, http_client: = nil) ¶
- @return [WhatsOnChain] a new instance of WhatsOnChain