A simple NodeJS API wrapper for DEXTools. Supports Dextools API v1 and Dextools API v2
- Installation
- Obtaining API Key
- Getting Started
- Version 1 Queries
- Version 2 Queries
- Blockchain
- Exchange
- Pool
- Token
- Get token
- Get token locks
- Get token score
- Get token info
- Get token price
- Get token audit
- Get tokens
- Get tokens sorted by
creationBlockand descending order and providing block numbers instead in descending order - Get tokens sorted by
socialsInfoUpdatedand descending order and datetimes in descending order - Get token pools
- Get token pools sorted by
creationBlockand descending order and providing block numbers instead in descending order
- Rankings
- Page and PageSize arguments
- Examples
- Testing
- Supported Blockchains
- Authors
- More information
npm install dextools-node
To obtain an API key, head to the Developer Portal and choose your plan.
There are 2 versions of the Dextools API. Dextools API v1 and Dextools API v2
To get started, import the package, and initiate a DextoolsAPI instance object by passing your API key:
const { DextoolsAPI } = require('dextools-node');
const dextools = new DextoolsAPI(api_key);
You can also pass an optional user agent:
const dextools = new DextoolsAPI(api_key, "User-Agent");
To get started, import the package, and initiate a DextoolsAPIV2 instance object by passing your API key and your plan:
const { DextoolsAPIV2 } = require('dextools-node');
const dextools = new DextoolsAPIV2(api_key, "trial");
You can also pass an optional user agent:
const dextools = new DextoolsAPIV2(api_key, "User-Agent", "trial");
If you don't specify any plan when instantiating the object, it will default to "partner" plan
You can setup your plan when setting the object instance by providing the plan argument in the constructor. If no plan is specified, it will default to "partner" plan
To set your plan after the object is created, you can use the setPlan("your_plan") method
dextools.setPlan("standard");
Available values: "free", "trial", "standard", "advanced", "pro", and "partner"
Below are a set of queries supported by the Dextools API v1. All data is returned as a JavaScript object for easy data handling.
To get the pairs of a token, pass a chain id and a pair address:
let pair = await dextools.getPair("ether", "0xa29fe6ef9592b5d408cca961d0fb9b1faf497d6d");
console.log(pair);
To get token details, pass a chain id, and a token address:
let token = await dextools.getToken("ether", "0xfb7b4564402e5500db5bb6d63ae671302777c75a");
console.log(token);
You can also pass the page and pageSize parameters:
let token = await dextools.getToken("ether", "0xfb7b4564402e5500db5bb6d63ae671302777c75a", 1, 50);
console.log(token);
To get the chain list:
let chain_list = await dextools.getChainList();
console.log(chain_list);
You can also pass the page and pageSize parameters:
let chain_list = await dextools.getChainList(1, 50);
console.log(chain_list);
To get the exchange list, pass a chain id:
let exchange_list = await dextools.getExchangeList("ether");
console.log(exchange_list);
You can also pass the page and pageSize parameters:
let exchange_list = await dextools.getExchangeList("ether", 1, 50);
console.log(exchange_list);
Below are a set of queries supported by the Dextools API v2. All data is returned as a JavaScript object for easy data handling.
let blockchain = await dextools.getBlockchain("ether");
console.log(blockchain);
let blockchains = await dextools.getBlockchains();
console.log(blockchains);
let blockchains = await dextools.getBlockchains("desc", "name");
console.log(blockchains);
let factory = await dextools.getDexFactoryInfo("ether", "0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f");
console.log(factory);
let dexes = await dextools.getDexes("ether");
console.log(dexes);
let dexes = await dextools.getDexes("ether", "desc", "name");
console.log(dexes);
let pool = await dextools.getPool("ether", "0xa29fe6ef9592b5d408cca961d0fb9b1faf497d6d");
console.log(pool);
let pool_liquidity = await dextools.getPoolLiquidity("ether", "0xa29fe6ef9592b5d408cca961d0fb9b1faf497d6d");
console.log(pool_liquidity);
let pool_score = await dextools.getPoolScore("ether", "0xa29fe6ef9592b5d408cca961d0fb9b1faf497d6d");
console.log(pool_score);
let pool_price = await dextools.getPoolPrice("ether", "0xa29fe6ef9592b5d408cca961d0fb9b1faf497d6d");
console.log(pool_price);
let pool_locks = await dextools.getPoolLocks("ether", "0xa29fe6ef9592b5d408cca961d0fb9b1faf497d6d");
console.log(pool_locks);
let pools = await dextools.getPools("ether", from_="2023-11-14T19:00:00", to="2023-11-14T23:00:00");
console.log(pools);
let pools = await dextools.getPools("ether", "12755070", "12755071", "desc", "creationBlock");
console.log(pools);
let token = await dextools.getToken("ether", "0xfb7b4564402e5500db5bb6d63ae671302777c75a");
console.log(token);
let token_locks = await dextools.getTokenLocks("ether", "0xfb7b4564402e5500db5bb6d63ae671302777c75a");
console.log(token_locks);
let token_score = await dextools.getTokenScore("ether", "0xfb7b4564402e5500db5bb6d63ae671302777c75a");
console.log(token_score);
let token_info = await dextools.getTokenInfo("ether", "0xfb7b4564402e5500db5bb6d63ae671302777c75a");
console.log(token_info);
let token_price = await dextools.getTokenPrice("ether", "0xfb7b4564402e5500db5bb6d63ae671302777c75a");
console.log(token_price);
let token_audit = await dextools.getTokenAudit("ether", "0xfb7b4564402e5500db5bb6d63ae671302777c75a");
console.log(token_audit);
let tokens = await dextools.getTokens("ether", "2023-11-14T19:00:00", "2023-11-14T23:00:00");
console.log(tokens);
Get tokens sorted by creationBlock and descending order and providing block numbers instead in descending order
let tokens = await dextools.getTokens("ether", "18570000", "18570500", "desc", "creationBlock");
console.log(tokens);
let tokens = await dextools.getTokens("ether", "2023-11-14T19:00:00", "2023-11-14T23:00:00", "desc", "socialsInfoUpdated");
console.log(tokens);
let token_pools = await dextools.getTokenPools("ether", "0xfb7b4564402e5500db5bb6d63ae671302777c75a", "2023-11-14T19:00:00", "2023-11-14T23:00:00");
console.log(token_pools);
Get token pools sorted by creationBlock and descending order and providing block numbers instead in descending order
let token_pools = await dextools.getTokenPools("ether", "0xfb7b4564402e5500db5bb6d63ae671302777c75a", "18570000", "18570500", "desc", "creationBlock");
console.log(token_pools);
let hot_pools = await dextools.getRankingHotPools("ether");
console.log(hot_pools);
let gainers = await dextools.getRankingGainers("ether");
console.log(gainers);
let losers = await dextools.getRankingLosers("ether");
console.log(losers);
Some methods support the page and pageSize arguments. Check out the API documentation for more information.
Check out the examples folder for some synchronous and asynchronous example scripts.
A set of tests have been included inside tests folder. You will need to set an environment variable as DextoolsAPIKey using your API key.
Dextools adds support for new blockchains from time to time. dextools.getBlockchains() to get a list of supported blockchains and their IDs
