The SDK provides a Farms module for managing farming positions, liquidity, and rewards in the Cetus ecosystem. This module enables users to perform various farming operations with flexibility in how they want to manage their positions.
Getting Started
How to Use the Farms SDK?
Installation
To start using the Farms SDK, you first need to install it in your TypeScript project:
Initialize the SDK with the required configuration parameters. This typically includes setting up the network environment.
If you would like to use the mainnet network and the official Sui rpc url, you can do so as follows:
constsdk=CetusFarmsSDK.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:
If you wish to set your own full node URL or SuiClient, you can do so as follows:
Usage
After linking your wallet, if you need use your wallet address to do something, you should set it by sdk.setSenderAddress.
if you need to change your rpc url, you can do so as follows:
Common Parameters
pool_id: The ID of the farms pool
position_nft_id: The ID of the position NFT
clmm_position_id: The ID of the CLMM position
coin_type_a & coin_type_b: Coin type identifiers for the trading pair
amount_a & amount_b: Amounts of coins to deposit/withdraw