Prerequisites
1. NPM install
npm install @cetusprotocol/aggregator-sdk2. Setting Up Configuration
Example
import { AggregatorClient } from "@cetusprotocol/aggregator-sdk"
const client = new AggregatorClient({})import { AggregatorClient } from "@cetusprotocol/aggregator-sdk"
import { SuiGrpcClient } from "@mysten/sui/grpc"
import dotenv from 'dotenv'
dotenv.config()
// used to do simulate swap and swap
// https://fullnode.mainnet.sui.io:443
const fullNodeURL = process.env.SUI_RPC!
const suiClient = new SuiGrpcClient({
network: 'mainnet',
baseUrl: fullNodeURL,
})
// set your wallet address, used to do simulate
const wallet = "0x..."
// import { Env } from "@cetusprotocol/aggregator-sdk"
// Currently, we provide full support for Mainnet,
// while Testnet is only supported for Cetus and DeepBook providers.
const client = new AggregatorClient({
// endpoint, // If you do not have a exclusive aggregator api domain,just use cetus default aggregator endpoints.
signer: wallet,
client: suiClient,
env: Env.Mainnet,
pythUrls?: ["YOUR_PYTH_URL", "ANOTHER_PYTH_URL"], // Optional. Custom Pyth price feed URLs. Defaults to null (uses built-in endpoints).
partner?: "YOUR_CETUS_CLMM_PARTNER_ID", // Optional. Partner ID for CLMM fee sharing. Set once during initialization instead of per swap. Defaults to null (no fee sharing).
cetusDlmmPartner?: "YOUR_CETUS_DLMM_PARTNER_ID", // Optional. Partner ID for DLMM fee sharing. Defaults to null (no fee sharing).
overlayFeeRate?: 0.01, // Optional. Overlay fee rate (0.01 represents 1%). Defaults to 0 (no overlay fee).
overlayFeeReceiver?: "0x..", // Optional. Address to receive the overlay fees. Defaults to null. Required if overlayFeeRate is set.
})Last updated