- 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
1.1 KiB
Ruby
41 lines
1.1 KiB
Ruby
# frozen_string_literal: true
|
|
|
|
require_relative "synor_wallet/version"
|
|
require_relative "synor_wallet/types"
|
|
require_relative "synor_wallet/client"
|
|
|
|
# Synor Wallet SDK for Ruby
|
|
#
|
|
# Key management, transaction signing, and balance queries for the Synor blockchain.
|
|
#
|
|
# @example Quick Start
|
|
# require 'synor_wallet'
|
|
#
|
|
# # Create client
|
|
# client = SynorWallet::Client.new(api_key: 'your-api-key')
|
|
#
|
|
# # Create a new wallet
|
|
# result = client.create_wallet
|
|
# puts "Wallet ID: #{result.wallet.id}"
|
|
# puts "Mnemonic: #{result.mnemonic}"
|
|
#
|
|
# # Get balance
|
|
# balance = client.get_balance(result.wallet.addresses.first.address)
|
|
# puts "Balance: #{balance.total}"
|
|
#
|
|
# # Sign a message
|
|
# signature = client.sign_message(result.wallet.id, "Hello, Synor!")
|
|
# puts "Signature: #{signature.signature}"
|
|
#
|
|
module SynorWallet
|
|
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
|