boomflow-frontend
--- Conflux BoomFlow is the Decentralized Exchange solution for Conflux Chain
Last updated 2 months ago by justinpan97 .
ISC · Original npm · Tarball · package.json
$ cnpm install boomflow-frontend 
SYNC missed versions from official npm registry.

Conflux BoomFlow Frontend SDK


Conflux BoomFlow is the Decentralized Exchange solution for Conflux Chain

Scenarios Scripts Description
Deposit @examples/deposit Deposit ERC777 to CRC-L token
Signature @examples/sign Sign and issue DEX request, such as placing/cancelling orders and withdraw

Note: Force Withdraw should only apply in emergency situations. For regular withdraw, please submit withdraw requests to DEX


Contract Functions

async function getTokenAddress(token) -> BigNumber

Returns the ERC777 contract address corresponding to the CRCL token

async function balanceOf(token, account) -> BigNumber

Returns the balance of the account in either ERC777 or CRCL token

async function deferTime(token) -> BigNumber

Returns the force withdraw deferring time of the CRCL token

async function getOrderInfo(token) -> BigNumber

Returns the order info including order status, hash and filled amount

async function getRequestHash(token) -> BigNumber

Returns the request hash

async function getWithdrawHash(token) -> BigNumber

Returns the withdraw hash

async function deposit(cfx, sender, token, recipient, value, nonce)

Deposits from sender's ERC777 address to recipient's CRCL address with the value units of token.

async function requestForceWithdraw(cfx, sender, token, nonce)

Requests for future force withdraw in the CRCL token.

async function forceWithdraw(cfx, sender, token, recipient, nonce)

Forcely Withdraws all the balance from sender's CRCL address to recipient's ERC777 address.

DEX Functions

OrderService is the object that interat with DEX REST APIs.

OPCODE

OPCODE = {
    PlaceOrder: 0,
    Cancel: 1,
    Withdraw: 2,
    WithdrawCrossChain: 4,
}

async init(opts)

Initalize OrderService object

async getLocalBoomflow()

Return current Boomflow address

async setLocalBoomflow(boomflowAddr)

Set the current Boomflow address

async getAssetAddress(name)

Return asset address of a given asset name

async getSystemTime()

Return the UNIX time in ms.

async getOrder(orderId)

Return the order content corrsponding to the order ID.

async construct(order, baseAssetAddress, quoteAssetAddress, nonce, op)

Construct the type data for signature.

async submit(order, timestamp, signature, clientOrderId=null)

Place order to DEX.

async cancel(orderId, timestamp, signature)

Cancel order to DEX.

async withdraw(request, timestamp, signature)

Withdraw request to DEX.

async withdrawCrossChain(request, timestamp, signature)

WithdrawCrossChain request to DEX.

Token Addresses

Note: Contract Addresses are no longer exported via NPM packages

ABI Interfaces

crclABI

CRCL ABI interface

erc777ABI

ERC777 ABI interface

boomflowABI

Boomflow ABI interface

Examples

Please see example

Current Tags

  • 1.1.11                                ...           latest (2 months ago)

21 Versions

  • 1.1.11                                ...           2 months ago
  • 1.1.10                                ...           3 months ago
  • 1.1.9                                ...           3 months ago
  • 1.1.8                                ...           3 months ago
  • 1.1.7                                ...           4 months ago
  • 1.1.6                                ...           7 months ago
  • 1.1.5                                ...           7 months ago
  • 1.1.4                                ...           7 months ago
  • 1.1.3                                ...           7 months ago
  • 1.1.2                                ...           7 months ago
  • 1.1.0                                ...           8 months ago
  • 1.0.11                                ...           8 months ago
  • 1.0.10                                ...           8 months ago
  • 1.0.9                                ...           8 months ago
  • 1.0.8                                ...           8 months ago
  • 1.0.7                                ...           8 months ago
  • 1.0.6                                ...           9 months ago
  • 1.0.4                                ...           9 months ago
  • 1.0.3                                ...           9 months ago
  • 1.0.2                                ...           9 months ago
  • 1.0.0                                ...           9 months ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (4)
Dev Dependencies (0)
None
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |