# frozen_string_literal: true

require_relative "synor_rpc/version"
require_relative "synor_rpc/types"
require_relative "synor_rpc/client"

# Synor RPC SDK for Ruby
#
# Blockchain data queries, transaction submission, and real-time subscriptions.
#
# @example Quick Start
#   require 'synor_rpc'
#
#   # Create client
#   client = SynorRpc::Client.new(api_key: 'your-api-key')
#
#   # Get latest block
#   block = client.get_latest_block
#   puts "Block height: #{block.height}"
#
#   # Get transaction
#   tx = client.get_transaction(txid)
#   puts "Confirmations: #{tx.confirmations}"
#
#   # Subscribe to new blocks
#   client.subscribe_blocks do |block|
#     puts "New block: #{block.height}"
#   end
#
module SynorRpc
  class Error < StandardError; end
  class ApiError < Error
    attr_reader :status_code

    def initialize(message, status_code: nil)
      super(message)
      @status_code = status_code
    end
  end
  class ClientClosedError < Error; end
end
