Skip to content

imrahulprajapat/hexsafe-ruby

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Hexsafe Ruby

Simple Ruby client for the Hexsafe API.

Setup

Simply using rubygems:

gem install hexsafe

For Rails apps

Add this line to your application's Gemfile:

gem 'hexsafe'

And then execute:

$ bundle install

Or install it yourself as:

$ git clone https://github.com/imrahulprajapat/hexsafe-ruby.git
$ cd hexsafe-ruby
$ bundle
$ gem build hexsafe.gemspec
$ gem install hexsafe-0.0.0.gem

Initializing a client

If you want to call Hexsafe Apis, which is normally what you want to do, it's as simple as:

    hex_safe = Hexsafe::Api.new(env: "Test", key: "your-api-key", secret: "your-key-secret")
env: Envoirments i.e Test, Main
key: api key, will get when you create a account on hexsafe
secret: your secret when you create a account on hexsafe

Hexsafe's documentation

For more information check the API docs at:

To Get Account Details

All accounts

hex_safe.get_accounts

To Get specific account

hex_safe.get_account account_id

To Get Balance

By account_id

hex_safe.get_balance account_id

To Get Transaction

By tx_id

hex_safe.get_txn ticker, tx_hash
ticker: i.e BTC, ETH
tx_hash: "transaction_id"

By account_id and timer

hex_safe.get_txn_ac account_id, start_time, end_time

Deposits

Create Deposits

hex_safe.create_deposit body
body = {"account_id": 1028, "wallet_name": "test-wallet", "asset_ticker": "ETH", "quantity": 1.5, "memo": "string", "note": "string"}

Cancel Deposits

hex_safe.cancel_deposit request_id

Get Deposit by request id

hex_safe.get_deposit request_id

Withdrawls

Create Withdrawls

hex_safe.create_deposit body
body = {"quantity": 1.5, "memo": "string", "note": "string", "account_id": 1028, "asset_ticker": "ETH", "wallet_name": "test-wallet", "to_address": "0x8CfbA3Cd46fB7136Fc04c6B863bCbcb6d5FDb6DA", "fee_price": 75, "fee_limit": 21000}

Cancel Withdrawls

hex_safe.cancel_withdraw request_id

Get Deposit by request id

hex_safe.get_withdraw request_id

Webhook

Subscribe Webhook

hex_safe.subscribe_webhook body
body = {"url": "https://localhost/callback_url/","account_id": 2,"wallet_type_id": 3, "asset_ticker": "ETH" }

Get your subscriptions

hex_safe.get_subscriptions account_id

Cancel your subscriptions

hex_safe.delete_subscription uuid

Development

  • To generate api token you need to discuss with hexsafe support.

Contributors

https://github.com/imrahulprajapat