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
    ) 

You can access our SDK via this link: https://www.npmjs.com/package/kriya-v3-sdk

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 Discord.

Last updated