"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.QueryDenomsResponse = exports.QueryDenomsRequest = exports.QueryDenomResponse = exports.QueryDenomRequest = void 0;
const pagination_1 = require("../../../../cosmos/base/query/v1beta1/pagination");
const token_1 = require("./token");
const binary_1 = require("../../../../binary");
const registry_1 = require("../../../../registry");
function createBaseQueryDenomRequest() {
    return {
        hash: ""
    };
}
exports.QueryDenomRequest = {
    typeUrl: "/ibc.applications.transfer.v2.QueryDenomRequest",
    aminoType: "cosmos-sdk/QueryDenomRequest",
    is(o) {
        return o && (o.$typeUrl === exports.QueryDenomRequest.typeUrl || typeof o.hash === "string");
    },
    isAmino(o) {
        return o && (o.$typeUrl === exports.QueryDenomRequest.typeUrl || typeof o.hash === "string");
    },
    encode(message, writer = binary_1.BinaryWriter.create()) {
        if (message.hash !== "") {
            writer.uint32(10).string(message.hash);
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input);
        let end = length === undefined ? reader.len : reader.pos + length;
        const message = createBaseQueryDenomRequest();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.hash = reader.string();
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromPartial(object) {
        const message = createBaseQueryDenomRequest();
        message.hash = object.hash ?? "";
        return message;
    },
    fromAmino(object) {
        const message = createBaseQueryDenomRequest();
        if (object.hash !== undefined && object.hash !== null) {
            message.hash = object.hash;
        }
        return message;
    },
    toAmino(message) {
        const obj = {};
        obj.hash = message.hash === "" ? undefined : message.hash;
        return obj;
    },
    fromAminoMsg(object) {
        return exports.QueryDenomRequest.fromAmino(object.value);
    },
    toAminoMsg(message) {
        return {
            type: "cosmos-sdk/QueryDenomRequest",
            value: exports.QueryDenomRequest.toAmino(message)
        };
    },
    fromProtoMsg(message) {
        return exports.QueryDenomRequest.decode(message.value);
    },
    toProto(message) {
        return exports.QueryDenomRequest.encode(message).finish();
    },
    toProtoMsg(message) {
        return {
            typeUrl: "/ibc.applications.transfer.v2.QueryDenomRequest",
            value: exports.QueryDenomRequest.encode(message).finish()
        };
    }
};
registry_1.GlobalDecoderRegistry.register(exports.QueryDenomRequest.typeUrl, exports.QueryDenomRequest);
registry_1.GlobalDecoderRegistry.registerAminoProtoMapping(exports.QueryDenomRequest.aminoType, exports.QueryDenomRequest.typeUrl);
function createBaseQueryDenomResponse() {
    return {
        denom: undefined
    };
}
exports.QueryDenomResponse = {
    typeUrl: "/ibc.applications.transfer.v2.QueryDenomResponse",
    aminoType: "cosmos-sdk/QueryDenomResponse",
    is(o) {
        return o && o.$typeUrl === exports.QueryDenomResponse.typeUrl;
    },
    isAmino(o) {
        return o && o.$typeUrl === exports.QueryDenomResponse.typeUrl;
    },
    encode(message, writer = binary_1.BinaryWriter.create()) {
        if (message.denom !== undefined) {
            token_1.Denom.encode(message.denom, writer.uint32(10).fork()).ldelim();
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input);
        let end = length === undefined ? reader.len : reader.pos + length;
        const message = createBaseQueryDenomResponse();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.denom = token_1.Denom.decode(reader, reader.uint32());
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromPartial(object) {
        const message = createBaseQueryDenomResponse();
        message.denom = object.denom !== undefined && object.denom !== null ? token_1.Denom.fromPartial(object.denom) : undefined;
        return message;
    },
    fromAmino(object) {
        const message = createBaseQueryDenomResponse();
        if (object.denom !== undefined && object.denom !== null) {
            message.denom = token_1.Denom.fromAmino(object.denom);
        }
        return message;
    },
    toAmino(message) {
        const obj = {};
        obj.denom = message.denom ? token_1.Denom.toAmino(message.denom) : undefined;
        return obj;
    },
    fromAminoMsg(object) {
        return exports.QueryDenomResponse.fromAmino(object.value);
    },
    toAminoMsg(message) {
        return {
            type: "cosmos-sdk/QueryDenomResponse",
            value: exports.QueryDenomResponse.toAmino(message)
        };
    },
    fromProtoMsg(message) {
        return exports.QueryDenomResponse.decode(message.value);
    },
    toProto(message) {
        return exports.QueryDenomResponse.encode(message).finish();
    },
    toProtoMsg(message) {
        return {
            typeUrl: "/ibc.applications.transfer.v2.QueryDenomResponse",
            value: exports.QueryDenomResponse.encode(message).finish()
        };
    }
};
registry_1.GlobalDecoderRegistry.register(exports.QueryDenomResponse.typeUrl, exports.QueryDenomResponse);
registry_1.GlobalDecoderRegistry.registerAminoProtoMapping(exports.QueryDenomResponse.aminoType, exports.QueryDenomResponse.typeUrl);
function createBaseQueryDenomsRequest() {
    return {
        pagination: undefined
    };
}
exports.QueryDenomsRequest = {
    typeUrl: "/ibc.applications.transfer.v2.QueryDenomsRequest",
    aminoType: "cosmos-sdk/QueryDenomsRequest",
    is(o) {
        return o && o.$typeUrl === exports.QueryDenomsRequest.typeUrl;
    },
    isAmino(o) {
        return o && o.$typeUrl === exports.QueryDenomsRequest.typeUrl;
    },
    encode(message, writer = binary_1.BinaryWriter.create()) {
        if (message.pagination !== undefined) {
            pagination_1.PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim();
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input);
        let end = length === undefined ? reader.len : reader.pos + length;
        const message = createBaseQueryDenomsRequest();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.pagination = pagination_1.PageRequest.decode(reader, reader.uint32());
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromPartial(object) {
        const message = createBaseQueryDenomsRequest();
        message.pagination = object.pagination !== undefined && object.pagination !== null ? pagination_1.PageRequest.fromPartial(object.pagination) : undefined;
        return message;
    },
    fromAmino(object) {
        const message = createBaseQueryDenomsRequest();
        if (object.pagination !== undefined && object.pagination !== null) {
            message.pagination = pagination_1.PageRequest.fromAmino(object.pagination);
        }
        return message;
    },
    toAmino(message) {
        const obj = {};
        obj.pagination = message.pagination ? pagination_1.PageRequest.toAmino(message.pagination) : undefined;
        return obj;
    },
    fromAminoMsg(object) {
        return exports.QueryDenomsRequest.fromAmino(object.value);
    },
    toAminoMsg(message) {
        return {
            type: "cosmos-sdk/QueryDenomsRequest",
            value: exports.QueryDenomsRequest.toAmino(message)
        };
    },
    fromProtoMsg(message) {
        return exports.QueryDenomsRequest.decode(message.value);
    },
    toProto(message) {
        return exports.QueryDenomsRequest.encode(message).finish();
    },
    toProtoMsg(message) {
        return {
            typeUrl: "/ibc.applications.transfer.v2.QueryDenomsRequest",
            value: exports.QueryDenomsRequest.encode(message).finish()
        };
    }
};
registry_1.GlobalDecoderRegistry.register(exports.QueryDenomsRequest.typeUrl, exports.QueryDenomsRequest);
registry_1.GlobalDecoderRegistry.registerAminoProtoMapping(exports.QueryDenomsRequest.aminoType, exports.QueryDenomsRequest.typeUrl);
function createBaseQueryDenomsResponse() {
    return {
        denoms: [],
        pagination: undefined
    };
}
exports.QueryDenomsResponse = {
    typeUrl: "/ibc.applications.transfer.v2.QueryDenomsResponse",
    aminoType: "cosmos-sdk/QueryDenomsResponse",
    is(o) {
        return o && (o.$typeUrl === exports.QueryDenomsResponse.typeUrl || Array.isArray(o.denoms) && (!o.denoms.length || token_1.Denom.is(o.denoms[0])));
    },
    isAmino(o) {
        return o && (o.$typeUrl === exports.QueryDenomsResponse.typeUrl || Array.isArray(o.denoms) && (!o.denoms.length || token_1.Denom.isAmino(o.denoms[0])));
    },
    encode(message, writer = binary_1.BinaryWriter.create()) {
        for (const v of message.denoms) {
            token_1.Denom.encode(v, writer.uint32(10).fork()).ldelim();
        }
        if (message.pagination !== undefined) {
            pagination_1.PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim();
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input);
        let end = length === undefined ? reader.len : reader.pos + length;
        const message = createBaseQueryDenomsResponse();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.denoms.push(token_1.Denom.decode(reader, reader.uint32()));
                    break;
                case 2:
                    message.pagination = pagination_1.PageResponse.decode(reader, reader.uint32());
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromPartial(object) {
        const message = createBaseQueryDenomsResponse();
        message.denoms = object.denoms?.map(e => token_1.Denom.fromPartial(e)) || [];
        message.pagination = object.pagination !== undefined && object.pagination !== null ? pagination_1.PageResponse.fromPartial(object.pagination) : undefined;
        return message;
    },
    fromAmino(object) {
        const message = createBaseQueryDenomsResponse();
        message.denoms = object.denoms?.map(e => token_1.Denom.fromAmino(e)) || [];
        if (object.pagination !== undefined && object.pagination !== null) {
            message.pagination = pagination_1.PageResponse.fromAmino(object.pagination);
        }
        return message;
    },
    toAmino(message) {
        const obj = {};
        if (message.denoms) {
            obj.denoms = message.denoms.map(e => e ? token_1.Denom.toAmino(e) : undefined);
        }
        else {
            obj.denoms = message.denoms;
        }
        obj.pagination = message.pagination ? pagination_1.PageResponse.toAmino(message.pagination) : undefined;
        return obj;
    },
    fromAminoMsg(object) {
        return exports.QueryDenomsResponse.fromAmino(object.value);
    },
    toAminoMsg(message) {
        return {
            type: "cosmos-sdk/QueryDenomsResponse",
            value: exports.QueryDenomsResponse.toAmino(message)
        };
    },
    fromProtoMsg(message) {
        return exports.QueryDenomsResponse.decode(message.value);
    },
    toProto(message) {
        return exports.QueryDenomsResponse.encode(message).finish();
    },
    toProtoMsg(message) {
        return {
            typeUrl: "/ibc.applications.transfer.v2.QueryDenomsResponse",
            value: exports.QueryDenomsResponse.encode(message).finish()
        };
    }
};
registry_1.GlobalDecoderRegistry.register(exports.QueryDenomsResponse.typeUrl, exports.QueryDenomsResponse);
registry_1.GlobalDecoderRegistry.registerAminoProtoMapping(exports.QueryDenomsResponse.aminoType, exports.QueryDenomsResponse.typeUrl);
