"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    var desc = Object.getOwnPropertyDescriptor(m, k);
    if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
      desc = { enumerable: true, get: function() { return m[k]; } };
    }
    Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
    Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
    o["default"] = v;
});
var __importStar = (this && this.__importStar) || (function () {
    var ownKeys = function(o) {
        ownKeys = Object.getOwnPropertyNames || function (o) {
            var ar = [];
            for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
            return ar;
        };
        return ownKeys(o);
    };
    return function (mod) {
        if (mod && mod.__esModule) return mod;
        var result = {};
        if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
        __setModuleDefault(result, mod);
        return result;
    };
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.createRpcQueryExtension = exports.QueryClientImpl = void 0;
const _m0 = __importStar(require("protobufjs/minimal"));
const stargate_1 = require("@cosmjs/stargate");
const query_1 = require("./query");
class QueryClientImpl {
    constructor(rpc) {
        this.rpc = rpc;
        this.perpetual = this.perpetual.bind(this);
        this.allPerpetuals = this.allPerpetuals.bind(this);
        this.allLiquidityTiers = this.allLiquidityTiers.bind(this);
        this.premiumVotes = this.premiumVotes.bind(this);
        this.premiumSamples = this.premiumSamples.bind(this);
        this.params = this.params.bind(this);
        this.nextPerpetualId = this.nextPerpetualId.bind(this);
    }
    perpetual(request) {
        const data = query_1.QueryPerpetualRequest.encode(request).finish();
        const promise = this.rpc.request("ritbit.perpetuals.Query", "Perpetual", data);
        return promise.then(data => query_1.QueryPerpetualResponse.decode(new _m0.Reader(data)));
    }
    allPerpetuals(request = {
        pagination: undefined
    }) {
        const data = query_1.QueryAllPerpetualsRequest.encode(request).finish();
        const promise = this.rpc.request("ritbit.perpetuals.Query", "AllPerpetuals", data);
        return promise.then(data => query_1.QueryAllPerpetualsResponse.decode(new _m0.Reader(data)));
    }
    allLiquidityTiers(request = {
        pagination: undefined
    }) {
        const data = query_1.QueryAllLiquidityTiersRequest.encode(request).finish();
        const promise = this.rpc.request("ritbit.perpetuals.Query", "AllLiquidityTiers", data);
        return promise.then(data => query_1.QueryAllLiquidityTiersResponse.decode(new _m0.Reader(data)));
    }
    premiumVotes(request = {}) {
        const data = query_1.QueryPremiumVotesRequest.encode(request).finish();
        const promise = this.rpc.request("ritbit.perpetuals.Query", "PremiumVotes", data);
        return promise.then(data => query_1.QueryPremiumVotesResponse.decode(new _m0.Reader(data)));
    }
    premiumSamples(request = {}) {
        const data = query_1.QueryPremiumSamplesRequest.encode(request).finish();
        const promise = this.rpc.request("ritbit.perpetuals.Query", "PremiumSamples", data);
        return promise.then(data => query_1.QueryPremiumSamplesResponse.decode(new _m0.Reader(data)));
    }
    params(request = {}) {
        const data = query_1.QueryParamsRequest.encode(request).finish();
        const promise = this.rpc.request("ritbit.perpetuals.Query", "Params", data);
        return promise.then(data => query_1.QueryParamsResponse.decode(new _m0.Reader(data)));
    }
    nextPerpetualId(request = {}) {
        const data = query_1.QueryNextPerpetualIdRequest.encode(request).finish();
        const promise = this.rpc.request("ritbit.perpetuals.Query", "NextPerpetualId", data);
        return promise.then(data => query_1.QueryNextPerpetualIdResponse.decode(new _m0.Reader(data)));
    }
}
exports.QueryClientImpl = QueryClientImpl;
const createRpcQueryExtension = (base) => {
    const rpc = (0, stargate_1.createProtobufRpcClient)(base);
    const queryService = new QueryClientImpl(rpc);
    return {
        perpetual(request) {
            return queryService.perpetual(request);
        },
        allPerpetuals(request) {
            return queryService.allPerpetuals(request);
        },
        allLiquidityTiers(request) {
            return queryService.allLiquidityTiers(request);
        },
        premiumVotes(request) {
            return queryService.premiumVotes(request);
        },
        premiumSamples(request) {
            return queryService.premiumSamples(request);
        },
        params(request) {
            return queryService.params(request);
        },
        nextPerpetualId(request) {
            return queryService.nextPerpetualId(request);
        }
    };
};
exports.createRpcQueryExtension = createRpcQueryExtension;
//# sourceMappingURL=data:application/json;base64, 