import { PageRequest, PageResponse } from "../../../cosmos/base/query/v1beta1/pagination"; import { SwapAmountInRoute, SwapAmountOutRoute } from "./tx"; import { Any } from "../../../google/protobuf/any"; import { Coin } from "../../../cosmos/base/v1beta1/coin"; import { Rpc } from "@osmonauts/helpers"; import * as _m0 from "protobufjs/minimal"; import { QueryPoolsRequest, QueryPoolsResponse, QueryNumPoolsRequest, QueryNumPoolsResponse, QueryTotalLiquidityRequest, QueryTotalLiquidityResponse, QueryPoolRequest, QueryPoolResponse, QueryPoolParamsRequest, QueryPoolParamsResponse, QueryTotalPoolLiquidityRequest, QueryTotalPoolLiquidityResponse, QueryTotalSharesRequest, QueryTotalSharesResponse, QuerySpotPriceRequest, QuerySpotPriceResponse, QuerySwapExactAmountInRequest, QuerySwapExactAmountInResponse, QuerySwapExactAmountOutRequest, QuerySwapExactAmountOutResponse } from "./query"; /** Query defines the RPC service */ export interface Query { pools(request: QueryPoolsRequest): Promise; /*null*/ numPools(request: QueryNumPoolsRequest): Promise; /*null*/ totalLiquidity(request: QueryTotalLiquidityRequest): Promise; /*null*/ pool(request: QueryPoolRequest): Promise; /*Per Pool gRPC Endpoints*/ poolParams(request: QueryPoolParamsRequest): Promise; /*null*/ totalPoolLiquidity(request: QueryTotalPoolLiquidityRequest): Promise; /*null*/ totalShares(request: QueryTotalSharesRequest): Promise; /*null*/ spotPrice(request: QuerySpotPriceRequest): Promise; /*SpotPrice defines a gRPC query handler that returns the spot price given a base denomination and a quote denomination.*/ estimateSwapExactAmountIn(request: QuerySwapExactAmountInRequest): Promise; /*Estimate the swap.*/ estimateSwapExactAmountOut(request: QuerySwapExactAmountOutRequest): Promise; /*null*/ } export class QueryClientImpl implements Query { private readonly rpc: Rpc; constructor(rpc: Rpc) { this.rpc = rpc; this.pools = this.pools.bind(this); this.numPools = this.numPools.bind(this); this.totalLiquidity = this.totalLiquidity.bind(this); this.pool = this.pool.bind(this); this.poolParams = this.poolParams.bind(this); this.totalPoolLiquidity = this.totalPoolLiquidity.bind(this); this.totalShares = this.totalShares.bind(this); this.spotPrice = this.spotPrice.bind(this); this.estimateSwapExactAmountIn = this.estimateSwapExactAmountIn.bind(this); this.estimateSwapExactAmountOut = this.estimateSwapExactAmountOut.bind(this); } pools(request: QueryPoolsRequest): Promise { const data = QueryPoolsRequest.encode(request).finish(); const promise = this.rpc.request("osmosis.gamm.v1beta1.Query", "Pools", data); return promise.then(data => QueryPoolsResponse.decode(new _m0.Reader(data))); } numPools(request: QueryNumPoolsRequest): Promise { const data = QueryNumPoolsRequest.encode(request).finish(); const promise = this.rpc.request("osmosis.gamm.v1beta1.Query", "NumPools", data); return promise.then(data => QueryNumPoolsResponse.decode(new _m0.Reader(data))); } totalLiquidity(request: QueryTotalLiquidityRequest): Promise { const data = QueryTotalLiquidityRequest.encode(request).finish(); const promise = this.rpc.request("osmosis.gamm.v1beta1.Query", "TotalLiquidity", data); return promise.then(data => QueryTotalLiquidityResponse.decode(new _m0.Reader(data))); } pool(request: QueryPoolRequest): Promise { const data = QueryPoolRequest.encode(request).finish(); const promise = this.rpc.request("osmosis.gamm.v1beta1.Query", "Pool", data); return promise.then(data => QueryPoolResponse.decode(new _m0.Reader(data))); } poolParams(request: QueryPoolParamsRequest): Promise { const data = QueryPoolParamsRequest.encode(request).finish(); const promise = this.rpc.request("osmosis.gamm.v1beta1.Query", "PoolParams", data); return promise.then(data => QueryPoolParamsResponse.decode(new _m0.Reader(data))); } totalPoolLiquidity(request: QueryTotalPoolLiquidityRequest): Promise { const data = QueryTotalPoolLiquidityRequest.encode(request).finish(); const promise = this.rpc.request("osmosis.gamm.v1beta1.Query", "TotalPoolLiquidity", data); return promise.then(data => QueryTotalPoolLiquidityResponse.decode(new _m0.Reader(data))); } totalShares(request: QueryTotalSharesRequest): Promise { const data = QueryTotalSharesRequest.encode(request).finish(); const promise = this.rpc.request("osmosis.gamm.v1beta1.Query", "TotalShares", data); return promise.then(data => QueryTotalSharesResponse.decode(new _m0.Reader(data))); } spotPrice(request: QuerySpotPriceRequest): Promise { const data = QuerySpotPriceRequest.encode(request).finish(); const promise = this.rpc.request("osmosis.gamm.v1beta1.Query", "SpotPrice", data); return promise.then(data => QuerySpotPriceResponse.decode(new _m0.Reader(data))); } estimateSwapExactAmountIn(request: QuerySwapExactAmountInRequest): Promise { const data = QuerySwapExactAmountInRequest.encode(request).finish(); const promise = this.rpc.request("osmosis.gamm.v1beta1.Query", "EstimateSwapExactAmountIn", data); return promise.then(data => QuerySwapExactAmountInResponse.decode(new _m0.Reader(data))); } estimateSwapExactAmountOut(request: QuerySwapExactAmountOutRequest): Promise { const data = QuerySwapExactAmountOutRequest.encode(request).finish(); const promise = this.rpc.request("osmosis.gamm.v1beta1.Query", "EstimateSwapExactAmountOut", data); return promise.then(data => QuerySwapExactAmountOutResponse.decode(new _m0.Reader(data))); } }