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