import { InputEntryFunctionData } from '@aptos-labs/ts-sdk'; import { RemoveSingleAMMLiquidityParams, RemoveMultipleAMMLiquidityParams, RemoveSingleCLMMLiquidityParams, RemoveMultipleCLMMLiquidityParams, RemoveSingleStableLiquidityParams, RemoveMultipleStableLiquidityParams, AddAMMLiquidityParams, AddCLMMLiquidityParams, AddStableLiquidityParams, CreateAMMPoolAndAddLiquidityParams, CreateCLMMPoolAndAddLiquidityParams, CreateStablePoolAndAddLiquidityParams, CollectFeeParams, GetPositionParams, GetPositions } from './types/position.type.mjs'; import { PaginatedResult } from './types/requestModule.type.mjs'; import RequestModule from './modules/requestModule.mjs'; import { GetPoolsParams, GetPools, PoolInfo } from './types/pool.type.mjs'; import { SwapAMMParams, SwapCLMMParams, SwapStableParams, GetEstSwapParams, EstSwapResult, GetSOREstSwapParams, SOREstSwapResult, SwapSORParams } from './types/swap.type.mjs'; import { SDKConfig } from './types/index.mjs'; declare class PoolModule { protected _sdk: TappSDK; constructor(sdk: TappSDK); /** * Fetches a paginated list of liquidity pools from the public API. * * @param params - Optional parameters to control pagination and sorting. * - `page`: The page number to fetch (defaults to 1). * - `size`: Number of items per page (defaults to 10). * - `sortBy`: Field to sort by (defaults to "tvl"). * - `type`: Optional pool type filter. * * @returns {Promise>} A Promise resolving to a paginated result of pools. */ getPools(params?: GetPoolsParams): Promise>; /** * * Retrieves detailed information for a specific liquidity pool. * * @param poolId The unique identifier of the pool to retrieve. * @returns {Promise} A Promise that resolves to the pool information. * @throws ErrorNotFound if the pool does not exist or cannot be found. */ getInfo(poolId: string): Promise; } declare class PositionModule { protected _sdk: TappSDK; constructor(sdk: TappSDK); /** * Creates the input data for removing liquidity from a single AMM pool. * * @param params - Parameters required to remove liquidity, including: * - `poolId`: The ID of the pool to remove liquidity from. * - `positionAddr`: The address of the liquidity position. * - `mintedShare`: The amount of share tokens to burn. * - `minAmount0`: Minimum amount of token0 to receive. * - `minAmount1`: Minimum amount of token1 to receive. * * @returns {InputEntryFunctionData} An object containing the target function identifier and serialized arguments, * which can be used to call the smart contract. */ removeSingleAMMLiquidity(params: RemoveSingleAMMLiquidityParams): InputEntryFunctionData; /** * Creates the input data for removing liquidity from multiple AMM positions in a single transaction. * * @param params - Parameters required to remove multiple liquidity positions, including: * - `poolId`: The ID of the pool. * - `positions`: An array of position objects, each containing: * - `positionAddr`: The address of the liquidity position. * - `mintedShare`: The amount of share tokens to burn. * - `minAmount0`: Minimum amount of token0 to receive. * - `minAmount1`: Minimum amount of token1 to receive. * * @returns {InputEntryFunctionData} An object containing the target function identifier and serialized arguments, * which can be used to call the smart contract. */ removeMultipleAMMLiquidity(params: RemoveMultipleAMMLiquidityParams): InputEntryFunctionData; /** * Creates the input data for removing liquidity from a single CLMM (Concentrated Liquidity Market Maker) position. * * @param params - Parameters required to remove liquidity from a CLMM pool, including: * - `poolId`: The ID of the CLMM pool. * - `positionAddr`: The address of the specific liquidity position. * - `mintedShare`: The amount of share tokens to burn. * - `minAmount0`: Minimum amount of token0 to receive. * - `minAmount1`: Minimum amount of token1 to receive. * * @returns {InputEntryFunctionData} An object containing the function identifier and serialized arguments * used to invoke the `remove_liquidity` function on-chain. */ removeSingleCLMMLiquidity(params: RemoveSingleCLMMLiquidityParams): InputEntryFunctionData; /** * Creates the input data for removing liquidity from multiple CLMM (Concentrated Liquidity Market Maker) positions * in a single transaction. * * @param params - Parameters required to remove multiple liquidity positions, including: * - `poolId`: The ID of the CLMM pool. * - `positions`: An array of objects, each describing a position with: * - `positionAddr`: The address of the liquidity position. * - `mintedShare`: The amount of share tokens to burn. * - `minAmount0`: Minimum amount of token0 to receive. * - `minAmount1`: Minimum amount of token1 to receive. * * @returns {InputEntryFunctionData} An object containing the contract function identifier and serialized arguments * for removing multiple liquidity positions on-chain. */ removeMultipleCLMMLiquidity(params: RemoveMultipleCLMMLiquidityParams): InputEntryFunctionData; /** * Creates the input data for removing liquidity from a single StableSwap-style pool position. * Supports multiple liquidity removal types via a `liquidityType` switch. * * @param params - Parameters required to remove stable liquidity, including: * - `poolId`: The ID of the stable pool. * - `position`: The position object with: * - `positionAddr`: The address of the liquidity position. * - `mintedShare`: (Used for default case) The amount of share tokens to burn. * - `amounts`: (Used for default case) Minimum amounts expected to receive. * - `liquidityType`: Indicates the removal method: * - `0`: Single asset withdrawal. * - `1`: Imbalanced withdrawal. * - Default: Proportional withdrawal using `mintedShare` and `amounts`. * * @returns {InputEntryFunctionData} An object containing the contract function identifier and serialized arguments * for smart contract execution. */ removeSingleStableLiquidity(params: RemoveSingleStableLiquidityParams): InputEntryFunctionData; /** * Creates the input data for removing liquidity from multiple StableSwap-style pool positions * in a single transaction. Supports multiple liquidity removal strategies via `liquidityType`. * * @param params - Parameters for bulk stable liquidity removal, including: * - `poolId`: The ID of the stable pool. * - `positions`: An array of position objects, each containing: * - `positionAddr`: The address of the individual liquidity position. * - `mintedShare`: (Used in default case) The amount of share tokens to burn. * - `amounts`: (Used in default case) The expected minimum token amounts to receive. * - `liquidityType`: Defines the method of liquidity removal: * - `0`: Single asset withdrawal (currently not implemented). * - `1`: Imbalanced withdrawal (currently not implemented). * - Default: Proportional withdrawal using `mintedShare` and `amounts`. * * @returns {InputEntryFunctionData} An object with the smart contract function identifier and the serialized arguments, * allowing the user to remove multiple positions' liquidity on-chain. */ removeMultipleStableLiquidity(params: RemoveMultipleStableLiquidityParams): InputEntryFunctionData; /** * Creates the input data required to add liquidity to an AMM (Automated Market Maker) pool. * * @param params - Parameters used when adding liquidity, including: * - `poolId`: The ID of the AMM pool. * - `amountA`: The amount of token A to add as liquidity. * - `amountB`: The amount of token B to add as liquidity. * * @returns {InputEntryFunctionData} An object containing the contract function string and serialized arguments * required to perform the liquidity addition on-chain. */ addAMMLiquidity(params: AddAMMLiquidityParams): InputEntryFunctionData; /** * Constructs input data for adding liquidity to a CLMM (Concentrated Liquidity Market Maker) pool. * This function encodes amounts, price ranges, and tick information based on pool configuration and input. * * @param params - The parameters needed to add liquidity: * - `poolId`: The unique identifier of the CLMM pool. * - `amountA`: The amount of token A to add. * - `amountB`: The amount of token B to add. * - `fee`: The fee tier of the pool (used to compute tick spacing). * - `isMaxAmountB`: If true, treats `amountB` as the maximum and increases `amountA` by 10%. * - `minPrice`: The minimum price boundary of the liquidity range. * - `maxPrice`: The maximum price boundary of the liquidity range. * * @returns {InputEntryFunctionData} An object containing the target function identifier and serialized arguments * for executing the liquidity addition on-chain. */ addCLMMLiquidity(params: AddCLMMLiquidityParams): InputEntryFunctionData; /** * Constructs the input required to add liquidity to a **Stable Pool**. * Used in cases where multiple assets are pooled together with minimal slippage (e.g., stablecoins). * * @param params - The parameters needed to add liquidity: * - `poolId`: The ID of the stable pool. * - `amounts`: An array of token amounts corresponding to the pool's asset composition. * * @returns {InputEntryFunctionData} An object containing: * - The contract function identifier string. * - A serialized byte array of the input data suitable for blockchain invocation. */ addStableLiquidity(params: AddStableLiquidityParams): InputEntryFunctionData; /** * Creates a new AMM pool and simultaneously adds initial liquidity to it. * * @param params - The parameters required for pool creation and liquidity addition: * - `tokenAddress`: An array of token addresses to be included in the pool. * - `fee`: The fee tier to apply to this pool (typically determines tick spacing and swap cost). * - `amounts`: An array of token amounts to provide as initial liquidity. * * @returns {InputEntryFunctionData} An object containing: * - `function`: The full identifier of the smart contract function being called. * - `functionArguments`: A serialized byte array containing the input data formatted for the contract call. */ createAMMPoolAndAddLiquidity(params: CreateAMMPoolAndAddLiquidityParams): InputEntryFunctionData; /** * Creates a CLMM (Concentrated Liquidity Market Maker) pool and adds initial liquidity in a single transaction. * * @param params - Configuration object containing: * - `tokenAddress`: An array of token addresses involved in the pool. * - `fee`: The fee tier for the pool, which determines tick spacing. * - `amounts`: The initial token amounts to deposit. * - `initialPrice`: The square root price at which the pool starts (used for initialization). * - `minPrice`: The lower bound price of the liquidity range. * - `maxPrice`: The upper bound price of the liquidity range. * - `isMaxAmountB`: Whether the second token amount (`amountB`) is flexible based on slippage. * * @returns {InputEntryFunctionData} An object ready to be used for blockchain interaction, * including the function path and serialized parameters. */ createCLMMPoolAndAddLiquidity(params: CreateCLMMPoolAndAddLiquidityParams): InputEntryFunctionData; /** * Creates a stable swap pool and adds initial liquidity in a single transaction. * * @param params - The configuration object containing: * - `tokenAddress`: An array of token addresses in the pool. * - `fee`: The base swap fee (as a percentage, e.g. `0.003` for 0.3%). * - `amounts`: The initial token amounts to deposit. * - `amplificationFactor`: Amplification factor controlling curve stability (used for low-slippage swaps). * - `offpeg_fee_multiplier`: Optional. Multiplier applied to fee when assets are off-peg. Defaults to `20_000_000_000`. * * @returns {InputEntryFunctionData} An object with the function identifier and encoded arguments * for executing the `create_pool_add_liquidity` function. */ createStablePoolAndAddLiquidity(params: CreateStablePoolAndAddLiquidityParams): InputEntryFunctionData; /** * Collects accrued fees from a specific liquidity position in a given pool. * * @param params - The configuration object containing: * - `poolId`: The address of the pool from which to collect fees. * - `positionAddr`: The address of the liquidity position. * * @returns {InputEntryFunctionData} An object containing: * - `function`: The fully qualified name of the entry function. * - `functionArguments`: A byte array representing the serialized arguments. */ collectFee(params: CollectFeeParams): InputEntryFunctionData; /** * Retrieves a paginated list of liquidity positions for a given user address. * * @param params - An object containing the following: * - `userAddr`: The user's wallet address to fetch positions for. * - `page` (optional): The page number for pagination (defaults to 1). * - `size` (optional): The number of results per page (defaults to 10). * * @returns {Promise>} A object containing: * - `data`: The list of position entries. * - `total`: The total number of positions available. */ getPositions(params: GetPositionParams): Promise>; } declare class SwapModule { protected _sdk: TappSDK; constructor(sdk: TappSDK); /** * Creates a transaction payload for executing a swap on an AMM pool. * * @param params - An object containing: * - `poolId`: The address of the pool in which the swap is performed. * - `a2b`: Direction of the swap; `true` for token A to B, `false` for B to A. * - `fixedAmountIn` (optional): Whether the input amount is fixed (defaults to `true`). * - `amount0`: Amount of token A. * - `amount1`: Amount of token B. * * @returns {InputEntryFunctionData} An object representing the transaction payload. */ swapAMMTransactionPayload({ poolId, a2b, fixedAmountIn, amount0, amount1, }: SwapAMMParams): InputEntryFunctionData; /** * Creates a transaction payload for executing a swap on a CLMM (Concentrated Liquidity Market Maker) pool. * * @param params - An object containing: * - `poolId`: The address of the CLMM pool. * - `amountIn`: The input token amount for the swap. * - `minAmountOut`: The minimum acceptable output amount (slippage protection). * - `a2b`: Direction of the swap; `true` for token A to B, `false` for B to A. * - `fixedAmountIn` (optional): Indicates whether `amountIn` is fixed (`true`) or calculated from `minAmountOut` (`false`). Defaults to `true`. * - `targetSqrtPrice`: The target square root price to stop the swap at. * * @returns {InputEntryFunctionData} An object representing the transaction payload to be submitted. */ swapCLMMTransactionPayload({ poolId, amountIn, minAmountOut, a2b, fixedAmountIn, targetSqrtPrice, }: SwapCLMMParams): InputEntryFunctionData; /** * Creates a transaction payload for executing a swap on a Stable pool. * * @param params - An object containing: * - `poolId`: The address of the Stable pool. * - `tokenIn`: The index of the input token in the pool. * - `tokenOut`: The index of the output token in the pool. * - `amountIn`: The input token amount for the swap. * - `minAmountOut`: The minimum acceptable output amount to protect against slippage. * * @returns {InputEntryFunctionData} An object representing the serialized transaction payload. */ swapStableTransactionPayload({ poolId, tokenIn, tokenOut, amountIn, minAmountOut, }: SwapStableParams): InputEntryFunctionData; /** * Estimates the swap output or required input amount for a given pool using the on-chain order book. * * @param params - An object containing: * - `amount`: The amount for estimation (used as input or desired output depending on `field`). * - `poolId`: The identifier of the pool. * - `pair`: A tuple of token indexes to swap, e.g., `[0, 1]` means token at index 0 is being swapped for token at index 1. * - `a2b`: Swap direction — `true` for token at `pair[0]` to `pair[1]`, `false` for `pair[1]` to `pair[0]`. * - `field` (optional): Indicates if `amount` is an `"input"` or `"output"` amount (defaults to `"input"`). * * @returns {Promise}. * * @throws Will throw an error if the order book is missing or malformed. */ getEstSwapAmount(params: GetEstSwapParams): Promise; /** * Retrieves the pool route information between two tokens. * * @param tokenAddr0 - The address of the first token. * @param tokenAddr1 - The address of the second token. * * @returns {Promise} object containing route details between the two tokens. * * @throws {ErrorNotFound} If no route is found between the given tokens. */ getRoute(tokenAddr0: string, tokenAddr1: string): Promise; getSOREstSwapAmount(params: GetSOREstSwapParams): Promise; swapSORTransactionPayload({ routeMatrix, amounts, slippage, }: SwapSORParams): InputEntryFunctionData; } declare class TappSDK { protected _pool: PoolModule; protected _swap: SwapModule; protected _position: PositionModule; protected _sdkConfig: SDKConfig; protected _request: RequestModule; /** * Initializes the SDK with the given configuration. * * @param config - The configuration object containing base URL and other settings. * * Sets up internal modules for: * - HTTP request * - Pool * - Swap * - Position * */ constructor(config: SDKConfig); get Pool(): PoolModule; get Swap(): SwapModule; get Position(): PositionModule; get sdkConfig(): SDKConfig; get request(): RequestModule; } export { PoolModule as P, SwapModule as S, TappSDK as T, PositionModule as a };