3.1.2 • Published 9 months ago

turbos-clmm-sdk v3.1.2

Weekly downloads
-
License
MIT
Repository
-
Last release
9 months ago

Installation

pnpm add turbos-clmm-sdk @mysten/sui

Modules

  • contract
  • trade
  • pool
  • nft
  • account
  • math

Initial SDK

import { JsonRpcProvider, testnetConnection } from '@mysten/sui';
import { Network, TurbosSdk } from 'turbos-clmm-sdk';

// Choose one way
export const sdk = new TurbosSdk(Network.testnet);
export const sdk = new TurbosSdk(Network.testnet, testnetConnection);
export const sdk = new TurbosSdk(Network.testnet, new JsonRpcProvider(testnetConnection));

Module:Contract

getConfig

import type { Contract } from 'turbos-clmm-sdk';

const contract = await sdk.contract.getConfig(); // interface: Contract.Config

getFees

import type { Contract } from 'turbos-clmm-sdk';

const fees = await sdk.contract.getFees(); // interface: Contract.Fee[]

Module:Trade

computeSwapResult

import type { Trade } from 'turbos-clmm-sdk';

// interface: Trade.ComputedSwapResult[]
const swapResults = await sdk.trade.computeSwapResult({
  pools: Array<{
    pool: string;
    a2b: boolean;
  }>,
  address: string;
  amountSpecified: number | string;
  amountSpecifiedIsInput: boolean;
});

swap

const txb = await sdk.trade.swap({
  /**
   * nextTickIndex = sdk.math.bitsToNumber(swapResult.tick_current_index.bits)
   */
  routes: { pool: string; a2b: boolean; nextTickIndex: number }[];
  coinTypeA: string;
  coinTypeB: string;
  address: string;
  amountA: number | string;
  amountB: number | string;
  amountSpecifiedIsInput: boolean;
  slippage: string;
  txb?: Transaction;
});
3.1.2

9 months ago

3.1.1

9 months ago

2.4.1

1 year ago

2.4.0

1 year ago

2.6.1

12 months ago

2.6.0

1 year ago

2.6.2

12 months ago

3.0.2

12 months ago

3.0.1

12 months ago

3.0.0

12 months ago

2.5.0

1 year ago

3.1.0

10 months ago

2.3.1

1 year ago

2.3.0

1 year ago

2.2.1

1 year ago

2.2.2

1 year ago

2.2.0

1 year ago

2.1.0

1 year ago

2.0.6

1 year ago

2.0.5

1 year ago

2.0.4

1 year ago

2.0.3

2 years ago

1.1.1

2 years ago

1.1.0

2 years ago

1.0.0

2 years ago

0.7.6

2 years ago

0.7.5

2 years ago

0.7.7

2 years ago

2.0.2

2 years ago

2.0.1

2 years ago

2.0.0

2 years ago

0.3.0

2 years ago

0.1.2

2 years ago

0.2.0

2 years ago

0.7.2

2 years ago

0.7.1

2 years ago

0.7.4

2 years ago

0.7.3

2 years ago

0.5.0

2 years ago

0.4.1

2 years ago

0.1.4

2 years ago

0.4.0

2 years ago

0.3.1

2 years ago

0.1.3

2 years ago

0.7.0

2 years ago

0.6.1

2 years ago

0.4.3

2 years ago

0.6.0

2 years ago

0.4.2

2 years ago

0.1.1

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.1.0

2 years ago