/** * 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 */ import { isProgramError, type Address, type SOLANA_ERROR__INSTRUCTION_ERROR__CUSTOM, type SolanaError, } from "@solana/kit"; import { SCOPE_PROGRAM_ADDRESS } from "../programs"; /** IntegerOverflow: Integer overflow */ export const SCOPE_ERROR__INTEGER_OVERFLOW = 0x1770; // 6000 /** ConversionFailure: Conversion failure */ export const SCOPE_ERROR__CONVERSION_FAILURE = 0x1771; // 6001 /** MathOverflow: Mathematical operation with overflow */ export const SCOPE_ERROR__MATH_OVERFLOW = 0x1772; // 6002 /** OutOfRangeIntegralConversion: Out of range integral conversion attempted */ export const SCOPE_ERROR__OUT_OF_RANGE_INTEGRAL_CONVERSION = 0x1773; // 6003 /** UnexpectedAccount: Unexpected account in instruction */ export const SCOPE_ERROR__UNEXPECTED_ACCOUNT = 0x1774; // 6004 /** PriceNotValid: Price is not valid */ export const SCOPE_ERROR__PRICE_NOT_VALID = 0x1775; // 6005 /** AccountsAndTokenMismatch: The number of tokens is different from the number of received accounts */ export const SCOPE_ERROR__ACCOUNTS_AND_TOKEN_MISMATCH = 0x1776; // 6006 /** BadTokenNb: The token index received is out of range */ export const SCOPE_ERROR__BAD_TOKEN_NB = 0x1777; // 6007 /** BadTokenType: The token type received is invalid */ export const SCOPE_ERROR__BAD_TOKEN_TYPE = 0x1778; // 6008 /** SwitchboardV2Error: There was an error with the Switchboard V2 retrieval */ export const SCOPE_ERROR__SWITCHBOARD_V2_ERROR = 0x1779; // 6009 /** InvalidAccountDiscriminator: Invalid account discriminator */ export const SCOPE_ERROR__INVALID_ACCOUNT_DISCRIMINATOR = 0x177a; // 6010 /** UnableToDeserializeAccount: Unable to deserialize account */ export const SCOPE_ERROR__UNABLE_TO_DESERIALIZE_ACCOUNT = 0x177b; // 6011 /** BadScopeChainOrPrices: Error while computing price with ScopeChain */ export const SCOPE_ERROR__BAD_SCOPE_CHAIN_OR_PRICES = 0x177c; // 6012 /** RefreshInCPI: Refresh price instruction called in a CPI */ export const SCOPE_ERROR__REFRESH_IN_C_P_I = 0x177d; // 6013 /** RefreshWithUnexpectedIxs: Refresh price instruction preceded by unexpected ixs */ export const SCOPE_ERROR__REFRESH_WITH_UNEXPECTED_IXS = 0x177e; // 6014 /** InvalidUpdateSequenceOrAccounts: Invalid update sequence or accounts */ export const SCOPE_ERROR__INVALID_UPDATE_SEQUENCE_OR_ACCOUNTS = 0x177f; // 6015 /** UnableToDerivePDA: Unable to derive PDA address */ export const SCOPE_ERROR__UNABLE_TO_DERIVE_P_D_A = 0x1780; // 6016 /** BadTimestamp: Invalid timestamp */ export const SCOPE_ERROR__BAD_TIMESTAMP = 0x1781; // 6017 /** BadSlot: Invalid slot */ export const SCOPE_ERROR__BAD_SLOT = 0x1782; // 6018 /** PriceAccountNotExpected: Received a price account when none is expected */ export const SCOPE_ERROR__PRICE_ACCOUNT_NOT_EXPECTED = 0x1783; // 6019 /** TwapSourceIndexOutOfRange: TWAP source index out of range */ export const SCOPE_ERROR__TWAP_SOURCE_INDEX_OUT_OF_RANGE = 0x1784; // 6020 /** TwapSampleTooFrequent: TWAP sample is too close to the previous one */ export const SCOPE_ERROR__TWAP_SAMPLE_TOO_FREQUENT = 0x1785; // 6021 /** UnexpectedJlpConfiguration: Unexpected JLP configuration */ export const SCOPE_ERROR__UNEXPECTED_JLP_CONFIGURATION = 0x1786; // 6022 /** TwapNotEnoughSamplesInPeriod: Not enough price samples in period to compute TWAP */ export const SCOPE_ERROR__TWAP_NOT_ENOUGH_SAMPLES_IN_PERIOD = 0x1787; // 6023 /** EmptyTokenList: The provided token list to refresh is empty */ export const SCOPE_ERROR__EMPTY_TOKEN_LIST = 0x1788; // 6024 /** StakeFeeTooHigh: The stake pool fee is higher than the maximum allowed */ export const SCOPE_ERROR__STAKE_FEE_TOO_HIGH = 0x1789; // 6025 /** KTokenUnderlyingPriceNotValid: Cannot get a valid price for the tokens composing the Ktoken */ export const SCOPE_ERROR__K_TOKEN_UNDERLYING_PRICE_NOT_VALID = 0x178a; // 6026 /** KTokenHoldingsCalculationError: Error while computing the Ktoken pool holdings */ export const SCOPE_ERROR__K_TOKEN_HOLDINGS_CALCULATION_ERROR = 0x178b; // 6027 /** CannotResizeAccount: Cannot resize the account we only allow it to grow in size */ export const SCOPE_ERROR__CANNOT_RESIZE_ACCOUNT = 0x178c; // 6028 /** FixedPriceInvalid: The provided fixed price is invalid */ export const SCOPE_ERROR__FIXED_PRICE_INVALID = 0x178d; // 6029 /** SwitchboardOnDemandError: Switchboard On Demand price derive error */ export const SCOPE_ERROR__SWITCHBOARD_ON_DEMAND_ERROR = 0x178e; // 6030 /** ConfidenceIntervalCheckFailed: Confidence interval check failed */ export const SCOPE_ERROR__CONFIDENCE_INTERVAL_CHECK_FAILED = 0x178f; // 6031 /** InvalidGenericData: Invalid generic data */ export const SCOPE_ERROR__INVALID_GENERIC_DATA = 0x1790; // 6032 /** NoChainlinkReportData: No valid Chainlink report data found */ export const SCOPE_ERROR__NO_CHAINLINK_REPORT_DATA = 0x1791; // 6033 /** InvalidChainlinkReportData: Invalid Chainlink report data format */ export const SCOPE_ERROR__INVALID_CHAINLINK_REPORT_DATA = 0x1792; // 6034 /** OracleConfigInvalidSourceIndices: Oracle config must contain at least one valid source index */ export const SCOPE_ERROR__ORACLE_CONFIG_INVALID_SOURCE_INDICES = 0x1793; // 6035 /** MostRecentOfInvalidMaxDivergence: Invalid max divergence (bps) for MostRecentOf oracle */ export const SCOPE_ERROR__MOST_RECENT_OF_INVALID_MAX_DIVERGENCE = 0x1794; // 6036 /** CompositeOracleInvalidMaxAge: Invalid max age (s) for composite oracle */ export const SCOPE_ERROR__COMPOSITE_ORACLE_INVALID_MAX_AGE = 0x1795; // 6037 /** CompositeOracleMaxAgeViolated: Max age constraint violated for composite oracle */ export const SCOPE_ERROR__COMPOSITE_ORACLE_MAX_AGE_VIOLATED = 0x1796; // 6038 /** MostRecentOfMaxDivergenceBpsViolated: Max divergence bps constraint violated for MostRecentOf oracle */ export const SCOPE_ERROR__MOST_RECENT_OF_MAX_DIVERGENCE_BPS_VIOLATED = 0x1797; // 6039 /** PythLazerVerifyIxFailed: The invoked pyth lazer verify instruction failed */ export const SCOPE_ERROR__PYTH_LAZER_VERIFY_IX_FAILED = 0x1798; // 6040 /** PythLazerInvalidFeedID: Invalid feed id passed in to PythLazer oracle */ export const SCOPE_ERROR__PYTH_LAZER_INVALID_FEED_I_D = 0x1799; // 6041 /** PythLazerInvalidExponent: Invalid exponent passed in to PythLazer oracle */ export const SCOPE_ERROR__PYTH_LAZER_INVALID_EXPONENT = 0x179a; // 6042 /** PythLazerInvalidConfidenceFactor: Invalid confidence factor passed in to PythLazer oracle */ export const SCOPE_ERROR__PYTH_LAZER_INVALID_CONFIDENCE_FACTOR = 0x179b; // 6043 /** PythLazerInvalidMessagePayload: Received an invalid message payload in the PythLazer oracle when refreshing price */ export const SCOPE_ERROR__PYTH_LAZER_INVALID_MESSAGE_PAYLOAD = 0x179c; // 6044 /** PythLazerInvalidChannel: Received an invalid channel in the PythLazer payload when refreshing price */ export const SCOPE_ERROR__PYTH_LAZER_INVALID_CHANNEL = 0x179d; // 6045 /** PythLazerInvalidFeedsLength: Payload should have a single feed in the PythLazer payload when refreshing price */ export const SCOPE_ERROR__PYTH_LAZER_INVALID_FEEDS_LENGTH = 0x179e; // 6046 /** PythLazerInvalidFeedId: Invalid feed id in the PythLazer payload when refreshing price */ export const SCOPE_ERROR__PYTH_LAZER_INVALID_FEED_ID = 0x179f; // 6047 /** PythLazerPriceNotPresent: Property fields in the feed of the PythLazer payload do not contain a price */ export const SCOPE_ERROR__PYTH_LAZER_PRICE_NOT_PRESENT = 0x17a0; // 6048 /** PythLazerBestBidPriceNotPresent: Property fields in the feed of the PythLazer payload do not contain a best bid price */ export const SCOPE_ERROR__PYTH_LAZER_BEST_BID_PRICE_NOT_PRESENT = 0x17a1; // 6049 /** PythLazerBestAskPriceNotPresent: Property fields in the feed of the PythLazer payload do not contain a best ask price */ export const SCOPE_ERROR__PYTH_LAZER_BEST_ASK_PRICE_NOT_PRESENT = 0x17a2; // 6050 /** PythLazerInvalidAskBidPrices: Invalid ask/bid prices provided in the feed of the PythLazer payload */ export const SCOPE_ERROR__PYTH_LAZER_INVALID_ASK_BID_PRICES = 0x17a3; // 6051 /** ExpectedPriceAccount: Price account expected when updating mapping */ export const SCOPE_ERROR__EXPECTED_PRICE_ACCOUNT = 0x17a4; // 6052 /** WrongAccountOwner: Provided account has a different owner than expected */ export const SCOPE_ERROR__WRONG_ACCOUNT_OWNER = 0x17a5; // 6053 /** CompositeOracleInvalidSourceIndex: Provided source index is invalid */ export const SCOPE_ERROR__COMPOSITE_ORACLE_INVALID_SOURCE_INDEX = 0x17a6; // 6054 /** CappedFlooredBothCapAndFloorAreNone: Can't set both cap and floor to None for CappedFloored oracle */ export const SCOPE_ERROR__CAPPED_FLOORED_BOTH_CAP_AND_FLOOR_ARE_NONE = 0x17a7; // 6055 /** MissingPriceAccount: Missing price account for Oracle Mapping update */ export const SCOPE_ERROR__MISSING_PRICE_ACCOUNT = 0x17a8; // 6056 /** ChainlinkXPriceNotSuspended: Cannot resume a ChainlinkX price that was not suspended */ export const SCOPE_ERROR__CHAINLINK_X_PRICE_NOT_SUSPENDED = 0x17a9; // 6057 /** OutsideMarketHours: Price update rejected as outside of market hours */ export const SCOPE_ERROR__OUTSIDE_MARKET_HOURS = 0x17aa; // 6058 /** PythLazerExponentNotPresent: Property fields in the feed of the PythLazer payload do not contain an exponent */ export const SCOPE_ERROR__PYTH_LAZER_EXPONENT_NOT_PRESENT = 0x17ab; // 6059 /** PythLazerUnexpectedExponent: The exponent provided in the feed of the PythLazer payload is not the expected one */ export const SCOPE_ERROR__PYTH_LAZER_UNEXPECTED_EXPONENT = 0x17ac; // 6060 /** InvalidConversionToEmaTypeForOracleType: Cannot convert oracle type to EMA type */ export const SCOPE_ERROR__INVALID_CONVERSION_TO_EMA_TYPE_FOR_ORACLE_TYPE = 0x17ad; // 6061 /** TwapEnabledBitmaskConversionFailure: Invalid TWAP enabled bitmask value */ export const SCOPE_ERROR__TWAP_ENABLED_BITMASK_CONVERSION_FAILURE = 0x17ae; // 6062 /** OperationNotSupported: This operation is not supported */ export const SCOPE_ERROR__OPERATION_NOT_SUPPORTED = 0x17af; // 6063 /** TwapSourceIndexNotSet: TWAP source index not set */ export const SCOPE_ERROR__TWAP_SOURCE_INDEX_NOT_SET = 0x17b0; // 6064 /** PythLazerFeedUpdateTimestampNotPresent: Property fields in the feed of the PythLazer payload do not contain a feed update timestamp */ export const SCOPE_ERROR__PYTH_LAZER_FEED_UPDATE_TIMESTAMP_NOT_PRESENT = 0x17b1; // 6065 /** PriceFrozen: Cannot update a frozen price entry */ export const SCOPE_ERROR__PRICE_FROZEN = 0x17b2; // 6066 /** PriceAlreadyFrozen: Price entry is already frozen */ export const SCOPE_ERROR__PRICE_ALREADY_FROZEN = 0x17b3; // 6067 /** PriceNotFrozen: Price entry is not frozen */ export const SCOPE_ERROR__PRICE_NOT_FROZEN = 0x17b4; // 6068 /** UnauthorizedFreeze: Signer is not authorized to freeze/unfreeze */ export const SCOPE_ERROR__UNAUTHORIZED_FREEZE = 0x17b5; // 6069 /** PythLazerEmaPriceNotPresent: Property fields in the feed of the PythLazer payload do not contain an EMA price */ export const SCOPE_ERROR__PYTH_LAZER_EMA_PRICE_NOT_PRESENT = 0x17b6; // 6070 /** PythLazerEmaConfidenceNotPresent: Property fields in the feed of the PythLazer payload do not contain an EMA confidence */ export const SCOPE_ERROR__PYTH_LAZER_EMA_CONFIDENCE_NOT_PRESENT = 0x17b7; // 6071 /** PythLazerEmaNotEnabledOnSource: PythLazerEMA source entry does not have EMA enabled */ export const SCOPE_ERROR__PYTH_LAZER_EMA_NOT_ENABLED_ON_SOURCE = 0x17b8; // 6072 /** UnauthorizedResume: Signer is not authorized to resume */ export const SCOPE_ERROR__UNAUTHORIZED_RESUME = 0x17b9; // 6073 /** PythLazerConfidenceNotPresent: Property fields in the feed of the PythLazer payload do not contain a confidence */ export const SCOPE_ERROR__PYTH_LAZER_CONFIDENCE_NOT_PRESENT = 0x17ba; // 6074 /** KlendCTokenExchangeRateCPIError: Klend cToken exchange rate CPI call failed */ export const SCOPE_ERROR__KLEND_C_TOKEN_EXCHANGE_RATE_C_P_I_ERROR = 0x17bb; // 6075 /** KlendReserveDeprecated: Klend reserve version does not match the expected program version (deprecated reserve) */ export const SCOPE_ERROR__KLEND_RESERVE_DEPRECATED = 0x17bc; // 6076 export type ScopeError = | typeof SCOPE_ERROR__ACCOUNTS_AND_TOKEN_MISMATCH | typeof SCOPE_ERROR__BAD_SCOPE_CHAIN_OR_PRICES | typeof SCOPE_ERROR__BAD_SLOT | typeof SCOPE_ERROR__BAD_TIMESTAMP | typeof SCOPE_ERROR__BAD_TOKEN_NB | typeof SCOPE_ERROR__BAD_TOKEN_TYPE | typeof SCOPE_ERROR__CANNOT_RESIZE_ACCOUNT | typeof SCOPE_ERROR__CAPPED_FLOORED_BOTH_CAP_AND_FLOOR_ARE_NONE | typeof SCOPE_ERROR__CHAINLINK_X_PRICE_NOT_SUSPENDED | typeof SCOPE_ERROR__COMPOSITE_ORACLE_INVALID_MAX_AGE | typeof SCOPE_ERROR__COMPOSITE_ORACLE_INVALID_SOURCE_INDEX | typeof SCOPE_ERROR__COMPOSITE_ORACLE_MAX_AGE_VIOLATED | typeof SCOPE_ERROR__CONFIDENCE_INTERVAL_CHECK_FAILED | typeof SCOPE_ERROR__CONVERSION_FAILURE | typeof SCOPE_ERROR__EMPTY_TOKEN_LIST | typeof SCOPE_ERROR__EXPECTED_PRICE_ACCOUNT | typeof SCOPE_ERROR__FIXED_PRICE_INVALID | typeof SCOPE_ERROR__INTEGER_OVERFLOW | typeof SCOPE_ERROR__INVALID_ACCOUNT_DISCRIMINATOR | typeof SCOPE_ERROR__INVALID_CHAINLINK_REPORT_DATA | typeof SCOPE_ERROR__INVALID_CONVERSION_TO_EMA_TYPE_FOR_ORACLE_TYPE | typeof SCOPE_ERROR__INVALID_GENERIC_DATA | typeof SCOPE_ERROR__INVALID_UPDATE_SEQUENCE_OR_ACCOUNTS | typeof SCOPE_ERROR__KLEND_C_TOKEN_EXCHANGE_RATE_C_P_I_ERROR | typeof SCOPE_ERROR__KLEND_RESERVE_DEPRECATED | typeof SCOPE_ERROR__K_TOKEN_HOLDINGS_CALCULATION_ERROR | typeof SCOPE_ERROR__K_TOKEN_UNDERLYING_PRICE_NOT_VALID | typeof SCOPE_ERROR__MATH_OVERFLOW | typeof SCOPE_ERROR__MISSING_PRICE_ACCOUNT | typeof SCOPE_ERROR__MOST_RECENT_OF_INVALID_MAX_DIVERGENCE | typeof SCOPE_ERROR__MOST_RECENT_OF_MAX_DIVERGENCE_BPS_VIOLATED | typeof SCOPE_ERROR__NO_CHAINLINK_REPORT_DATA | typeof SCOPE_ERROR__OPERATION_NOT_SUPPORTED | typeof SCOPE_ERROR__ORACLE_CONFIG_INVALID_SOURCE_INDICES | typeof SCOPE_ERROR__OUT_OF_RANGE_INTEGRAL_CONVERSION | typeof SCOPE_ERROR__OUTSIDE_MARKET_HOURS | typeof SCOPE_ERROR__PRICE_ACCOUNT_NOT_EXPECTED | typeof SCOPE_ERROR__PRICE_ALREADY_FROZEN | typeof SCOPE_ERROR__PRICE_FROZEN | typeof SCOPE_ERROR__PRICE_NOT_FROZEN | typeof SCOPE_ERROR__PRICE_NOT_VALID | typeof SCOPE_ERROR__PYTH_LAZER_BEST_ASK_PRICE_NOT_PRESENT | typeof SCOPE_ERROR__PYTH_LAZER_BEST_BID_PRICE_NOT_PRESENT | typeof SCOPE_ERROR__PYTH_LAZER_CONFIDENCE_NOT_PRESENT | typeof SCOPE_ERROR__PYTH_LAZER_EMA_CONFIDENCE_NOT_PRESENT | typeof SCOPE_ERROR__PYTH_LAZER_EMA_NOT_ENABLED_ON_SOURCE | typeof SCOPE_ERROR__PYTH_LAZER_EMA_PRICE_NOT_PRESENT | typeof SCOPE_ERROR__PYTH_LAZER_EXPONENT_NOT_PRESENT | typeof SCOPE_ERROR__PYTH_LAZER_FEED_UPDATE_TIMESTAMP_NOT_PRESENT | typeof SCOPE_ERROR__PYTH_LAZER_INVALID_ASK_BID_PRICES | typeof SCOPE_ERROR__PYTH_LAZER_INVALID_CHANNEL | typeof SCOPE_ERROR__PYTH_LAZER_INVALID_CONFIDENCE_FACTOR | typeof SCOPE_ERROR__PYTH_LAZER_INVALID_EXPONENT | typeof SCOPE_ERROR__PYTH_LAZER_INVALID_FEED_ID | typeof SCOPE_ERROR__PYTH_LAZER_INVALID_FEED_I_D | typeof SCOPE_ERROR__PYTH_LAZER_INVALID_FEEDS_LENGTH | typeof SCOPE_ERROR__PYTH_LAZER_INVALID_MESSAGE_PAYLOAD | typeof SCOPE_ERROR__PYTH_LAZER_PRICE_NOT_PRESENT | typeof SCOPE_ERROR__PYTH_LAZER_UNEXPECTED_EXPONENT | typeof SCOPE_ERROR__PYTH_LAZER_VERIFY_IX_FAILED | typeof SCOPE_ERROR__REFRESH_IN_C_P_I | typeof SCOPE_ERROR__REFRESH_WITH_UNEXPECTED_IXS | typeof SCOPE_ERROR__STAKE_FEE_TOO_HIGH | typeof SCOPE_ERROR__SWITCHBOARD_ON_DEMAND_ERROR | typeof SCOPE_ERROR__SWITCHBOARD_V2_ERROR | typeof SCOPE_ERROR__TWAP_ENABLED_BITMASK_CONVERSION_FAILURE | typeof SCOPE_ERROR__TWAP_NOT_ENOUGH_SAMPLES_IN_PERIOD | typeof SCOPE_ERROR__TWAP_SAMPLE_TOO_FREQUENT | typeof SCOPE_ERROR__TWAP_SOURCE_INDEX_NOT_SET | typeof SCOPE_ERROR__TWAP_SOURCE_INDEX_OUT_OF_RANGE | typeof SCOPE_ERROR__UNABLE_TO_DERIVE_P_D_A | typeof SCOPE_ERROR__UNABLE_TO_DESERIALIZE_ACCOUNT | typeof SCOPE_ERROR__UNAUTHORIZED_FREEZE | typeof SCOPE_ERROR__UNAUTHORIZED_RESUME | typeof SCOPE_ERROR__UNEXPECTED_ACCOUNT | typeof SCOPE_ERROR__UNEXPECTED_JLP_CONFIGURATION | typeof SCOPE_ERROR__WRONG_ACCOUNT_OWNER; let scopeErrorMessages: Record | undefined; if (process.env.NODE_ENV !== "production") { scopeErrorMessages = { [SCOPE_ERROR__ACCOUNTS_AND_TOKEN_MISMATCH]: `The number of tokens is different from the number of received accounts`, [SCOPE_ERROR__BAD_SCOPE_CHAIN_OR_PRICES]: `Error while computing price with ScopeChain`, [SCOPE_ERROR__BAD_SLOT]: `Invalid slot`, [SCOPE_ERROR__BAD_TIMESTAMP]: `Invalid timestamp`, [SCOPE_ERROR__BAD_TOKEN_NB]: `The token index received is out of range`, [SCOPE_ERROR__BAD_TOKEN_TYPE]: `The token type received is invalid`, [SCOPE_ERROR__CANNOT_RESIZE_ACCOUNT]: `Cannot resize the account we only allow it to grow in size`, [SCOPE_ERROR__CAPPED_FLOORED_BOTH_CAP_AND_FLOOR_ARE_NONE]: `Can't set both cap and floor to None for CappedFloored oracle`, [SCOPE_ERROR__CHAINLINK_X_PRICE_NOT_SUSPENDED]: `Cannot resume a ChainlinkX price that was not suspended`, [SCOPE_ERROR__COMPOSITE_ORACLE_INVALID_MAX_AGE]: `Invalid max age (s) for composite oracle`, [SCOPE_ERROR__COMPOSITE_ORACLE_INVALID_SOURCE_INDEX]: `Provided source index is invalid`, [SCOPE_ERROR__COMPOSITE_ORACLE_MAX_AGE_VIOLATED]: `Max age constraint violated for composite oracle`, [SCOPE_ERROR__CONFIDENCE_INTERVAL_CHECK_FAILED]: `Confidence interval check failed`, [SCOPE_ERROR__CONVERSION_FAILURE]: `Conversion failure`, [SCOPE_ERROR__EMPTY_TOKEN_LIST]: `The provided token list to refresh is empty`, [SCOPE_ERROR__EXPECTED_PRICE_ACCOUNT]: `Price account expected when updating mapping`, [SCOPE_ERROR__FIXED_PRICE_INVALID]: `The provided fixed price is invalid`, [SCOPE_ERROR__INTEGER_OVERFLOW]: `Integer overflow`, [SCOPE_ERROR__INVALID_ACCOUNT_DISCRIMINATOR]: `Invalid account discriminator`, [SCOPE_ERROR__INVALID_CHAINLINK_REPORT_DATA]: `Invalid Chainlink report data format`, [SCOPE_ERROR__INVALID_CONVERSION_TO_EMA_TYPE_FOR_ORACLE_TYPE]: `Cannot convert oracle type to EMA type`, [SCOPE_ERROR__INVALID_GENERIC_DATA]: `Invalid generic data`, [SCOPE_ERROR__INVALID_UPDATE_SEQUENCE_OR_ACCOUNTS]: `Invalid update sequence or accounts`, [SCOPE_ERROR__KLEND_C_TOKEN_EXCHANGE_RATE_C_P_I_ERROR]: `Klend cToken exchange rate CPI call failed`, [SCOPE_ERROR__KLEND_RESERVE_DEPRECATED]: `Klend reserve version does not match the expected program version (deprecated reserve)`, [SCOPE_ERROR__K_TOKEN_HOLDINGS_CALCULATION_ERROR]: `Error while computing the Ktoken pool holdings`, [SCOPE_ERROR__K_TOKEN_UNDERLYING_PRICE_NOT_VALID]: `Cannot get a valid price for the tokens composing the Ktoken`, [SCOPE_ERROR__MATH_OVERFLOW]: `Mathematical operation with overflow`, [SCOPE_ERROR__MISSING_PRICE_ACCOUNT]: `Missing price account for Oracle Mapping update`, [SCOPE_ERROR__MOST_RECENT_OF_INVALID_MAX_DIVERGENCE]: `Invalid max divergence (bps) for MostRecentOf oracle`, [SCOPE_ERROR__MOST_RECENT_OF_MAX_DIVERGENCE_BPS_VIOLATED]: `Max divergence bps constraint violated for MostRecentOf oracle`, [SCOPE_ERROR__NO_CHAINLINK_REPORT_DATA]: `No valid Chainlink report data found`, [SCOPE_ERROR__OPERATION_NOT_SUPPORTED]: `This operation is not supported`, [SCOPE_ERROR__ORACLE_CONFIG_INVALID_SOURCE_INDICES]: `Oracle config must contain at least one valid source index`, [SCOPE_ERROR__OUT_OF_RANGE_INTEGRAL_CONVERSION]: `Out of range integral conversion attempted`, [SCOPE_ERROR__OUTSIDE_MARKET_HOURS]: `Price update rejected as outside of market hours`, [SCOPE_ERROR__PRICE_ACCOUNT_NOT_EXPECTED]: `Received a price account when none is expected`, [SCOPE_ERROR__PRICE_ALREADY_FROZEN]: `Price entry is already frozen`, [SCOPE_ERROR__PRICE_FROZEN]: `Cannot update a frozen price entry`, [SCOPE_ERROR__PRICE_NOT_FROZEN]: `Price entry is not frozen`, [SCOPE_ERROR__PRICE_NOT_VALID]: `Price is not valid`, [SCOPE_ERROR__PYTH_LAZER_BEST_ASK_PRICE_NOT_PRESENT]: `Property fields in the feed of the PythLazer payload do not contain a best ask price`, [SCOPE_ERROR__PYTH_LAZER_BEST_BID_PRICE_NOT_PRESENT]: `Property fields in the feed of the PythLazer payload do not contain a best bid price`, [SCOPE_ERROR__PYTH_LAZER_CONFIDENCE_NOT_PRESENT]: `Property fields in the feed of the PythLazer payload do not contain a confidence`, [SCOPE_ERROR__PYTH_LAZER_EMA_CONFIDENCE_NOT_PRESENT]: `Property fields in the feed of the PythLazer payload do not contain an EMA confidence`, [SCOPE_ERROR__PYTH_LAZER_EMA_NOT_ENABLED_ON_SOURCE]: `PythLazerEMA source entry does not have EMA enabled`, [SCOPE_ERROR__PYTH_LAZER_EMA_PRICE_NOT_PRESENT]: `Property fields in the feed of the PythLazer payload do not contain an EMA price`, [SCOPE_ERROR__PYTH_LAZER_EXPONENT_NOT_PRESENT]: `Property fields in the feed of the PythLazer payload do not contain an exponent`, [SCOPE_ERROR__PYTH_LAZER_FEED_UPDATE_TIMESTAMP_NOT_PRESENT]: `Property fields in the feed of the PythLazer payload do not contain a feed update timestamp`, [SCOPE_ERROR__PYTH_LAZER_INVALID_ASK_BID_PRICES]: `Invalid ask/bid prices provided in the feed of the PythLazer payload`, [SCOPE_ERROR__PYTH_LAZER_INVALID_CHANNEL]: `Received an invalid channel in the PythLazer payload when refreshing price`, [SCOPE_ERROR__PYTH_LAZER_INVALID_CONFIDENCE_FACTOR]: `Invalid confidence factor passed in to PythLazer oracle`, [SCOPE_ERROR__PYTH_LAZER_INVALID_EXPONENT]: `Invalid exponent passed in to PythLazer oracle`, [SCOPE_ERROR__PYTH_LAZER_INVALID_FEED_ID]: `Invalid feed id in the PythLazer payload when refreshing price`, [SCOPE_ERROR__PYTH_LAZER_INVALID_FEED_I_D]: `Invalid feed id passed in to PythLazer oracle`, [SCOPE_ERROR__PYTH_LAZER_INVALID_FEEDS_LENGTH]: `Payload should have a single feed in the PythLazer payload when refreshing price`, [SCOPE_ERROR__PYTH_LAZER_INVALID_MESSAGE_PAYLOAD]: `Received an invalid message payload in the PythLazer oracle when refreshing price`, [SCOPE_ERROR__PYTH_LAZER_PRICE_NOT_PRESENT]: `Property fields in the feed of the PythLazer payload do not contain a price`, [SCOPE_ERROR__PYTH_LAZER_UNEXPECTED_EXPONENT]: `The exponent provided in the feed of the PythLazer payload is not the expected one`, [SCOPE_ERROR__PYTH_LAZER_VERIFY_IX_FAILED]: `The invoked pyth lazer verify instruction failed`, [SCOPE_ERROR__REFRESH_IN_C_P_I]: `Refresh price instruction called in a CPI`, [SCOPE_ERROR__REFRESH_WITH_UNEXPECTED_IXS]: `Refresh price instruction preceded by unexpected ixs`, [SCOPE_ERROR__STAKE_FEE_TOO_HIGH]: `The stake pool fee is higher than the maximum allowed`, [SCOPE_ERROR__SWITCHBOARD_ON_DEMAND_ERROR]: `Switchboard On Demand price derive error`, [SCOPE_ERROR__SWITCHBOARD_V2_ERROR]: `There was an error with the Switchboard V2 retrieval`, [SCOPE_ERROR__TWAP_ENABLED_BITMASK_CONVERSION_FAILURE]: `Invalid TWAP enabled bitmask value`, [SCOPE_ERROR__TWAP_NOT_ENOUGH_SAMPLES_IN_PERIOD]: `Not enough price samples in period to compute TWAP`, [SCOPE_ERROR__TWAP_SAMPLE_TOO_FREQUENT]: `TWAP sample is too close to the previous one`, [SCOPE_ERROR__TWAP_SOURCE_INDEX_NOT_SET]: `TWAP source index not set`, [SCOPE_ERROR__TWAP_SOURCE_INDEX_OUT_OF_RANGE]: `TWAP source index out of range`, [SCOPE_ERROR__UNABLE_TO_DERIVE_P_D_A]: `Unable to derive PDA address`, [SCOPE_ERROR__UNABLE_TO_DESERIALIZE_ACCOUNT]: `Unable to deserialize account`, [SCOPE_ERROR__UNAUTHORIZED_FREEZE]: `Signer is not authorized to freeze/unfreeze`, [SCOPE_ERROR__UNAUTHORIZED_RESUME]: `Signer is not authorized to resume`, [SCOPE_ERROR__UNEXPECTED_ACCOUNT]: `Unexpected account in instruction`, [SCOPE_ERROR__UNEXPECTED_JLP_CONFIGURATION]: `Unexpected JLP configuration`, [SCOPE_ERROR__WRONG_ACCOUNT_OWNER]: `Provided account has a different owner than expected`, }; } export function getScopeErrorMessage(code: ScopeError): string { if (process.env.NODE_ENV !== "production") { return (scopeErrorMessages as Record)[code]; } return "Error message not available in production bundles."; } export function isScopeError( error: unknown, transactionMessage: { instructions: Record; }, code?: TProgramErrorCode, ): error is SolanaError & Readonly<{ context: Readonly<{ code: TProgramErrorCode }> }> { return isProgramError( error, transactionMessage, SCOPE_PROGRAM_ADDRESS, code, ); }