Skip to main content

Getting Started

This guide covers everything you need to start integrating with Kroko DEX — connecting to the network, setting up contract references, and making your first API call.

Prerequisites

  • A wallet library (e.g., ethers.js or viem)
  • Node.js 18+ (for server-side integration) or a modern browser (for frontend)

1. Connect to Kasplex

Add the Kasplex network to your wallet or provider:
import { ethers } from 'ethers';

// Mainnet
const provider = new ethers.JsonRpcProvider('https://evmrpc.kasplex.org');

// Testnet
const testnetProvider = new ethers.JsonRpcProvider('https://rpc.kasplextest.xyz');

2. Contract Addresses

Reference the deployed contracts for the network you’re targeting:
const CONTRACTS = {
  PERMIT2: '0x2E1987F680FD7Bc8B33d3Bf94f12B988A0B50034',
  UNIVERSAL_ROUTER: '0xefeCc1c2dE3BfE4C6D43030F2AcDD5C3cE279024',
  WKAS: '0x2c2Ae87Ba178F48637acAe54B87c3924F544a83e',
  V2_FACTORY: '0x4373b7Fcf5059A785843cD224129e01d243Aef71',
  V2_ROUTER: '0xC7ca845B8302346e1C7227f03bb9EFb35ecD51fe',
  V3_FACTORY: '0x0dfb1Bb755d872EA1fa4d95E4ad0c2E6317Ce9B9',
  V3_POSITION_MANAGER: '0x343b244bEDF133D57C61b241557bF29AA32ea4F9',
};
See Contract Addresses for the full table.

3. API Base URL

The Swap API is available at:
https://dex.kasplex.org/swap-api

4. Your First API Call

Fetch the token list to verify connectivity:
const response = await fetch('https://dex.kasplex.org/api/v1/tokens2?limit=10');
const data = await response.json();
console.log(data.tokens);
// [{ address: '0x...', symbol: 'WKAS', name: 'Wrapped KAS', decimals: 18 }, ...]

5. Get a Quote

Try fetching a swap quote:
const params = new URLSearchParams({
  tokenIn: CONTRACTS.WKAS,
  tokenOut: '0xB190a6A7fC2873f1Abf145279eD664348d5Ef630', // Example token
  amountIn: '1000000000000000000', // 1 KAS
  tradeType: '0'
});

const quote = await fetch(`https://dex.kasplex.org/swap-api/api/v1/quote?${params}`);
const data = await quote.json();
console.log(`1 KAS = ${data.executionPrice} tokens`);

Next Steps