Old swap params - V2
These parameters will not be deprecated.
1. Build fast swap transaction
BuildFastRouterSwapParamsV2
Name
Type
Details
Optional parameters
Name
Type
Details
Example
import { AggregatorClient } from "@cetusprotocol/aggregator-sdk"
import { Transaction } from '@mysten/sui/transactions';
const client = new AggregatorClient({})
const amount = new BN(1000000)
const from = "0x2::sui::SUI"
const target = "0x06864a6f921804860930db6ddbe2e16acdf8504495ea7481637a1c8b9a8fe54b::cetus::CETUS"
const routers = await client.findRouters({
from,
target,
amount,
byAmountIn: true, // `true` means fix input amount, `false` means fix output amount
})
const txb = new Transaction()
await client.fastRouterSwap({
routers,
txb,
slippage: 0.01,
})2. Build swap transaction and return target coin object
BuildRouterSwapParamsV2
Name
Type
Details
Optional parameters
Name
Type
Details
Example
Last updated