import { PageRequest, PageResponse } from "../../cosmos/base/query/v1beta1/pagination"; import { Coin } from "../../cosmos/base/v1beta1/coin"; import { Gauge } from "./gauge"; import { Duration } from "../../google/protobuf/duration"; import { LCDClient } from "@osmonauts/lcd"; import { setPaginationParams } from "@osmonauts/helpers"; import { ModuleToDistributeCoinsRequest, ModuleToDistributeCoinsResponse, ModuleDistributedCoinsRequest, ModuleDistributedCoinsResponse, GaugeByIDRequest, GaugeByIDResponse, GaugesRequest, GaugesResponse, ActiveGaugesRequest, ActiveGaugesResponse, ActiveGaugesPerDenomRequest, ActiveGaugesPerDenomResponse, UpcomingGaugesRequest, UpcomingGaugesResponse, UpcomingGaugesPerDenomRequest, UpcomingGaugesPerDenomResponse, RewardsEstRequest, RewardsEstResponse, QueryLockableDurationsRequest, QueryLockableDurationsResponse } from "./query"; export class LCDQueryClient extends LCDClient { constructor({ restEndpoint }: { restEndpoint: string; }) { super({ restEndpoint }); } /* returns coins that is going to be distributed */ async moduleToDistributeCoins(_params: ModuleToDistributeCoinsRequest = {}): Promise { const endpoint = `osmosis/incentives/v1beta1/module_to_distribute_coins`; return await this.request(endpoint); } /* returns coins that are distributed by module so far */ async moduleDistributedCoins(_params: ModuleDistributedCoinsRequest = {}): Promise { const endpoint = `osmosis/incentives/v1beta1/module_distributed_coins`; return await this.request(endpoint); } /* returns Gauge by id */ async gaugeByID(params: GaugeByIDRequest): Promise { const endpoint = `osmosis/incentives/v1beta1/gauge_by_id/${params.id}`; return await this.request(endpoint); } /* returns gauges both upcoming and active */ async gauges(params: GaugesRequest = { pagination: undefined }): Promise { const options: any = { params: {} }; if (typeof params?.pagination !== "undefined") { setPaginationParams(options, params.pagination); } const endpoint = `osmosis/incentives/v1beta1/gauges`; return await this.request(endpoint, options); } /* returns active gauges */ async activeGauges(params: ActiveGaugesRequest = { pagination: undefined }): Promise { const options: any = { params: {} }; if (typeof params?.pagination !== "undefined") { setPaginationParams(options, params.pagination); } const endpoint = `osmosis/incentives/v1beta1/active_gauges`; return await this.request(endpoint, options); } /* returns active gauges per denom */ async activeGaugesPerDenom(params: ActiveGaugesPerDenomRequest): Promise { const options: any = { params: {} }; if (typeof params?.denom !== "undefined") { options.params.denom = params.denom; } if (typeof params?.pagination !== "undefined") { setPaginationParams(options, params.pagination); } const endpoint = `osmosis/incentives/v1beta1/active_gauges_per_denom`; return await this.request(endpoint, options); } /* returns scheduled gauges */ async upcomingGauges(params: UpcomingGaugesRequest = { pagination: undefined }): Promise { const options: any = { params: {} }; if (typeof params?.pagination !== "undefined") { setPaginationParams(options, params.pagination); } const endpoint = `osmosis/incentives/v1beta1/upcoming_gauges`; return await this.request(endpoint, options); } /* returns scheduled gauges per denom */ async upcomingGaugesPerDenom(params: UpcomingGaugesPerDenomRequest): Promise { const options: any = { params: {} }; if (typeof params?.denom !== "undefined") { options.params.denom = params.denom; } if (typeof params?.pagination !== "undefined") { setPaginationParams(options, params.pagination); } const endpoint = `osmosis/incentives/v1beta1/upcoming_gauges_per_denom`; return await this.request(endpoint, options); } /* RewardsEst returns an estimate of the rewards at a future specific time. The querier either provides an address or a set of locks for which they want to find the associated rewards. */ async rewardsEst(params: RewardsEstRequest): Promise { const options: any = { params: {} }; if (typeof params?.lock_ids !== "undefined") { options.params.lock_ids = params.lock_ids; } if (typeof params?.end_epoch !== "undefined") { options.params.end_epoch = params.end_epoch; } const endpoint = `osmosis/incentives/v1beta1/rewards_est/${params.owner}`; return await this.request(endpoint, options); } /* returns lockable durations that are valid to give incentives */ async lockableDurations(_params: QueryLockableDurationsRequest = {}): Promise { const endpoint = `osmosis/incentives/v1beta1/lockable_durations`; return await this.request(endpoint); } }