Skip to content
Build DEX trading into your platform with the DEX.AG API and SDK
JavaScript CSS HTML
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
public metadata update May 23, 2019
src
.gitignore
README.md
buildspec.yml
package.json

README.md

Documentation

See the DEXAG Docs
View the app running live DEXAG Checkout

Installation

Install the packages with:

npm install

Start the app

npm run start

Main SDK Usage

The DEXAG SDK is used to get the best price for a given trading pair and amount. Using validateWeb3, the client wraps ETH, sets token allowances, or whatever other steps are required to checkout. The tradeOrder function is used to execute the trade and request the client to confirm their transaction.

import {DEXAG} from 'dexag-sdk'
const sdk = new DEXAG();

// receive status messages as the client executes the trade
sdk.registerStatusHandler((status, data)=>{
  console.log(status, data)
});

// get trade
const trade = await sdk.getTrade({to: 'DAI', from: 'ETH', amount: 1})

// checkout
const valid = await sdk.validateWeb3(trade);
if (valid) {
  // web3 is valid, trade order
  sdk.tradeOrder({tx: trade}); /** Metamask opens **/
}

More information

Find more information about how to build DEX trading into your platform on the DEXAG Docs

You can’t perform that action at this time.