- Implement SynorStorage class for decentralized storage operations including upload, download, pinning, and CAR file management. - Create supporting types and models for storage operations such as UploadOptions, Pin, and StorageConfig. - Implement SynorWallet class for wallet operations including wallet creation, address generation, transaction signing, and balance queries. - Create supporting types and models for wallet operations such as Wallet, Address, and Transaction. - Introduce error handling for both storage and wallet operations.
41 lines
971 B
Ruby
41 lines
971 B
Ruby
# 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
|