Class: BSV::Network::Protocols::JungleBus

Inherits:
BSV::Network::Protocol show all
Defined in:
lib/bsv/network/protocols/jungle_bus.rb

Overview

JungleBus implements the GorillaPool JungleBus REST API as a Protocol subclass.

JungleBus is a blockchain indexer that indexes all BSV transactions and provides parsed transaction data, address lookups, and block headers. The get_tx endpoint returns both the full transaction (base64-encoded) and a TSC merkle proof in a single call.

Usage

jb = BSV::Network::Protocols::JungleBus.new(
  base_url: 'https://junglebus.gorillapool.io'
)
result = jb.call(:get_tx, 'abc123...')
result.data['transaction']  # => base64-encoded raw tx
result.data['merkle_proof'] # => base64-encoded TSC proof (or nil)

Instance Attribute Summary

Attributes inherited from BSV::Network::Protocol

#api_key, #auth, #base_url, #http_client, #network

Instance Method Summary collapse

Methods inherited from BSV::Network::Protocol

#call, commands, #default_call, endpoint, endpoints, inherited, subscription, subscriptions

Constructor Details

#initialize(base_url:, api_key: nil, auth: nil, http_client: nil) ⇒ JungleBus

Returns a new instance of JungleBus.

Parameters:

  • base_url (String)

    base URL for the JungleBus API

  • api_key (String, nil) (defaults to: nil)

    legacy API key shorthand — use auth: for new code

  • auth (Hash, Symbol, nil) (defaults to: nil)

    auth config; takes precedence over api_key:

  • http_client (Object, nil) (defaults to: nil)

    injectable HTTP client for testing



46
47
48
# File 'lib/bsv/network/protocols/jungle_bus.rb', line 46

def initialize(base_url:, api_key: nil, auth: nil, http_client: nil)
  super
end