# Kriya Swap SDK

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

```typescript
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**

<pre class="language-typescript"><code class="lang-typescript"><strong>const adminModule = kriyaSdk.Admin();
</strong><strong>const poolModule = kriyaSdk.Pool();
</strong>const positionModule = kriyaSdk.Position();
</code></pre>

## Test Example

#### Add Liquidity to a pool

```typescript
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](https://discord.gg/kriya).


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.kriya.finance/for-developers/kriya-swap-sdk.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
