Skip to content

onchain/onchain-ruby

Repository files navigation

swagger_client

SwaggerClient - the Ruby gem for the ONCHAIN.IO API overview

No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)

This SDK is automatically generated by the Swagger Codegen project:

  • API version: v2
  • Package version: 1.0.0
  • Build package: io.swagger.codegen.languages.RubyClientCodegen

Installation

Build a gem

To build the Ruby code into a gem:

gem build swagger_client.gemspec

Then either install the gem locally:

gem install ./swagger_client-1.0.0.gem

(for development, run gem install --dev ./swagger_client-1.0.0.gem to install the development dependencies)

or publish the gem to a gem hosting service, e.g. RubyGems.

Finally add this to the Gemfile:

gem 'swagger_client', '~> 1.0.0'

Install from Git

If the Ruby gem is hosted at a git repository: https://github.com/YOUR_GIT_USERNAME/YOUR_GIT_REPO, then add the following in the Gemfile:

gem 'swagger_client', :git => 'https://github.com/YOUR_GIT_USERNAME/YOUR_GIT_REPO.git'

Include the Ruby code directly

Include the Ruby code directly using -I as follows:

ruby -Ilib script.rb

Getting Started

Please follow the installation procedure and then run the following code:

# Load the gem
require 'swagger_client'

# Setup authorization
SwaggerClient.configure do |config|
  # Configure API key authorization: ApiKeyAuth
  config.api_key['X-API-KEY'] = 'YOUR API KEY'
  # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
  #config.api_key_prefix['X-API-KEY'] = 'Bearer'
end

api_instance = SwaggerClient::AddressAPIApi.new

coin = "\"testnet3\"" # String | The name of the coin i.e. bitcoin

address = "address_example" # String | The public address to lookup

opts = { 
  contract_id: "6.058968844090876E47", # String | The contract ID of the ERC20 token.
  decimal_places: 18 # Integer | The number of decimal places for this contract.
}

begin
  #Get Balance
  result = api_instance.get_balance(coin, address, opts)
  p result
rescue SwaggerClient::ApiError => e
  puts "Exception when calling AddressAPIApi->get_balance: #{e}"
end

Documentation for API Endpoints

All URIs are relative to https://onchain.io/api

Class Method HTTP request Description
SwaggerClient::AddressAPIApi get_balance GET /address/balance/{coin}/{address} Get Balance
SwaggerClient::AddressAPIApi get_balances GET /address/balances/{coin}/{addresses} Get Balances
SwaggerClient::AddressAPIApi get_history GET /address/history/{coin}/{addresses} Get History
SwaggerClient::AddressAPIApi get_unspent GET /address/utxo/{coin}/{addresses} Get Unspent Outs
SwaggerClient::AddressAPIApi to_network_addresses POST /address/to_network_addresses To Network Address
SwaggerClient::ERC20Api create POST /erc20/create/ Create Unsigned Transaction
SwaggerClient::ERC20Api sign_and_send POST /erc20/sign_and_send/ Sign and send transaction.
SwaggerClient::EthereumAPIApi create POST /ethereum/create/ Create Unsigned Transaction
SwaggerClient::EthereumAPIApi sign_and_send POST /ethereum/sign_and_send/ Sign and send transaction.
SwaggerClient::MultisigApi create POST /multi_sig/create/{coin} Create Unsigned Transaction
SwaggerClient::MultisigApi sign_and_send POST /multi_sig/sign_and_send/{coin} Sign and Send a Transaction
SwaggerClient::TransactionAPIApi create POST /transaction/create/{coin} Create Unsigned Transaction
SwaggerClient::TransactionAPIApi send_raw POST /transaction/send_raw/{coin} Send Raw Transaction
SwaggerClient::TransactionAPIApi sign_and_send POST /transaction/sign_and_send/{coin} Sign and Send a Transaction

Documentation for Models

Documentation for Authorization

ApiKeyAuth

  • Type: API key
  • API key parameter name: X-API-KEY
  • Location: HTTP header

About

Ruby gem for interacting with the Onchain API

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages