UNPKG

@firefly-exchange/library-sui

Version:

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

59 lines (58 loc) 2.62 kB
/** * This file incorporates code from cetus-clmm-sui-sdk by CetusProtocol, * licensed under the Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0) * which can be found at https://github.com/CetusProtocol/cetus-clmm-sui-sdk/blob/main/LICENSE */ import BN from "bn.js"; export declare class SwapUtils { /** * Retrieves the default sqrt price limit for a swap operation. * * @param a2b - Set to true for an A to B swap, or false for a B to A swap. * @returns The default sqrt price limit for the specified swap direction. */ static getDefaultSqrtPriceLimit(a2b: boolean): BN; /** * Retrieves the default values for the otherAmountThreshold parameter in a swap. * * @param amountSpecifiedIsInput - Indicates the direction of the swap. * @returns The default values for the otherAmountThreshold in the swap. */ static getDefaultOtherAmountThreshold(amountSpecifiedIsInput: boolean): BN; } /** * Calculates the lower sqrt price based on the amount of token A. * * @param amount - The amount of tokens the user wants to swap. * @param liquidity - The current pool liquidity. * @param sqrtPriceX64 - The pool's current sqrt price. * @returns The calculated lower sqrt price (LowesqrtPriceX64). */ export declare function getLowerSqrtPriceFromCoinA(amount: BN, liquidity: BN, sqrtPriceX64: BN): BN; /** * Calculates the upper sqrt price based on the amount of token A. * * @param amount - The amount of tokens the user wants to swap. * @param liquidity - The current pool liquidity. * @param sqrtPriceX64 - The pool's current sqrt price. * @returns The calculated upper sqrt price (UpperSqrtPriceX64). */ export declare function getUpperSqrtPriceFromCoinA(amount: BN, liquidity: BN, sqrtPriceX64: BN): BN; /** * Calculates the lower sqrt price based on the amount of coin B. * * @param amount - The amount of coins the user wants to swap. * @param liquidity - The current pool liquidity. * @param sqrtPriceX64 - The pool's current sqrt price. * @returns The calculated lower sqrt price (LowerSqrtPriceX64). */ export declare function getLowerSqrtPriceFromCoinB(amount: BN, liquidity: BN, sqrtPriceX64: BN): BN; /** * Calculates the upper sqrt price based on the amount of coin B. * * @param amount - The amount of coins the user wants to swap. * @param liquidity - The current pool liquidity. * @param sqrtPriceX64 - The pool's current sqrt price. * @returns The calculated upper sqrt price (UpperSqrtPriceX64). */ export declare function getUpperSqrtPriceFromCoinB(amount: BN, liquidity: BN, sqrtPriceX64: BN): BN;