"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.marketPrice = this.marketPrice.bind(this);
        this.allMarketPrices = this.allMarketPrices.bind(this);
        this.marketParam = this.marketParam.bind(this);
        this.allMarketParams = this.allMarketParams.bind(this);
        this.nextMarketId = this.nextMarketId.bind(this);
    }
    marketPrice(request) {
        const data = query_1.QueryMarketPriceRequest.encode(request).finish();
        const promise = this.rpc.request("ritbit.prices.Query", "MarketPrice", data);
        return promise.then(data => query_1.QueryMarketPriceResponse.decode(new _m0.Reader(data)));
    }
    allMarketPrices(request = {
        pagination: undefined
    }) {
        const data = query_1.QueryAllMarketPricesRequest.encode(request).finish();
        const promise = this.rpc.request("ritbit.prices.Query", "AllMarketPrices", data);
        return promise.then(data => query_1.QueryAllMarketPricesResponse.decode(new _m0.Reader(data)));
    }
    marketParam(request) {
        const data = query_1.QueryMarketParamRequest.encode(request).finish();
        const promise = this.rpc.request("ritbit.prices.Query", "MarketParam", data);
        return promise.then(data => query_1.QueryMarketParamResponse.decode(new _m0.Reader(data)));
    }
    allMarketParams(request = {
        pagination: undefined
    }) {
        const data = query_1.QueryAllMarketParamsRequest.encode(request).finish();
        const promise = this.rpc.request("ritbit.prices.Query", "AllMarketParams", data);
        return promise.then(data => query_1.QueryAllMarketParamsResponse.decode(new _m0.Reader(data)));
    }
    nextMarketId(request = {}) {
        const data = query_1.QueryNextMarketIdRequest.encode(request).finish();
        const promise = this.rpc.request("ritbit.prices.Query", "NextMarketId", data);
        return promise.then(data => query_1.QueryNextMarketIdResponse.decode(new _m0.Reader(data)));
    }
}
exports.QueryClientImpl = QueryClientImpl;
const createRpcQueryExtension = (base) => {
    const rpc = (0, stargate_1.createProtobufRpcClient)(base);
    const queryService = new QueryClientImpl(rpc);
    return {
        marketPrice(request) {
            return queryService.marketPrice(request);
        },
        allMarketPrices(request) {
            return queryService.allMarketPrices(request);
        },
        marketParam(request) {
            return queryService.marketParam(request);
        },
        allMarketParams(request) {
            return queryService.allMarketParams(request);
        },
        nextMarketId(request) {
            return queryService.nextMarketId(request);
        }
    };
};
exports.createRpcQueryExtension = createRpcQueryExtension;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicXVlcnkucnBjLlF1ZXJ5LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vLi4vLi4vLi4vLi4vbm9kZV9tb2R1bGVzL0ByaXRiaXQvdjQtcHJvdG8vc3JjL2NvZGVnZW4vcml0Yml0L3ByaWNlcy9xdWVyeS5ycGMuUXVlcnkudHMiXSwibmFtZXMiOltdLCJtY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