Automated summary
Provides integration with the Cetus Aggregator SDK for multi-DEX token swaps on the Sui blockchain, enabling optimal routing across 30+ DEXs.
Strengths
- Simplifies multi-DEX swap execution with a unified API
- Supports slippage protection, gas optimization, and overlay fees
- Includes automatic routing and manual swap options
Limitations
- Requires Sui blockchain knowledge and SDK setup
- Dependent on external RPC and DEX availability
- Limited to Sui ecosystem only
When you need to execute token swaps on Sui with best price discovery across multiple DEXs.
For simple single-DEX swaps or chains other than Sui.
Security analysis
SafeThe skill provides standard code patterns for Sui blockchain token swaps using the Cetus Aggregator SDK. It uses environment variables for mnemonics, which is a common practice, and does not contain any destructive, exfiltrating, or obfuscated actions. It is a legitimate DeFi development tool.
No concerns found
How this analysis is madeExamples
Find the optimal route to swap 1 SUI to CETUS on Sui mainnet using Cetus Aggregator, considering the top DEXs like CETUS, KRIYA, and AFTERMATH.Execute a fast swap of 500 USDC to SUI on Sui mainnet with 0.5% slippage tolerance using Cetus Aggregator.Set up a swap from SUI to USDC on Cetus Aggregator with a 0.1% overlay fee directed to address 0x123, using the fast router.name: cetus-aggregator description: A Claude Code skill for working with the Cetus Aggregator SDK to execute optimized swaps across multiple Sui DEXs. Use this skill when you need to perform token swaps, find optimal routes across 30+ DEXs, execute gas-optimized transactions, or configure overlay fees on Sui blockchain.
Cetus Aggregator SDK Skill
A Claude Code skill for working with the Cetus Aggregator SDK to execute optimized swaps across multiple Sui DEXs. This skill provides comprehensive tools for multi-DEX routing, price discovery, and gas-optimized swap execution using the @cetusprotocol/aggregator-sdk library.
Instructions
Use this skill when you need to execute token swaps on the Sui blockchain. Includes:
- SDK Initialization: Configure environment, wallet, and RPC connection
- Multi-DEX Routing: Find optimal price routes across 30+ DEXs
- Swap Execution: Execute fast swaps or manual route swaps
- Slippage Protection: Configure slippage tolerance to protect transactions
- Gas Optimization: Dynamic gas management and budget settings
- Protocol Fees: Configure overlay fees and recipient addresses
- Error Handling: Comprehensive error handling and market condition validation
Quick Start
// Initialize SDK
import { AggregatorClient, Env } from '@cetusprotocol/aggregator-sdk'
import { SuiClient } from '@mysten/sui/client'
import { Ed25519Keypair } from '@mysten/sui/keypairs/ed25519'
const mnemonics: string = process.env.MNEMONICS!;
const i = 0;
const path = `m/44'/784'/${i}'/0'/0'`;
const keypair = Ed25519Keypair.deriveKeypair(mnemonics, path);
const wallet = keypair.toSuiAddress();
const suiClient = new SuiClient({
url: process.env.RPC!,
});
const client = new AggregatorClient({
signer: wallet,
client: suiClient,
env: Env.Mainnet,
});
Core Features
SDK Initialization
- Environment Configuration: Mainnet/Testnet support
- Wallet Management: Derive keypairs from mnemonics
- RPC Configuration: Custom RPC endpoint support
Multi-DEX Routing
- 30+ DEX Support: Access major Sui DEXs
- Optimal Price Discovery: Best price routing across providers
- Provider Selection: Customizable DEX provider list
Swap Execution
- Fast Router Swap: Automatic token management
- Manual Router Swap: Advanced token control
- Slippage Protection: Configurable slippage tolerance
Advanced Features
- Overlay Fees: Protocol fee integration
- Pyth Oracle: Price oracle integration
- Gas Optimization: Dynamic gas management
Usage Examples
Basic Swap Operations
// Find optimal routes
const routers = await client.findRouters({
from: "0x2::sui::SUI",
target: "0x06864a6f921804860930db6ddbe2e16acdf8504495ea7481637a1c8b9a8fe54b::cetus::CETUS",
amount: new BN(1000000000),
byAmountIn: true,
providers: ["CETUS", "KRIYA", "AFTERMATH"]
});
// Execute fast swap
const txb = new Transaction();
await client.fastRouterSwap({
router: routers,
txb,
slippage: 0.01,
refreshAllCoins: true,
});
const result = await client.signAndExecuteTransaction(txb, keypair);
console.log("Swap executed:", result);
Query Swap Function
import { Transaction, coinWithBalance } from '@mysten/sui/transactions'
import BN from 'bn.js'
import { bcs } from '@mysten/sui/bcs'
export const querySwap = async (client: AggregatorClient, keypair: Ed25519Keypair, from: string, target: string, amount: string, amountOut: string) => {
let router: any = null;
let txb: any = null;
let targetCoin: any = null;
try {
const wallet = keypair.toSuiAddress();
const amountIn = new BN(amount);
router = await client.findRouters({
from,
target,
amount: amountIn,
byAmountIn: true,
providers: ["CETUS","SCALLOP","AFTERMATH","FLOWXV3","AFSUI","STEAMM","VOLO","KRIYAV3","KRIYA","ALPHAFI","FLOWX","BLUEMOVE","DEEPBOOKV3","BLUEFIN","HAEDAL","TURBOS","SPRINGSUI","STEAMM","METASTABLE","HAWAL","OBRIC"]
});
if (router === null) {
return;
}
const amountOutput = router.amountOut;
if (amountOutput.lt(new BN(amountOut))) {
console.log("Trade condition not met");
return;
}
txb = new Transaction();
targetCoin = await client.routerSwap({
router,
txb,
inputCoin: coinWithBalance({ type: from, balance: BigInt(amount) }),
slippage: 0.01,
});
txb.moveCall({
package: "0xe450c157978058fc23078941924ad91bfe3022db6243ffa432f7209ad5bc9889",
module: "utils",
function: "check_coin_threshold",
arguments: [
targetCoin,
txb.pure(bcs.U64.serialize(BigInt(amountOut))),
],
typeArguments: [
target,
],
});
txb.transferObjects([targetCoin], wallet);
txb.setSender(wallet);
txb.setGasBudget(1_000000000);
const result = await client.client.signAndExecuteTransaction({ transaction: txb, signer: keypair });
console.log("result", result);
} catch (error) {
console.log("querySwap error:", error);
} finally {
router = null;
txb = null;
targetCoin = null;
if (global.gc) {
global.gc();
}
}
}
Provider Management
import { getAllProviders, getProvidersExcluding, getProvidersIncluding } from '@cetusprotocol/aggregator-sdk'
// Get all supported providers
const allProviders = getAllProviders()
// Get providers excluding specific ones
const filteredProviders = getProvidersExcluding(["CETUS", "KRIYA"])
// Get only specific providers
const specificProviders = getProvidersIncluding(["TURBOS", "AFTERMATH"])
Supported DEXs
The aggregator supports 30+ DEXs, including:
- CETUS, KRIYA (V2/V3), FLOWX (V2/V3), TURBOS, AFTERMATH
- HAEDAL, VOLO, AFSUI, BLUEMOVE, DEEPBOOKV3
- SCALLOP, SUILEND, BLUEFIN, HAEDALPMM, ALPHAFI
- SPRINGSUI, STEAMM, METASTABLE, OBRIC, HAWAL
- MOMENTUM, STEAMM_OMM, STEAMM_OMM_V2, MAGMA, SEVENK
- HAEDALHMMV2, FULLSAIL
Common Token Types
// Mainnet token types
const SUI = "0x2::sui::SUI"
const USDC = "0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7::usdc::USDC"
const USDT = "0x375f70cf2ae4c00bf37117d0c85a2c71545e6ee05c4a5c7d282cd66a4504b068::usdt::USDT"
const CETUS = "0x06864a6f921804860930db6ddbe2e16acdf8504495ea7481637a1c8b9a8fe54b::cetus::CETUS"
const AFSUI = "0xf325ce1300e8dac124071d3152c5c5ee6174914f8bc2161e88329cf579246efc::afsui::AFSUI"
const HA_SUI = "0xbde4ba4c2e274a60ce15c1cfff9e5c42e41654ac8b6d906a57efa4bd3c29f47d::hasui::HA_SUI"
Best Practices
Route Validation
// Always check for null routes
const routers = await client.findRouters({
from: "0x2::sui::SUI",
target: "0x...::cetus::CETUS",
amount: new BN(1000000000),
byAmountIn: true,
});
if (routers) {
// Execute swap
} else {
console.log("No routes found");
}
Slippage Management
// Use appropriate slippage based on market conditions
const slippage = 0.01; // 1% for stable pairs
const slippage = 0.05; // 5% for volatile pairs
Gas Optimization
// Set appropriate gas budget
txb.setGasBudget(1_000000000); // 1 SUI for complex swaps
txb.setGasBudget(500000000); // 0.5 SUI for simple swaps
Error Handling
try {
const routers = await client.findRouters({
from: "0x2::sui::SUI",
target: "0x...::cetus::CETUS",
amount: new BN(1000000000),
byAmountIn: true,
});
if (routers) {
const txb = new Transaction();
await client.fastRouterSwap({
router: routers,
txb,
slippage: 0.01,
refreshAllCoins: true,
});
const result = await client.signAndExecuteTransaction(txb, keypair);
} else {
console.log("No routes found");
}
} catch (error) {
console.error("Swap execution failed:", error);
}
Complete Workflow Example
import { AggregatorClient, Env } from '@cetusprotocol/aggregator-sdk'
import { SuiClient } from '@mysten/sui/client'
import { Ed25519Keypair } from '@mysten/sui/keypairs/ed25519'
import { Transaction } from '@mysten/sui/transactions'
import BN from 'bn.js'
async function executeOptimizedSwap() {
// 1. Initialize client
const mnemonics: string = process.env.MNEMONICS!;
const keypair = Ed25519Keypair.deriveKeypair(mnemonics, `m/44'/784'/0'/0'/0'`);
const suiClient = new SuiClient({ url: process.env.RPC! });
const client = new AggregatorClient({
signer: keypair.toSuiAddress(),
client: suiClient,
env: Env.Mainnet,
});
// 2. Find optimal routes
const routers = await client.findRouters({
from: "0x2::sui::SUI",
target: "0x06864a6f921804860930db6ddbe2e16acdf8504495ea7481637a1c8b9a8fe54b::cetus::CETUS",
amount: new BN(1000000000),
byAmountIn: true,
providers: ["CETUS", "KRIYA", "AFTERMATH"]
});
if (!routers) {
console.log("No routes available");
return;
}
// 3. Execute swap
const txb = new Transaction();
await client.fastRouterSwap({
router: routers,
txb,
slippage: 0.01,
refreshAllCoins: true,
});
const result = await client.signAndExecuteTransaction(txb, keypair);
console.log("Swap completed:", result.digest);
return result;
}
Dependencies
@cetusprotocol/aggregator-sdk: ^1.4.2 (core SDK library)@mysten/sui: ^1.45.0 (Sui blockchain client)bn.js: ^5.2.0 (big number processing)- TypeScript: ^5.0.0 (language support)
Support
If you encounter issues or have questions:
- Check the official Cetus documentation
- Check SDK error codes and messages
- Test on testnet before deploying to mainnet
- Monitor gas usage and adjust budgets accordingly
Skill Version: 1.0.0 Last Updated: 2025-11-25 Compatibility: Cetus Aggregator SDK v1.0+
From the file to a first result
The download contains exactly the content displayed on this page. This copy may differ from the latest version in the source repository.
View the source and supporting filesThis download contains SKILL.md only. Any scripts, references, templates and dependencies are not included. Get the required files from the source, preserving their directory structure, before continuing.
1. Download the file
Download SKILL.mdFrom the root of a test project, save the file as .skill-downloads/cetus-aggregator-sdk-for-sui-mmlj2olr/SKILL.md, or use the command below. This folder is for inspecting the skill before installation.
Command for macOS/Linux or WSL: requires a POSIX shell and curl. On Windows without WSL, use the download button and create the folder manually.
mkdir -p '.skill-downloads/cetus-aggregator-sdk-for-sui-mmlj2olr' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/cetus-aggregator-sdk-for-sui-mmlj2olr/download' --output '.skill-downloads/cetus-aggregator-sdk-for-sui-mmlj2olr/SKILL.md.part' && mv '.skill-downloads/cetus-aggregator-sdk-for-sui-mmlj2olr/SKILL.md.part' '.skill-downloads/cetus-aggregator-sdk-for-sui-mmlj2olr/SKILL.md'2. Check prerequisites
Read SKILL.md before using it. If it references scripts or external services, inspect them and prepare the required access in your test environment.
Original excerpt: Dependencies
@cetusprotocol/aggregator-sdk: ^1.4.2 (core SDK library)@mysten/sui: ^1.45.0 (Sui blockchain client)bn.js: ^5.2.0 (big number processing)- TypeScript: ^5.0.0 (language support)
The platforms on this page are catalog indications. The paths below follow tool documentation; they do not prove this skill has been run in those tools. No minimum tool version is confirmed for this listing.
3. Load the skill
After inspection, copy the complete folder into your project using one of the commands below, then open a new tool session. The command stops if a folder with the same name already exists: compare the files before replacing it.
Claude Code
test -f '.skill-downloads/cetus-aggregator-sdk-for-sui-mmlj2olr/SKILL.md' && test -s '.skill-downloads/cetus-aggregator-sdk-for-sui-mmlj2olr/SKILL.md' && mkdir -p '.claude/skills' && test ! -e '.claude/skills/cetus-aggregator' && cp -R '.skill-downloads/cetus-aggregator-sdk-for-sui-mmlj2olr' '.claude/skills/cetus-aggregator'OpenSkills
OpenSkills must already be installed. The local install/read procedure is checked with OpenSkills 1.5.0, which requires Node.js ≥ 20.6.0. Catalog slugs are not resolved automatically.
Official OpenSkills installationopenskills install './.skill-downloads/cetus-aggregator-sdk-for-sui-mmlj2olr'openskills read 'cetus-aggregator-sdk-for-sui-mmlj2olr'Reading should display the installed file content and its base directory. It does not run the skill or install its dependencies.
For an agent that reads AGENTS.md, then sync the index. This command changes AGENTS.md: review the diff before using it.
openskills syncManual method or another tool: attach SKILL.md to a conversation, or open it in an agent that can read files. Include any required supporting resources. No universal folder is recognized by every tool.
4. Try a first task
Use a short, synthetic input: an API endpoint, a small document or an interface brief. In a new conversation, attach the file or give the agent its path, then adapt this request:
Read .skill-downloads/cetus-aggregator-sdk-for-sui-mmlj2olr/SKILL.md and apply its instructions to this example: [describe a test input]. Identify any missing files, dependencies or access. Produce the result requested by the skill without inventing data or running unreviewed scripts.Expected result: output matching the skill instructions, or a precise list of missing prerequisites. A read confirmation alone does not validate a first use. If an external resource is unavailable, that path remains untested.
React Hook Form Best Practices
Development
Master React Hook Form: avoid anti-patterns, manage subscriptions, and handle reset, dirty state, and controlled inputs correctly.
Emotion to Mantine Migration
Development
Migrate Emotion styled-components to Mantine components with style props and CSS modules. Use when converting .styled.tsx files or removing @emotion imports.
Scope Creep Detector
Development
Analyzes git diffs against a stated intent to detect scope creep, unrelated files, broad PRs, and oversized changes, then suggests keep, split, or justify actions.