Agent skill

cetus-clmm-sdk-skill

Guides developers through using Cetus CLMM TypeScript SDK for liquidity management, pool operations, swaps, and reward collection. Use when working with Cetus Protocol's Concentrated Liquidity Market Maker (CLMM) or when the user mentions Cetus SDK, CLMM, liquidity pools, or DeFi on Sui.

Stars 5
Forks 1

Install this agent skill to your Project

npx add-skill https://github.com/RandyPen/sui-eco-skills/tree/main/cetus-clmm-sdk-skill

SKILL.md

Cetus CLMM SDK Guide

Overview

This Skill provides comprehensive guidance for using the Cetus CLMM (Concentrated Liquidity Market Maker) TypeScript SDK. The SDK enables developers to interact with Cetus Protocol's CLMM on the Sui blockchain, including liquidity management, pool operations, swaps, and reward collection.

Getting Started

See Getting Started Guide for installation, configuration, and basic setup.

Core Modules

Liquidity Management

Add, remove, and manage liquidity positions:

  • Add liquidity: Deposit tokens into existing positions
  • Remove liquidity: Withdraw tokens from positions
  • Open Position: Create new liquidity positions
  • Close Position: Remove and collect from positions
  • Detailed guide

Pool Operations

Create and interact with CLMM pools:

  • Create CLMM Pool: Initialize new trading pools
  • Getting CLMM Pools: Query and list available pools
  • Gets ticks: Fetch tick data for price ranges
  • Detailed guide

Swap Operations

Execute token swaps with optimized pricing:

  • Pre Swap: Calculate swap outcomes before execution
  • Swap: Execute token exchanges
  • Price impact & fees: Calculate trading costs
  • Detailed guide

Rewards Management

Collect and manage liquidity provider rewards:

  • Collect rewards: Claim accumulated rewards
  • Gets Pool Position Rewards: Query reward amounts for positions
  • Detailed guide

Math Utilities

CLMM calculation tools from @cetusprotocol/common-sdk:

  • Price conversions: Convert between price, sqrt price, and tick index
  • Liquidity calculations: Compute liquidity amounts and token requirements
  • Tick math: Work with tick indices and ranges
  • Detailed guide

Examples

  • End-to-end Liquidity Management - Complete workflow for adding and managing liquidity
  • Complete Swap Flow - Full swap execution with pre-calculation
  • Reward Collection Workflow - Claiming and managing rewards

Best Practices

SDK Initialization

Always initialize the SDK with appropriate network configuration:

typescript
import CetusClmmSDK from '@cetusprotocol/sui-clmm-sdk'

// For mainnet use
const sdk = CetusClmmSDK.createSDK({ env: 'mainnet' })

// For testnet use
const sdk = CetusClmmSDK.createSDK({ env: 'testnet' })

Error Handling

Wrap SDK calls in try-catch blocks and handle common errors:

  • Network connectivity issues
  • Insufficient balance errors
  • Transaction validation failures
  • Position/pool not found errors

Performance Considerations

  • Cache pool and position data when possible
  • Batch related operations when appropriate
  • Monitor gas estimates before transaction submission

Security

  • Never expose private keys in code
  • Validate all user inputs and parameters
  • Use appropriate slippage protection
  • Review transaction payloads before signing

Troubleshooting

Common Issues

SDK initialization fails

  • Verify network connectivity
  • Check RPC endpoint availability
  • Ensure proper package installation

Transactions fail

  • Check account balance and gas fees
  • Verify position/pool exists and is accessible
  • Review error messages for specific issues

Price calculations incorrect

  • Confirm decimal precision settings
  • Verify tick spacing matches pool configuration
  • Check current pool state and liquidity

Debugging Tips

  1. Enable debug logging in SDK configuration
  2. Test with small amounts first
  3. Use testnet for development and testing
  4. Consult the Cetus documentation for updates

Resources

Expand your agent's capabilities with these related and highly-rated skills.

RandyPen/sui-eco-skills

sui-transaction-building

Helps Claude Code understand Sui blockchain transaction building, providing guidelines and examples for Transaction class, commands, input types, gas configuration, and serialization. Use when building blockchain transactions on Sui or when the user mentions transaction building, Transaction class, or Move calls.

5 1
Explore
RandyPen/sui-eco-skills

sui-keypair-cryptography

Helps Claude Code understand Sui blockchain keypair and cryptography operations, providing guidelines and examples for key generation, signing, verification, address derivation, and multi-signature scheme support. Use when working with cryptography in Sui development or when the user mentions keypairs, cryptography, signing, or verification.

5 1
Explore
RandyPen/sui-eco-skills

deepbook-trading

Helps Claude Code understand DeepBook V3 SDK usage for order book trading, flash loans, fund management, and market data queries on Sui blockchain. Use when operating DeepBook DEX, executing trading strategies, or querying market data.

5 1
Explore
RandyPen/sui-eco-skills

working-with-ferra-dlmm

Helps developers work with the Ferra DLMM SDK for Discrete Liquidity Market Maker operations on Sui blockchain. Provides guidance on SDK initialization, pair creation, liquidity management, token swaps, and position handling. Use when working with DLMM pairs, adding/removing liquidity, creating trading pairs, or performing token swaps in the ferra-sdks monorepo.

5 1
Explore
RandyPen/sui-eco-skills

deepbook-margin-trading-skill

Guides developers through using DeepBook V3 Margin Trading SDK for leverage trading, borrowing, lending, liquidation operations, and risk management on Sui blockchain. Use when working with DeepBook margin trading, margin pools, margin managers, take profit/stop loss orders, or liquidation functionality.

5 1
Explore
RandyPen/sui-eco-skills

sui-client

Interact with Sui blockchain using @mysten/sui SDK. Use when building transactions, reading chain data, or managing staking positions on Sui.

5 1
Explore

Didn't find tool you were looking for?

Be as detailed as possible for better results