//@ts-nocheck
import { BinaryReader, BinaryWriter } from '../../../binary.js';
import { isSet } from '../../../helpers.js';
import {} from '../../../json-safe.js';
import { decodeBase64 as bytesFromBase64 } from '@endo/base64';
import { encodeBase64 as base64FromBytes } from '@endo/base64';
function createBaseAttesterEnabled() {
    return {
        attester: '',
    };
}
export const AttesterEnabled = {
    typeUrl: '/circle.cctp.v1.AttesterEnabled',
    encode(message, writer = BinaryWriter.create()) {
        if (message.attester !== '') {
            writer.uint32(10).string(message.attester);
        }
        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 = createBaseAttesterEnabled();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.attester = reader.string();
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        return {
            attester: isSet(object.attester) ? String(object.attester) : '',
        };
    },
    toJSON(message) {
        const obj = {};
        message.attester !== undefined && (obj.attester = message.attester);
        return obj;
    },
    fromPartial(object) {
        const message = createBaseAttesterEnabled();
        message.attester = object.attester ?? '';
        return message;
    },
    fromProtoMsg(message) {
        return AttesterEnabled.decode(message.value);
    },
    toProto(message) {
        return AttesterEnabled.encode(message).finish();
    },
    toProtoMsg(message) {
        return {
            typeUrl: '/circle.cctp.v1.AttesterEnabled',
            value: AttesterEnabled.encode(message).finish(),
        };
    },
};
function createBaseAttesterDisabled() {
    return {
        attester: '',
    };
}
export const AttesterDisabled = {
    typeUrl: '/circle.cctp.v1.AttesterDisabled',
    encode(message, writer = BinaryWriter.create()) {
        if (message.attester !== '') {
            writer.uint32(10).string(message.attester);
        }
        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 = createBaseAttesterDisabled();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.attester = reader.string();
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        return {
            attester: isSet(object.attester) ? String(object.attester) : '',
        };
    },
    toJSON(message) {
        const obj = {};
        message.attester !== undefined && (obj.attester = message.attester);
        return obj;
    },
    fromPartial(object) {
        const message = createBaseAttesterDisabled();
        message.attester = object.attester ?? '';
        return message;
    },
    fromProtoMsg(message) {
        return AttesterDisabled.decode(message.value);
    },
    toProto(message) {
        return AttesterDisabled.encode(message).finish();
    },
    toProtoMsg(message) {
        return {
            typeUrl: '/circle.cctp.v1.AttesterDisabled',
            value: AttesterDisabled.encode(message).finish(),
        };
    },
};
function createBaseSignatureThresholdUpdated() {
    return {
        oldSignatureThreshold: BigInt(0),
        newSignatureThreshold: BigInt(0),
    };
}
export const SignatureThresholdUpdated = {
    typeUrl: '/circle.cctp.v1.SignatureThresholdUpdated',
    encode(message, writer = BinaryWriter.create()) {
        if (message.oldSignatureThreshold !== BigInt(0)) {
            writer.uint32(8).uint64(message.oldSignatureThreshold);
        }
        if (message.newSignatureThreshold !== BigInt(0)) {
            writer.uint32(16).uint64(message.newSignatureThreshold);
        }
        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 = createBaseSignatureThresholdUpdated();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.oldSignatureThreshold = reader.uint64();
                    break;
                case 2:
                    message.newSignatureThreshold = reader.uint64();
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        return {
            oldSignatureThreshold: isSet(object.oldSignatureThreshold)
                ? BigInt(object.oldSignatureThreshold.toString())
                : BigInt(0),
            newSignatureThreshold: isSet(object.newSignatureThreshold)
                ? BigInt(object.newSignatureThreshold.toString())
                : BigInt(0),
        };
    },
    toJSON(message) {
        const obj = {};
        message.oldSignatureThreshold !== undefined &&
            (obj.oldSignatureThreshold = (message.oldSignatureThreshold || BigInt(0)).toString());
        message.newSignatureThreshold !== undefined &&
            (obj.newSignatureThreshold = (message.newSignatureThreshold || BigInt(0)).toString());
        return obj;
    },
    fromPartial(object) {
        const message = createBaseSignatureThresholdUpdated();
        message.oldSignatureThreshold =
            object.oldSignatureThreshold !== undefined &&
                object.oldSignatureThreshold !== null
                ? BigInt(object.oldSignatureThreshold.toString())
                : BigInt(0);
        message.newSignatureThreshold =
            object.newSignatureThreshold !== undefined &&
                object.newSignatureThreshold !== null
                ? BigInt(object.newSignatureThreshold.toString())
                : BigInt(0);
        return message;
    },
    fromProtoMsg(message) {
        return SignatureThresholdUpdated.decode(message.value);
    },
    toProto(message) {
        return SignatureThresholdUpdated.encode(message).finish();
    },
    toProtoMsg(message) {
        return {
            typeUrl: '/circle.cctp.v1.SignatureThresholdUpdated',
            value: SignatureThresholdUpdated.encode(message).finish(),
        };
    },
};
function createBaseOwnerUpdated() {
    return {
        previousOwner: '',
        newOwner: '',
    };
}
export const OwnerUpdated = {
    typeUrl: '/circle.cctp.v1.OwnerUpdated',
    encode(message, writer = BinaryWriter.create()) {
        if (message.previousOwner !== '') {
            writer.uint32(10).string(message.previousOwner);
        }
        if (message.newOwner !== '') {
            writer.uint32(18).string(message.newOwner);
        }
        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 = createBaseOwnerUpdated();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.previousOwner = reader.string();
                    break;
                case 2:
                    message.newOwner = reader.string();
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        return {
            previousOwner: isSet(object.previousOwner)
                ? String(object.previousOwner)
                : '',
            newOwner: isSet(object.newOwner) ? String(object.newOwner) : '',
        };
    },
    toJSON(message) {
        const obj = {};
        message.previousOwner !== undefined &&
            (obj.previousOwner = message.previousOwner);
        message.newOwner !== undefined && (obj.newOwner = message.newOwner);
        return obj;
    },
    fromPartial(object) {
        const message = createBaseOwnerUpdated();
        message.previousOwner = object.previousOwner ?? '';
        message.newOwner = object.newOwner ?? '';
        return message;
    },
    fromProtoMsg(message) {
        return OwnerUpdated.decode(message.value);
    },
    toProto(message) {
        return OwnerUpdated.encode(message).finish();
    },
    toProtoMsg(message) {
        return {
            typeUrl: '/circle.cctp.v1.OwnerUpdated',
            value: OwnerUpdated.encode(message).finish(),
        };
    },
};
function createBaseOwnershipTransferStarted() {
    return {
        previousOwner: '',
        newOwner: '',
    };
}
export const OwnershipTransferStarted = {
    typeUrl: '/circle.cctp.v1.OwnershipTransferStarted',
    encode(message, writer = BinaryWriter.create()) {
        if (message.previousOwner !== '') {
            writer.uint32(10).string(message.previousOwner);
        }
        if (message.newOwner !== '') {
            writer.uint32(18).string(message.newOwner);
        }
        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 = createBaseOwnershipTransferStarted();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.previousOwner = reader.string();
                    break;
                case 2:
                    message.newOwner = reader.string();
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        return {
            previousOwner: isSet(object.previousOwner)
                ? String(object.previousOwner)
                : '',
            newOwner: isSet(object.newOwner) ? String(object.newOwner) : '',
        };
    },
    toJSON(message) {
        const obj = {};
        message.previousOwner !== undefined &&
            (obj.previousOwner = message.previousOwner);
        message.newOwner !== undefined && (obj.newOwner = message.newOwner);
        return obj;
    },
    fromPartial(object) {
        const message = createBaseOwnershipTransferStarted();
        message.previousOwner = object.previousOwner ?? '';
        message.newOwner = object.newOwner ?? '';
        return message;
    },
    fromProtoMsg(message) {
        return OwnershipTransferStarted.decode(message.value);
    },
    toProto(message) {
        return OwnershipTransferStarted.encode(message).finish();
    },
    toProtoMsg(message) {
        return {
            typeUrl: '/circle.cctp.v1.OwnershipTransferStarted',
            value: OwnershipTransferStarted.encode(message).finish(),
        };
    },
};
function createBasePauserUpdated() {
    return {
        previousPauser: '',
        newPauser: '',
    };
}
export const PauserUpdated = {
    typeUrl: '/circle.cctp.v1.PauserUpdated',
    encode(message, writer = BinaryWriter.create()) {
        if (message.previousPauser !== '') {
            writer.uint32(10).string(message.previousPauser);
        }
        if (message.newPauser !== '') {
            writer.uint32(18).string(message.newPauser);
        }
        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 = createBasePauserUpdated();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.previousPauser = reader.string();
                    break;
                case 2:
                    message.newPauser = reader.string();
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        return {
            previousPauser: isSet(object.previousPauser)
                ? String(object.previousPauser)
                : '',
            newPauser: isSet(object.newPauser) ? String(object.newPauser) : '',
        };
    },
    toJSON(message) {
        const obj = {};
        message.previousPauser !== undefined &&
            (obj.previousPauser = message.previousPauser);
        message.newPauser !== undefined && (obj.newPauser = message.newPauser);
        return obj;
    },
    fromPartial(object) {
        const message = createBasePauserUpdated();
        message.previousPauser = object.previousPauser ?? '';
        message.newPauser = object.newPauser ?? '';
        return message;
    },
    fromProtoMsg(message) {
        return PauserUpdated.decode(message.value);
    },
    toProto(message) {
        return PauserUpdated.encode(message).finish();
    },
    toProtoMsg(message) {
        return {
            typeUrl: '/circle.cctp.v1.PauserUpdated',
            value: PauserUpdated.encode(message).finish(),
        };
    },
};
function createBaseAttesterManagerUpdated() {
    return {
        previousAttesterManager: '',
        newAttesterManager: '',
    };
}
export const AttesterManagerUpdated = {
    typeUrl: '/circle.cctp.v1.AttesterManagerUpdated',
    encode(message, writer = BinaryWriter.create()) {
        if (message.previousAttesterManager !== '') {
            writer.uint32(10).string(message.previousAttesterManager);
        }
        if (message.newAttesterManager !== '') {
            writer.uint32(18).string(message.newAttesterManager);
        }
        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 = createBaseAttesterManagerUpdated();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.previousAttesterManager = reader.string();
                    break;
                case 2:
                    message.newAttesterManager = reader.string();
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        return {
            previousAttesterManager: isSet(object.previousAttesterManager)
                ? String(object.previousAttesterManager)
                : '',
            newAttesterManager: isSet(object.newAttesterManager)
                ? String(object.newAttesterManager)
                : '',
        };
    },
    toJSON(message) {
        const obj = {};
        message.previousAttesterManager !== undefined &&
            (obj.previousAttesterManager = message.previousAttesterManager);
        message.newAttesterManager !== undefined &&
            (obj.newAttesterManager = message.newAttesterManager);
        return obj;
    },
    fromPartial(object) {
        const message = createBaseAttesterManagerUpdated();
        message.previousAttesterManager = object.previousAttesterManager ?? '';
        message.newAttesterManager = object.newAttesterManager ?? '';
        return message;
    },
    fromProtoMsg(message) {
        return AttesterManagerUpdated.decode(message.value);
    },
    toProto(message) {
        return AttesterManagerUpdated.encode(message).finish();
    },
    toProtoMsg(message) {
        return {
            typeUrl: '/circle.cctp.v1.AttesterManagerUpdated',
            value: AttesterManagerUpdated.encode(message).finish(),
        };
    },
};
function createBaseTokenControllerUpdated() {
    return {
        previousTokenController: '',
        newTokenController: '',
    };
}
export const TokenControllerUpdated = {
    typeUrl: '/circle.cctp.v1.TokenControllerUpdated',
    encode(message, writer = BinaryWriter.create()) {
        if (message.previousTokenController !== '') {
            writer.uint32(10).string(message.previousTokenController);
        }
        if (message.newTokenController !== '') {
            writer.uint32(18).string(message.newTokenController);
        }
        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 = createBaseTokenControllerUpdated();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.previousTokenController = reader.string();
                    break;
                case 2:
                    message.newTokenController = reader.string();
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        return {
            previousTokenController: isSet(object.previousTokenController)
                ? String(object.previousTokenController)
                : '',
            newTokenController: isSet(object.newTokenController)
                ? String(object.newTokenController)
                : '',
        };
    },
    toJSON(message) {
        const obj = {};
        message.previousTokenController !== undefined &&
            (obj.previousTokenController = message.previousTokenController);
        message.newTokenController !== undefined &&
            (obj.newTokenController = message.newTokenController);
        return obj;
    },
    fromPartial(object) {
        const message = createBaseTokenControllerUpdated();
        message.previousTokenController = object.previousTokenController ?? '';
        message.newTokenController = object.newTokenController ?? '';
        return message;
    },
    fromProtoMsg(message) {
        return TokenControllerUpdated.decode(message.value);
    },
    toProto(message) {
        return TokenControllerUpdated.encode(message).finish();
    },
    toProtoMsg(message) {
        return {
            typeUrl: '/circle.cctp.v1.TokenControllerUpdated',
            value: TokenControllerUpdated.encode(message).finish(),
        };
    },
};
function createBaseBurningAndMintingPausedEvent() {
    return {};
}
export const BurningAndMintingPausedEvent = {
    typeUrl: '/circle.cctp.v1.BurningAndMintingPausedEvent',
    encode(_, writer = BinaryWriter.create()) {
        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 = createBaseBurningAndMintingPausedEvent();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(_) {
        return {};
    },
    toJSON(_) {
        const obj = {};
        return obj;
    },
    fromPartial(_) {
        const message = createBaseBurningAndMintingPausedEvent();
        return message;
    },
    fromProtoMsg(message) {
        return BurningAndMintingPausedEvent.decode(message.value);
    },
    toProto(message) {
        return BurningAndMintingPausedEvent.encode(message).finish();
    },
    toProtoMsg(message) {
        return {
            typeUrl: '/circle.cctp.v1.BurningAndMintingPausedEvent',
            value: BurningAndMintingPausedEvent.encode(message).finish(),
        };
    },
};
function createBaseBurningAndMintingUnpausedEvent() {
    return {};
}
export const BurningAndMintingUnpausedEvent = {
    typeUrl: '/circle.cctp.v1.BurningAndMintingUnpausedEvent',
    encode(_, writer = BinaryWriter.create()) {
        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 = createBaseBurningAndMintingUnpausedEvent();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(_) {
        return {};
    },
    toJSON(_) {
        const obj = {};
        return obj;
    },
    fromPartial(_) {
        const message = createBaseBurningAndMintingUnpausedEvent();
        return message;
    },
    fromProtoMsg(message) {
        return BurningAndMintingUnpausedEvent.decode(message.value);
    },
    toProto(message) {
        return BurningAndMintingUnpausedEvent.encode(message).finish();
    },
    toProtoMsg(message) {
        return {
            typeUrl: '/circle.cctp.v1.BurningAndMintingUnpausedEvent',
            value: BurningAndMintingUnpausedEvent.encode(message).finish(),
        };
    },
};
function createBaseSendingAndReceivingPausedEvent() {
    return {};
}
export const SendingAndReceivingPausedEvent = {
    typeUrl: '/circle.cctp.v1.SendingAndReceivingPausedEvent',
    encode(_, writer = BinaryWriter.create()) {
        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 = createBaseSendingAndReceivingPausedEvent();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(_) {
        return {};
    },
    toJSON(_) {
        const obj = {};
        return obj;
    },
    fromPartial(_) {
        const message = createBaseSendingAndReceivingPausedEvent();
        return message;
    },
    fromProtoMsg(message) {
        return SendingAndReceivingPausedEvent.decode(message.value);
    },
    toProto(message) {
        return SendingAndReceivingPausedEvent.encode(message).finish();
    },
    toProtoMsg(message) {
        return {
            typeUrl: '/circle.cctp.v1.SendingAndReceivingPausedEvent',
            value: SendingAndReceivingPausedEvent.encode(message).finish(),
        };
    },
};
function createBaseSendingAndReceivingUnpausedEvent() {
    return {};
}
export const SendingAndReceivingUnpausedEvent = {
    typeUrl: '/circle.cctp.v1.SendingAndReceivingUnpausedEvent',
    encode(_, writer = BinaryWriter.create()) {
        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 = createBaseSendingAndReceivingUnpausedEvent();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(_) {
        return {};
    },
    toJSON(_) {
        const obj = {};
        return obj;
    },
    fromPartial(_) {
        const message = createBaseSendingAndReceivingUnpausedEvent();
        return message;
    },
    fromProtoMsg(message) {
        return SendingAndReceivingUnpausedEvent.decode(message.value);
    },
    toProto(message) {
        return SendingAndReceivingUnpausedEvent.encode(message).finish();
    },
    toProtoMsg(message) {
        return {
            typeUrl: '/circle.cctp.v1.SendingAndReceivingUnpausedEvent',
            value: SendingAndReceivingUnpausedEvent.encode(message).finish(),
        };
    },
};
function createBaseDepositForBurn() {
    return {
        nonce: BigInt(0),
        burnToken: '',
        amount: '',
        depositor: '',
        mintRecipient: new Uint8Array(),
        destinationDomain: 0,
        destinationTokenMessenger: new Uint8Array(),
        destinationCaller: new Uint8Array(),
    };
}
export const DepositForBurn = {
    typeUrl: '/circle.cctp.v1.DepositForBurn',
    encode(message, writer = BinaryWriter.create()) {
        if (message.nonce !== BigInt(0)) {
            writer.uint32(8).uint64(message.nonce);
        }
        if (message.burnToken !== '') {
            writer.uint32(18).string(message.burnToken);
        }
        if (message.amount !== '') {
            writer.uint32(26).string(message.amount);
        }
        if (message.depositor !== '') {
            writer.uint32(34).string(message.depositor);
        }
        if (message.mintRecipient.length !== 0) {
            writer.uint32(42).bytes(message.mintRecipient);
        }
        if (message.destinationDomain !== 0) {
            writer.uint32(48).uint32(message.destinationDomain);
        }
        if (message.destinationTokenMessenger.length !== 0) {
            writer.uint32(58).bytes(message.destinationTokenMessenger);
        }
        if (message.destinationCaller.length !== 0) {
            writer.uint32(66).bytes(message.destinationCaller);
        }
        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 = createBaseDepositForBurn();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.nonce = reader.uint64();
                    break;
                case 2:
                    message.burnToken = reader.string();
                    break;
                case 3:
                    message.amount = reader.string();
                    break;
                case 4:
                    message.depositor = reader.string();
                    break;
                case 5:
                    message.mintRecipient = reader.bytes();
                    break;
                case 6:
                    message.destinationDomain = reader.uint32();
                    break;
                case 7:
                    message.destinationTokenMessenger = reader.bytes();
                    break;
                case 8:
                    message.destinationCaller = reader.bytes();
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        return {
            nonce: isSet(object.nonce) ? BigInt(object.nonce.toString()) : BigInt(0),
            burnToken: isSet(object.burnToken) ? String(object.burnToken) : '',
            amount: isSet(object.amount) ? String(object.amount) : '',
            depositor: isSet(object.depositor) ? String(object.depositor) : '',
            mintRecipient: isSet(object.mintRecipient)
                ? bytesFromBase64(object.mintRecipient)
                : new Uint8Array(),
            destinationDomain: isSet(object.destinationDomain)
                ? Number(object.destinationDomain)
                : 0,
            destinationTokenMessenger: isSet(object.destinationTokenMessenger)
                ? bytesFromBase64(object.destinationTokenMessenger)
                : new Uint8Array(),
            destinationCaller: isSet(object.destinationCaller)
                ? bytesFromBase64(object.destinationCaller)
                : new Uint8Array(),
        };
    },
    toJSON(message) {
        const obj = {};
        message.nonce !== undefined &&
            (obj.nonce = (message.nonce || BigInt(0)).toString());
        message.burnToken !== undefined && (obj.burnToken = message.burnToken);
        message.amount !== undefined && (obj.amount = message.amount);
        message.depositor !== undefined && (obj.depositor = message.depositor);
        message.mintRecipient !== undefined &&
            (obj.mintRecipient = base64FromBytes(message.mintRecipient !== undefined
                ? message.mintRecipient
                : new Uint8Array()));
        message.destinationDomain !== undefined &&
            (obj.destinationDomain = Math.round(message.destinationDomain));
        message.destinationTokenMessenger !== undefined &&
            (obj.destinationTokenMessenger = base64FromBytes(message.destinationTokenMessenger !== undefined
                ? message.destinationTokenMessenger
                : new Uint8Array()));
        message.destinationCaller !== undefined &&
            (obj.destinationCaller = base64FromBytes(message.destinationCaller !== undefined
                ? message.destinationCaller
                : new Uint8Array()));
        return obj;
    },
    fromPartial(object) {
        const message = createBaseDepositForBurn();
        message.nonce =
            object.nonce !== undefined && object.nonce !== null
                ? BigInt(object.nonce.toString())
                : BigInt(0);
        message.burnToken = object.burnToken ?? '';
        message.amount = object.amount ?? '';
        message.depositor = object.depositor ?? '';
        message.mintRecipient = object.mintRecipient ?? new Uint8Array();
        message.destinationDomain = object.destinationDomain ?? 0;
        message.destinationTokenMessenger =
            object.destinationTokenMessenger ?? new Uint8Array();
        message.destinationCaller = object.destinationCaller ?? new Uint8Array();
        return message;
    },
    fromProtoMsg(message) {
        return DepositForBurn.decode(message.value);
    },
    toProto(message) {
        return DepositForBurn.encode(message).finish();
    },
    toProtoMsg(message) {
        return {
            typeUrl: '/circle.cctp.v1.DepositForBurn',
            value: DepositForBurn.encode(message).finish(),
        };
    },
};
function createBaseMintAndWithdraw() {
    return {
        mintRecipient: new Uint8Array(),
        amount: '',
        mintToken: '',
    };
}
export const MintAndWithdraw = {
    typeUrl: '/circle.cctp.v1.MintAndWithdraw',
    encode(message, writer = BinaryWriter.create()) {
        if (message.mintRecipient.length !== 0) {
            writer.uint32(10).bytes(message.mintRecipient);
        }
        if (message.amount !== '') {
            writer.uint32(18).string(message.amount);
        }
        if (message.mintToken !== '') {
            writer.uint32(26).string(message.mintToken);
        }
        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 = createBaseMintAndWithdraw();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.mintRecipient = reader.bytes();
                    break;
                case 2:
                    message.amount = reader.string();
                    break;
                case 3:
                    message.mintToken = reader.string();
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        return {
            mintRecipient: isSet(object.mintRecipient)
                ? bytesFromBase64(object.mintRecipient)
                : new Uint8Array(),
            amount: isSet(object.amount) ? String(object.amount) : '',
            mintToken: isSet(object.mintToken) ? String(object.mintToken) : '',
        };
    },
    toJSON(message) {
        const obj = {};
        message.mintRecipient !== undefined &&
            (obj.mintRecipient = base64FromBytes(message.mintRecipient !== undefined
                ? message.mintRecipient
                : new Uint8Array()));
        message.amount !== undefined && (obj.amount = message.amount);
        message.mintToken !== undefined && (obj.mintToken = message.mintToken);
        return obj;
    },
    fromPartial(object) {
        const message = createBaseMintAndWithdraw();
        message.mintRecipient = object.mintRecipient ?? new Uint8Array();
        message.amount = object.amount ?? '';
        message.mintToken = object.mintToken ?? '';
        return message;
    },
    fromProtoMsg(message) {
        return MintAndWithdraw.decode(message.value);
    },
    toProto(message) {
        return MintAndWithdraw.encode(message).finish();
    },
    toProtoMsg(message) {
        return {
            typeUrl: '/circle.cctp.v1.MintAndWithdraw',
            value: MintAndWithdraw.encode(message).finish(),
        };
    },
};
function createBaseTokenPairLinked() {
    return {
        localToken: '',
        remoteDomain: 0,
        remoteToken: new Uint8Array(),
    };
}
export const TokenPairLinked = {
    typeUrl: '/circle.cctp.v1.TokenPairLinked',
    encode(message, writer = BinaryWriter.create()) {
        if (message.localToken !== '') {
            writer.uint32(10).string(message.localToken);
        }
        if (message.remoteDomain !== 0) {
            writer.uint32(16).uint32(message.remoteDomain);
        }
        if (message.remoteToken.length !== 0) {
            writer.uint32(26).bytes(message.remoteToken);
        }
        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 = createBaseTokenPairLinked();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.localToken = reader.string();
                    break;
                case 2:
                    message.remoteDomain = reader.uint32();
                    break;
                case 3:
                    message.remoteToken = reader.bytes();
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        return {
            localToken: isSet(object.localToken) ? String(object.localToken) : '',
            remoteDomain: isSet(object.remoteDomain)
                ? Number(object.remoteDomain)
                : 0,
            remoteToken: isSet(object.remoteToken)
                ? bytesFromBase64(object.remoteToken)
                : new Uint8Array(),
        };
    },
    toJSON(message) {
        const obj = {};
        message.localToken !== undefined && (obj.localToken = message.localToken);
        message.remoteDomain !== undefined &&
            (obj.remoteDomain = Math.round(message.remoteDomain));
        message.remoteToken !== undefined &&
            (obj.remoteToken = base64FromBytes(message.remoteToken !== undefined
                ? message.remoteToken
                : new Uint8Array()));
        return obj;
    },
    fromPartial(object) {
        const message = createBaseTokenPairLinked();
        message.localToken = object.localToken ?? '';
        message.remoteDomain = object.remoteDomain ?? 0;
        message.remoteToken = object.remoteToken ?? new Uint8Array();
        return message;
    },
    fromProtoMsg(message) {
        return TokenPairLinked.decode(message.value);
    },
    toProto(message) {
        return TokenPairLinked.encode(message).finish();
    },
    toProtoMsg(message) {
        return {
            typeUrl: '/circle.cctp.v1.TokenPairLinked',
            value: TokenPairLinked.encode(message).finish(),
        };
    },
};
function createBaseTokenPairUnlinked() {
    return {
        localToken: '',
        remoteDomain: 0,
        remoteToken: new Uint8Array(),
    };
}
export const TokenPairUnlinked = {
    typeUrl: '/circle.cctp.v1.TokenPairUnlinked',
    encode(message, writer = BinaryWriter.create()) {
        if (message.localToken !== '') {
            writer.uint32(10).string(message.localToken);
        }
        if (message.remoteDomain !== 0) {
            writer.uint32(16).uint32(message.remoteDomain);
        }
        if (message.remoteToken.length !== 0) {
            writer.uint32(26).bytes(message.remoteToken);
        }
        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 = createBaseTokenPairUnlinked();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.localToken = reader.string();
                    break;
                case 2:
                    message.remoteDomain = reader.uint32();
                    break;
                case 3:
                    message.remoteToken = reader.bytes();
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        return {
            localToken: isSet(object.localToken) ? String(object.localToken) : '',
            remoteDomain: isSet(object.remoteDomain)
                ? Number(object.remoteDomain)
                : 0,
            remoteToken: isSet(object.remoteToken)
                ? bytesFromBase64(object.remoteToken)
                : new Uint8Array(),
        };
    },
    toJSON(message) {
        const obj = {};
        message.localToken !== undefined && (obj.localToken = message.localToken);
        message.remoteDomain !== undefined &&
            (obj.remoteDomain = Math.round(message.remoteDomain));
        message.remoteToken !== undefined &&
            (obj.remoteToken = base64FromBytes(message.remoteToken !== undefined
                ? message.remoteToken
                : new Uint8Array()));
        return obj;
    },
    fromPartial(object) {
        const message = createBaseTokenPairUnlinked();
        message.localToken = object.localToken ?? '';
        message.remoteDomain = object.remoteDomain ?? 0;
        message.remoteToken = object.remoteToken ?? new Uint8Array();
        return message;
    },
    fromProtoMsg(message) {
        return TokenPairUnlinked.decode(message.value);
    },
    toProto(message) {
        return TokenPairUnlinked.encode(message).finish();
    },
    toProtoMsg(message) {
        return {
            typeUrl: '/circle.cctp.v1.TokenPairUnlinked',
            value: TokenPairUnlinked.encode(message).finish(),
        };
    },
};
function createBaseMessageSent() {
    return {
        message: new Uint8Array(),
    };
}
export const MessageSent = {
    typeUrl: '/circle.cctp.v1.MessageSent',
    encode(message, writer = BinaryWriter.create()) {
        if (message.message.length !== 0) {
            writer.uint32(10).bytes(message.message);
        }
        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 = createBaseMessageSent();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.message = reader.bytes();
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        return {
            message: isSet(object.message)
                ? bytesFromBase64(object.message)
                : new Uint8Array(),
        };
    },
    toJSON(message) {
        const obj = {};
        message.message !== undefined &&
            (obj.message = base64FromBytes(message.message !== undefined ? message.message : new Uint8Array()));
        return obj;
    },
    fromPartial(object) {
        const message = createBaseMessageSent();
        message.message = object.message ?? new Uint8Array();
        return message;
    },
    fromProtoMsg(message) {
        return MessageSent.decode(message.value);
    },
    toProto(message) {
        return MessageSent.encode(message).finish();
    },
    toProtoMsg(message) {
        return {
            typeUrl: '/circle.cctp.v1.MessageSent',
            value: MessageSent.encode(message).finish(),
        };
    },
};
function createBaseMessageReceived() {
    return {
        caller: '',
        sourceDomain: 0,
        nonce: BigInt(0),
        sender: new Uint8Array(),
        messageBody: new Uint8Array(),
    };
}
export const MessageReceived = {
    typeUrl: '/circle.cctp.v1.MessageReceived',
    encode(message, writer = BinaryWriter.create()) {
        if (message.caller !== '') {
            writer.uint32(10).string(message.caller);
        }
        if (message.sourceDomain !== 0) {
            writer.uint32(16).uint32(message.sourceDomain);
        }
        if (message.nonce !== BigInt(0)) {
            writer.uint32(24).uint64(message.nonce);
        }
        if (message.sender.length !== 0) {
            writer.uint32(34).bytes(message.sender);
        }
        if (message.messageBody.length !== 0) {
            writer.uint32(42).bytes(message.messageBody);
        }
        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 = createBaseMessageReceived();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.caller = reader.string();
                    break;
                case 2:
                    message.sourceDomain = reader.uint32();
                    break;
                case 3:
                    message.nonce = reader.uint64();
                    break;
                case 4:
                    message.sender = reader.bytes();
                    break;
                case 5:
                    message.messageBody = reader.bytes();
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        return {
            caller: isSet(object.caller) ? String(object.caller) : '',
            sourceDomain: isSet(object.sourceDomain)
                ? Number(object.sourceDomain)
                : 0,
            nonce: isSet(object.nonce) ? BigInt(object.nonce.toString()) : BigInt(0),
            sender: isSet(object.sender)
                ? bytesFromBase64(object.sender)
                : new Uint8Array(),
            messageBody: isSet(object.messageBody)
                ? bytesFromBase64(object.messageBody)
                : new Uint8Array(),
        };
    },
    toJSON(message) {
        const obj = {};
        message.caller !== undefined && (obj.caller = message.caller);
        message.sourceDomain !== undefined &&
            (obj.sourceDomain = Math.round(message.sourceDomain));
        message.nonce !== undefined &&
            (obj.nonce = (message.nonce || BigInt(0)).toString());
        message.sender !== undefined &&
            (obj.sender = base64FromBytes(message.sender !== undefined ? message.sender : new Uint8Array()));
        message.messageBody !== undefined &&
            (obj.messageBody = base64FromBytes(message.messageBody !== undefined
                ? message.messageBody
                : new Uint8Array()));
        return obj;
    },
    fromPartial(object) {
        const message = createBaseMessageReceived();
        message.caller = object.caller ?? '';
        message.sourceDomain = object.sourceDomain ?? 0;
        message.nonce =
            object.nonce !== undefined && object.nonce !== null
                ? BigInt(object.nonce.toString())
                : BigInt(0);
        message.sender = object.sender ?? new Uint8Array();
        message.messageBody = object.messageBody ?? new Uint8Array();
        return message;
    },
    fromProtoMsg(message) {
        return MessageReceived.decode(message.value);
    },
    toProto(message) {
        return MessageReceived.encode(message).finish();
    },
    toProtoMsg(message) {
        return {
            typeUrl: '/circle.cctp.v1.MessageReceived',
            value: MessageReceived.encode(message).finish(),
        };
    },
};
function createBaseMaxMessageBodySizeUpdated() {
    return {
        newMaxMessageBodySize: BigInt(0),
    };
}
export const MaxMessageBodySizeUpdated = {
    typeUrl: '/circle.cctp.v1.MaxMessageBodySizeUpdated',
    encode(message, writer = BinaryWriter.create()) {
        if (message.newMaxMessageBodySize !== BigInt(0)) {
            writer.uint32(8).uint64(message.newMaxMessageBodySize);
        }
        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 = createBaseMaxMessageBodySizeUpdated();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.newMaxMessageBodySize = reader.uint64();
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        return {
            newMaxMessageBodySize: isSet(object.newMaxMessageBodySize)
                ? BigInt(object.newMaxMessageBodySize.toString())
                : BigInt(0),
        };
    },
    toJSON(message) {
        const obj = {};
        message.newMaxMessageBodySize !== undefined &&
            (obj.newMaxMessageBodySize = (message.newMaxMessageBodySize || BigInt(0)).toString());
        return obj;
    },
    fromPartial(object) {
        const message = createBaseMaxMessageBodySizeUpdated();
        message.newMaxMessageBodySize =
            object.newMaxMessageBodySize !== undefined &&
                object.newMaxMessageBodySize !== null
                ? BigInt(object.newMaxMessageBodySize.toString())
                : BigInt(0);
        return message;
    },
    fromProtoMsg(message) {
        return MaxMessageBodySizeUpdated.decode(message.value);
    },
    toProto(message) {
        return MaxMessageBodySizeUpdated.encode(message).finish();
    },
    toProtoMsg(message) {
        return {
            typeUrl: '/circle.cctp.v1.MaxMessageBodySizeUpdated',
            value: MaxMessageBodySizeUpdated.encode(message).finish(),
        };
    },
};
function createBaseRemoteTokenMessengerAdded() {
    return {
        domain: 0,
        remoteTokenMessenger: new Uint8Array(),
    };
}
export const RemoteTokenMessengerAdded = {
    typeUrl: '/circle.cctp.v1.RemoteTokenMessengerAdded',
    encode(message, writer = BinaryWriter.create()) {
        if (message.domain !== 0) {
            writer.uint32(8).uint32(message.domain);
        }
        if (message.remoteTokenMessenger.length !== 0) {
            writer.uint32(18).bytes(message.remoteTokenMessenger);
        }
        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 = createBaseRemoteTokenMessengerAdded();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.domain = reader.uint32();
                    break;
                case 2:
                    message.remoteTokenMessenger = reader.bytes();
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        return {
            domain: isSet(object.domain) ? Number(object.domain) : 0,
            remoteTokenMessenger: isSet(object.remoteTokenMessenger)
                ? bytesFromBase64(object.remoteTokenMessenger)
                : new Uint8Array(),
        };
    },
    toJSON(message) {
        const obj = {};
        message.domain !== undefined && (obj.domain = Math.round(message.domain));
        message.remoteTokenMessenger !== undefined &&
            (obj.remoteTokenMessenger = base64FromBytes(message.remoteTokenMessenger !== undefined
                ? message.remoteTokenMessenger
                : new Uint8Array()));
        return obj;
    },
    fromPartial(object) {
        const message = createBaseRemoteTokenMessengerAdded();
        message.domain = object.domain ?? 0;
        message.remoteTokenMessenger =
            object.remoteTokenMessenger ?? new Uint8Array();
        return message;
    },
    fromProtoMsg(message) {
        return RemoteTokenMessengerAdded.decode(message.value);
    },
    toProto(message) {
        return RemoteTokenMessengerAdded.encode(message).finish();
    },
    toProtoMsg(message) {
        return {
            typeUrl: '/circle.cctp.v1.RemoteTokenMessengerAdded',
            value: RemoteTokenMessengerAdded.encode(message).finish(),
        };
    },
};
function createBaseRemoteTokenMessengerRemoved() {
    return {
        domain: 0,
        remoteTokenMessenger: new Uint8Array(),
    };
}
export const RemoteTokenMessengerRemoved = {
    typeUrl: '/circle.cctp.v1.RemoteTokenMessengerRemoved',
    encode(message, writer = BinaryWriter.create()) {
        if (message.domain !== 0) {
            writer.uint32(8).uint32(message.domain);
        }
        if (message.remoteTokenMessenger.length !== 0) {
            writer.uint32(18).bytes(message.remoteTokenMessenger);
        }
        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 = createBaseRemoteTokenMessengerRemoved();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.domain = reader.uint32();
                    break;
                case 2:
                    message.remoteTokenMessenger = reader.bytes();
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        return {
            domain: isSet(object.domain) ? Number(object.domain) : 0,
            remoteTokenMessenger: isSet(object.remoteTokenMessenger)
                ? bytesFromBase64(object.remoteTokenMessenger)
                : new Uint8Array(),
        };
    },
    toJSON(message) {
        const obj = {};
        message.domain !== undefined && (obj.domain = Math.round(message.domain));
        message.remoteTokenMessenger !== undefined &&
            (obj.remoteTokenMessenger = base64FromBytes(message.remoteTokenMessenger !== undefined
                ? message.remoteTokenMessenger
                : new Uint8Array()));
        return obj;
    },
    fromPartial(object) {
        const message = createBaseRemoteTokenMessengerRemoved();
        message.domain = object.domain ?? 0;
        message.remoteTokenMessenger =
            object.remoteTokenMessenger ?? new Uint8Array();
        return message;
    },
    fromProtoMsg(message) {
        return RemoteTokenMessengerRemoved.decode(message.value);
    },
    toProto(message) {
        return RemoteTokenMessengerRemoved.encode(message).finish();
    },
    toProtoMsg(message) {
        return {
            typeUrl: '/circle.cctp.v1.RemoteTokenMessengerRemoved',
            value: RemoteTokenMessengerRemoved.encode(message).finish(),
        };
    },
};
function createBaseSetBurnLimitPerMessage() {
    return {
        token: '',
        burnLimitPerMessage: '',
    };
}
export const SetBurnLimitPerMessage = {
    typeUrl: '/circle.cctp.v1.SetBurnLimitPerMessage',
    encode(message, writer = BinaryWriter.create()) {
        if (message.token !== '') {
            writer.uint32(10).string(message.token);
        }
        if (message.burnLimitPerMessage !== '') {
            writer.uint32(18).string(message.burnLimitPerMessage);
        }
        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 = createBaseSetBurnLimitPerMessage();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.token = reader.string();
                    break;
                case 2:
                    message.burnLimitPerMessage = reader.string();
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        return {
            token: isSet(object.token) ? String(object.token) : '',
            burnLimitPerMessage: isSet(object.burnLimitPerMessage)
                ? String(object.burnLimitPerMessage)
                : '',
        };
    },
    toJSON(message) {
        const obj = {};
        message.token !== undefined && (obj.token = message.token);
        message.burnLimitPerMessage !== undefined &&
            (obj.burnLimitPerMessage = message.burnLimitPerMessage);
        return obj;
    },
    fromPartial(object) {
        const message = createBaseSetBurnLimitPerMessage();
        message.token = object.token ?? '';
        message.burnLimitPerMessage = object.burnLimitPerMessage ?? '';
        return message;
    },
    fromProtoMsg(message) {
        return SetBurnLimitPerMessage.decode(message.value);
    },
    toProto(message) {
        return SetBurnLimitPerMessage.encode(message).finish();
    },
    toProtoMsg(message) {
        return {
            typeUrl: '/circle.cctp.v1.SetBurnLimitPerMessage',
            value: SetBurnLimitPerMessage.encode(message).finish(),
        };
    },
};
//# sourceMappingURL=events.js.map