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 { SuiClient } from '@mysten/sui/client';
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 SuiClient({
url: 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"],
partner: "YOUR_PARTNER_ID" /// Partner ID for fee sharing. Set once during initialization instead of per swap.
overlayFeeRate: 0.01, // Overlay fee rate (0.01 represents 1%).
overlayFeeReceiver: "0x..", // Address to receive the overlay fees
})Last updated