"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ClientState = void 0;
const client_1 = require("../../../core/client/v1/client");
const binary_1 = require("../../../../binary");
function createBaseClientState() {
    return {
        latestHeight: client_1.Height.fromPartial({})
    };
}
exports.ClientState = {
    typeUrl: "/ibc.lightclients.localhost.v2.ClientState",
    aminoType: "cosmos-sdk/ClientState",
    encode(message, writer = binary_1.BinaryWriter.create()) {
        if (message.latestHeight !== undefined) {
            client_1.Height.encode(message.latestHeight, 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 = createBaseClientState();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.latestHeight = client_1.Height.decode(reader, reader.uint32());
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromPartial(object) {
        const message = createBaseClientState();
        message.latestHeight = object.latestHeight !== undefined && object.latestHeight !== null ? client_1.Height.fromPartial(object.latestHeight) : undefined;
        return message;
    },
    fromAmino(object) {
        return {
            latestHeight: object?.latest_height ? client_1.Height.fromAmino(object.latest_height) : undefined
        };
    },
    toAmino(message) {
        const obj = {};
        obj.latest_height = message.latestHeight ? client_1.Height.toAmino(message.latestHeight) : {};
        return obj;
    },
    fromAminoMsg(object) {
        return exports.ClientState.fromAmino(object.value);
    },
    toAminoMsg(message) {
        return {
            type: "cosmos-sdk/ClientState",
            value: exports.ClientState.toAmino(message)
        };
    },
    fromProtoMsg(message) {
        return exports.ClientState.decode(message.value);
    },
    toProto(message) {
        return exports.ClientState.encode(message).finish();
    },
    toProtoMsg(message) {
        return {
            typeUrl: "/ibc.lightclients.localhost.v2.ClientState",
            value: exports.ClientState.encode(message).finish()
        };
    }
};
//# sourceMappingURL=localhost.js.map