"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.QueryConfigResponse = exports.QueryConfigRequest = exports.QueryCounterpartyInfoResponse = exports.QueryCounterpartyInfoRequest = void 0;
const counterparty_1 = require("./counterparty");
const config_1 = require("./config");
const binary_1 = require("../../../../binary");
const registry_1 = require("../../../../registry");
function createBaseQueryCounterpartyInfoRequest() {
    return {
        clientId: ""
    };
}
/**
 * QueryCounterpartyInfoRequest is the request type for the Query/CounterpartyInfo RPC
 * method
 * @name QueryCounterpartyInfoRequest
 * @package ibc.core.client.v2
 * @see proto type: ibc.core.client.v2.QueryCounterpartyInfoRequest
 */
exports.QueryCounterpartyInfoRequest = {
    typeUrl: "/ibc.core.client.v2.QueryCounterpartyInfoRequest",
    aminoType: "cosmos-sdk/QueryCounterpartyInfoRequest",
    is(o) {
        return o && (o.$typeUrl === exports.QueryCounterpartyInfoRequest.typeUrl || typeof o.clientId === "string");
    },
    isAmino(o) {
        return o && (o.$typeUrl === exports.QueryCounterpartyInfoRequest.typeUrl || typeof o.client_id === "string");
    },
    encode(message, writer = binary_1.BinaryWriter.create()) {
        if (message.clientId !== "") {
            writer.uint32(10).string(message.clientId);
        }
        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 = createBaseQueryCounterpartyInfoRequest();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.clientId = reader.string();
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromPartial(object) {
        const message = createBaseQueryCounterpartyInfoRequest();
        message.clientId = object.clientId ?? "";
        return message;
    },
    fromAmino(object) {
        const message = createBaseQueryCounterpartyInfoRequest();
        if (object.client_id !== undefined && object.client_id !== null) {
            message.clientId = object.client_id;
        }
        return message;
    },
    toAmino(message) {
        const obj = {};
        obj.client_id = message.clientId === "" ? undefined : message.clientId;
        return obj;
    },
    fromAminoMsg(object) {
        return exports.QueryCounterpartyInfoRequest.fromAmino(object.value);
    },
    toAminoMsg(message) {
        return {
            type: "cosmos-sdk/QueryCounterpartyInfoRequest",
            value: exports.QueryCounterpartyInfoRequest.toAmino(message)
        };
    },
    fromProtoMsg(message) {
        return exports.QueryCounterpartyInfoRequest.decode(message.value);
    },
    toProto(message) {
        return exports.QueryCounterpartyInfoRequest.encode(message).finish();
    },
    toProtoMsg(message) {
        return {
            typeUrl: "/ibc.core.client.v2.QueryCounterpartyInfoRequest",
            value: exports.QueryCounterpartyInfoRequest.encode(message).finish()
        };
    },
    registerTypeUrl() { }
};
function createBaseQueryCounterpartyInfoResponse() {
    return {
        counterpartyInfo: undefined
    };
}
/**
 * QueryCounterpartyInfoResponse is the response type for the
 * Query/CounterpartyInfo RPC method.
 * @name QueryCounterpartyInfoResponse
 * @package ibc.core.client.v2
 * @see proto type: ibc.core.client.v2.QueryCounterpartyInfoResponse
 */
exports.QueryCounterpartyInfoResponse = {
    typeUrl: "/ibc.core.client.v2.QueryCounterpartyInfoResponse",
    aminoType: "cosmos-sdk/QueryCounterpartyInfoResponse",
    is(o) {
        return o && o.$typeUrl === exports.QueryCounterpartyInfoResponse.typeUrl;
    },
    isAmino(o) {
        return o && o.$typeUrl === exports.QueryCounterpartyInfoResponse.typeUrl;
    },
    encode(message, writer = binary_1.BinaryWriter.create()) {
        if (message.counterpartyInfo !== undefined) {
            counterparty_1.CounterpartyInfo.encode(message.counterpartyInfo, 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 = createBaseQueryCounterpartyInfoResponse();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.counterpartyInfo = counterparty_1.CounterpartyInfo.decode(reader, reader.uint32());
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromPartial(object) {
        const message = createBaseQueryCounterpartyInfoResponse();
        message.counterpartyInfo = object.counterpartyInfo !== undefined && object.counterpartyInfo !== null ? counterparty_1.CounterpartyInfo.fromPartial(object.counterpartyInfo) : undefined;
        return message;
    },
    fromAmino(object) {
        const message = createBaseQueryCounterpartyInfoResponse();
        if (object.counterparty_info !== undefined && object.counterparty_info !== null) {
            message.counterpartyInfo = counterparty_1.CounterpartyInfo.fromAmino(object.counterparty_info);
        }
        return message;
    },
    toAmino(message) {
        const obj = {};
        obj.counterparty_info = message.counterpartyInfo ? counterparty_1.CounterpartyInfo.toAmino(message.counterpartyInfo) : undefined;
        return obj;
    },
    fromAminoMsg(object) {
        return exports.QueryCounterpartyInfoResponse.fromAmino(object.value);
    },
    toAminoMsg(message) {
        return {
            type: "cosmos-sdk/QueryCounterpartyInfoResponse",
            value: exports.QueryCounterpartyInfoResponse.toAmino(message)
        };
    },
    fromProtoMsg(message) {
        return exports.QueryCounterpartyInfoResponse.decode(message.value);
    },
    toProto(message) {
        return exports.QueryCounterpartyInfoResponse.encode(message).finish();
    },
    toProtoMsg(message) {
        return {
            typeUrl: "/ibc.core.client.v2.QueryCounterpartyInfoResponse",
            value: exports.QueryCounterpartyInfoResponse.encode(message).finish()
        };
    },
    registerTypeUrl() {
        if (!registry_1.GlobalDecoderRegistry.registerExistingTypeUrl(exports.QueryCounterpartyInfoResponse.typeUrl)) {
            return;
        }
        counterparty_1.CounterpartyInfo.registerTypeUrl();
    }
};
function createBaseQueryConfigRequest() {
    return {
        clientId: ""
    };
}
/**
 * QueryConfigRequest is the request type for the Query/Config RPC method
 * @name QueryConfigRequest
 * @package ibc.core.client.v2
 * @see proto type: ibc.core.client.v2.QueryConfigRequest
 */
exports.QueryConfigRequest = {
    typeUrl: "/ibc.core.client.v2.QueryConfigRequest",
    aminoType: "cosmos-sdk/QueryConfigRequest",
    is(o) {
        return o && (o.$typeUrl === exports.QueryConfigRequest.typeUrl || typeof o.clientId === "string");
    },
    isAmino(o) {
        return o && (o.$typeUrl === exports.QueryConfigRequest.typeUrl || typeof o.client_id === "string");
    },
    encode(message, writer = binary_1.BinaryWriter.create()) {
        if (message.clientId !== "") {
            writer.uint32(10).string(message.clientId);
        }
        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 = createBaseQueryConfigRequest();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.clientId = reader.string();
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromPartial(object) {
        const message = createBaseQueryConfigRequest();
        message.clientId = object.clientId ?? "";
        return message;
    },
    fromAmino(object) {
        const message = createBaseQueryConfigRequest();
        if (object.client_id !== undefined && object.client_id !== null) {
            message.clientId = object.client_id;
        }
        return message;
    },
    toAmino(message) {
        const obj = {};
        obj.client_id = message.clientId === "" ? undefined : message.clientId;
        return obj;
    },
    fromAminoMsg(object) {
        return exports.QueryConfigRequest.fromAmino(object.value);
    },
    toAminoMsg(message) {
        return {
            type: "cosmos-sdk/QueryConfigRequest",
            value: exports.QueryConfigRequest.toAmino(message)
        };
    },
    fromProtoMsg(message) {
        return exports.QueryConfigRequest.decode(message.value);
    },
    toProto(message) {
        return exports.QueryConfigRequest.encode(message).finish();
    },
    toProtoMsg(message) {
        return {
            typeUrl: "/ibc.core.client.v2.QueryConfigRequest",
            value: exports.QueryConfigRequest.encode(message).finish()
        };
    },
    registerTypeUrl() { }
};
function createBaseQueryConfigResponse() {
    return {
        config: undefined
    };
}
/**
 * QueryConfigResponse is the response type for the Query/Config RPC method
 * @name QueryConfigResponse
 * @package ibc.core.client.v2
 * @see proto type: ibc.core.client.v2.QueryConfigResponse
 */
exports.QueryConfigResponse = {
    typeUrl: "/ibc.core.client.v2.QueryConfigResponse",
    aminoType: "cosmos-sdk/QueryConfigResponse",
    is(o) {
        return o && o.$typeUrl === exports.QueryConfigResponse.typeUrl;
    },
    isAmino(o) {
        return o && o.$typeUrl === exports.QueryConfigResponse.typeUrl;
    },
    encode(message, writer = binary_1.BinaryWriter.create()) {
        if (message.config !== undefined) {
            config_1.Config.encode(message.config, 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 = createBaseQueryConfigResponse();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.config = config_1.Config.decode(reader, reader.uint32());
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromPartial(object) {
        const message = createBaseQueryConfigResponse();
        message.config = object.config !== undefined && object.config !== null ? config_1.Config.fromPartial(object.config) : undefined;
        return message;
    },
    fromAmino(object) {
        const message = createBaseQueryConfigResponse();
        if (object.config !== undefined && object.config !== null) {
            message.config = config_1.Config.fromAmino(object.config);
        }
        return message;
    },
    toAmino(message) {
        const obj = {};
        obj.config = message.config ? config_1.Config.toAmino(message.config) : undefined;
        return obj;
    },
    fromAminoMsg(object) {
        return exports.QueryConfigResponse.fromAmino(object.value);
    },
    toAminoMsg(message) {
        return {
            type: "cosmos-sdk/QueryConfigResponse",
            value: exports.QueryConfigResponse.toAmino(message)
        };
    },
    fromProtoMsg(message) {
        return exports.QueryConfigResponse.decode(message.value);
    },
    toProto(message) {
        return exports.QueryConfigResponse.encode(message).finish();
    },
    toProtoMsg(message) {
        return {
            typeUrl: "/ibc.core.client.v2.QueryConfigResponse",
            value: exports.QueryConfigResponse.encode(message).finish()
        };
    },
    registerTypeUrl() {
        if (!registry_1.GlobalDecoderRegistry.registerExistingTypeUrl(exports.QueryConfigResponse.typeUrl)) {
            return;
        }
        config_1.Config.registerTypeUrl();
    }
};
