{"version":3,"sources":["../../src/modules/poolModule.ts"],"sourcesContent":["import { ErrorNotFound } from \"../common/ErrorNotFound\";\nimport { TappSDK } from \"../core\";\nimport { GetPools, GetPoolsParams, PoolInfo } from \"../types/pool.type\";\nimport {\n  Nullable,\n  PaginatedResult,\n  RequestResult,\n} from \"../types/requestModule.type\";\n\nexport default class PoolModule {\n  protected _sdk: TappSDK;\n  constructor(sdk: TappSDK) {\n    this._sdk = sdk;\n  }\n\n  /**\n   * Fetches a paginated list of liquidity pools from the public API.\n   *\n   * @param params - Optional parameters to control pagination and sorting.\n   *   - `page`: The page number to fetch (defaults to 1).\n   *   - `size`: Number of items per page (defaults to 10).\n   *   - `sortBy`: Field to sort by (defaults to \"tvl\").\n   *   - `type`: Optional pool type filter.\n   *\n   * @returns {Promise<PaginatedResult<GetPools>>} A Promise resolving to a paginated result of pools.\n   */\n  async getPools(params?: GetPoolsParams): Promise<PaginatedResult<GetPools>> {\n    const res = await this._sdk.request.post<\n      RequestResult<PaginatedResult<GetPools>>\n    >(\"public/pool\", {\n      page: params?.page ?? 1,\n      size: params?.size ?? 10,\n      sortBy: params?.sortBy ?? \"tvl\",\n      poolType: params?.type,\n    });\n\n    return res.result;\n  }\n\n  /**\n   * \n   * Retrieves detailed information for a specific liquidity pool.\n   *\n   * @param poolId The unique identifier of the pool to retrieve.\n   * @returns {Promise<PoolInfo>} A Promise that resolves to the pool information.\n   * @throws ErrorNotFound if the pool does not exist or cannot be found.\n   */\n  async getInfo(poolId: string): Promise<PoolInfo> {\n    const res = await this._sdk.request.post<RequestResult<Nullable<PoolInfo>>>(\n      \"public/pool_info\",\n      {\n        poolId,\n      }\n    );\n\n    if (!res.result) {\n      throw new ErrorNotFound(`Pool not found. ${poolId}`);\n    }\n\n    return res.result;\n  }\n}\n"],"mappings":"yCASA,IAAqBA,EAArB,KAAgC,CAE9B,YAAYC,EAAc,CACxB,KAAK,KAAOA,CACd,CAaA,MAAM,SAASC,EAA6D,CAU1E,OATY,MAAM,KAAK,KAAK,QAAQ,KAElC,cAAe,CACf,KAAMA,GAAQ,MAAQ,EACtB,KAAMA,GAAQ,MAAQ,GACtB,OAAQA,GAAQ,QAAU,MAC1B,SAAUA,GAAQ,IACpB,CAAC,GAEU,MACb,CAUA,MAAM,QAAQC,EAAmC,CAC/C,IAAMC,EAAM,MAAM,KAAK,KAAK,QAAQ,KAClC,mBACA,CACE,OAAAD,CACF,CACF,EAEA,GAAI,CAACC,EAAI,OACP,MAAM,IAAIC,EAAc,mBAAmBF,CAAM,EAAE,EAGrD,OAAOC,EAAI,MACb,CACF","names":["PoolModule","sdk","params","poolId","res","ErrorNotFound"]}