Skip to content
This repository was archived by the owner on Apr 3, 2020. It is now read-only.

ihaveCred/zeroXIntegration

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

0x_exchange

This is a 0x protocol tool that allows you to quickly finish the fill Order,submitOrder.

install

npm i 0x_exchange --save

ETH exchange WETH

let mnemonic = "xxx xxx xxx xxx xxx";
let wethContractAddress = "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2";
let relayerApiUrl = "https://api.radarrelay.com/0x/v0/";
let WETH_ADDRESS = "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2";
let DAI_ADDRESS = "0x89d24a6b4ccb1b6faa2625fe562bdd9a23260359";
let clientUrl = "https://mainnet.infura.io/xxxxxxxxxxxxxxxxxxxxxx";

async function test(){
    try{
        let dtx = await require("0x_exchange").echangeWETH(mnemonic,clientUrl,wethContractAddress,"0.001",1);
        console.info(dtx);
    }catch (e){
        console.error(e);
    }
}

fillOrder

let mnemonic = "xxx xxx xxx xxx xxx";
let wethContractAddress = "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2";
let relayerApiUrl = "https://api.radarrelay.com/0x/v0/";
let WETH_ADDRESS = "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2";
let DAI_ADDRESS = "0x89d24a6b4ccb1b6faa2625fe562bdd9a23260359";
let clientUrl = "https://mainnet.infura.io/xxxxxxxxxxxxxxxxxxxxxx";

async function test(){
    try{
        let fillOrderAmount = "0.005";
        let net = 1;
        let dtx = await require("0x_exchange").fillOrder(mnemonic,clientUrl,relayerApiUrl,WETH_ADDRESS,DAI_ADDRESS,net,fillOrderAmount);
        console.info(dtx);
    }catch (e){
        console.error(e);
    }
}

submitOrder

let mnemonic = "xxx xxx xxx xxx xxx";
let wethContractAddress = "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2";
let relayerApiUrl = "https://api.radarrelay.com/0x/v0/";
let WETH_ADDRESS = "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2";
let DAI_ADDRESS = "0x89d24a6b4ccb1b6faa2625fe562bdd9a23260359";
let clientUrl = "https://mainnet.infura.io/xxxxxxxxxxxxxxxxxxxxxx";

async function test(){
    try{
        let fillOrderAmount = "0.005";
        let net = 1;
        let dtx = await require("0x_exchange").fillOrder(mnemonic,clientUrl,relayerApiUrl,WETH_ADDRESS,DAI_ADDRESS,net,fillOrderAmount);
        console.info(dtx);
    }catch (e){
        console.error(e);
    }
}

submitDdexOrder

let privateKey = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";

async function test() {
    try {
        let orderId = await require("0x_exchange").submitDdexOrder(privateKey,5,0.0013184,"buy","DAI-ETH");
        console.info(orderId);
    }catch (e){
        console.error(e);
    }
}

About

This is an client library for integrate with 0x-based exchanges

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors