/**
 * 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, parseAddLocalTokenInstruction, parseAddRemoteTokenMessengerInstruction, parseBurnTokenCustodyInstruction, parseDepositForBurnInstruction, parseDepositForBurnWithCallerInstruction, parseHandleReceiveMessageInstruction, parseInitializeInstruction, parseLinkTokenPairInstruction, parsePauseInstruction, parseRemoveLocalTokenInstruction, parseRemoveRemoteTokenMessengerInstruction, parseReplaceDepositForBurnInstruction, parseSetMaxBurnAmountPerMessageInstruction, parseSetTokenControllerInstruction, parseTransferOwnershipInstruction, parseUnlinkTokenPairInstruction, parseUnpauseInstruction, parseUpdatePauserInstruction, } from "../instructions";
export var TOKEN_MESSENGER_MINTER_PROGRAM_ADDRESS = "CCTPiPYPc6AsJuwueEnWgSgucamXDZwBd53dQ11YiKX3";
export var TokenMessengerMinterAccount;
(function (TokenMessengerMinterAccount) {
    TokenMessengerMinterAccount[TokenMessengerMinterAccount["TokenMessenger"] = 0] = "TokenMessenger";
    TokenMessengerMinterAccount[TokenMessengerMinterAccount["RemoteTokenMessenger"] = 1] = "RemoteTokenMessenger";
    TokenMessengerMinterAccount[TokenMessengerMinterAccount["TokenMinter"] = 2] = "TokenMinter";
    TokenMessengerMinterAccount[TokenMessengerMinterAccount["TokenPair"] = 3] = "TokenPair";
    TokenMessengerMinterAccount[TokenMessengerMinterAccount["LocalToken"] = 4] = "LocalToken";
})(TokenMessengerMinterAccount || (TokenMessengerMinterAccount = {}));
export function identifyTokenMessengerMinterAccount(account) {
    var data = "data" in account ? account.data : account;
    if (containsBytes(data, fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([162, 4, 242, 52, 147, 243, 221, 96])), 0)) {
        return TokenMessengerMinterAccount.TokenMessenger;
    }
    if (containsBytes(data, fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([105, 115, 174, 34, 95, 233, 138, 252])), 0)) {
        return TokenMessengerMinterAccount.RemoteTokenMessenger;
    }
    if (containsBytes(data, fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([122, 133, 84, 63, 57, 159, 171, 206])), 0)) {
        return TokenMessengerMinterAccount.TokenMinter;
    }
    if (containsBytes(data, fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([17, 214, 45, 176, 229, 149, 197, 71])), 0)) {
        return TokenMessengerMinterAccount.TokenPair;
    }
    if (containsBytes(data, fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([159, 131, 58, 170, 193, 84, 128, 182])), 0)) {
        return TokenMessengerMinterAccount.LocalToken;
    }
    throw new Error("The provided account could not be identified as a tokenMessengerMinter account.");
}
export var TokenMessengerMinterInstruction;
(function (TokenMessengerMinterInstruction) {
    TokenMessengerMinterInstruction[TokenMessengerMinterInstruction["Initialize"] = 0] = "Initialize";
    TokenMessengerMinterInstruction[TokenMessengerMinterInstruction["TransferOwnership"] = 1] = "TransferOwnership";
    TokenMessengerMinterInstruction[TokenMessengerMinterInstruction["AcceptOwnership"] = 2] = "AcceptOwnership";
    TokenMessengerMinterInstruction[TokenMessengerMinterInstruction["AddRemoteTokenMessenger"] = 3] = "AddRemoteTokenMessenger";
    TokenMessengerMinterInstruction[TokenMessengerMinterInstruction["RemoveRemoteTokenMessenger"] = 4] = "RemoveRemoteTokenMessenger";
    TokenMessengerMinterInstruction[TokenMessengerMinterInstruction["DepositForBurn"] = 5] = "DepositForBurn";
    TokenMessengerMinterInstruction[TokenMessengerMinterInstruction["DepositForBurnWithCaller"] = 6] = "DepositForBurnWithCaller";
    TokenMessengerMinterInstruction[TokenMessengerMinterInstruction["ReplaceDepositForBurn"] = 7] = "ReplaceDepositForBurn";
    TokenMessengerMinterInstruction[TokenMessengerMinterInstruction["HandleReceiveMessage"] = 8] = "HandleReceiveMessage";
    TokenMessengerMinterInstruction[TokenMessengerMinterInstruction["SetTokenController"] = 9] = "SetTokenController";
    TokenMessengerMinterInstruction[TokenMessengerMinterInstruction["Pause"] = 10] = "Pause";
    TokenMessengerMinterInstruction[TokenMessengerMinterInstruction["Unpause"] = 11] = "Unpause";
    TokenMessengerMinterInstruction[TokenMessengerMinterInstruction["UpdatePauser"] = 12] = "UpdatePauser";
    TokenMessengerMinterInstruction[TokenMessengerMinterInstruction["SetMaxBurnAmountPerMessage"] = 13] = "SetMaxBurnAmountPerMessage";
    TokenMessengerMinterInstruction[TokenMessengerMinterInstruction["AddLocalToken"] = 14] = "AddLocalToken";
    TokenMessengerMinterInstruction[TokenMessengerMinterInstruction["RemoveLocalToken"] = 15] = "RemoveLocalToken";
    TokenMessengerMinterInstruction[TokenMessengerMinterInstruction["LinkTokenPair"] = 16] = "LinkTokenPair";
    TokenMessengerMinterInstruction[TokenMessengerMinterInstruction["UnlinkTokenPair"] = 17] = "UnlinkTokenPair";
    TokenMessengerMinterInstruction[TokenMessengerMinterInstruction["BurnTokenCustody"] = 18] = "BurnTokenCustody";
})(TokenMessengerMinterInstruction || (TokenMessengerMinterInstruction = {}));
export function identifyTokenMessengerMinterInstruction(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 TokenMessengerMinterInstruction.Initialize;
    }
    if (containsBytes(data, fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([65, 177, 215, 73, 53, 45, 99, 47])), 0)) {
        return TokenMessengerMinterInstruction.TransferOwnership;
    }
    if (containsBytes(data, fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([172, 23, 43, 13, 238, 213, 85, 150])), 0)) {
        return TokenMessengerMinterInstruction.AcceptOwnership;
    }
    if (containsBytes(data, fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([12, 149, 172, 165, 111, 202, 24, 33])), 0)) {
        return TokenMessengerMinterInstruction.AddRemoteTokenMessenger;
    }
    if (containsBytes(data, fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([65, 114, 66, 85, 169, 98, 177, 146])), 0)) {
        return TokenMessengerMinterInstruction.RemoveRemoteTokenMessenger;
    }
    if (containsBytes(data, fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([215, 60, 61, 46, 114, 55, 128, 176])), 0)) {
        return TokenMessengerMinterInstruction.DepositForBurn;
    }
    if (containsBytes(data, fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([167, 222, 19, 114, 85, 21, 14, 118])), 0)) {
        return TokenMessengerMinterInstruction.DepositForBurnWithCaller;
    }
    if (containsBytes(data, fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([7, 27, 93, 132, 1, 80, 19, 163])), 0)) {
        return TokenMessengerMinterInstruction.ReplaceDepositForBurn;
    }
    if (containsBytes(data, fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([133, 102, 1, 180, 145, 11, 138, 180])), 0)) {
        return TokenMessengerMinterInstruction.HandleReceiveMessage;
    }
    if (containsBytes(data, fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([88, 6, 98, 10, 79, 59, 15, 24])), 0)) {
        return TokenMessengerMinterInstruction.SetTokenController;
    }
    if (containsBytes(data, fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([211, 22, 221, 251, 74, 121, 193, 47])), 0)) {
        return TokenMessengerMinterInstruction.Pause;
    }
    if (containsBytes(data, fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([169, 144, 4, 38, 10, 141, 188, 255])), 0)) {
        return TokenMessengerMinterInstruction.Unpause;
    }
    if (containsBytes(data, fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([140, 171, 211, 132, 57, 201, 16, 254])), 0)) {
        return TokenMessengerMinterInstruction.UpdatePauser;
    }
    if (containsBytes(data, fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([30, 128, 145, 240, 70, 237, 109, 207])), 0)) {
        return TokenMessengerMinterInstruction.SetMaxBurnAmountPerMessage;
    }
    if (containsBytes(data, fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([213, 199, 205, 18, 98, 124, 73, 198])), 0)) {
        return TokenMessengerMinterInstruction.AddLocalToken;
    }
    if (containsBytes(data, fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([27, 43, 66, 170, 188, 44, 109, 97])), 0)) {
        return TokenMessengerMinterInstruction.RemoveLocalToken;
    }
    if (containsBytes(data, fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([68, 162, 24, 104, 125, 46, 130, 12])), 0)) {
        return TokenMessengerMinterInstruction.LinkTokenPair;
    }
    if (containsBytes(data, fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([52, 198, 100, 114, 104, 174, 85, 58])), 0)) {
        return TokenMessengerMinterInstruction.UnlinkTokenPair;
    }
    if (containsBytes(data, fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([233, 136, 180, 175, 112, 41, 62, 71])), 0)) {
        return TokenMessengerMinterInstruction.BurnTokenCustody;
    }
    throw new Error("The provided instruction could not be identified as a tokenMessengerMinter instruction.");
}
export function parseTokenMessengerMinterInstruction(instruction) {
    var instructionType = identifyTokenMessengerMinterInstruction(instruction);
    switch (instructionType) {
        case TokenMessengerMinterInstruction.Initialize: {
            assertIsInstructionWithAccounts(instruction);
            return __assign({ instructionType: TokenMessengerMinterInstruction.Initialize }, parseInitializeInstruction(instruction));
        }
        case TokenMessengerMinterInstruction.TransferOwnership: {
            assertIsInstructionWithAccounts(instruction);
            return __assign({ instructionType: TokenMessengerMinterInstruction.TransferOwnership }, parseTransferOwnershipInstruction(instruction));
        }
        case TokenMessengerMinterInstruction.AcceptOwnership: {
            assertIsInstructionWithAccounts(instruction);
            return __assign({ instructionType: TokenMessengerMinterInstruction.AcceptOwnership }, parseAcceptOwnershipInstruction(instruction));
        }
        case TokenMessengerMinterInstruction.AddRemoteTokenMessenger: {
            assertIsInstructionWithAccounts(instruction);
            return __assign({ instructionType: TokenMessengerMinterInstruction.AddRemoteTokenMessenger }, parseAddRemoteTokenMessengerInstruction(instruction));
        }
        case TokenMessengerMinterInstruction.RemoveRemoteTokenMessenger: {
            assertIsInstructionWithAccounts(instruction);
            return __assign({ instructionType: TokenMessengerMinterInstruction.RemoveRemoteTokenMessenger }, parseRemoveRemoteTokenMessengerInstruction(instruction));
        }
        case TokenMessengerMinterInstruction.DepositForBurn: {
            assertIsInstructionWithAccounts(instruction);
            return __assign({ instructionType: TokenMessengerMinterInstruction.DepositForBurn }, parseDepositForBurnInstruction(instruction));
        }
        case TokenMessengerMinterInstruction.DepositForBurnWithCaller: {
            assertIsInstructionWithAccounts(instruction);
            return __assign({ instructionType: TokenMessengerMinterInstruction.DepositForBurnWithCaller }, parseDepositForBurnWithCallerInstruction(instruction));
        }
        case TokenMessengerMinterInstruction.ReplaceDepositForBurn: {
            assertIsInstructionWithAccounts(instruction);
            return __assign({ instructionType: TokenMessengerMinterInstruction.ReplaceDepositForBurn }, parseReplaceDepositForBurnInstruction(instruction));
        }
        case TokenMessengerMinterInstruction.HandleReceiveMessage: {
            assertIsInstructionWithAccounts(instruction);
            return __assign({ instructionType: TokenMessengerMinterInstruction.HandleReceiveMessage }, parseHandleReceiveMessageInstruction(instruction));
        }
        case TokenMessengerMinterInstruction.SetTokenController: {
            assertIsInstructionWithAccounts(instruction);
            return __assign({ instructionType: TokenMessengerMinterInstruction.SetTokenController }, parseSetTokenControllerInstruction(instruction));
        }
        case TokenMessengerMinterInstruction.Pause: {
            assertIsInstructionWithAccounts(instruction);
            return __assign({ instructionType: TokenMessengerMinterInstruction.Pause }, parsePauseInstruction(instruction));
        }
        case TokenMessengerMinterInstruction.Unpause: {
            assertIsInstructionWithAccounts(instruction);
            return __assign({ instructionType: TokenMessengerMinterInstruction.Unpause }, parseUnpauseInstruction(instruction));
        }
        case TokenMessengerMinterInstruction.UpdatePauser: {
            assertIsInstructionWithAccounts(instruction);
            return __assign({ instructionType: TokenMessengerMinterInstruction.UpdatePauser }, parseUpdatePauserInstruction(instruction));
        }
        case TokenMessengerMinterInstruction.SetMaxBurnAmountPerMessage: {
            assertIsInstructionWithAccounts(instruction);
            return __assign({ instructionType: TokenMessengerMinterInstruction.SetMaxBurnAmountPerMessage }, parseSetMaxBurnAmountPerMessageInstruction(instruction));
        }
        case TokenMessengerMinterInstruction.AddLocalToken: {
            assertIsInstructionWithAccounts(instruction);
            return __assign({ instructionType: TokenMessengerMinterInstruction.AddLocalToken }, parseAddLocalTokenInstruction(instruction));
        }
        case TokenMessengerMinterInstruction.RemoveLocalToken: {
            assertIsInstructionWithAccounts(instruction);
            return __assign({ instructionType: TokenMessengerMinterInstruction.RemoveLocalToken }, parseRemoveLocalTokenInstruction(instruction));
        }
        case TokenMessengerMinterInstruction.LinkTokenPair: {
            assertIsInstructionWithAccounts(instruction);
            return __assign({ instructionType: TokenMessengerMinterInstruction.LinkTokenPair }, parseLinkTokenPairInstruction(instruction));
        }
        case TokenMessengerMinterInstruction.UnlinkTokenPair: {
            assertIsInstructionWithAccounts(instruction);
            return __assign({ instructionType: TokenMessengerMinterInstruction.UnlinkTokenPair }, parseUnlinkTokenPairInstruction(instruction));
        }
        case TokenMessengerMinterInstruction.BurnTokenCustody: {
            assertIsInstructionWithAccounts(instruction);
            return __assign({ instructionType: TokenMessengerMinterInstruction.BurnTokenCustody }, parseBurnTokenCustodyInstruction(instruction));
        }
        default:
            throw new Error("Unrecognized instruction type: ".concat(instructionType));
    }
}
//# sourceMappingURL=tokenMessengerMinter.js.map