@cetusprotocol/zap-sdk
@cetusprotocol/zap-sdk
The SDK provides a Zap module for specialized liquidity operations with different modes to suit various trading strategies. This module enables users to perform complex liquidity operations with flexibility in how they want to manage their positions.
Getting Started
How to Use the Zap SDK ?
Installation
To start using the Zap SDK
, you first need to install it in your TypeScript project:
npm link: https://www.npmjs.com/package/@cetusprotocol/zap-sdk
npm install @cetusprotocol/zap-sdk
Setup
Import the SDK into the TypeScript file where you intend to use it:
import { CetusZapSDK } from '@cetusprotocol/zap-sdk'
Initializing the SDK
Initialize the SDK with the required configuration parameters. This typically includes setting up the network and API keys, if needed.
If you would like to use the mainnet network and the official Sui rpc url, you can do so as follows:
const sdk = CetusZapSDK.createSDK()
If you wish to set your own full node URL or network (You have the option to select either 'mainnet' or 'testnet' for the network), you can do so as follows:
const env = 'mainnet'
const full_rpc_url = 'YOUR_FULL_NODE_URL'
const wallet = 'YOUR_WALLET_ADDRESS'
const sdk = CetusZapSDK.createSDK({ env })
If you wish to set your own full node URL or SuiClient, you can do so as follows:
const sdk = CetusZapSDK.createSDK({ env, sui_client })
// or
const sdk = CetusZapSDK.createSDK({ env, full_rpc_url })
Usage
After linking your wallet, if you need use your wallet address to do something, you should set it by sdk.setSenderAddress
.
const wallet = 'YOUR_WALLET_ADDRESS'
sdk.setSenderAddress(wallet)
if you need to change your rpc url, you can do so as follows:
const new_rpc_url = 'YOUR_NEW_FULL_NODE_URL'
sdk.updateFullRpcUrl(new_rpc_url)
Common Parameters
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 type
Last updated