"use strict";
/**
 * This code was AUTOGENERATED using the kinobi library.
 * Please DO NOT EDIT THIS FILE, instead use visitors
 * to add features, then rerun kinobi to update it.
 *
 * @see https://github.com/metaplex-foundation/kinobi
 */
Object.defineProperty(exports, "__esModule", { value: true });
exports.getMplTokenExtrasErrorFromName = exports.getMplTokenExtrasErrorFromCode = exports.TokExCannotCreateNonAssociatedTokenError = exports.TokExInvalidTokenOwnerError = exports.TokExInvalidTokenMintError = exports.TokExInvalidProgramOwnerError = exports.TokExInvalidAssociatedTokenAccountError = exports.TokExInvalidAssociatedTokenProgramError = exports.TokExInvalidTokenProgramError = exports.TokExInvalidSystemProgramError = void 0;
const umi_1 = require("@metaplex-foundation/umi");
const codeToErrorMap = new Map();
const nameToErrorMap = new Map();
/** InvalidSystemProgram: Invalid System Program */
class TokExInvalidSystemProgramError extends umi_1.ProgramError {
    constructor(program, cause) {
        super('Invalid System Program', program, cause);
        this.name = 'InvalidSystemProgram';
        this.code = 0x0; // 0
    }
}
exports.TokExInvalidSystemProgramError = TokExInvalidSystemProgramError;
codeToErrorMap.set(0x0, TokExInvalidSystemProgramError);
nameToErrorMap.set('InvalidSystemProgram', TokExInvalidSystemProgramError);
/** InvalidTokenProgram: Invalid Token Program */
class TokExInvalidTokenProgramError extends umi_1.ProgramError {
    constructor(program, cause) {
        super('Invalid Token Program', program, cause);
        this.name = 'InvalidTokenProgram';
        this.code = 0x1; // 1
    }
}
exports.TokExInvalidTokenProgramError = TokExInvalidTokenProgramError;
codeToErrorMap.set(0x1, TokExInvalidTokenProgramError);
nameToErrorMap.set('InvalidTokenProgram', TokExInvalidTokenProgramError);
/** InvalidAssociatedTokenProgram: Invalid Associated Token Program */
class TokExInvalidAssociatedTokenProgramError extends umi_1.ProgramError {
    constructor(program, cause) {
        super('Invalid Associated Token Program', program, cause);
        this.name = 'InvalidAssociatedTokenProgram';
        this.code = 0x2; // 2
    }
}
exports.TokExInvalidAssociatedTokenProgramError = TokExInvalidAssociatedTokenProgramError;
codeToErrorMap.set(0x2, TokExInvalidAssociatedTokenProgramError);
nameToErrorMap.set('InvalidAssociatedTokenProgram', TokExInvalidAssociatedTokenProgramError);
/** InvalidAssociatedTokenAccount: Invalid Associated Token Account: it should derive from the provided mint and owner */
class TokExInvalidAssociatedTokenAccountError extends umi_1.ProgramError {
    constructor(program, cause) {
        super('Invalid Associated Token Account: it should derive from the provided mint and owner', program, cause);
        this.name = 'InvalidAssociatedTokenAccount';
        this.code = 0x3; // 3
    }
}
exports.TokExInvalidAssociatedTokenAccountError = TokExInvalidAssociatedTokenAccountError;
codeToErrorMap.set(0x3, TokExInvalidAssociatedTokenAccountError);
nameToErrorMap.set('InvalidAssociatedTokenAccount', TokExInvalidAssociatedTokenAccountError);
/** InvalidProgramOwner: Invalid Program Owner */
class TokExInvalidProgramOwnerError extends umi_1.ProgramError {
    constructor(program, cause) {
        super('Invalid Program Owner', program, cause);
        this.name = 'InvalidProgramOwner';
        this.code = 0x4; // 4
    }
}
exports.TokExInvalidProgramOwnerError = TokExInvalidProgramOwnerError;
codeToErrorMap.set(0x4, TokExInvalidProgramOwnerError);
nameToErrorMap.set('InvalidProgramOwner', TokExInvalidProgramOwnerError);
/** InvalidTokenMint: Invalid Token Mint: it should be the same as the provided mint account */
class TokExInvalidTokenMintError extends umi_1.ProgramError {
    constructor(program, cause) {
        super('Invalid Token Mint: it should be the same as the provided mint account', program, cause);
        this.name = 'InvalidTokenMint';
        this.code = 0x5; // 5
    }
}
exports.TokExInvalidTokenMintError = TokExInvalidTokenMintError;
codeToErrorMap.set(0x5, TokExInvalidTokenMintError);
nameToErrorMap.set('InvalidTokenMint', TokExInvalidTokenMintError);
/** InvalidTokenOwner: Invalid Program Owner: it should be the same as the provided owner account */
class TokExInvalidTokenOwnerError extends umi_1.ProgramError {
    constructor(program, cause) {
        super('Invalid Program Owner: it should be the same as the provided owner account', program, cause);
        this.name = 'InvalidTokenOwner';
        this.code = 0x6; // 6
    }
}
exports.TokExInvalidTokenOwnerError = TokExInvalidTokenOwnerError;
codeToErrorMap.set(0x6, TokExInvalidTokenOwnerError);
nameToErrorMap.set('InvalidTokenOwner', TokExInvalidTokenOwnerError);
/** CannotCreateNonAssociatedToken: Cannot create non-associated token accounts as they would need to sign the transaction. Please provide an associated token account instead */
class TokExCannotCreateNonAssociatedTokenError extends umi_1.ProgramError {
    constructor(program, cause) {
        super('Cannot create non-associated token accounts as they would need to sign the transaction. Please provide an associated token account instead', program, cause);
        this.name = 'CannotCreateNonAssociatedToken';
        this.code = 0x7; // 7
    }
}
exports.TokExCannotCreateNonAssociatedTokenError = TokExCannotCreateNonAssociatedTokenError;
codeToErrorMap.set(0x7, TokExCannotCreateNonAssociatedTokenError);
nameToErrorMap.set('CannotCreateNonAssociatedToken', TokExCannotCreateNonAssociatedTokenError);
/**
 * Attempts to resolve a custom program error from the provided error code.
 * @category Errors
 */
function getMplTokenExtrasErrorFromCode(code, program, cause) {
    const constructor = codeToErrorMap.get(code);
    return constructor ? new constructor(program, cause) : null;
}
exports.getMplTokenExtrasErrorFromCode = getMplTokenExtrasErrorFromCode;
/**
 * Attempts to resolve a custom program error from the provided error name, i.e. 'Unauthorized'.
 * @category Errors
 */
function getMplTokenExtrasErrorFromName(name, program, cause) {
    const constructor = nameToErrorMap.get(name);
    return constructor ? new constructor(program, cause) : null;
}
exports.getMplTokenExtrasErrorFromName = getMplTokenExtrasErrorFromName;
//# sourceMappingURL=mplTokenExtras.js.map