Class: BSV::Network::Protocols::TAALBinary
- Inherits:
-
BSV::Network::Protocol
- Object
- BSV::Network::Protocol
- BSV::Network::Protocols::TAALBinary
- Defined in:
- lib/bsv/network/protocols/taal_binary.rb
Overview
TAALBinary implements the TAAL broadcast API using raw binary transaction submission over HTTP.
TAAL quirks handled here:
-
Content-Type is
application/octet-stream(not JSON) -
Authorization header is applied via the standard
apply_authmechanism -
A response containing
txn-already-knownin the error field is treated as success (the transaction is already in the mempool — idempotent)
Example
protocol = BSV::Network::Protocols::TAALBinary.new(
base_url: 'https://api.taal.com',
auth: { api_key: 'mainnet_your_key_here' }
)
result = protocol.call(:broadcast, tx)
puts result.data[:txid] if result.success?
Instance Attribute Summary
Attributes inherited from BSV::Network::Protocol
#api_key, #auth, #base_url, #http_client, #network
Instance Method Summary collapse
-
#initialize(base_url:, api_key: nil, auth: nil, http_client: nil) ⇒ TAALBinary
constructor
A new instance of TAALBinary.
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) ⇒ TAALBinary
Returns a new instance of TAALBinary.
32 33 34 35 36 37 |
# File 'lib/bsv/network/protocols/taal_binary.rb', line 32 def initialize(base_url:, api_key: nil, auth: nil, http_client: nil) # Translate legacy api_key: to auth: { api_key: } so the base class sends # the raw key without a Bearer prefix, matching TAAL's expected auth format. resolved_auth = auth || (api_key ? { api_key: api_key } : nil) super(base_url: base_url, auth: resolved_auth, http_client: http_client) end |