"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.SVM_SPOKE_ERROR__INVALID_A_T_A_CREATION_ACCOUNTS = exports.SVM_SPOKE_ERROR__INVALID_PRODUCTION_SEED = exports.SVM_SPOKE_ERROR__INVALID_REFUND_TOKEN_ACCOUNT = exports.SVM_SPOKE_ERROR__INVALID_CLAIM_INITIALIZER = exports.SVM_SPOKE_ERROR__NON_ZERO_REFUND_CLAIM = exports.SVM_SPOKE_ERROR__ZERO_REFUND_CLAIM = exports.SVM_SPOKE_ERROR__INVALID_REFUND = exports.SVM_SPOKE_ERROR__PARAMS_WRITE_OVERFLOW = exports.SVM_SPOKE_ERROR__EXCEEDED_PENDING_BRIDGE_AMOUNT = exports.SVM_SPOKE_ERROR__INVALID_MINT = exports.SVM_SPOKE_ERROR__INVALID_REMOTE_SENDER = exports.SVM_SPOKE_ERROR__INVALID_REMOTE_DOMAIN = exports.SVM_SPOKE_ERROR__CANNOT_SET_CURRENT_TIME = exports.SVM_SPOKE_ERROR__NOT_RELAYER = exports.SVM_SPOKE_ERROR__CAN_ONLY_CLOSE_FILL_STATUS_PDA_IF_FILL_DEADLINE_PASSED = exports.SVM_SPOKE_ERROR__INVALID_RELAY_HASH = exports.SVM_SPOKE_ERROR__NOT_OWNER = void 0;
exports.getSvmSpokeErrorMessage = getSvmSpokeErrorMessage;
exports.isSvmSpokeError = isSvmSpokeError;
const web3_v2_js_1 = require("@solana/web3-v2.js");
const programs_1 = require("../programs");
/** NotOwner: Only the owner can call this function! */
exports.SVM_SPOKE_ERROR__NOT_OWNER = 0x1770; // 6000
/** InvalidRelayHash: Invalid relay hash! */
exports.SVM_SPOKE_ERROR__INVALID_RELAY_HASH = 0x1771; // 6001
/** CanOnlyCloseFillStatusPdaIfFillDeadlinePassed: The fill deadline has not passed! */
exports.SVM_SPOKE_ERROR__CAN_ONLY_CLOSE_FILL_STATUS_PDA_IF_FILL_DEADLINE_PASSED = 0x1772; // 6002
/** NotRelayer: The caller is not the relayer! */
exports.SVM_SPOKE_ERROR__NOT_RELAYER = 0x1773; // 6003
/** CannotSetCurrentTime: Cannot set time if not in test mode! */
exports.SVM_SPOKE_ERROR__CANNOT_SET_CURRENT_TIME = 0x1774; // 6004
/** InvalidRemoteDomain: Invalid remote domain! */
exports.SVM_SPOKE_ERROR__INVALID_REMOTE_DOMAIN = 0x1775; // 6005
/** InvalidRemoteSender: Invalid remote sender! */
exports.SVM_SPOKE_ERROR__INVALID_REMOTE_SENDER = 0x1776; // 6006
/** InvalidMint: Invalid mint! */
exports.SVM_SPOKE_ERROR__INVALID_MINT = 0x1777; // 6007
/** ExceededPendingBridgeAmount: Exceeded pending bridge amount to HubPool! */
exports.SVM_SPOKE_ERROR__EXCEEDED_PENDING_BRIDGE_AMOUNT = 0x1778; // 6008
/** ParamsWriteOverflow: Overflow writing to parameters account! */
exports.SVM_SPOKE_ERROR__PARAMS_WRITE_OVERFLOW = 0x1779; // 6009
/** InvalidRefund: Invalid refund address! */
exports.SVM_SPOKE_ERROR__INVALID_REFUND = 0x177a; // 6010
/** ZeroRefundClaim: Zero relayer refund claim! */
exports.SVM_SPOKE_ERROR__ZERO_REFUND_CLAIM = 0x177b; // 6011
/** NonZeroRefundClaim: Cannot close non-zero relayer refund claim! */
exports.SVM_SPOKE_ERROR__NON_ZERO_REFUND_CLAIM = 0x177c; // 6012
/** InvalidClaimInitializer: Invalid claim initializer! */
exports.SVM_SPOKE_ERROR__INVALID_CLAIM_INITIALIZER = 0x177d; // 6013
/** InvalidRefundTokenAccount: Invalid refund token account! */
exports.SVM_SPOKE_ERROR__INVALID_REFUND_TOKEN_ACCOUNT = 0x177e; // 6014
/** InvalidProductionSeed: Seed must be 0 in production! */
exports.SVM_SPOKE_ERROR__INVALID_PRODUCTION_SEED = 0x177f; // 6015
/** InvalidATACreationAccounts: Invalid remaining accounts for ATA creation! */
exports.SVM_SPOKE_ERROR__INVALID_A_T_A_CREATION_ACCOUNTS = 0x1780; // 6016
let svmSpokeErrorMessages;
if (process.env.NODE_ENV !== 'production') {
    svmSpokeErrorMessages = {
        [exports.SVM_SPOKE_ERROR__CANNOT_SET_CURRENT_TIME]: `Cannot set time if not in test mode!`,
        [exports.SVM_SPOKE_ERROR__CAN_ONLY_CLOSE_FILL_STATUS_PDA_IF_FILL_DEADLINE_PASSED]: `The fill deadline has not passed!`,
        [exports.SVM_SPOKE_ERROR__EXCEEDED_PENDING_BRIDGE_AMOUNT]: `Exceeded pending bridge amount to HubPool!`,
        [exports.SVM_SPOKE_ERROR__INVALID_A_T_A_CREATION_ACCOUNTS]: `Invalid remaining accounts for ATA creation!`,
        [exports.SVM_SPOKE_ERROR__INVALID_CLAIM_INITIALIZER]: `Invalid claim initializer!`,
        [exports.SVM_SPOKE_ERROR__INVALID_MINT]: `Invalid mint!`,
        [exports.SVM_SPOKE_ERROR__INVALID_PRODUCTION_SEED]: `Seed must be 0 in production!`,
        [exports.SVM_SPOKE_ERROR__INVALID_REFUND]: `Invalid refund address!`,
        [exports.SVM_SPOKE_ERROR__INVALID_REFUND_TOKEN_ACCOUNT]: `Invalid refund token account!`,
        [exports.SVM_SPOKE_ERROR__INVALID_RELAY_HASH]: `Invalid relay hash!`,
        [exports.SVM_SPOKE_ERROR__INVALID_REMOTE_DOMAIN]: `Invalid remote domain!`,
        [exports.SVM_SPOKE_ERROR__INVALID_REMOTE_SENDER]: `Invalid remote sender!`,
        [exports.SVM_SPOKE_ERROR__NON_ZERO_REFUND_CLAIM]: `Cannot close non-zero relayer refund claim!`,
        [exports.SVM_SPOKE_ERROR__NOT_OWNER]: `Only the owner can call this function!`,
        [exports.SVM_SPOKE_ERROR__NOT_RELAYER]: `The caller is not the relayer!`,
        [exports.SVM_SPOKE_ERROR__PARAMS_WRITE_OVERFLOW]: `Overflow writing to parameters account!`,
        [exports.SVM_SPOKE_ERROR__ZERO_REFUND_CLAIM]: `Zero relayer refund claim!`,
    };
}
function getSvmSpokeErrorMessage(code) {
    if (process.env.NODE_ENV !== 'production') {
        return svmSpokeErrorMessages[code];
    }
    return 'Error message not available in production bundles.';
}
function isSvmSpokeError(error, transactionMessage, code) {
    return (0, web3_v2_js_1.isProgramError)(error, transactionMessage, programs_1.SVM_SPOKE_PROGRAM_ADDRESS, code);
}
