//@ts-nocheck
import { Height } from '../../../core/client/v1/client.js';
import { BinaryReader, BinaryWriter } from '../../../../binary.js';
import { isSet } from '../../../../helpers.js';
import {} from '../../../../json-safe.js';
function createBaseClientState() {
    return {
        latestHeight: Height.fromPartial({}),
    };
}
export const ClientState = {
    typeUrl: '/ibc.lightclients.localhost.v2.ClientState',
    encode(message, writer = BinaryWriter.create()) {
        if (message.latestHeight !== undefined) {
            Height.encode(message.latestHeight, 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 = createBaseClientState();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.latestHeight = Height.decode(reader, reader.uint32());
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        return {
            latestHeight: isSet(object.latestHeight)
                ? Height.fromJSON(object.latestHeight)
                : undefined,
        };
    },
    toJSON(message) {
        const obj = {};
        message.latestHeight !== undefined &&
            (obj.latestHeight = message.latestHeight
                ? Height.toJSON(message.latestHeight)
                : undefined);
        return obj;
    },
    fromPartial(object) {
        const message = createBaseClientState();
        message.latestHeight =
            object.latestHeight !== undefined && object.latestHeight !== null
                ? Height.fromPartial(object.latestHeight)
                : undefined;
        return message;
    },
    fromProtoMsg(message) {
        return ClientState.decode(message.value);
    },
    toProto(message) {
        return ClientState.encode(message).finish();
    },
    toProtoMsg(message) {
        return {
            typeUrl: '/ibc.lightclients.localhost.v2.ClientState',
            value: ClientState.encode(message).finish(),
        };
    },
};
//# sourceMappingURL=localhost.js.map