navi-sdk
Version:
The NAVI SDK Client provides tools for interacting with the Sui blockchain networks, designed for handling transactions, accounts, and smart contracts efficiently. This documentation covers the setup, account management, and transaction handling within th
39 lines (35 loc) • 933 B
text/typescript
import { Transaction } from "@mysten/sui/transactions";
import { AggregatorConfig } from "../config";
export async function makeCETUSPTB(
txb: Transaction,
poolId: string,
byAmountIn: boolean,
coinA: any,
coinB: any,
amount: any,
a2b: boolean,
typeArguments: any,
) {
let coinTypeA = typeArguments[0];
let coinTypeB = typeArguments[1];
const sqrtPriceLimit = BigInt(
a2b ? "4295048016" : "79226673515401279992447579055"
);
const coinABs = txb.moveCall({
target: `${AggregatorConfig.cetusPackageId}::router::swap`,
arguments: [
txb.object(AggregatorConfig.cetusConfigId),
txb.object(poolId),
coinA,
coinB,
txb.pure.bool(a2b),
txb.pure.bool(byAmountIn),
amount,
txb.pure.u128(sqrtPriceLimit),
txb.pure.bool(false),
txb.object(AggregatorConfig.clockAddress),
],
typeArguments: [coinTypeA, coinTypeB],
});
return coinABs;
}