/**
 * This code was AUTOGENERATED using the Codama library.
 * Please DO NOT EDIT THIS FILE, instead use visitors
 * to add features, then rerun Codama to update it.
 *
 * @see https://github.com/codama-idl/codama
 */
import { __assign } from "tslib";
import { assertIsInstructionWithAccounts, containsBytes, fixEncoderSize, getBytesEncoder, } from "@solana/kit";
import { parseAcceptOwnershipInstruction, parseDisableAttesterInstruction, parseEnableAttesterInstruction, parseGetNoncePdaInstruction, parseInitializeInstruction, parseIsNonceUsedInstruction, parsePauseInstruction, parseReceiveMessageInstruction, parseReclaimEventAccountInstruction, parseReplaceMessageInstruction, parseSendMessageInstruction, parseSendMessageWithCallerInstruction, parseSetMaxMessageBodySizeInstruction, parseSetSignatureThresholdInstruction, parseTransferOwnershipInstruction, parseUnpauseInstruction, parseUpdateAttesterManagerInstruction, parseUpdatePauserInstruction, } from "../instructions";
export var MESSAGE_TRANSMITTER_PROGRAM_ADDRESS = "CCTPmbSD7gX1bxKPAmg77w8oFzNFpaQiQUWD43TKaecd";
export var MessageTransmitterAccount;
(function (MessageTransmitterAccount) {
    MessageTransmitterAccount[MessageTransmitterAccount["MessageSent"] = 0] = "MessageSent";
    MessageTransmitterAccount[MessageTransmitterAccount["MessageTransmitter"] = 1] = "MessageTransmitter";
    MessageTransmitterAccount[MessageTransmitterAccount["UsedNonces"] = 2] = "UsedNonces";
})(MessageTransmitterAccount || (MessageTransmitterAccount = {}));
export function identifyMessageTransmitterAccount(account) {
    var data = "data" in account ? account.data : account;
    if (containsBytes(data, fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([131, 100, 133, 56, 166, 225, 151, 60])), 0)) {
        return MessageTransmitterAccount.MessageSent;
    }
    if (containsBytes(data, fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([71, 40, 180, 142, 19, 203, 35, 252])), 0)) {
        return MessageTransmitterAccount.MessageTransmitter;
    }
    if (containsBytes(data, fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([60, 112, 18, 72, 138, 181, 100, 138])), 0)) {
        return MessageTransmitterAccount.UsedNonces;
    }
    throw new Error("The provided account could not be identified as a messageTransmitter account.");
}
export var MessageTransmitterInstruction;
(function (MessageTransmitterInstruction) {
    MessageTransmitterInstruction[MessageTransmitterInstruction["Initialize"] = 0] = "Initialize";
    MessageTransmitterInstruction[MessageTransmitterInstruction["TransferOwnership"] = 1] = "TransferOwnership";
    MessageTransmitterInstruction[MessageTransmitterInstruction["AcceptOwnership"] = 2] = "AcceptOwnership";
    MessageTransmitterInstruction[MessageTransmitterInstruction["UpdatePauser"] = 3] = "UpdatePauser";
    MessageTransmitterInstruction[MessageTransmitterInstruction["UpdateAttesterManager"] = 4] = "UpdateAttesterManager";
    MessageTransmitterInstruction[MessageTransmitterInstruction["Pause"] = 5] = "Pause";
    MessageTransmitterInstruction[MessageTransmitterInstruction["Unpause"] = 6] = "Unpause";
    MessageTransmitterInstruction[MessageTransmitterInstruction["SetMaxMessageBodySize"] = 7] = "SetMaxMessageBodySize";
    MessageTransmitterInstruction[MessageTransmitterInstruction["EnableAttester"] = 8] = "EnableAttester";
    MessageTransmitterInstruction[MessageTransmitterInstruction["DisableAttester"] = 9] = "DisableAttester";
    MessageTransmitterInstruction[MessageTransmitterInstruction["SetSignatureThreshold"] = 10] = "SetSignatureThreshold";
    MessageTransmitterInstruction[MessageTransmitterInstruction["SendMessage"] = 11] = "SendMessage";
    MessageTransmitterInstruction[MessageTransmitterInstruction["SendMessageWithCaller"] = 12] = "SendMessageWithCaller";
    MessageTransmitterInstruction[MessageTransmitterInstruction["ReplaceMessage"] = 13] = "ReplaceMessage";
    MessageTransmitterInstruction[MessageTransmitterInstruction["ReceiveMessage"] = 14] = "ReceiveMessage";
    MessageTransmitterInstruction[MessageTransmitterInstruction["ReclaimEventAccount"] = 15] = "ReclaimEventAccount";
    MessageTransmitterInstruction[MessageTransmitterInstruction["GetNoncePda"] = 16] = "GetNoncePda";
    MessageTransmitterInstruction[MessageTransmitterInstruction["IsNonceUsed"] = 17] = "IsNonceUsed";
})(MessageTransmitterInstruction || (MessageTransmitterInstruction = {}));
export function identifyMessageTransmitterInstruction(instruction) {
    var data = "data" in instruction ? instruction.data : instruction;
    if (containsBytes(data, fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([175, 175, 109, 31, 13, 152, 155, 237])), 0)) {
        return MessageTransmitterInstruction.Initialize;
    }
    if (containsBytes(data, fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([65, 177, 215, 73, 53, 45, 99, 47])), 0)) {
        return MessageTransmitterInstruction.TransferOwnership;
    }
    if (containsBytes(data, fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([172, 23, 43, 13, 238, 213, 85, 150])), 0)) {
        return MessageTransmitterInstruction.AcceptOwnership;
    }
    if (containsBytes(data, fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([140, 171, 211, 132, 57, 201, 16, 254])), 0)) {
        return MessageTransmitterInstruction.UpdatePauser;
    }
    if (containsBytes(data, fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([175, 245, 178, 104, 85, 179, 71, 16])), 0)) {
        return MessageTransmitterInstruction.UpdateAttesterManager;
    }
    if (containsBytes(data, fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([211, 22, 221, 251, 74, 121, 193, 47])), 0)) {
        return MessageTransmitterInstruction.Pause;
    }
    if (containsBytes(data, fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([169, 144, 4, 38, 10, 141, 188, 255])), 0)) {
        return MessageTransmitterInstruction.Unpause;
    }
    if (containsBytes(data, fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([168, 178, 8, 117, 217, 167, 219, 31])), 0)) {
        return MessageTransmitterInstruction.SetMaxMessageBodySize;
    }
    if (containsBytes(data, fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([2, 11, 193, 115, 5, 148, 4, 198])), 0)) {
        return MessageTransmitterInstruction.EnableAttester;
    }
    if (containsBytes(data, fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([61, 171, 131, 95, 172, 15, 227, 229])), 0)) {
        return MessageTransmitterInstruction.DisableAttester;
    }
    if (containsBytes(data, fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([163, 19, 154, 168, 82, 209, 214, 219])), 0)) {
        return MessageTransmitterInstruction.SetSignatureThreshold;
    }
    if (containsBytes(data, fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([57, 40, 34, 178, 189, 10, 65, 26])), 0)) {
        return MessageTransmitterInstruction.SendMessage;
    }
    if (containsBytes(data, fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([212, 47, 34, 52, 91, 32, 176, 204])), 0)) {
        return MessageTransmitterInstruction.SendMessageWithCaller;
    }
    if (containsBytes(data, fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([189, 189, 210, 163, 149, 205, 69, 229])), 0)) {
        return MessageTransmitterInstruction.ReplaceMessage;
    }
    if (containsBytes(data, fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([38, 144, 127, 225, 31, 225, 238, 25])), 0)) {
        return MessageTransmitterInstruction.ReceiveMessage;
    }
    if (containsBytes(data, fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([94, 198, 180, 159, 131, 236, 15, 174])), 0)) {
        return MessageTransmitterInstruction.ReclaimEventAccount;
    }
    if (containsBytes(data, fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([114, 70, 229, 212, 223, 50, 33, 39])), 0)) {
        return MessageTransmitterInstruction.GetNoncePda;
    }
    if (containsBytes(data, fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([144, 72, 107, 148, 35, 218, 31, 187])), 0)) {
        return MessageTransmitterInstruction.IsNonceUsed;
    }
    throw new Error("The provided instruction could not be identified as a messageTransmitter instruction.");
}
export function parseMessageTransmitterInstruction(instruction) {
    var instructionType = identifyMessageTransmitterInstruction(instruction);
    switch (instructionType) {
        case MessageTransmitterInstruction.Initialize: {
            assertIsInstructionWithAccounts(instruction);
            return __assign({ instructionType: MessageTransmitterInstruction.Initialize }, parseInitializeInstruction(instruction));
        }
        case MessageTransmitterInstruction.TransferOwnership: {
            assertIsInstructionWithAccounts(instruction);
            return __assign({ instructionType: MessageTransmitterInstruction.TransferOwnership }, parseTransferOwnershipInstruction(instruction));
        }
        case MessageTransmitterInstruction.AcceptOwnership: {
            assertIsInstructionWithAccounts(instruction);
            return __assign({ instructionType: MessageTransmitterInstruction.AcceptOwnership }, parseAcceptOwnershipInstruction(instruction));
        }
        case MessageTransmitterInstruction.UpdatePauser: {
            assertIsInstructionWithAccounts(instruction);
            return __assign({ instructionType: MessageTransmitterInstruction.UpdatePauser }, parseUpdatePauserInstruction(instruction));
        }
        case MessageTransmitterInstruction.UpdateAttesterManager: {
            assertIsInstructionWithAccounts(instruction);
            return __assign({ instructionType: MessageTransmitterInstruction.UpdateAttesterManager }, parseUpdateAttesterManagerInstruction(instruction));
        }
        case MessageTransmitterInstruction.Pause: {
            assertIsInstructionWithAccounts(instruction);
            return __assign({ instructionType: MessageTransmitterInstruction.Pause }, parsePauseInstruction(instruction));
        }
        case MessageTransmitterInstruction.Unpause: {
            assertIsInstructionWithAccounts(instruction);
            return __assign({ instructionType: MessageTransmitterInstruction.Unpause }, parseUnpauseInstruction(instruction));
        }
        case MessageTransmitterInstruction.SetMaxMessageBodySize: {
            assertIsInstructionWithAccounts(instruction);
            return __assign({ instructionType: MessageTransmitterInstruction.SetMaxMessageBodySize }, parseSetMaxMessageBodySizeInstruction(instruction));
        }
        case MessageTransmitterInstruction.EnableAttester: {
            assertIsInstructionWithAccounts(instruction);
            return __assign({ instructionType: MessageTransmitterInstruction.EnableAttester }, parseEnableAttesterInstruction(instruction));
        }
        case MessageTransmitterInstruction.DisableAttester: {
            assertIsInstructionWithAccounts(instruction);
            return __assign({ instructionType: MessageTransmitterInstruction.DisableAttester }, parseDisableAttesterInstruction(instruction));
        }
        case MessageTransmitterInstruction.SetSignatureThreshold: {
            assertIsInstructionWithAccounts(instruction);
            return __assign({ instructionType: MessageTransmitterInstruction.SetSignatureThreshold }, parseSetSignatureThresholdInstruction(instruction));
        }
        case MessageTransmitterInstruction.SendMessage: {
            assertIsInstructionWithAccounts(instruction);
            return __assign({ instructionType: MessageTransmitterInstruction.SendMessage }, parseSendMessageInstruction(instruction));
        }
        case MessageTransmitterInstruction.SendMessageWithCaller: {
            assertIsInstructionWithAccounts(instruction);
            return __assign({ instructionType: MessageTransmitterInstruction.SendMessageWithCaller }, parseSendMessageWithCallerInstruction(instruction));
        }
        case MessageTransmitterInstruction.ReplaceMessage: {
            assertIsInstructionWithAccounts(instruction);
            return __assign({ instructionType: MessageTransmitterInstruction.ReplaceMessage }, parseReplaceMessageInstruction(instruction));
        }
        case MessageTransmitterInstruction.ReceiveMessage: {
            assertIsInstructionWithAccounts(instruction);
            return __assign({ instructionType: MessageTransmitterInstruction.ReceiveMessage }, parseReceiveMessageInstruction(instruction));
        }
        case MessageTransmitterInstruction.ReclaimEventAccount: {
            assertIsInstructionWithAccounts(instruction);
            return __assign({ instructionType: MessageTransmitterInstruction.ReclaimEventAccount }, parseReclaimEventAccountInstruction(instruction));
        }
        case MessageTransmitterInstruction.GetNoncePda: {
            assertIsInstructionWithAccounts(instruction);
            return __assign({ instructionType: MessageTransmitterInstruction.GetNoncePda }, parseGetNoncePdaInstruction(instruction));
        }
        case MessageTransmitterInstruction.IsNonceUsed: {
            assertIsInstructionWithAccounts(instruction);
            return __assign({ instructionType: MessageTransmitterInstruction.IsNonceUsed }, parseIsNonceUsedInstruction(instruction));
        }
        default:
            throw new Error("Unrecognized instruction type: ".concat(instructionType));
    }
}
//# sourceMappingURL=messageTransmitter.js.map