Javascript SDK
A powerful JavaScript SDK for integrating with the 1DEX decentralized exchange platform, providing seamless access to trading functionality and market data.
1DEX JavaScript SDK
Installation
npm install 1dex-js-sdkGetting Started
Initializing the SDK
import { DexKit, ETradeSide, EOrderType } from "1dex-js-sdk";
// Create a new DexKit instance
const dexKit = new DexKit({
apiKey: "YOUR_API_KEY",
secretKey: "YOUR_SECRET_KEY",
enableProxy: false, // Optional, defaults to true
apiClientConfig: {
baseUrl: "https://api-v1.example.com", // Optional, defaults to 'https://api-v1.1dex.com'
},
blockchainRpcClientConfig: {
chainID: "YOUR_CHAIN_ID", // Optional, defaults to 'aca376f206b8fc25a6ed44dbdc66547c36c6c33e3a119ffbeaef943642f0e906'
rpcUrl: "https://rpc.example.com", // Optional, defaults to 'https://spring-rpc.1dex.com'
},
devMode: false, // Optional, if set to true, it will output debug information of certain methods in the console
version: "v2" // Optional, if set to 'v2', it will enable AMM listing, default is 'v1'
});
// Initialize the DexKit instance
await dexKit.initialize();DexKit Interface
Core Methods
Resource Management
Constructor Options
HTTP API Client
Account and Balance
Market Data
Order Management
Token Information
Complete Trading Example
Powerup Example
Error Handling
Last updated