"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_OUTPUT_TOKEN = exports.SVM_SPOKE_ERROR__INVALID_EXCLUSIVE_RELAYER = exports.SVM_SPOKE_ERROR__INSUFFICIENT_SPOKE_POOL_BALANCE_TO_EXECUTE_LEAF = exports.SVM_SPOKE_ERROR__FILLS_ARE_PAUSED = exports.SVM_SPOKE_ERROR__DEPOSITS_ARE_PAUSED = exports.SVM_SPOKE_ERROR__CLAIMED_MERKLE_LEAF = exports.SVM_SPOKE_ERROR__INVALID_MERKLE_LEAF = exports.SVM_SPOKE_ERROR__INVALID_CHAIN_ID = exports.SVM_SPOKE_ERROR__INVALID_MERKLE_PROOF = exports.SVM_SPOKE_ERROR__EXPIRED_FILL_DEADLINE = exports.SVM_SPOKE_ERROR__INVALID_SLOW_FILL_REQUEST = exports.SVM_SPOKE_ERROR__RELAY_FILLED = exports.SVM_SPOKE_ERROR__NO_SLOW_FILLS_IN_EXCLUSIVITY_WINDOW = exports.SVM_SPOKE_ERROR__NOT_EXCLUSIVE_RELAYER = exports.SVM_SPOKE_ERROR__INVALID_FILL_DEADLINE = exports.SVM_SPOKE_ERROR__INVALID_QUOTE_TIMESTAMP = void 0;
exports.getSvmSpokeErrorMessage = getSvmSpokeErrorMessage;
exports.isSvmSpokeError = isSvmSpokeError;
const kit_1 = require("@solana/kit");
const programs_1 = require("../programs");
/** InvalidQuoteTimestamp: Invalid quote timestamp! */
exports.SVM_SPOKE_ERROR__INVALID_QUOTE_TIMESTAMP = 0x1770; // 6000
/** InvalidFillDeadline: Invalid fill deadline! */
exports.SVM_SPOKE_ERROR__INVALID_FILL_DEADLINE = 0x1771; // 6001
/** NotExclusiveRelayer: Caller is not the exclusive relayer and exclusivity deadline has not passed! */
exports.SVM_SPOKE_ERROR__NOT_EXCLUSIVE_RELAYER = 0x1772; // 6002
/** NoSlowFillsInExclusivityWindow: The Deposit is still within the exclusivity window! */
exports.SVM_SPOKE_ERROR__NO_SLOW_FILLS_IN_EXCLUSIVITY_WINDOW = 0x1773; // 6003
/** RelayFilled: The relay has already been filled! */
exports.SVM_SPOKE_ERROR__RELAY_FILLED = 0x1774; // 6004
/** InvalidSlowFillRequest: Slow fill requires status of Unfilled! */
exports.SVM_SPOKE_ERROR__INVALID_SLOW_FILL_REQUEST = 0x1775; // 6005
/** ExpiredFillDeadline: The fill deadline has passed! */
exports.SVM_SPOKE_ERROR__EXPIRED_FILL_DEADLINE = 0x1776; // 6006
/** InvalidMerkleProof: Invalid Merkle proof! */
exports.SVM_SPOKE_ERROR__INVALID_MERKLE_PROOF = 0x1777; // 6007
/** InvalidChainId: Invalid chain id! */
exports.SVM_SPOKE_ERROR__INVALID_CHAIN_ID = 0x1778; // 6008
/** InvalidMerkleLeaf: Invalid Merkle leaf! */
exports.SVM_SPOKE_ERROR__INVALID_MERKLE_LEAF = 0x1779; // 6009
/** ClaimedMerkleLeaf: Leaf already claimed! */
exports.SVM_SPOKE_ERROR__CLAIMED_MERKLE_LEAF = 0x177a; // 6010
/** DepositsArePaused: Deposits are currently paused! */
exports.SVM_SPOKE_ERROR__DEPOSITS_ARE_PAUSED = 0x177b; // 6011
/** FillsArePaused: Fills are currently paused! */
exports.SVM_SPOKE_ERROR__FILLS_ARE_PAUSED = 0x177c; // 6012
/** InsufficientSpokePoolBalanceToExecuteLeaf: Insufficient spoke pool balance to execute leaf */
exports.SVM_SPOKE_ERROR__INSUFFICIENT_SPOKE_POOL_BALANCE_TO_EXECUTE_LEAF = 0x177d; // 6013
/** InvalidExclusiveRelayer: Invalid exclusive relayer! */
exports.SVM_SPOKE_ERROR__INVALID_EXCLUSIVE_RELAYER = 0x177e; // 6014
/** InvalidOutputToken: Invalid output token! */
exports.SVM_SPOKE_ERROR__INVALID_OUTPUT_TOKEN = 0x177f; // 6015
let svmSpokeErrorMessages;
if (process.env.NODE_ENV !== 'production') {
    svmSpokeErrorMessages = {
        [exports.SVM_SPOKE_ERROR__CLAIMED_MERKLE_LEAF]: `Leaf already claimed!`,
        [exports.SVM_SPOKE_ERROR__DEPOSITS_ARE_PAUSED]: `Deposits are currently paused!`,
        [exports.SVM_SPOKE_ERROR__EXPIRED_FILL_DEADLINE]: `The fill deadline has passed!`,
        [exports.SVM_SPOKE_ERROR__FILLS_ARE_PAUSED]: `Fills are currently paused!`,
        [exports.SVM_SPOKE_ERROR__INSUFFICIENT_SPOKE_POOL_BALANCE_TO_EXECUTE_LEAF]: `Insufficient spoke pool balance to execute leaf`,
        [exports.SVM_SPOKE_ERROR__INVALID_CHAIN_ID]: `Invalid chain id!`,
        [exports.SVM_SPOKE_ERROR__INVALID_EXCLUSIVE_RELAYER]: `Invalid exclusive relayer!`,
        [exports.SVM_SPOKE_ERROR__INVALID_FILL_DEADLINE]: `Invalid fill deadline!`,
        [exports.SVM_SPOKE_ERROR__INVALID_MERKLE_LEAF]: `Invalid Merkle leaf!`,
        [exports.SVM_SPOKE_ERROR__INVALID_MERKLE_PROOF]: `Invalid Merkle proof!`,
        [exports.SVM_SPOKE_ERROR__INVALID_OUTPUT_TOKEN]: `Invalid output token!`,
        [exports.SVM_SPOKE_ERROR__INVALID_QUOTE_TIMESTAMP]: `Invalid quote timestamp!`,
        [exports.SVM_SPOKE_ERROR__INVALID_SLOW_FILL_REQUEST]: `Slow fill requires status of Unfilled!`,
        [exports.SVM_SPOKE_ERROR__NO_SLOW_FILLS_IN_EXCLUSIVITY_WINDOW]: `The Deposit is still within the exclusivity window!`,
        [exports.SVM_SPOKE_ERROR__NOT_EXCLUSIVE_RELAYER]: `Caller is not the exclusive relayer and exclusivity deadline has not passed!`,
        [exports.SVM_SPOKE_ERROR__RELAY_FILLED]: `The relay has already been filled!`,
    };
}
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, kit_1.isProgramError)(error, transactionMessage, programs_1.SVM_SPOKE_PROGRAM_ADDRESS, code);
}
