docs

Plug-and-Play Documentation

docs.sh — Copy-paste snippets
[ _ ][ 🗗 ][ X ]

Your GitHub repository is your most important DevRel blog. Tested configs, copy-paste ready.

--tool@0x Swap API

Provides a mature HTTP interface for sourcing best-price ERC20 swaps; Cross-Chain API extends this model to multi-chain flows.

install
npm install axios qs
javascript
const axios = require("axios");
const qs = require("qs");

const params = {
  buyToken: "DAI",
  sellToken: "WETH",
  sellAmount: "100000000000000000"
};

const URL = "https://api.0x.org/swap/v1/quote";

axios
  .get(`${URL}?${qs.stringify(params)}`)
  .then((res) => console.log(res.data.price, res.data.sources))
  .catch(console.error);