Class: BSV::Network::Providers::GorillaPool

Inherits:
Object
  • Object
show all
Defined in:
lib/bsv/network/providers/gorilla_pool.rb

Overview

GorillaPool returns pre-configured Provider instances using the GorillaPool ARCADE infrastructure for ARC and Chaintracks, the GorillaPool Ordinals API for transaction and merkle path lookups, and JungleBus for indexed transaction data and block headers.

Mainnet composes four protocols:

  • ARC at https://arcade.gorillapool.io

  • Chaintracks at https://arcade.gorillapool.io

  • Ordinals at https://ordinals.gorillapool.io

  • JungleBus at https://junglebus.gorillapool.io

Testnet provides ARC and Chaintracks at https://testnet.arcade.gorillapool.io.

Example

provider = BSV::Network::Providers::GorillaPool.mainnet
provider.call(:broadcast, tx)

provider = BSV::Network::Providers::GorillaPool.mainnet(auth: { bearer: 'token' })
provider.call(:broadcast, tx)

# Legacy api_key: shorthand — still supported
provider = BSV::Network::Providers::GorillaPool.testnet(api_key: 'my-key')

Constant Summary collapse

DEFAULT_RATE_LIMIT =

Default requests-per-second limit for unauthenticated use.

3

Class Method Summary collapse

Class Method Details

.default(testnet: false, auth: nil, rate_limit: DEFAULT_RATE_LIMIT, **opts) ⇒ Provider

Returns a mainnet or testnet Provider depending on the testnet: flag.

Parameters:

  • testnet (Boolean) (defaults to: false)

    when true, returns the testnet Provider

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

    auth config forwarded to Provider and all protocols

  • rate_limit (Numeric, nil) (defaults to: DEFAULT_RATE_LIMIT)

    requests per second; defaults to DEFAULT_RATE_LIMIT

  • opts (Hash)

    keyword arguments forwarded to each protocol constructor

Returns:



76
77
78
79
# File 'lib/bsv/network/providers/gorilla_pool.rb', line 76

def self.default(testnet: false, auth: nil, rate_limit: DEFAULT_RATE_LIMIT, **opts)
  kwargs = { auth: auth, rate_limit: rate_limit, **opts }
  testnet ? testnet(**kwargs) : mainnet(**kwargs)
end

.mainnet(auth: nil, rate_limit: DEFAULT_RATE_LIMIT, **opts) ⇒ Provider

Returns a mainnet Provider configured with ARC, Chaintracks, Ordinals, and JungleBus.

Auth is forwarded to all four protocols so each can authenticate independently.

Parameters:

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

    auth config forwarded to Provider and all protocols

  • rate_limit (Numeric, nil) (defaults to: DEFAULT_RATE_LIMIT)

    requests per second; defaults to DEFAULT_RATE_LIMIT

  • opts (Hash)

    keyword arguments forwarded to each protocol constructor

Returns:



41
42
43
44
45
46
47
48
49
50
# File 'lib/bsv/network/providers/gorilla_pool.rb', line 41

def self.mainnet(auth: nil, rate_limit: DEFAULT_RATE_LIMIT, **opts)
  resolved_auth = auth || (opts[:api_key] ? { bearer: opts[:api_key] } : :none)
  common = opts.slice(:api_key, :http_client).merge(auth: auth)
  Provider.new('GorillaPool', auth: resolved_auth, rate_limit: rate_limit) do |p|
    p.protocol Protocols::ARC,         base_url: 'https://arcade.gorillapool.io', auth: auth, **opts
    p.protocol Protocols::Chaintracks, base_url: 'https://arcade.gorillapool.io', **common
    p.protocol Protocols::Ordinals,    base_url: 'https://ordinals.gorillapool.io', **common
    p.protocol Protocols::JungleBus,   base_url: 'https://junglebus.gorillapool.io', **common
  end
end

.testnet(auth: nil, rate_limit: DEFAULT_RATE_LIMIT, **opts) ⇒ Provider

Returns a testnet Provider configured with ARC and Chaintracks.

Auth is forwarded to both protocols.

Parameters:

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

    auth config forwarded to Provider and all protocols

  • rate_limit (Numeric, nil) (defaults to: DEFAULT_RATE_LIMIT)

    requests per second; defaults to DEFAULT_RATE_LIMIT

  • opts (Hash)

    keyword arguments forwarded to each protocol constructor

Returns:



60
61
62
63
64
65
66
67
# File 'lib/bsv/network/providers/gorilla_pool.rb', line 60

def self.testnet(auth: nil, rate_limit: DEFAULT_RATE_LIMIT, **opts)
  resolved_auth = auth || (opts[:api_key] ? { bearer: opts[:api_key] } : :none)
  common = opts.slice(:api_key, :http_client).merge(auth: auth)
  Provider.new('GorillaPool', auth: resolved_auth, rate_limit: rate_limit) do |p|
    p.protocol Protocols::ARC,         base_url: 'https://testnet.arcade.gorillapool.io', auth: auth, **opts
    p.protocol Protocols::Chaintracks, base_url: 'https://testnet.arcade.gorillapool.io', **common
  end
end