eidoo / hybrid-exchange-sdk

The Eidoo Hybrid Exchange Node.js SDK

Home Page:https://eidoo.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

OpenZeppelin

contributions welcome CircleCI

The official EIDOO HYBRID EXCHANGE SDK for Node.js.
Learn more about Eidoo and the Eidoo Hybrid Exchange APIs.

This project is designed to make the interaction with Eidoo Hybrid Exchange easier.
You will be able to:

  • create a trading wallet smart contract
  • deposit and withdraw funds from a trading wallet
  • list, create and delete orders
  • retrieve order book informations

For release notes, please see the CHANGELOG.

Installation

If you want you can install it with npm:

npm install --save eidoo/hybrid-exchange-sdk

or if you prefer using yarn:

yarn add eidoo/hybrid-exchange-sdk

Then within your application, you can reference SDK with the following:

const hybridExchangeSdk = require('@eidoo/hybrid-exchange-sdk')

After the installation the SDK is also available as CLI (command line interface), check the documentation here.

Quick start

To interact with the Eidoo hybrid exchange and submit an order based on what you would like to trade you need to check the available pairs.
Once you have chosen the pair you can retrieve the associated order book and eventually check the related EDO pair fee.

As soon as you are ready you need a funded ethereum wallet address.

The first step to place an order is the creation of a trading wallet.
The trading wallet is a smart contract connected to your ethereum wallet address.
You can create it using the SDK.
If you already have a trading wallet connected to your ethereum wallet you can also just retrieve its address.

You can manage the trading wallet by depositing and withdrawing funds. You can deposit both ether and ERC20 token.

In order to deposit the above assets your ethereum wallet needs to be funded.

Please note that as soon as you are ready to deposit some ERC20 token you must approve your trading wallet as spender of the deposit amount since the trading wallet will perform a transferFrom of the token from your ethereum wallet to itself.
You can check the status of the approval verifying the allowance. You can decide also to deposit ERC20 token with auto managed approve operation (example).

You will always be the only one able to withdraw ERC20 token and ether from your trading wallet to the connected ethereum wallet.

Once you have your trading wallet funded you can create an order on Eidoo exchange and eventually retrieve the list of the orders you have already created.
You will also be able to retrieve the single order information.

If you are not satisfied by the order you have just created you are able to cancel it as soon as it is still in the order book and did not find any match.

Build and Sign transaction

Using the SDK you are able to build and sign transactions before submitting them to the Eidoo exchange.

Suppose you would like to create a trading wallet specifying some transaction object values like the GAS, GASPRICE and NONCE.
You could build the transaction getting the transaction object draft without any NONCE and GAS values.
After that you can sign the transaction obeject setting your favorite GAS, GASPRICE and NONCE values and then execute the transaction manually.

Build and Sign an order manually

You can create and cancel an order without building and signing the order, but if you would like to do it manually you have to build and sign the order before submitting them to the Eidoo exchange.

Opening Issues

If you encounter a bug in the EIDOO HYBRID EXCHANGE SDK please check the existing issues and try to make sure your problem doesn’t already exist before opening a new issue. Please include the version of the SDK you are using and all the relevant information to reproduce the bug.

License

This SDK is distributed under the MIT, see LICENSE for more information.

About

The Eidoo Hybrid Exchange Node.js SDK

https://eidoo.io

License:MIT License


Languages

Language:JavaScript 100.0%