Kriya Docs
  • Overview
    • What is Kriya?
      • Kriya Suite : HLD
    • Why Sui?
    • FAQs
    • Legal Disclaimer
  • Get funds on SUI
    • Bridge
    • Withdraw from CEX (Cede Store)
    • Buy SUI with Fiat (Transak)
    • P2P escrow from Eth (Heroswap)
  • Kriya x Sui Wallet Campaign
  • Migrating liquidity to v3
  • Kriya Swap
    • Swap Tutorial
      • Trade
        • Market Order
        • Limit Order
        • Dollar Cost Averaging (Coming Soon)
      • Provide Liquidity
    • Swap Architecture
      • Router Mechanism
      • Supported Pool Types
    • Swap Fee Structure
  • Kriya Strategy Vaults
    • Leverage Lending Vaults
      • Concept - Leverage Lending
      • Vault Tutorial
    • CLMM LP Optimizer Vaults
      • Vault Strategy - Auto Rebalancing and Compounding
      • Vault Tutorial
    • Deepbook MM Vaults (Coming Soon)
    • KLP Vaults (Coming Soon)
    • 1-click Automation Strats (Deprecated)
      • Concept - Leverage Lending
      • Strat Tutorial
  • Kriya Degen Corner
    • Sui Sniffer
    • No Code Token Launch on Sui
      • Tutorial to launch a coin
    • Airdrop to Sui Communities
  • Kriya Perpetuals
    • Perpetual Tutorial
      • Place Trade
      • Understanding Open Orders
      • Understanding Open Positions
    • How to get Early Access
    • Protocol Configs and Fees
      • Trading Limits
      • Listed Markets
      • Maker / Taker Fee
    • Perpetual Architecture
      • Margining and Liquidation
        • Custom Mark Price Oracle
      • Matching and Settlement
        • Order Types
        • Orderbook Tech Design
      • Funding Rate
      • Insurance Fund
    • Market Maker Program
  • Kriya OTC (Coming Soon)
    • Introduction and Use Case
    • User Guide
      • Creating an RFQ
        • Option RFQ example
      • Escrow Assets for RFQ
      • Respond to RFQ
      • Settlement
    • Protocol Architecture
      • Privacy
      • On-chain negotiation
    • MMs Get Access
  • Reward Programs
    • Suinami LP Campaign
    • Chakra Season 1 🧘‍♂️
    • Chakra Season 2 🧘‍♀️
    • Chakra Season 3 (Coming Soon)
    • Partner Campaigns
    • Galxe and Zealy
    • DoubleUp
    • Referral Program (Coming Soon)
    • Sui Overflow Hackathon
  • For Developers
    • Smart Contracts
    • Kriya Swap SDK
    • Kriya Perps
      • Run your own MM Bot
      • Run your own Liquidator Bot
      • Public Functions for Liveness
  • About
    • Audit Reports
    • Socials and Community
      • Discord
      • Blog
      • Twitter
    • Brand Assets
    • Careers
Powered by GitBook
On this page
  • Installation
  • Usage
  • Test Example
  1. For Developers

Kriya Swap SDK

Official Kriya CLMM TypeScript SDK for Sui

The Kriya CLMM TypeScript SDK enables you to interact with Kriya CLMM smart contracts within a TypeScript/JavaScript environment. Follow these steps to integrate the SDK with your project:

Installation

To interact with the CLMM SDK, we recommend installing though npm:

npm i kriya-v3-sdk

Usage

For ease of use, create an instance of KriyaSDK to make calls to individual modules:

Initialize Kriya SDK

import { KriyaSDK } from 'kriya-v3-sdk';
const rpcEndpoint = "https://fullnode.mainnet.sui.io:443"
const kriyaSdk = new KriyaSDK(rpcEndpoint, isMainnet); // isMainnet- true or false

Create individual module provider

const adminModule = kriyaSdk.Admin();
const poolModule = kriyaSdk.Pool();
const positionModule = kriyaSdk.Position();

Test Example

Add Liquidity to a pool

const txb = new TransactionBlock();

const rpcEndpoint = "https://fullnode.mainnet.sui.io:443"

const kriyaSdk = new KriyaSDK(rpcEndpoint, true);

const pool: PoolParams = {
        objectId: "0x6d592184e5e29f640551e899f247799f78d1d13b033933cb70b28d8ba1532ffa",
        tokenXType: "0x5d4b302506645c37ff133b98c4b50a5ae14841659738d6d733d59d0d217a93bf::coin::COIN",
        tokenYType: "0x2::sui::SUI",
    };

// coinsXlist,coinsYlist -> { objectId: string; balance: bigint }[]
let CoinX = getExactCoinByAmount(pool.tokenXType, coinsXlist, BigInt(amount_x), txb);
let CoinY = getExactCoinByAmount(pool.tokenYType, coinsYlist, BigInt(amount_y), txb);

// Add Liquidity
kriyaSdk.pool.addLiquidity(...)
public addLiquidity(
        txb: TransactionBlock,
        pool: PoolParams,
        position: string | TransactionArgument,
        coinX: TransactionArgument,
        coinY: TransactionArgument,
        min_amount_x: number,
        min_amount_y: number,
        transferToAddress?: string
    ) 

PreviousSmart ContractsNextKriya Perps

Last updated 10 months ago

You can access our SDK via this link:

The latest version of the SDK is used in production in the Kriya Interface but it may change significantly between patch versions. If you have questions about how to use the SDK, please create a ticket in .

https://www.npmjs.com/package/kriya-v3-sdk
Discord