"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.subaccount = this.subaccount.bind(this);
        this.subaccountAll = this.subaccountAll.bind(this);
        this.getWithdrawalAndTransfersBlockedInfo = this.getWithdrawalAndTransfersBlockedInfo.bind(this);
        this.collateralPoolAddress = this.collateralPoolAddress.bind(this);
    }
    subaccount(request) {
        const data = query_1.QueryGetSubaccountRequest.encode(request).finish();
        const promise = this.rpc.request("ritbit.subaccounts.Query", "Subaccount", data);
        return promise.then(data => query_1.QuerySubaccountResponse.decode(new _m0.Reader(data)));
    }
    subaccountAll(request = {
        pagination: undefined
    }) {
        const data = query_1.QueryAllSubaccountRequest.encode(request).finish();
        const promise = this.rpc.request("ritbit.subaccounts.Query", "SubaccountAll", data);
        return promise.then(data => query_1.QuerySubaccountAllResponse.decode(new _m0.Reader(data)));
    }
    getWithdrawalAndTransfersBlockedInfo(request) {
        const data = query_1.QueryGetWithdrawalAndTransfersBlockedInfoRequest.encode(request).finish();
        const promise = this.rpc.request("ritbit.subaccounts.Query", "GetWithdrawalAndTransfersBlockedInfo", data);
        return promise.then(data => query_1.QueryGetWithdrawalAndTransfersBlockedInfoResponse.decode(new _m0.Reader(data)));
    }
    collateralPoolAddress(request) {
        const data = query_1.QueryCollateralPoolAddressRequest.encode(request).finish();
        const promise = this.rpc.request("ritbit.subaccounts.Query", "CollateralPoolAddress", data);
        return promise.then(data => query_1.QueryCollateralPoolAddressResponse.decode(new _m0.Reader(data)));
    }
}
exports.QueryClientImpl = QueryClientImpl;
const createRpcQueryExtension = (base) => {
    const rpc = (0, stargate_1.createProtobufRpcClient)(base);
    const queryService = new QueryClientImpl(rpc);
    return {
        subaccount(request) {
            return queryService.subaccount(request);
        },
        subaccountAll(request) {
            return queryService.subaccountAll(request);
        },
        getWithdrawalAndTransfersBlockedInfo(request) {
            return queryService.getWithdrawalAndTransfersBlockedInfo(request);
        },
        collateralPoolAddress(request) {
            return queryService.collateralPoolAddress(request);
        }
    };
};
exports.createRpcQueryExtension = createRpcQueryExtension;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicXVlcnkucnBjLlF1ZXJ5LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vLi4vLi4vLi4vLi4vbm9kZV9tb2R1bGVzL0ByaXRiaXQvdjQtcHJvdG8vc3JjL2NvZGVnZW4vcml0Yml0L3N1YmFjY291bnRzL3F1ZXJ5LnJwYy5RdWVyeS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7Ozs7Ozs7Ozs7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