UNPKG

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

38 lines (37 loc) 1.82 kB
"use strict"; var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; Object.defineProperty(exports, "__esModule", { value: true }); exports.makeCETUSPTB = makeCETUSPTB; const config_1 = require("../config"); function makeCETUSPTB(txb, poolId, byAmountIn, coinA, coinB, amount, a2b, typeArguments) { return __awaiter(this, void 0, void 0, function* () { let coinTypeA = typeArguments[0]; let coinTypeB = typeArguments[1]; const sqrtPriceLimit = BigInt(a2b ? "4295048016" : "79226673515401279992447579055"); const coinABs = txb.moveCall({ target: `${config_1.AggregatorConfig.cetusPackageId}::router::swap`, arguments: [ txb.object(config_1.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(config_1.AggregatorConfig.clockAddress), ], typeArguments: [coinTypeA, coinTypeB], }); return coinABs; }); }