Class: BSV::Network::Protocols::ARC
- Inherits:
-
BSV::Network::Protocol
- Object
- BSV::Network::Protocol
- BSV::Network::Protocols::ARC
- Defined in:
- lib/bsv/network/protocols/arc.rb
Overview
ARC protocol implementation for submitting transactions to the BSV network.
Extends Protocol with five endpoints and two escape hatches for broadcast logic: EF format preference, rejection detection, and custom headers.
The protocol returns Result objects (never raises). The facade layer (Phase D) is responsible for translating Results to BroadcastResponse / BroadcastError as needed by consumer code.
Example
arc = BSV::Network::Protocols::ARC.new(
base_url: 'https://arc.taal.com',
api_key: 'my-api-key'
)
result = arc.call(:broadcast, tx)
result.success? # => true
result.data[:txid] # => "abc123..."
Constant Summary collapse
- REJECTED_STATUSES =
ARC response statuses that indicate a transaction was NOT accepted. Matches the TypeScript SDK’s ARC broadcaster failure set.
%w[ REJECTED DOUBLE_SPEND_ATTEMPTED INVALID MALFORMED MINED_IN_STALE_BLOCK ].freeze
- ORPHAN_MARKER =
Substring marker for orphan detection in txStatus or extraInfo fields.
'ORPHAN'
Instance Attribute Summary
Attributes inherited from BSV::Network::Protocol
#api_key, #base_url, #http_client, #network
Instance Method Summary collapse
-
#initialize(base_url:, api_key: nil, network: nil, deployment_id: nil, callback_url: nil, callback_token: nil, http_client: nil) ⇒ ARC
constructor
A new instance of ARC.
Methods inherited from BSV::Network::Protocol
#call, commands, #default_call, endpoint, endpoints, inherited, subscription, subscriptions
Constructor Details
#initialize(base_url:, api_key: nil, network: nil, deployment_id: nil, callback_url: nil, callback_token: nil, http_client: nil) ⇒ ARC
Returns a new instance of ARC.
55 56 57 58 59 60 61 |
# File 'lib/bsv/network/protocols/arc.rb', line 55 def initialize(base_url:, api_key: nil, network: nil, deployment_id: nil, callback_url: nil, callback_token: nil, http_client: nil) super(base_url: base_url, api_key: api_key, network: network, http_client: http_client) @deployment_id = deployment_id || "bsv-ruby-sdk-#{SecureRandom.hex(8)}" @callback_url = callback_url @callback_token = callback_token end |