boomflow-frontend

1.1.11 • Public • Published

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

Readme

Keywords

none

Package Sidebar

Install

npm i boomflow-frontend

Weekly Downloads

0

Version

1.1.11

License

ISC

Unpacked Size

8.2 MB

Total Files

12

Last publish

Collaborators

  • justinpan97