import { CounterpartyInfo } from "./counterparty";
import { Config } from "./config";
import { BinaryReader, BinaryWriter } from "../../../../binary";
import { GlobalDecoderRegistry } from "../../../../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
 */
export const QueryCounterpartyInfoRequest = {
    typeUrl: "/ibc.core.client.v2.QueryCounterpartyInfoRequest",
    aminoType: "cosmos-sdk/QueryCounterpartyInfoRequest",
    is(o) {
        return o && (o.$typeUrl === QueryCounterpartyInfoRequest.typeUrl || typeof o.clientId === "string");
    },
    isAmino(o) {
        return o && (o.$typeUrl === QueryCounterpartyInfoRequest.typeUrl || typeof o.client_id === "string");
    },
    encode(message, writer = BinaryWriter.create()) {
        if (message.clientId !== "") {
            writer.uint32(10).string(message.clientId);
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof BinaryReader ? input : new 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 QueryCounterpartyInfoRequest.fromAmino(object.value);
    },
    toAminoMsg(message) {
        return {
            type: "cosmos-sdk/QueryCounterpartyInfoRequest",
            value: QueryCounterpartyInfoRequest.toAmino(message)
        };
    },
    fromProtoMsg(message) {
        return QueryCounterpartyInfoRequest.decode(message.value);
    },
    toProto(message) {
        return QueryCounterpartyInfoRequest.encode(message).finish();
    },
    toProtoMsg(message) {
        return {
            typeUrl: "/ibc.core.client.v2.QueryCounterpartyInfoRequest",
            value: 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
 */
export const QueryCounterpartyInfoResponse = {
    typeUrl: "/ibc.core.client.v2.QueryCounterpartyInfoResponse",
    aminoType: "cosmos-sdk/QueryCounterpartyInfoResponse",
    is(o) {
        return o && o.$typeUrl === QueryCounterpartyInfoResponse.typeUrl;
    },
    isAmino(o) {
        return o && o.$typeUrl === QueryCounterpartyInfoResponse.typeUrl;
    },
    encode(message, writer = BinaryWriter.create()) {
        if (message.counterpartyInfo !== undefined) {
            CounterpartyInfo.encode(message.counterpartyInfo, writer.uint32(10).fork()).ldelim();
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof BinaryReader ? input : new 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 = 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 ? CounterpartyInfo.fromPartial(object.counterpartyInfo) : undefined;
        return message;
    },
    fromAmino(object) {
        const message = createBaseQueryCounterpartyInfoResponse();
        if (object.counterparty_info !== undefined && object.counterparty_info !== null) {
            message.counterpartyInfo = CounterpartyInfo.fromAmino(object.counterparty_info);
        }
        return message;
    },
    toAmino(message) {
        const obj = {};
        obj.counterparty_info = message.counterpartyInfo ? CounterpartyInfo.toAmino(message.counterpartyInfo) : undefined;
        return obj;
    },
    fromAminoMsg(object) {
        return QueryCounterpartyInfoResponse.fromAmino(object.value);
    },
    toAminoMsg(message) {
        return {
            type: "cosmos-sdk/QueryCounterpartyInfoResponse",
            value: QueryCounterpartyInfoResponse.toAmino(message)
        };
    },
    fromProtoMsg(message) {
        return QueryCounterpartyInfoResponse.decode(message.value);
    },
    toProto(message) {
        return QueryCounterpartyInfoResponse.encode(message).finish();
    },
    toProtoMsg(message) {
        return {
            typeUrl: "/ibc.core.client.v2.QueryCounterpartyInfoResponse",
            value: QueryCounterpartyInfoResponse.encode(message).finish()
        };
    },
    registerTypeUrl() {
        if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryCounterpartyInfoResponse.typeUrl)) {
            return;
        }
        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
 */
export const QueryConfigRequest = {
    typeUrl: "/ibc.core.client.v2.QueryConfigRequest",
    aminoType: "cosmos-sdk/QueryConfigRequest",
    is(o) {
        return o && (o.$typeUrl === QueryConfigRequest.typeUrl || typeof o.clientId === "string");
    },
    isAmino(o) {
        return o && (o.$typeUrl === QueryConfigRequest.typeUrl || typeof o.client_id === "string");
    },
    encode(message, writer = BinaryWriter.create()) {
        if (message.clientId !== "") {
            writer.uint32(10).string(message.clientId);
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof BinaryReader ? input : new 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 QueryConfigRequest.fromAmino(object.value);
    },
    toAminoMsg(message) {
        return {
            type: "cosmos-sdk/QueryConfigRequest",
            value: QueryConfigRequest.toAmino(message)
        };
    },
    fromProtoMsg(message) {
        return QueryConfigRequest.decode(message.value);
    },
    toProto(message) {
        return QueryConfigRequest.encode(message).finish();
    },
    toProtoMsg(message) {
        return {
            typeUrl: "/ibc.core.client.v2.QueryConfigRequest",
            value: 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
 */
export const QueryConfigResponse = {
    typeUrl: "/ibc.core.client.v2.QueryConfigResponse",
    aminoType: "cosmos-sdk/QueryConfigResponse",
    is(o) {
        return o && o.$typeUrl === QueryConfigResponse.typeUrl;
    },
    isAmino(o) {
        return o && o.$typeUrl === QueryConfigResponse.typeUrl;
    },
    encode(message, writer = BinaryWriter.create()) {
        if (message.config !== undefined) {
            Config.encode(message.config, writer.uint32(10).fork()).ldelim();
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof BinaryReader ? input : new 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.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.fromPartial(object.config) : undefined;
        return message;
    },
    fromAmino(object) {
        const message = createBaseQueryConfigResponse();
        if (object.config !== undefined && object.config !== null) {
            message.config = Config.fromAmino(object.config);
        }
        return message;
    },
    toAmino(message) {
        const obj = {};
        obj.config = message.config ? Config.toAmino(message.config) : undefined;
        return obj;
    },
    fromAminoMsg(object) {
        return QueryConfigResponse.fromAmino(object.value);
    },
    toAminoMsg(message) {
        return {
            type: "cosmos-sdk/QueryConfigResponse",
            value: QueryConfigResponse.toAmino(message)
        };
    },
    fromProtoMsg(message) {
        return QueryConfigResponse.decode(message.value);
    },
    toProto(message) {
        return QueryConfigResponse.encode(message).finish();
    },
    toProtoMsg(message) {
        return {
            typeUrl: "/ibc.core.client.v2.QueryConfigResponse",
            value: QueryConfigResponse.encode(message).finish()
        };
    },
    registerTypeUrl() {
        if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryConfigResponse.typeUrl)) {
            return;
        }
        Config.registerTypeUrl();
    }
};
