UNPKG

@firefly-exchange/library-sui

Version:

Sui library housing helper methods, classes to interact with Bluefin protocol(s) deployed on Sui

46 lines (45 loc) 2.46 kB
/// <reference types="bn.js" /> import { Transaction, TransactionArgument } from "@mysten/sui/transactions"; import { BigNumber, BigNumberable, BN } from "../types"; import { NumStr } from "../types"; import { CoinAmounts } from "./clmm"; import { ILiquidityParams, IPoolMeta } from "./interfaces"; import { Pool } from "./types"; /** * Converts a bigint to an unsigned integer of the specified number of bits. * @param {bigint} int - The bigint to convert. * @param {number} bits - The number of bits to use in the conversion. Defaults to 32 bits. * @returns {string} - Returns the converted unsigned integer as a string. */ export declare function asUintN(int: bigint, bits?: number): string; /** * Converts given value to unsigned number * @param tickValue The value to be converted * @returns unsigned number */ export declare function toUnsignedTick(tickValue: NumStr): number; /** * Returns the the bits of lower, upper tick and liquidity * to be passed as input to provide liquidity/mint contract call */ export declare function getLiquidityParams(pool: Pool, lowerPrice: number, upperPrice: number, coinAmounts: CoinAmounts, slippage: number): ILiquidityParams; export declare function priceToTick(pool: Pool, price: NumStr): number; export declare function priceToSqrtPriceX64(pool: Pool, price: NumStr): BN; export declare function sqrtPriceX64ToPrice(pool: Pool, sqrtPriceX64: NumStr | BN): BigNumber; export declare function getEstimatedAmountIncludingSlippage(amount: BigNumber, slippage: BigNumber, byAmountIn: boolean): BigNumber; export declare function parsePool(pool: Pool): IPoolMeta; export declare function getPercentageAmount(number: BigNumberable, percentage: number, upside: any): BigNumber; export declare function getPools(pools: Array<IPoolMeta>, name: string): Array<IPoolMeta>; export declare function coinIntoBalance(tx: Transaction, coinType: string, coinObject: TransactionArgument): { $kind: "NestedResult"; NestedResult: [number, number]; }; export declare function coinFromBalance(tx: Transaction, coinType: string, balance: TransactionArgument): { $kind: "NestedResult"; NestedResult: [number, number]; }; export declare function transferOrDestroyZeroCoin(tx: Transaction, coinType: string, coin: TransactionArgument, to: string, pkg?: string): void; export declare function zeroBalance(tx: Transaction, coinType: string): { $kind: "NestedResult"; NestedResult: [number, number]; };