Class: BSV::Network::Providers::TAAL

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

Overview

TAAL returns pre-configured Provider instances using the TAAL infrastructure.

Mainnet composes two protocols:

  • ARC at https://arc.taal.com for standard ARC operations

  • TAALBinary at https://api.taal.com for binary broadcast

ARC is registered first, so :broadcast is served by ARC (first-registered wins). TAALBinary registers its own :broadcast command but will not win the index. To use TAALBinary directly, call provider.protocol_for(:broadcast) on the TAALBinary instance via provider.protocols.last, or build a custom Provider.

There is no TAAL testnet default — TAAL does not publish a supported testnet ARC URL.

Example

provider = BSV::Network::Providers::TAAL.mainnet(api_key: 'mainnet_...')
provider.call(:broadcast, tx)

Class Method Summary collapse

Class Method Details

.default(testnet: false, **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

  • opts (Hash)

    keyword arguments forwarded to each protocol constructor

Returns:



51
52
53
# File 'lib/bsv/network/providers/taal.rb', line 51

def self.default(testnet: false, **opts)
  testnet ? testnet(**opts) : mainnet(**opts)
end

.mainnet(**opts) ⇒ Provider

Returns a mainnet Provider configured with ARC and TAALBinary.

Parameters:

  • opts (Hash)

    keyword arguments forwarded to each protocol constructor

Returns:



28
29
30
31
32
33
34
# File 'lib/bsv/network/providers/taal.rb', line 28

def self.mainnet(**opts)
  common = opts.slice(:api_key, :http_client)
  Provider.new('TAAL') do |p|
    p.protocol Protocols::ARC, base_url: 'https://arc.taal.com', **opts
    p.protocol Protocols::TAALBinary, base_url: 'https://api.taal.com', **common
  end
end

.testnet(**opts) ⇒ Provider

Returns a testnet Provider configured with ARC only.

Parameters:

  • opts (Hash)

    keyword arguments forwarded to each protocol constructor

Returns:



40
41
42
43
44
# File 'lib/bsv/network/providers/taal.rb', line 40

def self.testnet(**opts)
  Provider.new('TAAL') do |p|
    p.protocol Protocols::ARC, base_url: 'https://arc-test.taal.com', **opts
  end
end