"use strict";
var _a;
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;
var kit_1 = require("@solana/kit");
var programs_1 = require("../programs");
exports.MESSAGE_TRANSMITTER_V2_ERROR__INVALID_AUTHORITY = 0x1770;
exports.MESSAGE_TRANSMITTER_V2_ERROR__PROGRAM_PAUSED = 0x1771;
exports.MESSAGE_TRANSMITTER_V2_ERROR__INVALID_MESSAGE_TRANSMITTER_STATE = 0x1772;
exports.MESSAGE_TRANSMITTER_V2_ERROR__INVALID_SIGNATURE_THRESHOLD = 0x1773;
exports.MESSAGE_TRANSMITTER_V2_ERROR__SIGNATURE_THRESHOLD_ALREADY_SET = 0x1774;
exports.MESSAGE_TRANSMITTER_V2_ERROR__INVALID_OWNER = 0x1775;
exports.MESSAGE_TRANSMITTER_V2_ERROR__INVALID_PAUSER = 0x1776;
exports.MESSAGE_TRANSMITTER_V2_ERROR__INVALID_ATTESTER_MANAGER = 0x1777;
exports.MESSAGE_TRANSMITTER_V2_ERROR__INVALID_ATTESTER = 0x1778;
exports.MESSAGE_TRANSMITTER_V2_ERROR__ATTESTER_ALREADY_ENABLED = 0x1779;
exports.MESSAGE_TRANSMITTER_V2_ERROR__TOO_FEW_ENABLED_ATTESTERS = 0x177a;
exports.MESSAGE_TRANSMITTER_V2_ERROR__SIGNATURE_THRESHOLD_TOO_LOW = 0x177b;
exports.MESSAGE_TRANSMITTER_V2_ERROR__ATTESTER_ALREADY_DISABLED = 0x177c;
exports.MESSAGE_TRANSMITTER_V2_ERROR__MESSAGE_BODY_LIMIT_EXCEEDED = 0x177d;
exports.MESSAGE_TRANSMITTER_V2_ERROR__INVALID_DESTINATION_CALLER = 0x177e;
exports.MESSAGE_TRANSMITTER_V2_ERROR__INVALID_RECIPIENT = 0x177f;
exports.MESSAGE_TRANSMITTER_V2_ERROR__SENDER_NOT_PERMITTED = 0x1780;
exports.MESSAGE_TRANSMITTER_V2_ERROR__INVALID_SOURCE_DOMAIN = 0x1781;
exports.MESSAGE_TRANSMITTER_V2_ERROR__INVALID_DESTINATION_DOMAIN = 0x1782;
exports.MESSAGE_TRANSMITTER_V2_ERROR__INVALID_MESSAGE_VERSION = 0x1783;
exports.MESSAGE_TRANSMITTER_V2_ERROR__INVALID_USED_NONCES_ACCOUNT = 0x1784;
exports.MESSAGE_TRANSMITTER_V2_ERROR__INVALID_RECIPIENT_PROGRAM = 0x1785;
exports.MESSAGE_TRANSMITTER_V2_ERROR__INVALID_NONCE = 0x1786;
exports.MESSAGE_TRANSMITTER_V2_ERROR__NONCE_ALREADY_USED = 0x1787;
exports.MESSAGE_TRANSMITTER_V2_ERROR__MESSAGE_TOO_SHORT = 0x1788;
exports.MESSAGE_TRANSMITTER_V2_ERROR__MALFORMED_MESSAGE = 0x1789;
exports.MESSAGE_TRANSMITTER_V2_ERROR__INVALID_SIGNATURE_ORDER_OR_DUPE = 0x178a;
exports.MESSAGE_TRANSMITTER_V2_ERROR__INVALID_ATTESTER_SIGNATURE = 0x178b;
exports.MESSAGE_TRANSMITTER_V2_ERROR__INVALID_ATTESTATION_LENGTH = 0x178c;
exports.MESSAGE_TRANSMITTER_V2_ERROR__INVALID_SIGNATURE_RECOVERY_ID = 0x178d;
exports.MESSAGE_TRANSMITTER_V2_ERROR__INVALID_SIGNATURE_S_VALUE = 0x178e;
exports.MESSAGE_TRANSMITTER_V2_ERROR__INVALID_MESSAGE_HASH = 0x178f;
exports.MESSAGE_TRANSMITTER_V2_ERROR__INVALID_DESTINATION_MESSAGE = 0x1790;
exports.MESSAGE_TRANSMITTER_V2_ERROR__EVENT_ACCOUNT_WINDOW_NOT_EXPIRED = 0x1791;
exports.MESSAGE_TRANSMITTER_V2_ERROR__DESTINATION_DOMAIN_IS_LOCAL_DOMAIN = 0x1792;
var messageTransmitterV2ErrorMessages;
if (process.env.NODE_ENV !== "production") {
    messageTransmitterV2ErrorMessages = (_a = {},
        _a[exports.MESSAGE_TRANSMITTER_V2_ERROR__ATTESTER_ALREADY_DISABLED] = "Attester already disabled",
        _a[exports.MESSAGE_TRANSMITTER_V2_ERROR__ATTESTER_ALREADY_ENABLED] = "Attester already enabled",
        _a[exports.MESSAGE_TRANSMITTER_V2_ERROR__DESTINATION_DOMAIN_IS_LOCAL_DOMAIN] = "Destination domain is local domain",
        _a[exports.MESSAGE_TRANSMITTER_V2_ERROR__EVENT_ACCOUNT_WINDOW_NOT_EXPIRED] = "Event account window not expired",
        _a[exports.MESSAGE_TRANSMITTER_V2_ERROR__INVALID_ATTESTATION_LENGTH] = "Invalid attestation length",
        _a[exports.MESSAGE_TRANSMITTER_V2_ERROR__INVALID_ATTESTER] = "Invalid attester",
        _a[exports.MESSAGE_TRANSMITTER_V2_ERROR__INVALID_ATTESTER_MANAGER] = "Invalid attester manager",
        _a[exports.MESSAGE_TRANSMITTER_V2_ERROR__INVALID_ATTESTER_SIGNATURE] = "Invalid attester signature",
        _a[exports.MESSAGE_TRANSMITTER_V2_ERROR__INVALID_AUTHORITY] = "Invalid authority",
        _a[exports.MESSAGE_TRANSMITTER_V2_ERROR__INVALID_DESTINATION_CALLER] = "Invalid destination caller",
        _a[exports.MESSAGE_TRANSMITTER_V2_ERROR__INVALID_DESTINATION_DOMAIN] = "Invalid destination domain",
        _a[exports.MESSAGE_TRANSMITTER_V2_ERROR__INVALID_DESTINATION_MESSAGE] = "Invalid destination message",
        _a[exports.MESSAGE_TRANSMITTER_V2_ERROR__INVALID_MESSAGE_HASH] = "Invalid message hash",
        _a[exports.MESSAGE_TRANSMITTER_V2_ERROR__INVALID_MESSAGE_TRANSMITTER_STATE] = "Invalid message transmitter state",
        _a[exports.MESSAGE_TRANSMITTER_V2_ERROR__INVALID_MESSAGE_VERSION] = "Invalid message version",
        _a[exports.MESSAGE_TRANSMITTER_V2_ERROR__INVALID_NONCE] = "Invalid nonce",
        _a[exports.MESSAGE_TRANSMITTER_V2_ERROR__INVALID_OWNER] = "Invalid owner",
        _a[exports.MESSAGE_TRANSMITTER_V2_ERROR__INVALID_PAUSER] = "Invalid pauser",
        _a[exports.MESSAGE_TRANSMITTER_V2_ERROR__INVALID_RECIPIENT] = "Invalid message recipient",
        _a[exports.MESSAGE_TRANSMITTER_V2_ERROR__INVALID_RECIPIENT_PROGRAM] = "Invalid recipient program",
        _a[exports.MESSAGE_TRANSMITTER_V2_ERROR__INVALID_SIGNATURE_ORDER_OR_DUPE] = "Invalid signature order or dupe",
        _a[exports.MESSAGE_TRANSMITTER_V2_ERROR__INVALID_SIGNATURE_RECOVERY_ID] = "Invalid signature recovery ID",
        _a[exports.MESSAGE_TRANSMITTER_V2_ERROR__INVALID_SIGNATURE_S_VALUE] = "Invalid signature S value",
        _a[exports.MESSAGE_TRANSMITTER_V2_ERROR__INVALID_SIGNATURE_THRESHOLD] = "Invalid signature threshold",
        _a[exports.MESSAGE_TRANSMITTER_V2_ERROR__INVALID_SOURCE_DOMAIN] = "Invalid source domain",
        _a[exports.MESSAGE_TRANSMITTER_V2_ERROR__INVALID_USED_NONCES_ACCOUNT] = "Invalid used nonces account",
        _a[exports.MESSAGE_TRANSMITTER_V2_ERROR__MALFORMED_MESSAGE] = "Malformed message",
        _a[exports.MESSAGE_TRANSMITTER_V2_ERROR__MESSAGE_BODY_LIMIT_EXCEEDED] = "Message body exceeds max size",
        _a[exports.MESSAGE_TRANSMITTER_V2_ERROR__MESSAGE_TOO_SHORT] = "Message is too short",
        _a[exports.MESSAGE_TRANSMITTER_V2_ERROR__NONCE_ALREADY_USED] = "Nonce already used",
        _a[exports.MESSAGE_TRANSMITTER_V2_ERROR__PROGRAM_PAUSED] = "Instruction is not allowed at this time",
        _a[exports.MESSAGE_TRANSMITTER_V2_ERROR__SENDER_NOT_PERMITTED] = "Sender is not permitted",
        _a[exports.MESSAGE_TRANSMITTER_V2_ERROR__SIGNATURE_THRESHOLD_ALREADY_SET] = "Signature threshold already set",
        _a[exports.MESSAGE_TRANSMITTER_V2_ERROR__SIGNATURE_THRESHOLD_TOO_LOW] = "Signature threshold is too low",
        _a[exports.MESSAGE_TRANSMITTER_V2_ERROR__TOO_FEW_ENABLED_ATTESTERS] = "Too few enabled attesters",
        _a);
}
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);
}
//# sourceMappingURL=messageTransmitterV2.js.map