//@ts-nocheck
import { BinaryReader, BinaryWriter } from '../../../binary.js';
import { isSet } from '../../../helpers.js';
import { decodeBase64 as bytesFromBase64 } from '@endo/base64';
import { encodeBase64 as base64FromBytes } from '@endo/base64';
import {} from '../../../json-safe.js';
function createBaseMsgDepositForBurn() {
    return {
        from: '',
        amount: '',
        destinationDomain: 0,
        mintRecipient: new Uint8Array(),
        burnToken: '',
    };
}
export const MsgDepositForBurn = {
    typeUrl: '/circle.cctp.v1.MsgDepositForBurn',
    encode(message, writer = BinaryWriter.create()) {
        if (message.from !== '') {
            writer.uint32(10).string(message.from);
        }
        if (message.amount !== '') {
            writer.uint32(18).string(message.amount);
        }
        if (message.destinationDomain !== 0) {
            writer.uint32(24).uint32(message.destinationDomain);
        }
        if (message.mintRecipient.length !== 0) {
            writer.uint32(34).bytes(message.mintRecipient);
        }
        if (message.burnToken !== '') {
            writer.uint32(42).string(message.burnToken);
        }
        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 = createBaseMsgDepositForBurn();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.from = reader.string();
                    break;
                case 2:
                    message.amount = reader.string();
                    break;
                case 3:
                    message.destinationDomain = reader.uint32();
                    break;
                case 4:
                    message.mintRecipient = reader.bytes();
                    break;
                case 5:
                    message.burnToken = reader.string();
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        return {
            from: isSet(object.from) ? String(object.from) : '',
            amount: isSet(object.amount) ? String(object.amount) : '',
            destinationDomain: isSet(object.destinationDomain)
                ? Number(object.destinationDomain)
                : 0,
            mintRecipient: isSet(object.mintRecipient)
                ? bytesFromBase64(object.mintRecipient)
                : new Uint8Array(),
            burnToken: isSet(object.burnToken) ? String(object.burnToken) : '',
        };
    },
    toJSON(message) {
        const obj = {};
        message.from !== undefined && (obj.from = message.from);
        message.amount !== undefined && (obj.amount = message.amount);
        message.destinationDomain !== undefined &&
            (obj.destinationDomain = Math.round(message.destinationDomain));
        message.mintRecipient !== undefined &&
            (obj.mintRecipient = base64FromBytes(message.mintRecipient !== undefined
                ? message.mintRecipient
                : new Uint8Array()));
        message.burnToken !== undefined && (obj.burnToken = message.burnToken);
        return obj;
    },
    fromPartial(object) {
        const message = createBaseMsgDepositForBurn();
        message.from = object.from ?? '';
        message.amount = object.amount ?? '';
        message.destinationDomain = object.destinationDomain ?? 0;
        message.mintRecipient = object.mintRecipient ?? new Uint8Array();
        message.burnToken = object.burnToken ?? '';
        return message;
    },
    fromProtoMsg(message) {
        return MsgDepositForBurn.decode(message.value);
    },
    toProto(message) {
        return MsgDepositForBurn.encode(message).finish();
    },
    toProtoMsg(message) {
        return {
            typeUrl: '/circle.cctp.v1.MsgDepositForBurn',
            value: MsgDepositForBurn.encode(message).finish(),
        };
    },
};
function createBaseMsgDepositForBurnResponse() {
    return {
        nonce: BigInt(0),
    };
}
export const MsgDepositForBurnResponse = {
    typeUrl: '/circle.cctp.v1.MsgDepositForBurnResponse',
    encode(message, writer = BinaryWriter.create()) {
        if (message.nonce !== BigInt(0)) {
            writer.uint32(8).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 = createBaseMsgDepositForBurnResponse();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.nonce = reader.uint64();
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        return {
            nonce: isSet(object.nonce) ? BigInt(object.nonce.toString()) : BigInt(0),
        };
    },
    toJSON(message) {
        const obj = {};
        message.nonce !== undefined &&
            (obj.nonce = (message.nonce || BigInt(0)).toString());
        return obj;
    },
    fromPartial(object) {
        const message = createBaseMsgDepositForBurnResponse();
        message.nonce =
            object.nonce !== undefined && object.nonce !== null
                ? BigInt(object.nonce.toString())
                : BigInt(0);
        return message;
    },
    fromProtoMsg(message) {
        return MsgDepositForBurnResponse.decode(message.value);
    },
    toProto(message) {
        return MsgDepositForBurnResponse.encode(message).finish();
    },
    toProtoMsg(message) {
        return {
            typeUrl: '/circle.cctp.v1.MsgDepositForBurnResponse',
            value: MsgDepositForBurnResponse.encode(message).finish(),
        };
    },
};
function createBaseMsgDepositForBurnWithCaller() {
    return {
        from: '',
        amount: '',
        destinationDomain: 0,
        mintRecipient: new Uint8Array(),
        burnToken: '',
        destinationCaller: new Uint8Array(),
    };
}
export const MsgDepositForBurnWithCaller = {
    typeUrl: '/circle.cctp.v1.MsgDepositForBurnWithCaller',
    encode(message, writer = BinaryWriter.create()) {
        if (message.from !== '') {
            writer.uint32(10).string(message.from);
        }
        if (message.amount !== '') {
            writer.uint32(18).string(message.amount);
        }
        if (message.destinationDomain !== 0) {
            writer.uint32(24).uint32(message.destinationDomain);
        }
        if (message.mintRecipient.length !== 0) {
            writer.uint32(34).bytes(message.mintRecipient);
        }
        if (message.burnToken !== '') {
            writer.uint32(42).string(message.burnToken);
        }
        if (message.destinationCaller.length !== 0) {
            writer.uint32(50).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 = createBaseMsgDepositForBurnWithCaller();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.from = reader.string();
                    break;
                case 2:
                    message.amount = reader.string();
                    break;
                case 3:
                    message.destinationDomain = reader.uint32();
                    break;
                case 4:
                    message.mintRecipient = reader.bytes();
                    break;
                case 5:
                    message.burnToken = reader.string();
                    break;
                case 6:
                    message.destinationCaller = reader.bytes();
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        return {
            from: isSet(object.from) ? String(object.from) : '',
            amount: isSet(object.amount) ? String(object.amount) : '',
            destinationDomain: isSet(object.destinationDomain)
                ? Number(object.destinationDomain)
                : 0,
            mintRecipient: isSet(object.mintRecipient)
                ? bytesFromBase64(object.mintRecipient)
                : new Uint8Array(),
            burnToken: isSet(object.burnToken) ? String(object.burnToken) : '',
            destinationCaller: isSet(object.destinationCaller)
                ? bytesFromBase64(object.destinationCaller)
                : new Uint8Array(),
        };
    },
    toJSON(message) {
        const obj = {};
        message.from !== undefined && (obj.from = message.from);
        message.amount !== undefined && (obj.amount = message.amount);
        message.destinationDomain !== undefined &&
            (obj.destinationDomain = Math.round(message.destinationDomain));
        message.mintRecipient !== undefined &&
            (obj.mintRecipient = base64FromBytes(message.mintRecipient !== undefined
                ? message.mintRecipient
                : new Uint8Array()));
        message.burnToken !== undefined && (obj.burnToken = message.burnToken);
        message.destinationCaller !== undefined &&
            (obj.destinationCaller = base64FromBytes(message.destinationCaller !== undefined
                ? message.destinationCaller
                : new Uint8Array()));
        return obj;
    },
    fromPartial(object) {
        const message = createBaseMsgDepositForBurnWithCaller();
        message.from = object.from ?? '';
        message.amount = object.amount ?? '';
        message.destinationDomain = object.destinationDomain ?? 0;
        message.mintRecipient = object.mintRecipient ?? new Uint8Array();
        message.burnToken = object.burnToken ?? '';
        message.destinationCaller = object.destinationCaller ?? new Uint8Array();
        return message;
    },
    fromProtoMsg(message) {
        return MsgDepositForBurnWithCaller.decode(message.value);
    },
    toProto(message) {
        return MsgDepositForBurnWithCaller.encode(message).finish();
    },
    toProtoMsg(message) {
        return {
            typeUrl: '/circle.cctp.v1.MsgDepositForBurnWithCaller',
            value: MsgDepositForBurnWithCaller.encode(message).finish(),
        };
    },
};
function createBaseMsgDepositForBurnWithCallerResponse() {
    return {
        nonce: BigInt(0),
    };
}
export const MsgDepositForBurnWithCallerResponse = {
    typeUrl: '/circle.cctp.v1.MsgDepositForBurnWithCallerResponse',
    encode(message, writer = BinaryWriter.create()) {
        if (message.nonce !== BigInt(0)) {
            writer.uint32(8).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 = createBaseMsgDepositForBurnWithCallerResponse();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.nonce = reader.uint64();
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        return {
            nonce: isSet(object.nonce) ? BigInt(object.nonce.toString()) : BigInt(0),
        };
    },
    toJSON(message) {
        const obj = {};
        message.nonce !== undefined &&
            (obj.nonce = (message.nonce || BigInt(0)).toString());
        return obj;
    },
    fromPartial(object) {
        const message = createBaseMsgDepositForBurnWithCallerResponse();
        message.nonce =
            object.nonce !== undefined && object.nonce !== null
                ? BigInt(object.nonce.toString())
                : BigInt(0);
        return message;
    },
    fromProtoMsg(message) {
        return MsgDepositForBurnWithCallerResponse.decode(message.value);
    },
    toProto(message) {
        return MsgDepositForBurnWithCallerResponse.encode(message).finish();
    },
    toProtoMsg(message) {
        return {
            typeUrl: '/circle.cctp.v1.MsgDepositForBurnWithCallerResponse',
            value: MsgDepositForBurnWithCallerResponse.encode(message).finish(),
        };
    },
};
//# sourceMappingURL=tx.js.map