Prerequisites

1. NPM install

npm i @cetusprotocol/cetus-sui-clmm-sdk

2. Setting Up Configuration

  1. Initialize testnet (or mainnet) SdkOption.

  2. Instantiate one CetusClmmSDK.

  • In this example, the contract address version may backward, please use the latest clmm pool and integrate address.

  • simulationAccount should be add an account address with a small amount of assets, it used to do estimated or other query object from chain

Example

import CetusClmmSDK, { SdkOptions } from '@cetusprotocol/cetus-sui-clmm-sdk'

const SDKConfig = {
  clmmConfig: {
    pools_id: '......',
    global_config_id: '......',
    global_vault_id: '......',
    admin_cap_id: '......',
  },
  cetusConfig: {
    coin_list_id: '......',
    launchpad_pools_id: '......',
    clmm_pools_id: '......',
    admin_cap_id: '......',
    global_config_id: '......',
    coin_list_handle: '......',
    launchpad_pools_handle: '......',
    clmm_pools_handle: '......',
  },
}

export const clmmTestnet: SdkOptions = {
  fullRpcUrl: '......',
  simulationAccount: {
    address: '......',
  },
  faucet: {
    package_id: '......',
    published_at: '......',
  },
  cetus_config: {
    package_id: '......',
    published_at: '......',
    config: SDKConfig.cetusConfig,
  },

  clmm_pool: {
    package_id: '......',
    published_at: '......',
    config: SDKConfig.clmmConfig,
  },
  integrate: {
    package_id: '......',
    published_at: '......',
  },
  deepbook: {
    package_id: '......',
    published_at: '......',
  },
  deepbook_endpoint_v2: {
    package_id: '......',
    published_at: '......',
  },
  aggregatorUrl: '......',
}

export const TestnetSDK = new CetusClmmSDK(clmmTestnet)

Now, you can start using Cetus SDK.

Last updated