/* eslint-disable */
import _m0 from "protobufjs/minimal";
export const protobufPackage = "tendermint.spn.types";
function createBaseMerkleRoot() {
    return { hash: "" };
}
export const MerkleRoot = {
    encode(message, writer = _m0.Writer.create()) {
        if (message.hash !== "") {
            writer.uint32(10).string(message.hash);
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
        let end = length === undefined ? reader.len : reader.pos + length;
        const message = createBaseMerkleRoot();
        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;
    },
    fromJSON(object) {
        return { hash: isSet(object.hash) ? String(object.hash) : "" };
    },
    toJSON(message) {
        const obj = {};
        message.hash !== undefined && (obj.hash = message.hash);
        return obj;
    },
    fromPartial(object) {
        const message = createBaseMerkleRoot();
        message.hash = object.hash ?? "";
        return message;
    },
};
function createBaseConsensusState() {
    return { nextValidatorsHash: "", timestamp: "", root: undefined };
}
export const ConsensusState = {
    encode(message, writer = _m0.Writer.create()) {
        if (message.nextValidatorsHash !== "") {
            writer.uint32(10).string(message.nextValidatorsHash);
        }
        if (message.timestamp !== "") {
            writer.uint32(18).string(message.timestamp);
        }
        if (message.root !== undefined) {
            MerkleRoot.encode(message.root, writer.uint32(26).fork()).ldelim();
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
        let end = length === undefined ? reader.len : reader.pos + length;
        const message = createBaseConsensusState();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.nextValidatorsHash = reader.string();
                    break;
                case 2:
                    message.timestamp = reader.string();
                    break;
                case 3:
                    message.root = MerkleRoot.decode(reader, reader.uint32());
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        return {
            nextValidatorsHash: isSet(object.nextValidatorsHash) ? String(object.nextValidatorsHash) : "",
            timestamp: isSet(object.timestamp) ? String(object.timestamp) : "",
            root: isSet(object.root) ? MerkleRoot.fromJSON(object.root) : undefined,
        };
    },
    toJSON(message) {
        const obj = {};
        message.nextValidatorsHash !== undefined && (obj.nextValidatorsHash = message.nextValidatorsHash);
        message.timestamp !== undefined && (obj.timestamp = message.timestamp);
        message.root !== undefined && (obj.root = message.root ? MerkleRoot.toJSON(message.root) : undefined);
        return obj;
    },
    fromPartial(object) {
        const message = createBaseConsensusState();
        message.nextValidatorsHash = object.nextValidatorsHash ?? "";
        message.timestamp = object.timestamp ?? "";
        message.root = (object.root !== undefined && object.root !== null)
            ? MerkleRoot.fromPartial(object.root)
            : undefined;
        return message;
    },
};
function createBasePubKey() {
    return { type: "", value: "" };
}
export const PubKey = {
    encode(message, writer = _m0.Writer.create()) {
        if (message.type !== "") {
            writer.uint32(10).string(message.type);
        }
        if (message.value !== "") {
            writer.uint32(18).string(message.value);
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
        let end = length === undefined ? reader.len : reader.pos + length;
        const message = createBasePubKey();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.type = reader.string();
                    break;
                case 2:
                    message.value = reader.string();
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        return {
            type: isSet(object.type) ? String(object.type) : "",
            value: isSet(object.value) ? String(object.value) : "",
        };
    },
    toJSON(message) {
        const obj = {};
        message.type !== undefined && (obj.type = message.type);
        message.value !== undefined && (obj.value = message.value);
        return obj;
    },
    fromPartial(object) {
        const message = createBasePubKey();
        message.type = object.type ?? "";
        message.value = object.value ?? "";
        return message;
    },
};
function createBaseValidator() {
    return { proposerPriority: "", votingPower: "", pubKey: undefined };
}
export const Validator = {
    encode(message, writer = _m0.Writer.create()) {
        if (message.proposerPriority !== "") {
            writer.uint32(10).string(message.proposerPriority);
        }
        if (message.votingPower !== "") {
            writer.uint32(18).string(message.votingPower);
        }
        if (message.pubKey !== undefined) {
            PubKey.encode(message.pubKey, writer.uint32(26).fork()).ldelim();
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
        let end = length === undefined ? reader.len : reader.pos + length;
        const message = createBaseValidator();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.proposerPriority = reader.string();
                    break;
                case 2:
                    message.votingPower = reader.string();
                    break;
                case 3:
                    message.pubKey = PubKey.decode(reader, reader.uint32());
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        return {
            proposerPriority: isSet(object.proposerPriority) ? String(object.proposerPriority) : "",
            votingPower: isSet(object.votingPower) ? String(object.votingPower) : "",
            pubKey: isSet(object.pubKey) ? PubKey.fromJSON(object.pubKey) : undefined,
        };
    },
    toJSON(message) {
        const obj = {};
        message.proposerPriority !== undefined && (obj.proposerPriority = message.proposerPriority);
        message.votingPower !== undefined && (obj.votingPower = message.votingPower);
        message.pubKey !== undefined && (obj.pubKey = message.pubKey ? PubKey.toJSON(message.pubKey) : undefined);
        return obj;
    },
    fromPartial(object) {
        const message = createBaseValidator();
        message.proposerPriority = object.proposerPriority ?? "";
        message.votingPower = object.votingPower ?? "";
        message.pubKey = (object.pubKey !== undefined && object.pubKey !== null)
            ? PubKey.fromPartial(object.pubKey)
            : undefined;
        return message;
    },
};
function createBaseValidatorSet() {
    return { validators: [] };
}
export const ValidatorSet = {
    encode(message, writer = _m0.Writer.create()) {
        for (const v of message.validators) {
            Validator.encode(v, writer.uint32(10).fork()).ldelim();
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
        let end = length === undefined ? reader.len : reader.pos + length;
        const message = createBaseValidatorSet();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.validators.push(Validator.decode(reader, reader.uint32()));
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        return {
            validators: Array.isArray(object?.validators) ? object.validators.map((e) => Validator.fromJSON(e)) : [],
        };
    },
    toJSON(message) {
        const obj = {};
        if (message.validators) {
            obj.validators = message.validators.map((e) => e ? Validator.toJSON(e) : undefined);
        }
        else {
            obj.validators = [];
        }
        return obj;
    },
    fromPartial(object) {
        const message = createBaseValidatorSet();
        message.validators = object.validators?.map((e) => Validator.fromPartial(e)) || [];
        return message;
    },
};
function isSet(value) {
    return value !== null && value !== undefined;
}
//# sourceMappingURL=ibc.js.map