otmjka / dg-sdk-node

dex.guru SDK Node

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

logo

dexguru-sdk is a light wrapper around dex.guru REST API.

Installation

NPM

npm install dexguru-sdk

Yarn

yarn install dexguru-sdk

Getting Started

Get an API key from developers.dex.guru

import DexGuru, { ChainsListModel } from "dexguru-sdk";

const YOUR_API_KEY = 'abc123';

const sdk = new DexGuru(YOUR_API_KEY, "https://api.dev.dex.guru");
const chains: ChainsListModel = await sdk.getAllChains();

SDK providers all responses with Typescript models

export interface ChainModel {
    chain_id: number;
    name: string;
    description: string;
}

export interface ChainsListModel {
  total: number;
  data: ChainModel[];
}

Usage Examples

See a wallet:

import DexGuru, { ChainsListModel } from 'dexguru-sdk';

const YOUR_API_KEY = 'abc123';
const wallet = 'bot_wallet_address';

const sdk = new DexGuru(YOUR_API_KEY, "https://api.dev.dex.guru");

const response = await sdk.getWalletInfo(ChainChoices._1, wallet)
console.log(response)

Note that a valid wallet id need to be provided.

The response:

{
    "wallet_address": "bot_wallet_address",
    "volume_1m_usd": 5000.123456,
    "txns_1m": 999999,
    "category": "bot",
    "timestamp": 1621635936
}

Check trades on that same wallet:

import DexGuru, { ChainChoices, SwapsBurnsMintsListModel } from 'dexguru-sdk';

const trades: SwapsBurnsMintsListModel = sdk.getWalletTransactions(ChainChoices._1, "bot_wallet_address");
console.log(trades);

About

dex.guru SDK Node


Languages

Language:TypeScript 100.0%