Skip to content

ConcourseOpen/cDAI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

54 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Documentation

See the DEXAG Docs
View the app running live cDAI.io

Installation

Install the packages with:

npm install

Start the app

npm run start

Main SDK Usage

Query DEXes for the best price and execute the trade with a web3 browser.

import {DEXAG} from 'dexag-sdk'
const sdk = DEXAG.fromProvider(window.ethereum)

// 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', toAmount: 1})

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

More information

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

About

Swap cDAI from https://compound.finance for ETH/ERC20 tokens through DEXes

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published