
Product
Introducing Webhook Events for Alert Changes
Add real-time Socket webhook events to your workflows to automatically receive software supply chain alert changes in real time.
@cetusprotocol/cetus-zap-sdk
Advanced tools
The SDK provides a Zap module for specialized liquidity operations with different modes to suit various trading strategies.
pool_id: The ID of the liquidity pooltick_lower & tick_upper: Price range boundaries for the positioncurrent_sqrt_price: Current square root price of the poolslippage: Maximum acceptable price slippage (e.g., 0.01 for 1%)coin_type_a & coin_type_b: Coin type identifiers for the trading paircoin_decimal_a & coin_decimal_b: Decimal places for each coin typeFixedOneSide
fixed_amount: Fixed amount to depositfixed_coin_a: Boolean indicating whether to fix coin A (true) or coin B (false)FlexibleBoth
coin_amount_a: Amount of coin A to depositcoin_amount_b: Amount of coin B to depositOnlyCoinA/OnlyCoinB
coin_amount: Amount of single coin to deposit// Initialize SDK and get pool information
const sdk = buildSdk(SdkEnv.mainnet)
const pool = await sdk.CetusClmmSDK.Pool.getPool(poolId)
// Pre-calculate deposit amounts (example: FixedOneSide mode)
const result = await sdk.Zap.preCalculateDepositAmount(
{
pool_id: poolId,
tick_lower,
tick_upper,
current_sqrt_price: pool.current_sqrt_price.toString(),
slippage: 0.01,
},
{
mode: 'FixedOneSide',
fixed_amount: toDecimalsAmount(1, 6).toString(),
fixed_coin_a: false,
}
)
// Build and send transaction
const tx = await sdk.Zap.buildDepositPayload({
deposit_obj: result,
pool_id: poolId,
coin_type_a: pool.coinTypeA,
coin_type_b: pool.coinTypeB,
tick_lower,
tick_upper,
slippage: 0.01,
pos_obj: { // Optional: Add to existing position
pos_id: positionId,
collect_fee: false,
collect_rewarder_types: [],
}
})
// Simulate or send the transaction
const simResult = await sdk.FullClient.sendSimulationTransaction(tx, address)
// const txResult = await sdk.FullClient.sendTransaction(sendKeyPair, tx)
Withdrawals require an existing position in the pool.
FixedOneSide
fixed_amount: Fixed amount to withdrawfixed_coin_a: Boolean indicating whether to withdraw coin A (true) or coin B (false)OnlyCoinA/OnlyCoinB
burn_liquidity: Amount of liquidity to burnavailable_liquidity: Total available liquidity in the position// Get pool and position information
const pool = await sdk.CetusClmmSDK.Pool.getPool(poolId)
const position = await sdk.CetusClmmSDK.Position.getPositionById(positionId)
if (!pool || !position) {
throw new Error('Pool or Position not found')
}
// Pre-calculate withdrawal (example: OnlyCoinA mode)
const result = await sdk.Zap.preCalculateWithdrawAmount({
mode: 'OnlyCoinA',
pool_id: poolId,
tick_lower: position.tick_lower_index,
tick_upper: position.tick_upper_index,
current_sqrt_price: pool.current_sqrt_price.toString(),
burn_liquidity: '200000',
available_liquidity: position.liquidity.toString(),
coin_type_a: pool.coinTypeA,
coin_type_b: pool.coinTypeB,
coin_decimal_a: 6,
coin_decimal_b: 9,
})
// Build and send transaction
const tx = await sdk.Zap.buildWithdrawPayload({
withdraw_obj: result,
pool_id: poolId,
pos_id: positionId,
close_pos: false, // Whether to close the position
collect_fee: true, // Whether to collect accumulated fees
collect_rewarder_types: [], // Types of rewards to collect
coin_type_a: pool.coinTypeA,
coin_type_b: pool.coinTypeB,
tick_lower: position.tick_lower_index,
tick_upper: position.tick_upper_index,
slippage: 0.01,
})
// Simulate or send the transaction
const simResult = await sdk.FullClient.sendSimulationTransaction(tx, address)
// const txResult = await sdk.FullClient.sendTransaction(sendKeyPair, tx)
FAQs
Zap SDK
The npm package @cetusprotocol/cetus-zap-sdk receives a total of 0 weekly downloads. As such, @cetusprotocol/cetus-zap-sdk popularity was classified as not popular.
We found that @cetusprotocol/cetus-zap-sdk demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Product
Add real-time Socket webhook events to your workflows to automatically receive software supply chain alert changes in real time.

Security News
ENISA has become a CVE Program Root, giving the EU a central authority for coordinating vulnerability reporting, disclosure, and cross-border response.

Product
Socket now scans OpenVSX extensions, giving teams early detection of risky behaviors, hidden capabilities, and supply chain threats in developer tools.