"use strict";
/**
 * 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
 */
Object.defineProperty(exports, "__esModule", { value: true });
exports.MESSAGE_TRANSMITTER_V2_ERROR__DESTINATION_DOMAIN_IS_LOCAL_DOMAIN = exports.MESSAGE_TRANSMITTER_V2_ERROR__EVENT_ACCOUNT_WINDOW_NOT_EXPIRED = exports.MESSAGE_TRANSMITTER_V2_ERROR__INVALID_DESTINATION_MESSAGE = exports.MESSAGE_TRANSMITTER_V2_ERROR__INVALID_MESSAGE_HASH = exports.MESSAGE_TRANSMITTER_V2_ERROR__INVALID_SIGNATURE_S_VALUE = exports.MESSAGE_TRANSMITTER_V2_ERROR__INVALID_SIGNATURE_RECOVERY_ID = exports.MESSAGE_TRANSMITTER_V2_ERROR__INVALID_ATTESTATION_LENGTH = exports.MESSAGE_TRANSMITTER_V2_ERROR__INVALID_ATTESTER_SIGNATURE = exports.MESSAGE_TRANSMITTER_V2_ERROR__INVALID_SIGNATURE_ORDER_OR_DUPE = exports.MESSAGE_TRANSMITTER_V2_ERROR__MALFORMED_MESSAGE = exports.MESSAGE_TRANSMITTER_V2_ERROR__MESSAGE_TOO_SHORT = exports.MESSAGE_TRANSMITTER_V2_ERROR__NONCE_ALREADY_USED = exports.MESSAGE_TRANSMITTER_V2_ERROR__INVALID_NONCE = exports.MESSAGE_TRANSMITTER_V2_ERROR__INVALID_RECIPIENT_PROGRAM = exports.MESSAGE_TRANSMITTER_V2_ERROR__INVALID_USED_NONCES_ACCOUNT = exports.MESSAGE_TRANSMITTER_V2_ERROR__INVALID_MESSAGE_VERSION = exports.MESSAGE_TRANSMITTER_V2_ERROR__INVALID_DESTINATION_DOMAIN = exports.MESSAGE_TRANSMITTER_V2_ERROR__INVALID_SOURCE_DOMAIN = exports.MESSAGE_TRANSMITTER_V2_ERROR__SENDER_NOT_PERMITTED = exports.MESSAGE_TRANSMITTER_V2_ERROR__INVALID_RECIPIENT = exports.MESSAGE_TRANSMITTER_V2_ERROR__INVALID_DESTINATION_CALLER = exports.MESSAGE_TRANSMITTER_V2_ERROR__MESSAGE_BODY_LIMIT_EXCEEDED = exports.MESSAGE_TRANSMITTER_V2_ERROR__ATTESTER_ALREADY_DISABLED = exports.MESSAGE_TRANSMITTER_V2_ERROR__SIGNATURE_THRESHOLD_TOO_LOW = exports.MESSAGE_TRANSMITTER_V2_ERROR__TOO_FEW_ENABLED_ATTESTERS = exports.MESSAGE_TRANSMITTER_V2_ERROR__ATTESTER_ALREADY_ENABLED = exports.MESSAGE_TRANSMITTER_V2_ERROR__INVALID_ATTESTER = exports.MESSAGE_TRANSMITTER_V2_ERROR__INVALID_ATTESTER_MANAGER = exports.MESSAGE_TRANSMITTER_V2_ERROR__INVALID_PAUSER = exports.MESSAGE_TRANSMITTER_V2_ERROR__INVALID_OWNER = exports.MESSAGE_TRANSMITTER_V2_ERROR__SIGNATURE_THRESHOLD_ALREADY_SET = exports.MESSAGE_TRANSMITTER_V2_ERROR__INVALID_SIGNATURE_THRESHOLD = exports.MESSAGE_TRANSMITTER_V2_ERROR__INVALID_MESSAGE_TRANSMITTER_STATE = exports.MESSAGE_TRANSMITTER_V2_ERROR__PROGRAM_PAUSED = exports.MESSAGE_TRANSMITTER_V2_ERROR__INVALID_AUTHORITY = void 0;
exports.getMessageTransmitterV2ErrorMessage = getMessageTransmitterV2ErrorMessage;
exports.isMessageTransmitterV2Error = isMessageTransmitterV2Error;
const kit_1 = require("@solana/kit");
const programs_1 = require("../programs");
/** InvalidAuthority: Invalid authority */
exports.MESSAGE_TRANSMITTER_V2_ERROR__INVALID_AUTHORITY = 0x1770; // 6000
/** ProgramPaused: Instruction is not allowed at this time */
exports.MESSAGE_TRANSMITTER_V2_ERROR__PROGRAM_PAUSED = 0x1771; // 6001
/** InvalidMessageTransmitterState: Invalid message transmitter state */
exports.MESSAGE_TRANSMITTER_V2_ERROR__INVALID_MESSAGE_TRANSMITTER_STATE = 0x1772; // 6002
/** InvalidSignatureThreshold: Invalid signature threshold */
exports.MESSAGE_TRANSMITTER_V2_ERROR__INVALID_SIGNATURE_THRESHOLD = 0x1773; // 6003
/** SignatureThresholdAlreadySet: Signature threshold already set */
exports.MESSAGE_TRANSMITTER_V2_ERROR__SIGNATURE_THRESHOLD_ALREADY_SET = 0x1774; // 6004
/** InvalidOwner: Invalid owner */
exports.MESSAGE_TRANSMITTER_V2_ERROR__INVALID_OWNER = 0x1775; // 6005
/** InvalidPauser: Invalid pauser */
exports.MESSAGE_TRANSMITTER_V2_ERROR__INVALID_PAUSER = 0x1776; // 6006
/** InvalidAttesterManager: Invalid attester manager */
exports.MESSAGE_TRANSMITTER_V2_ERROR__INVALID_ATTESTER_MANAGER = 0x1777; // 6007
/** InvalidAttester: Invalid attester */
exports.MESSAGE_TRANSMITTER_V2_ERROR__INVALID_ATTESTER = 0x1778; // 6008
/** AttesterAlreadyEnabled: Attester already enabled */
exports.MESSAGE_TRANSMITTER_V2_ERROR__ATTESTER_ALREADY_ENABLED = 0x1779; // 6009
/** TooFewEnabledAttesters: Too few enabled attesters */
exports.MESSAGE_TRANSMITTER_V2_ERROR__TOO_FEW_ENABLED_ATTESTERS = 0x177a; // 6010
/** SignatureThresholdTooLow: Signature threshold is too low */
exports.MESSAGE_TRANSMITTER_V2_ERROR__SIGNATURE_THRESHOLD_TOO_LOW = 0x177b; // 6011
/** AttesterAlreadyDisabled: Attester already disabled */
exports.MESSAGE_TRANSMITTER_V2_ERROR__ATTESTER_ALREADY_DISABLED = 0x177c; // 6012
/** MessageBodyLimitExceeded: Message body exceeds max size */
exports.MESSAGE_TRANSMITTER_V2_ERROR__MESSAGE_BODY_LIMIT_EXCEEDED = 0x177d; // 6013
/** InvalidDestinationCaller: Invalid destination caller */
exports.MESSAGE_TRANSMITTER_V2_ERROR__INVALID_DESTINATION_CALLER = 0x177e; // 6014
/** InvalidRecipient: Invalid message recipient */
exports.MESSAGE_TRANSMITTER_V2_ERROR__INVALID_RECIPIENT = 0x177f; // 6015
/** SenderNotPermitted: Sender is not permitted */
exports.MESSAGE_TRANSMITTER_V2_ERROR__SENDER_NOT_PERMITTED = 0x1780; // 6016
/** InvalidSourceDomain: Invalid source domain */
exports.MESSAGE_TRANSMITTER_V2_ERROR__INVALID_SOURCE_DOMAIN = 0x1781; // 6017
/** InvalidDestinationDomain: Invalid destination domain */
exports.MESSAGE_TRANSMITTER_V2_ERROR__INVALID_DESTINATION_DOMAIN = 0x1782; // 6018
/** InvalidMessageVersion: Invalid message version */
exports.MESSAGE_TRANSMITTER_V2_ERROR__INVALID_MESSAGE_VERSION = 0x1783; // 6019
/** InvalidUsedNoncesAccount: Invalid used nonces account */
exports.MESSAGE_TRANSMITTER_V2_ERROR__INVALID_USED_NONCES_ACCOUNT = 0x1784; // 6020
/** InvalidRecipientProgram: Invalid recipient program */
exports.MESSAGE_TRANSMITTER_V2_ERROR__INVALID_RECIPIENT_PROGRAM = 0x1785; // 6021
/** InvalidNonce: Invalid nonce */
exports.MESSAGE_TRANSMITTER_V2_ERROR__INVALID_NONCE = 0x1786; // 6022
/** NonceAlreadyUsed: Nonce already used */
exports.MESSAGE_TRANSMITTER_V2_ERROR__NONCE_ALREADY_USED = 0x1787; // 6023
/** MessageTooShort: Message is too short */
exports.MESSAGE_TRANSMITTER_V2_ERROR__MESSAGE_TOO_SHORT = 0x1788; // 6024
/** MalformedMessage: Malformed message */
exports.MESSAGE_TRANSMITTER_V2_ERROR__MALFORMED_MESSAGE = 0x1789; // 6025
/** InvalidSignatureOrderOrDupe: Invalid signature order or dupe */
exports.MESSAGE_TRANSMITTER_V2_ERROR__INVALID_SIGNATURE_ORDER_OR_DUPE = 0x178a; // 6026
/** InvalidAttesterSignature: Invalid attester signature */
exports.MESSAGE_TRANSMITTER_V2_ERROR__INVALID_ATTESTER_SIGNATURE = 0x178b; // 6027
/** InvalidAttestationLength: Invalid attestation length */
exports.MESSAGE_TRANSMITTER_V2_ERROR__INVALID_ATTESTATION_LENGTH = 0x178c; // 6028
/** InvalidSignatureRecoveryId: Invalid signature recovery ID */
exports.MESSAGE_TRANSMITTER_V2_ERROR__INVALID_SIGNATURE_RECOVERY_ID = 0x178d; // 6029
/** InvalidSignatureSValue: Invalid signature S value */
exports.MESSAGE_TRANSMITTER_V2_ERROR__INVALID_SIGNATURE_S_VALUE = 0x178e; // 6030
/** InvalidMessageHash: Invalid message hash */
exports.MESSAGE_TRANSMITTER_V2_ERROR__INVALID_MESSAGE_HASH = 0x178f; // 6031
/** InvalidDestinationMessage: Invalid destination message */
exports.MESSAGE_TRANSMITTER_V2_ERROR__INVALID_DESTINATION_MESSAGE = 0x1790; // 6032
/** EventAccountWindowNotExpired: Event account window not expired */
exports.MESSAGE_TRANSMITTER_V2_ERROR__EVENT_ACCOUNT_WINDOW_NOT_EXPIRED = 0x1791; // 6033
/** DestinationDomainIsLocalDomain: Destination domain is local domain */
exports.MESSAGE_TRANSMITTER_V2_ERROR__DESTINATION_DOMAIN_IS_LOCAL_DOMAIN = 0x1792; // 6034
let messageTransmitterV2ErrorMessages;
if (process.env.NODE_ENV !== 'production') {
    messageTransmitterV2ErrorMessages = {
        [exports.MESSAGE_TRANSMITTER_V2_ERROR__ATTESTER_ALREADY_DISABLED]: `Attester already disabled`,
        [exports.MESSAGE_TRANSMITTER_V2_ERROR__ATTESTER_ALREADY_ENABLED]: `Attester already enabled`,
        [exports.MESSAGE_TRANSMITTER_V2_ERROR__DESTINATION_DOMAIN_IS_LOCAL_DOMAIN]: `Destination domain is local domain`,
        [exports.MESSAGE_TRANSMITTER_V2_ERROR__EVENT_ACCOUNT_WINDOW_NOT_EXPIRED]: `Event account window not expired`,
        [exports.MESSAGE_TRANSMITTER_V2_ERROR__INVALID_ATTESTATION_LENGTH]: `Invalid attestation length`,
        [exports.MESSAGE_TRANSMITTER_V2_ERROR__INVALID_ATTESTER]: `Invalid attester`,
        [exports.MESSAGE_TRANSMITTER_V2_ERROR__INVALID_ATTESTER_MANAGER]: `Invalid attester manager`,
        [exports.MESSAGE_TRANSMITTER_V2_ERROR__INVALID_ATTESTER_SIGNATURE]: `Invalid attester signature`,
        [exports.MESSAGE_TRANSMITTER_V2_ERROR__INVALID_AUTHORITY]: `Invalid authority`,
        [exports.MESSAGE_TRANSMITTER_V2_ERROR__INVALID_DESTINATION_CALLER]: `Invalid destination caller`,
        [exports.MESSAGE_TRANSMITTER_V2_ERROR__INVALID_DESTINATION_DOMAIN]: `Invalid destination domain`,
        [exports.MESSAGE_TRANSMITTER_V2_ERROR__INVALID_DESTINATION_MESSAGE]: `Invalid destination message`,
        [exports.MESSAGE_TRANSMITTER_V2_ERROR__INVALID_MESSAGE_HASH]: `Invalid message hash`,
        [exports.MESSAGE_TRANSMITTER_V2_ERROR__INVALID_MESSAGE_TRANSMITTER_STATE]: `Invalid message transmitter state`,
        [exports.MESSAGE_TRANSMITTER_V2_ERROR__INVALID_MESSAGE_VERSION]: `Invalid message version`,
        [exports.MESSAGE_TRANSMITTER_V2_ERROR__INVALID_NONCE]: `Invalid nonce`,
        [exports.MESSAGE_TRANSMITTER_V2_ERROR__INVALID_OWNER]: `Invalid owner`,
        [exports.MESSAGE_TRANSMITTER_V2_ERROR__INVALID_PAUSER]: `Invalid pauser`,
        [exports.MESSAGE_TRANSMITTER_V2_ERROR__INVALID_RECIPIENT]: `Invalid message recipient`,
        [exports.MESSAGE_TRANSMITTER_V2_ERROR__INVALID_RECIPIENT_PROGRAM]: `Invalid recipient program`,
        [exports.MESSAGE_TRANSMITTER_V2_ERROR__INVALID_SIGNATURE_ORDER_OR_DUPE]: `Invalid signature order or dupe`,
        [exports.MESSAGE_TRANSMITTER_V2_ERROR__INVALID_SIGNATURE_RECOVERY_ID]: `Invalid signature recovery ID`,
        [exports.MESSAGE_TRANSMITTER_V2_ERROR__INVALID_SIGNATURE_S_VALUE]: `Invalid signature S value`,
        [exports.MESSAGE_TRANSMITTER_V2_ERROR__INVALID_SIGNATURE_THRESHOLD]: `Invalid signature threshold`,
        [exports.MESSAGE_TRANSMITTER_V2_ERROR__INVALID_SOURCE_DOMAIN]: `Invalid source domain`,
        [exports.MESSAGE_TRANSMITTER_V2_ERROR__INVALID_USED_NONCES_ACCOUNT]: `Invalid used nonces account`,
        [exports.MESSAGE_TRANSMITTER_V2_ERROR__MALFORMED_MESSAGE]: `Malformed message`,
        [exports.MESSAGE_TRANSMITTER_V2_ERROR__MESSAGE_BODY_LIMIT_EXCEEDED]: `Message body exceeds max size`,
        [exports.MESSAGE_TRANSMITTER_V2_ERROR__MESSAGE_TOO_SHORT]: `Message is too short`,
        [exports.MESSAGE_TRANSMITTER_V2_ERROR__NONCE_ALREADY_USED]: `Nonce already used`,
        [exports.MESSAGE_TRANSMITTER_V2_ERROR__PROGRAM_PAUSED]: `Instruction is not allowed at this time`,
        [exports.MESSAGE_TRANSMITTER_V2_ERROR__SENDER_NOT_PERMITTED]: `Sender is not permitted`,
        [exports.MESSAGE_TRANSMITTER_V2_ERROR__SIGNATURE_THRESHOLD_ALREADY_SET]: `Signature threshold already set`,
        [exports.MESSAGE_TRANSMITTER_V2_ERROR__SIGNATURE_THRESHOLD_TOO_LOW]: `Signature threshold is too low`,
        [exports.MESSAGE_TRANSMITTER_V2_ERROR__TOO_FEW_ENABLED_ATTESTERS]: `Too few enabled attesters`,
    };
}
function getMessageTransmitterV2ErrorMessage(code) {
    if (process.env.NODE_ENV !== 'production') {
        return messageTransmitterV2ErrorMessages[code];
    }
    return 'Error message not available in production bundles.';
}
function isMessageTransmitterV2Error(error, transactionMessage, code) {
    return (0, kit_1.isProgramError)(error, transactionMessage, programs_1.MESSAGE_TRANSMITTER_V2_PROGRAM_ADDRESS, code);
}
