"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.getSplAssociatedTokenErrorFromName = exports.getSplAssociatedTokenErrorFromCode = exports.AtaInvalidOwnerError = void 0;
const umi_1 = require("@metaplex-foundation/umi");
const codeToErrorMap = new Map();
const nameToErrorMap = new Map();
/** InvalidOwner: Associated token account owner does not match address derivation */
class AtaInvalidOwnerError extends umi_1.ProgramError {
    constructor(program, cause) {
        super('Associated token account owner does not match address derivation', program, cause);
        this.name = 'InvalidOwner';
        this.code = 0x0; // 0
    }
}
exports.AtaInvalidOwnerError = AtaInvalidOwnerError;
codeToErrorMap.set(0x0, AtaInvalidOwnerError);
nameToErrorMap.set('InvalidOwner', AtaInvalidOwnerError);
/**
 * Attempts to resolve a custom program error from the provided error code.
 * @category Errors
 */
function getSplAssociatedTokenErrorFromCode(code, program, cause) {
    const constructor = codeToErrorMap.get(code);
    return constructor ? new constructor(program, cause) : null;
}
exports.getSplAssociatedTokenErrorFromCode = getSplAssociatedTokenErrorFromCode;
/**
 * Attempts to resolve a custom program error from the provided error name, i.e. 'Unauthorized'.
 * @category Errors
 */
function getSplAssociatedTokenErrorFromName(name, program, cause) {
    const constructor = nameToErrorMap.get(name);
    return constructor ? new constructor(program, cause) : null;
}
exports.getSplAssociatedTokenErrorFromName = getSplAssociatedTokenErrorFromName;
//# sourceMappingURL=splAssociatedToken.js.map