//@ts-nocheck
import { BinaryReader, BinaryWriter } from '../../../binary.js';
import { isSet } from '../../../helpers.js';
import {} from '../../../json-safe.js';
function createBaseNonce() {
    return {
        sourceDomain: 0,
        nonce: BigInt(0),
    };
}
export const Nonce = {
    typeUrl: '/circle.cctp.v1.Nonce',
    encode(message, writer = BinaryWriter.create()) {
        if (message.sourceDomain !== 0) {
            writer.uint32(8).uint32(message.sourceDomain);
        }
        if (message.nonce !== BigInt(0)) {
            writer.uint32(16).uint64(message.nonce);
        }
        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 = createBaseNonce();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.sourceDomain = reader.uint32();
                    break;
                case 2:
                    message.nonce = reader.uint64();
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        return {
            sourceDomain: isSet(object.sourceDomain)
                ? Number(object.sourceDomain)
                : 0,
            nonce: isSet(object.nonce) ? BigInt(object.nonce.toString()) : BigInt(0),
        };
    },
    toJSON(message) {
        const obj = {};
        message.sourceDomain !== undefined &&
            (obj.sourceDomain = Math.round(message.sourceDomain));
        message.nonce !== undefined &&
            (obj.nonce = (message.nonce || BigInt(0)).toString());
        return obj;
    },
    fromPartial(object) {
        const message = createBaseNonce();
        message.sourceDomain = object.sourceDomain ?? 0;
        message.nonce =
            object.nonce !== undefined && object.nonce !== null
                ? BigInt(object.nonce.toString())
                : BigInt(0);
        return message;
    },
    fromProtoMsg(message) {
        return Nonce.decode(message.value);
    },
    toProto(message) {
        return Nonce.encode(message).finish();
    },
    toProtoMsg(message) {
        return {
            typeUrl: '/circle.cctp.v1.Nonce',
            value: Nonce.encode(message).finish(),
        };
    },
};
//# sourceMappingURL=nonce.js.map