@elevenyellow.com/switchain-api-client
client module to access switchains's api
Last updated 10 days ago by chemuto .
ISC · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @elevenyellow.com/switchain-api-client 
SYNC missed versions from official npm registry.

Install

npm i @elevenyellow.com/switchain-api-client

Initialize

const { init } = require('switchain-api-client')
const SwitchainApi = init({
  apiKey: 'xxxxxxxx-yyyy-zzzz-0000-999999999999',
  apiUrl: 'http://localhost:3020/rest/v1/' // optional
})

API

getMarketInfo

Returns

{
    info: [ { signature, expiryTs, pair, quote, maxLimit, minLimit }, ... ]
}

Example

const { info } = SwitchainApi.getMarketInfo()

getOffer

Params

  • pair: string

Returns

{
  offer: {
    signature, expiryTs, pair, quote, maxLimit, minLimit
  }
}

Example

const { offer } = SwitchainApi.getOffer({
  pair: 'ETH-DAI'
})

postOrder

Params

  • pair: string
  • toAddress: string
  • refundAddress: string
  • fromAmount: string
  • signature: string

Returns

{
  order: {
    orderId, fromAmount, rate, exchangeAddress, toAddress, refundAddress
  }
}

Example

const { offer } = SwitchainApi.postOrder({
  toAddress,
  refundAddress,
  pair,
  fromAmount,
  signature
})

getOrderStatus

Params

  • orderId: string

Returns

{
  status: {
    status, fromAmount, rate, exchangeAddress, toAddress, refundAddress, toTx
  }
}

Example

const { status } = SwitchainApi.getOrderStatus({ orderId })

Current Tags

  • 3.6.0                                ...           latest (10 days ago)

16 Versions

  • 3.6.0                                ...           10 days ago
  • 3.5.0                                ...           6 months ago
  • 3.4.0                                ...           6 months ago
  • 3.3.0                                ...           a year ago
  • 3.2.0                                ...           a year ago
  • 3.1.1                                ...           a year ago
  • 3.1.0                                ...           a year ago
  • 3.0.0                                ...           a year ago
  • 2.0.0                                ...           a year ago
  • 1.2.0                                ...           2 years ago
  • 1.1.0                                ...           2 years ago
  • 1.0.0                                ...           2 years ago
  • 0.2.0                                ...           2 years ago
  • 0.1.1                                ...           2 years ago
  • 0.1.0                                ...           2 years ago
  • 0.0.1                                ...           2 years ago
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 1
Last Month 36
Dependencies (2)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |