Skip to content

alb2001/dextools-node

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Image

DEXTools Node

Node.js CI NPM Downloads License: MIT NPM Version

A simple NodeJS API wrapper for DEXTools. Supports Dextools API v1 and Dextools API v2

  1. Installation
  2. Obtaining API Key
  3. Getting Started
    1. Version 1
    2. Version 2
      1. Available plans - Setting your plan
  4. Version 1 Queries
    1. Get pairs of a token
    2. Get token details
    3. Get chain list
    4. Get exchange list
  5. Version 2 Queries
    1. Blockchain
      1. Get blockchain info
      2. Get blockchains sorted by default settings
      3. Get blockchains sorted by default settings and descending order
    2. Exchange
      1. Get dex factory info
      2. Get dexes on a specific chain
      3. Get dexes on a specific chain sorted by name and descending order
    3. Pool
      1. Get pool info
      2. Get pool liquidity
      3. Get pool score
      4. Get pool price
      5. Get pool locks
      6. Get pools
      7. Get pools sorted by creationBlock and descending order and providing block numbers instead
    4. Token
      1. Get token
      2. Get token locks
      3. Get token score
      4. Get token info
      5. Get token price
      6. Get token audit
      7. Get tokens
      8. Get tokens sorted by creationBlock and descending order and providing block numbers instead in descending order
      9. Get tokens sorted by socialsInfoUpdated and descending order and datetimes in descending order
      10. Get token pools
      11. Get token pools sorted by creationBlock and descending order and providing block numbers instead in descending order
    5. Rankings
      1. Get hot pools
      2. Get gainers
      3. Get losers
  6. Page and PageSize arguments
  7. Examples
  8. Testing
  9. Supported Blockchains
  10. Authors
  11. More information

Installation

npm install dextools-node

Obtaining API Key

To obtain an API key, head to the Developer Portal and choose your plan.

Getting Started

There are 2 versions of the Dextools API. Dextools API v1 and Dextools API v2

Version 1

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");

Version 2

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

Available plans - Setting your 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"

Version 1 Queries

Below are a set of queries supported by the Dextools API v1. All data is returned as a JavaScript object for easy data handling.

Get pairs of a token

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);

Get token details

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);

Get chain list

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);

Get exchange 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);

Version 2 Queries

Below are a set of queries supported by the Dextools API v2. All data is returned as a JavaScript object for easy data handling.

Blockchain

Get blockchain info

let blockchain = await dextools.getBlockchain("ether");
console.log(blockchain);

Get blockchains sorted by default settings

let blockchains = await dextools.getBlockchains();
console.log(blockchains);

Get blockchains sorted by default settings and descending order

let blockchains = await dextools.getBlockchains("desc", "name");
console.log(blockchains);

Exchange

Get dex factory info

let factory = await dextools.getDexFactoryInfo("ether", "0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f");
console.log(factory);

Get dexes on a specific chain

let dexes = await dextools.getDexes("ether");
console.log(dexes);

Get dexes on a specific chain sorted by name and descending order

let dexes = await dextools.getDexes("ether", "desc", "name");
console.log(dexes);

Pool

Get pool info

let pool = await dextools.getPool("ether", "0xa29fe6ef9592b5d408cca961d0fb9b1faf497d6d");
console.log(pool);

Get pool liquidity

let pool_liquidity = await dextools.getPoolLiquidity("ether", "0xa29fe6ef9592b5d408cca961d0fb9b1faf497d6d");
console.log(pool_liquidity);

Get pool score

let pool_score = await dextools.getPoolScore("ether", "0xa29fe6ef9592b5d408cca961d0fb9b1faf497d6d");
console.log(pool_score);

Get pool price

let pool_price = await dextools.getPoolPrice("ether", "0xa29fe6ef9592b5d408cca961d0fb9b1faf497d6d");
console.log(pool_price);

Get pool locks

let pool_locks = await dextools.getPoolLocks("ether", "0xa29fe6ef9592b5d408cca961d0fb9b1faf497d6d");
console.log(pool_locks);

Get pools

let pools = await dextools.getPools("ether", from_="2023-11-14T19:00:00", to="2023-11-14T23:00:00");
console.log(pools);

Get pools sorted by creationBlock and descending order and providing block numbers instead

let pools = await dextools.getPools("ether", "12755070", "12755071", "desc", "creationBlock");
console.log(pools);

Token

Get token

let token = await dextools.getToken("ether", "0xfb7b4564402e5500db5bb6d63ae671302777c75a");
console.log(token);

Get token locks

let token_locks = await dextools.getTokenLocks("ether", "0xfb7b4564402e5500db5bb6d63ae671302777c75a");
console.log(token_locks);

Get token score

let token_score = await dextools.getTokenScore("ether", "0xfb7b4564402e5500db5bb6d63ae671302777c75a");
console.log(token_score);

Get token info

let token_info = await dextools.getTokenInfo("ether", "0xfb7b4564402e5500db5bb6d63ae671302777c75a");
console.log(token_info);

Get token price

let token_price = await dextools.getTokenPrice("ether", "0xfb7b4564402e5500db5bb6d63ae671302777c75a");
console.log(token_price);

Get token audit

let token_audit = await dextools.getTokenAudit("ether", "0xfb7b4564402e5500db5bb6d63ae671302777c75a");
console.log(token_audit);

Get tokens

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);

Get tokens sorted by socialsInfoUpdated and descending order and datetimes in descending order

let tokens = await dextools.getTokens("ether", "2023-11-14T19:00:00", "2023-11-14T23:00:00", "desc", "socialsInfoUpdated");
console.log(tokens);

Get token pools

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);

Rankings

Get hot pools

let hot_pools = await dextools.getRankingHotPools("ether");
console.log(hot_pools);

Get gainers

let gainers = await dextools.getRankingGainers("ether");
console.log(gainers);

Get losers

let losers = await dextools.getRankingLosers("ether");
console.log(losers);

Page and PageSize arguments

Some methods support the page and pageSize arguments. Check out the API documentation for more information.

Examples

Check out the examples folder for some synchronous and asynchronous example scripts.

Testing

A set of tests have been included inside tests folder. You will need to set an environment variable as DextoolsAPIKey using your API key.

Supported Blockchains

Dextools adds support for new blockchains from time to time. dextools.getBlockchains() to get a list of supported blockchains and their IDs

Authors

More information

Releases

No releases published

Packages

No packages published