LogoLogo
eckoDAOeckoDEXeckoWalleteckoGOV
  • 👾Welcome
    • eckoDAO - Introduction
    • Product Suite
    • $KDX Tokenomics
      • $KDX Token Distribution
      • $KDX Liquidity Mining
    • Governance
  • 🔄eckoDEX
    • Introduction
    • eckoDEX Litepaper
      • Why eckoDEX?
        • Problems in DeFi
        • Solution: Long Term Scalability
        • Solution: Gas-free
        • Solution: Slippage Control
        • Solution: Decentralised Infrastructure
        • Solution: Secure Smart Contracts
      • Industry Outlook
        • DEX Market Potential
        • eckoDEX: The Next Generation of DEXes
      • Vision
    • Platform
    • How to Swap
      • X-Swap
      • The eckoDEX Wrapper
    • Migrate liquidity from eckoDEX Beta to Mainnet V1
    • How to Add Liquidity
      • Single-Sided Liquidity
      • Understanding Liquidity Provision and Impermanent Loss
    • Governance Mining
      • Understanding Governance Mining
  • 💰eckoWALLET
    • Introduction
    • eckoWALLET API
    • Quicksign: KIP-0015
    • WalletConnect
    • FAQ
  • 🏛️eckoGOV
    • 👋Welcome to eckoGOV
      • 📚Litepaper Overview
    • 🚀Getting Started
      • 📋Minimum Requirements
      • 📥Login
      • 🌍Spaces
        • 💰Spaces Treasury
      • 👥Members
        • 🔠Edit Profile
    • 🧑‍🏫Role System
      • 1️L1 - eckoMEMBER
      • 2️L2 - eckoLEAD
      • 3️L3 - eckoCORE
      • 🧮Voting Power
      • 🙋Applying for a eckoDAO Role
      • 🔎KYC
    • 🌀Proposal Epoch
      • 🗃️Proposal Categories
      • 📑Creating Proposals
        • 🧾Proposal Template
        • 👍Proposal Example
      • 📊Voting on Proposals
      • 🗣️Discourse - Proposal Discussion
    • 💰Using the KDX Treasury
    • 📄Smart Contracts
  • 🔒Security & Contracts
    • Bug Bounty
    • Audits
  • 🤝Marketing
    • Social & Communities
    • eckoDAO Brand Assets
    • eckoWALLET Brand Assets
  • ⚡SDK
    • Overview
    • Quickstart
    • Reference
      • eckoDEX SDK
        • createPair
        • addLiquidity
        • removeLiquidity
        • swap
        • swapExactIn
        • swapExactOut
      • retrieveVerifiedAccount
      • TOKENS
Powered by GitBook
On this page
  1. SDK
  2. Reference

eckoDEX SDK

Initializing a eckoDEX SDK client

Initializing a eckoDEX SDK client is super simple and straightforward.

import { KaddexSdk } from 'kaddex-sdk';

const kaddex = new KaddexSdk({ account, secretKey:  );

await kaddex.swap({ ... });

You can also pass your account and/or secret key into the initializer to avoid the need to pass them into each function call.

import dotenv from 'dotenv';
import { KaddexSdk } from 'kaddex-sdk';

dotenv.config();

const PUBLIC_KEY = process.env.PUBLIC_KEY;
const SECRET_KEY = process.env.SECRET_KEY;

// if your account name is different from your PUBLIC_KEY, use the correct value here
const account = await retrieveVerifiedAccount({ accountName: PUBLIC_KEY });

const kaddex = new KaddexSdk({ account, secretKey: SECRET_KEY });

await kaddex.swap({ ... });

A client instance includes all the core methods you'll need for interacting with the swap.

PreviousReferenceNextcreatePair

Last updated 11 months ago

⚡
createPair
addLiquidity
removeLiquidity
swap
swapExactIn
swapExactOut