With the Eidoo hybrid exchange CLI you can enjoy the SDK package features with a command line interface.
You can install it globallly with:
yarn global add eidoo/hybrid-exchange-sdk
or
npm install -g eidoo/hybrid-exchange-sdk
and access it with:
hybrid-exchange-cli <domain> <command> <options>
The CLI has been designed in four macro domains:
For release notes, please see the CHANGELOG.
The ethereum wallet functionality let you create a keystore from a specific ethereum account.
A keystore file is a JSON file that encrypts your ethereum account using a password.
Command:
hybrid-exchange-cli ethereum-wallet keystore-generate
Args:
--keystore-file-path
Destination path of the generated keystore--hd-path [default: m/44'/60'/0/0]
The path for ethereum account derivation
The order functionalities let you create, cancel and sign orders to the Eidoo hybrid exchange.
Submit an order creation to the Eidoo hybrid exchange.
Command:
hybrid-exchange-cli order create
Args:
--cli-input-json
Order JSON--keystore-file-path
The path of your keystore
You can find a JSON order sample here.
Remember that it needs to be stringified: '{"exchangeAddress":"0xbfd9aaac82281b54ecf60b7d53ccc9cdf13cd14e"...}'
The command returns the orderId.
Submit a cancel order to the Eidoo hybrid exchange.
Command:
hybrid-exchange-cli order cancel
Args:
--order-id
The orderId--keystore-file-path
The path of your keystore
The create order command automatically adds an ecSignature
field to the order object if not provided.
The ecSignature
field can be manually generated and added to the order object using the sign command
.
Command:
hybrid-exchange-cli order sign
Args:
--cli-input-json
Order JSON--keystore-file-path
The path of your keystore
You can find a JSON order sample here.
Remember that it needs to be stringified: '{"exchangeAddress":"0xbfd9aaac82281b54ecf60b7d53ccc9cdf13cd14e"...}'
The command returns the ecSignature
value.
The token functionalities let you interact with ERC20 tokens.
It executes an ERC20 token approve method.
Command:
hybrid-exchange-cli token approve
Args:
--from
The token holder public key--to
The token address--quantity
The amount to be approved--spender
The spender account public key--keystore-file-path
The path of your keystore
Optional
--draft
It will not execute the transaction but it will return the transaction object--raw-tx
It will not execute the transaction but it will return the signed raw transaction
It returns the transaction hash.
It retrieves the ERC20 allowance property value.
Command:
hybrid-exchange-cli token get-allowance
Args:
--owner
The token holder public key--spender
The spender account public key--token
The token address
Optional
--draft
It will not execute the transaction but it will return the transaction object
It returns the allowed amount in WEI.
The trading wallet functionalities let you create and manage your trading wallet smart contract by deposit and withdraw funds.
You can also retrieve your trading wallet address and funds balances.
It creates a trading wallet instance.
Command:
hybrid-exchange-cli trading-wallet create-wallet
Args:
--eoa
The personal wallet address--keystore-file-path
The spender account public key
Optional
--draft
It will not execute the transaction but it will return the transaction object--raw-tx
It will not execute the transaction but it will return the signed raw transaction
It returns the transaction hash.
It retrieves the address of the trading wallet connected to the specified personal wallet address.
Command:
hybrid-exchange-cli trading-wallet get-address
Args:
--eoa
The personal wallet address
Optional
--draft
It will not execute the transaction but it will return the transaction object
It returns the trading wallet address.
It deposits a specified amount of ETH to your trading wallet.
Command:
hybrid-exchange-cli trading-wallet deposit-eth
Args:
--from
The personal wallet address--to
The trading wallet--quantity
The amount of ETH in WEI--keystore-file-path
The path of your keystore
Optional
--draft
It will not execute the transaction but it will return the transaction object--raw-tx
It will not execute the transaction but it will return the signed raw transaction
It returns the transaction hash.
It deposits a specified amount of an ERC20 token to your trading wallet.
Command:
hybrid-exchange-cli trading-wallet deposit-token
Args:
--from
The personal wallet address--to
The trading wallet--quantity
The amount of the token in WEI--token
The token address--keystore-file-path
The path of your keystore
Optional
--draft
It will not execute the transaction but it will return the transaction object--raw-tx
It will not execute the transaction but it will return the signed raw transaction
It returns the transaction hash.
It retrieves the asset balance of a trading wallet.
Command:
hybrid-exchange-cli trading-wallet get-balance
Args:
--from
The personal wallet address--to
The trading wallet address--token
The asset address
Optional
--draft
It will not execute the transaction but it will return the transaction object
It returns the asset balance in WEI.
It withdraws a specified amount of a specified asset from your trading wallet.
Command:
hybrid-exchange-cli trading-wallet withdraw
Args:
--from
The personal wallet address--to
The trading wallet--quantity
The amount of the asset in WEI--token
The asset address (0x0000000000000000000000000000000000000000
for ETH)--keystore-file-path
The path of your keystore
Optional
--draft
It will not execute the transaction but it will return the transaction object--raw-tx
It will not execute the transaction but it will return the signed raw transaction
It returns the transaction hash.