Prerequisites

1. NPM install

npm install @cetusprotocol/aggregator-sdk

2. Setting Up Configuration

  1. Initialize mainnet Aggregator client.

Example

  1. Fast create mainnet aggregator client default.

const client = new AggregatorClient()
  1. (Enhance) Customer create aggregator client by your self rpc node.

// 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,
})

// provider by cetus
const aggregatorURL = "https://api-sui.cetus.zone/router_v2/find_routes"

// 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(aggregatorURL, wallet, suiClient, Env.Mainnet)

Last updated