import { setPaginationParams } from "../../../helpers"; import { LCDClient } from "@osmonauts/lcd"; import { QuerySales, QuerySalesResponseSDKType, QuerySale, QuerySaleResponseSDKType, QueryUserPosition, QueryUserPositionResponseSDKType } from "./query"; export class LCDQueryClient { req: LCDClient; constructor({ requestClient }: { requestClient: LCDClient; }) { this.req = requestClient; this.sales = this.sales.bind(this); this.sale = this.sale.bind(this); this.userPosition = this.userPosition.bind(this); } /* Returns list of Sales ordered by the creation time */ async sales(params: QuerySales = { pagination: undefined }): Promise { const options: any = { params: {} }; if (typeof params?.pagination !== "undefined") { setPaginationParams(options, params.pagination); } const endpoint = `cosmos/streamswap/v1/sales`; return await this.req.get(endpoint, options); } /* Returns the specific Sale object */ async sale(params: QuerySale): Promise { const endpoint = `cosmos/streamswap/v1/sales/${params.saleId}`; return await this.req.get(endpoint); } /* UserPosition */ async userPosition(params: QueryUserPosition): Promise { const endpoint = `cosmos/streamswap/v1/sales/${params.saleId}/${params.user}`; return await this.req.get(endpoint); } }