/* eslint-disable */
import _m0 from "protobufjs/minimal";
import { PageRequest, PageResponse } from "../cosmos/base/query/v1beta1/pagination";
import { Info } from "./info";
import { Item } from "./item";
import { Params } from "./params";
export const protobufPackage = "rarifyprotocol.rarimocore.tokenmanager";
function createBaseQueryParamsRequest() {
    return {};
}
export const QueryParamsRequest = {
    encode(_, writer = _m0.Writer.create()) {
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
        let end = length === undefined ? reader.len : reader.pos + length;
        const message = createBaseQueryParamsRequest();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(_) {
        return {};
    },
    toJSON(_) {
        const obj = {};
        return obj;
    },
    fromPartial(_) {
        const message = createBaseQueryParamsRequest();
        return message;
    },
};
function createBaseQueryParamsResponse() {
    return { params: undefined };
}
export const QueryParamsResponse = {
    encode(message, writer = _m0.Writer.create()) {
        if (message.params !== undefined) {
            Params.encode(message.params, writer.uint32(10).fork()).ldelim();
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
        let end = length === undefined ? reader.len : reader.pos + length;
        const message = createBaseQueryParamsResponse();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.params = Params.decode(reader, reader.uint32());
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        return { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined };
    },
    toJSON(message) {
        const obj = {};
        message.params !== undefined && (obj.params = message.params ? Params.toJSON(message.params) : undefined);
        return obj;
    },
    fromPartial(object) {
        const message = createBaseQueryParamsResponse();
        message.params = (object.params !== undefined && object.params !== null)
            ? Params.fromPartial(object.params)
            : undefined;
        return message;
    },
};
function createBaseQueryGetItemRequest() {
    return { tokenAddress: "", tokenId: "", chain: "" };
}
export const QueryGetItemRequest = {
    encode(message, writer = _m0.Writer.create()) {
        if (message.tokenAddress !== "") {
            writer.uint32(10).string(message.tokenAddress);
        }
        if (message.tokenId !== "") {
            writer.uint32(18).string(message.tokenId);
        }
        if (message.chain !== "") {
            writer.uint32(26).string(message.chain);
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
        let end = length === undefined ? reader.len : reader.pos + length;
        const message = createBaseQueryGetItemRequest();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.tokenAddress = reader.string();
                    break;
                case 2:
                    message.tokenId = reader.string();
                    break;
                case 3:
                    message.chain = reader.string();
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        return {
            tokenAddress: isSet(object.tokenAddress) ? String(object.tokenAddress) : "",
            tokenId: isSet(object.tokenId) ? String(object.tokenId) : "",
            chain: isSet(object.chain) ? String(object.chain) : "",
        };
    },
    toJSON(message) {
        const obj = {};
        message.tokenAddress !== undefined && (obj.tokenAddress = message.tokenAddress);
        message.tokenId !== undefined && (obj.tokenId = message.tokenId);
        message.chain !== undefined && (obj.chain = message.chain);
        return obj;
    },
    fromPartial(object) {
        const message = createBaseQueryGetItemRequest();
        message.tokenAddress = object.tokenAddress ?? "";
        message.tokenId = object.tokenId ?? "";
        message.chain = object.chain ?? "";
        return message;
    },
};
function createBaseQueryGetItemResponse() {
    return { item: undefined };
}
export const QueryGetItemResponse = {
    encode(message, writer = _m0.Writer.create()) {
        if (message.item !== undefined) {
            Item.encode(message.item, writer.uint32(10).fork()).ldelim();
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
        let end = length === undefined ? reader.len : reader.pos + length;
        const message = createBaseQueryGetItemResponse();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.item = Item.decode(reader, reader.uint32());
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        return { item: isSet(object.item) ? Item.fromJSON(object.item) : undefined };
    },
    toJSON(message) {
        const obj = {};
        message.item !== undefined && (obj.item = message.item ? Item.toJSON(message.item) : undefined);
        return obj;
    },
    fromPartial(object) {
        const message = createBaseQueryGetItemResponse();
        message.item = (object.item !== undefined && object.item !== null) ? Item.fromPartial(object.item) : undefined;
        return message;
    },
};
function createBaseQueryGetItemByChainRequest() {
    return { infoIndex: "", chain: "" };
}
export const QueryGetItemByChainRequest = {
    encode(message, writer = _m0.Writer.create()) {
        if (message.infoIndex !== "") {
            writer.uint32(10).string(message.infoIndex);
        }
        if (message.chain !== "") {
            writer.uint32(18).string(message.chain);
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
        let end = length === undefined ? reader.len : reader.pos + length;
        const message = createBaseQueryGetItemByChainRequest();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.infoIndex = reader.string();
                    break;
                case 2:
                    message.chain = reader.string();
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        return {
            infoIndex: isSet(object.infoIndex) ? String(object.infoIndex) : "",
            chain: isSet(object.chain) ? String(object.chain) : "",
        };
    },
    toJSON(message) {
        const obj = {};
        message.infoIndex !== undefined && (obj.infoIndex = message.infoIndex);
        message.chain !== undefined && (obj.chain = message.chain);
        return obj;
    },
    fromPartial(object) {
        const message = createBaseQueryGetItemByChainRequest();
        message.infoIndex = object.infoIndex ?? "";
        message.chain = object.chain ?? "";
        return message;
    },
};
function createBaseQueryGetItemByChainResponse() {
    return { item: undefined };
}
export const QueryGetItemByChainResponse = {
    encode(message, writer = _m0.Writer.create()) {
        if (message.item !== undefined) {
            Item.encode(message.item, writer.uint32(10).fork()).ldelim();
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
        let end = length === undefined ? reader.len : reader.pos + length;
        const message = createBaseQueryGetItemByChainResponse();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.item = Item.decode(reader, reader.uint32());
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        return { item: isSet(object.item) ? Item.fromJSON(object.item) : undefined };
    },
    toJSON(message) {
        const obj = {};
        message.item !== undefined && (obj.item = message.item ? Item.toJSON(message.item) : undefined);
        return obj;
    },
    fromPartial(object) {
        const message = createBaseQueryGetItemByChainResponse();
        message.item = (object.item !== undefined && object.item !== null) ? Item.fromPartial(object.item) : undefined;
        return message;
    },
};
function createBaseQueryAllItemRequest() {
    return { pagination: undefined };
}
export const QueryAllItemRequest = {
    encode(message, writer = _m0.Writer.create()) {
        if (message.pagination !== undefined) {
            PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim();
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
        let end = length === undefined ? reader.len : reader.pos + length;
        const message = createBaseQueryAllItemRequest();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.pagination = PageRequest.decode(reader, reader.uint32());
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined };
    },
    toJSON(message) {
        const obj = {};
        message.pagination !== undefined
            && (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined);
        return obj;
    },
    fromPartial(object) {
        const message = createBaseQueryAllItemRequest();
        message.pagination = (object.pagination !== undefined && object.pagination !== null)
            ? PageRequest.fromPartial(object.pagination)
            : undefined;
        return message;
    },
};
function createBaseQueryAllItemResponse() {
    return { item: [], pagination: undefined };
}
export const QueryAllItemResponse = {
    encode(message, writer = _m0.Writer.create()) {
        for (const v of message.item) {
            Item.encode(v, writer.uint32(10).fork()).ldelim();
        }
        if (message.pagination !== undefined) {
            PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim();
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
        let end = length === undefined ? reader.len : reader.pos + length;
        const message = createBaseQueryAllItemResponse();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.item.push(Item.decode(reader, reader.uint32()));
                    break;
                case 2:
                    message.pagination = PageResponse.decode(reader, reader.uint32());
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        return {
            item: Array.isArray(object?.item) ? object.item.map((e) => Item.fromJSON(e)) : [],
            pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined,
        };
    },
    toJSON(message) {
        const obj = {};
        if (message.item) {
            obj.item = message.item.map((e) => e ? Item.toJSON(e) : undefined);
        }
        else {
            obj.item = [];
        }
        message.pagination !== undefined
            && (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined);
        return obj;
    },
    fromPartial(object) {
        const message = createBaseQueryAllItemResponse();
        message.item = object.item?.map((e) => Item.fromPartial(e)) || [];
        message.pagination = (object.pagination !== undefined && object.pagination !== null)
            ? PageResponse.fromPartial(object.pagination)
            : undefined;
        return message;
    },
};
function createBaseQueryGetInfoRequest() {
    return { index: "" };
}
export const QueryGetInfoRequest = {
    encode(message, writer = _m0.Writer.create()) {
        if (message.index !== "") {
            writer.uint32(10).string(message.index);
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
        let end = length === undefined ? reader.len : reader.pos + length;
        const message = createBaseQueryGetInfoRequest();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.index = reader.string();
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        return { index: isSet(object.index) ? String(object.index) : "" };
    },
    toJSON(message) {
        const obj = {};
        message.index !== undefined && (obj.index = message.index);
        return obj;
    },
    fromPartial(object) {
        const message = createBaseQueryGetInfoRequest();
        message.index = object.index ?? "";
        return message;
    },
};
function createBaseQueryGetInfoResponse() {
    return { info: undefined };
}
export const QueryGetInfoResponse = {
    encode(message, writer = _m0.Writer.create()) {
        if (message.info !== undefined) {
            Info.encode(message.info, writer.uint32(10).fork()).ldelim();
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
        let end = length === undefined ? reader.len : reader.pos + length;
        const message = createBaseQueryGetInfoResponse();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.info = Info.decode(reader, reader.uint32());
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        return { info: isSet(object.info) ? Info.fromJSON(object.info) : undefined };
    },
    toJSON(message) {
        const obj = {};
        message.info !== undefined && (obj.info = message.info ? Info.toJSON(message.info) : undefined);
        return obj;
    },
    fromPartial(object) {
        const message = createBaseQueryGetInfoResponse();
        message.info = (object.info !== undefined && object.info !== null) ? Info.fromPartial(object.info) : undefined;
        return message;
    },
};
function createBaseQueryAllInfoRequest() {
    return { pagination: undefined };
}
export const QueryAllInfoRequest = {
    encode(message, writer = _m0.Writer.create()) {
        if (message.pagination !== undefined) {
            PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim();
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
        let end = length === undefined ? reader.len : reader.pos + length;
        const message = createBaseQueryAllInfoRequest();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.pagination = PageRequest.decode(reader, reader.uint32());
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined };
    },
    toJSON(message) {
        const obj = {};
        message.pagination !== undefined
            && (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined);
        return obj;
    },
    fromPartial(object) {
        const message = createBaseQueryAllInfoRequest();
        message.pagination = (object.pagination !== undefined && object.pagination !== null)
            ? PageRequest.fromPartial(object.pagination)
            : undefined;
        return message;
    },
};
function createBaseQueryAllInfoResponse() {
    return { info: [], pagination: undefined };
}
export const QueryAllInfoResponse = {
    encode(message, writer = _m0.Writer.create()) {
        for (const v of message.info) {
            Info.encode(v, writer.uint32(10).fork()).ldelim();
        }
        if (message.pagination !== undefined) {
            PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim();
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
        let end = length === undefined ? reader.len : reader.pos + length;
        const message = createBaseQueryAllInfoResponse();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.info.push(Info.decode(reader, reader.uint32()));
                    break;
                case 2:
                    message.pagination = PageResponse.decode(reader, reader.uint32());
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        return {
            info: Array.isArray(object?.info) ? object.info.map((e) => Info.fromJSON(e)) : [],
            pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined,
        };
    },
    toJSON(message) {
        const obj = {};
        if (message.info) {
            obj.info = message.info.map((e) => e ? Info.toJSON(e) : undefined);
        }
        else {
            obj.info = [];
        }
        message.pagination !== undefined
            && (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined);
        return obj;
    },
    fromPartial(object) {
        const message = createBaseQueryAllInfoResponse();
        message.info = object.info?.map((e) => Info.fromPartial(e)) || [];
        message.pagination = (object.pagination !== undefined && object.pagination !== null)
            ? PageResponse.fromPartial(object.pagination)
            : undefined;
        return message;
    },
};
export class QueryClientImpl {
    rpc;
    constructor(rpc) {
        this.rpc = rpc;
        this.Params = this.Params.bind(this);
        this.Item = this.Item.bind(this);
        this.ItemByChain = this.ItemByChain.bind(this);
        this.ItemAll = this.ItemAll.bind(this);
        this.Info = this.Info.bind(this);
        this.InfoAll = this.InfoAll.bind(this);
    }
    Params(request) {
        const data = QueryParamsRequest.encode(request).finish();
        const promise = this.rpc.request("rarifyprotocol.rarimocore.tokenmanager.Query", "Params", data);
        return promise.then((data) => QueryParamsResponse.decode(new _m0.Reader(data)));
    }
    Item(request) {
        const data = QueryGetItemRequest.encode(request).finish();
        const promise = this.rpc.request("rarifyprotocol.rarimocore.tokenmanager.Query", "Item", data);
        return promise.then((data) => QueryGetItemResponse.decode(new _m0.Reader(data)));
    }
    ItemByChain(request) {
        const data = QueryGetItemByChainRequest.encode(request).finish();
        const promise = this.rpc.request("rarifyprotocol.rarimocore.tokenmanager.Query", "ItemByChain", data);
        return promise.then((data) => QueryGetItemByChainResponse.decode(new _m0.Reader(data)));
    }
    ItemAll(request) {
        const data = QueryAllItemRequest.encode(request).finish();
        const promise = this.rpc.request("rarifyprotocol.rarimocore.tokenmanager.Query", "ItemAll", data);
        return promise.then((data) => QueryAllItemResponse.decode(new _m0.Reader(data)));
    }
    Info(request) {
        const data = QueryGetInfoRequest.encode(request).finish();
        const promise = this.rpc.request("rarifyprotocol.rarimocore.tokenmanager.Query", "Info", data);
        return promise.then((data) => QueryGetInfoResponse.decode(new _m0.Reader(data)));
    }
    InfoAll(request) {
        const data = QueryAllInfoRequest.encode(request).finish();
        const promise = this.rpc.request("rarifyprotocol.rarimocore.tokenmanager.Query", "InfoAll", data);
        return promise.then((data) => QueryAllInfoResponse.decode(new _m0.Reader(data)));
    }
}
function isSet(value) {
    return value !== null && value !== undefined;
}
//# sourceMappingURL=query.js.map