/** * 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 { SAGE_PROGRAM_ADDRESS } from '../programs'; /** Program id mismatch */ export const SAGE_ERROR__PROGRAM_MISMATCH = 0x51890000; // 1367932928 /** Instruction must be the only instruction */ export const SAGE_ERROR__MUST_BE_ONLY_INSTRUCTION = 0x51890001; // 1367932929 /** Invalid fleet size */ export const SAGE_ERROR__INVALID_FLEET_SIZE = 0x51890002; // 1367932930 /** A referenced item was not found */ export const SAGE_ERROR__NOT_FOUND = 0x51890003; // 1367932931 /** Invalid user input */ export const SAGE_ERROR__INVALID_INPUT = 0x51890004; // 1367932932 /** Types or variants did not match as expected */ export const SAGE_ERROR__TYPE_MISMATCH = 0x51890005; // 1367932933 /** Celestial body type did not match expectations */ export const SAGE_ERROR__CELESTIAL_BODY_TYPE_MISMATCH = 0x51890006; // 1367932934 /** Status or enum mismatch */ export const SAGE_ERROR__STATUS_MISMATCH = 0x51890007; // 1367932935 /** Claim stake is not in the expected active/evicted state */ export const SAGE_ERROR__INACTIVE_CLAIM_STAKE = 0x51890008; // 1367932936 /** Crafting hab is not evicted when required */ export const SAGE_ERROR__CRAFTING_HAB_NOT_EVICTED = 0x51890009; // 1367932937 /** Eviction requires rent delinquency; current state is not delinquent. */ export const SAGE_ERROR__EVICTION_NOT_DELINQUENT = 0x5189000a; // 1367932938 /** State discrepancy */ export const SAGE_ERROR__STATE_MISMATCH = 0x5189000b; // 1367932939 /** Identifier/key mismatch */ export const SAGE_ERROR__ID_MISMATCH = 0x5189000c; // 1367932940 /** Game id mismatch */ export const SAGE_ERROR__GAME_MISMATCH = 0x5189000d; // 1367932941 /** Profile mismatch */ export const SAGE_ERROR__PROFILE_MISMATCH = 0x5189000e; // 1367932942 /** Faction mismatch */ export const SAGE_ERROR__FACTION_MISMATCH = 0x5189000f; // 1367932943 /** System mismatch */ export const SAGE_ERROR__SYSTEM_MISMATCH = 0x51890010; // 1367932944 /** Starbase is destroyed */ export const SAGE_ERROR__STARBASE_DESTROYED = 0x51890011; // 1367932945 /** Starbase is not destroyed */ export const SAGE_ERROR__STARBASE_NOT_DESTROYED = 0x51890012; // 1367932946 /** Resource or slot capacity exceeded */ export const SAGE_ERROR__CAPACITY_EXCEEDED = 0x51890013; // 1367932947 /** Prerequisites or requirements were not met */ export const SAGE_ERROR__REQUIREMENTS_NOT_MET = 0x51890014; // 1367932948 /** Operation blocked due to an active cooldown */ export const SAGE_ERROR__COOLDOWN_ACTIVE = 0x51890015; // 1367932949 /** Usage limit exceeded */ export const SAGE_ERROR__USAGE_LIMIT_EXCEEDED = 0x51890016; // 1367932950 /** Maximum number of crafting hab jobs reached */ export const SAGE_ERROR__CRAFTING_JOB_LIMIT_REACHED = 0x51890017; // 1367932951 /** Attempted to place more than one hub building */ export const SAGE_ERROR__HUB_ALREADY_PLACED = 0x51890018; // 1367932952 /** Duplicate/Already exists */ export const SAGE_ERROR__ALREADY_EXISTS = 0x51890019; // 1367932953 /** Duplicate entry for a resource-like item */ export const SAGE_ERROR__DUPLICATE_RESOURCE = 0x5189001a; // 1367932954 /** Not At Central Space Station */ export const SAGE_ERROR__NOT_AT_CENTRAL_SPACE_STATION = 0x5189001b; // 1367932955 /** Not within allowed range */ export const SAGE_ERROR__NOT_WITHIN_RANGE = 0x5189001c; // 1367932956 /** Combat actions are blocked by a global ceasefire */ export const SAGE_ERROR__GLOBAL_CEASEFIRE_ACTIVE = 0x5189001d; // 1367932957 /** Unauthorized or access denied */ export const SAGE_ERROR__UNAUTHORIZED = 0x5189001e; // 1367932958 /** Operation blocked while structure is under construction */ export const SAGE_ERROR__UNDER_CONSTRUCTION = 0x5189001f; // 1367932959 /** Structure instance is deactivated */ export const SAGE_ERROR__INSTANCE_DEACTIVATED = 0x51890020; // 1367932960 /** Numeric overflow occurred */ export const SAGE_ERROR__NUMERIC_OVERFLOW = 0x51890021; // 1367932961 /** Escrow underflow */ export const SAGE_ERROR__ESCROW_UNDERFLOW = 0x51890022; // 1367932962 /** Insufficient amount provided or available */ export const SAGE_ERROR__INSUFFICIENT_AMOUNT = 0x51890023; // 1367932963 /** Withdrawal amount exceeds configured limit */ export const SAGE_ERROR__WITHDRAWAL_LIMIT_EXCEEDED = 0x51890024; // 1367932964 /** Withdrawals are disabled for this cargo type */ export const SAGE_ERROR__WITHDRAW_DISABLED = 0x51890025; // 1367932965 /** Epoch calculation/division error */ export const SAGE_ERROR__EPOCH_DIVISION_ERROR = 0x51890026; // 1367932966 /** Invalid timestamp/clock value */ export const SAGE_ERROR__INVALID_TIMESTAMP = 0x51890027; // 1367932967 /** Region not found */ export const SAGE_ERROR__REGION_NOT_FOUND = 0x51890028; // 1367932968 /** Region is invalid */ export const SAGE_ERROR__REGION_INVALID = 0x51890029; // 1367932969 /** Invalid path */ export const SAGE_ERROR__INVALID_PATH = 0x5189002a; // 1367932970 /** Bounding box creation failed */ export const SAGE_ERROR__BOUNDING_BOX_FAILED = 0x5189002b; // 1367932971 /** Invariant violation (internal error) */ export const SAGE_ERROR__INVARIANT_VIOLATION = 0x5189002c; // 1367932972 /** Sequence ids do not match */ export const SAGE_ERROR__SEQUENCE_ID_MISMATCH = 0x5189002d; // 1367932973 /** Fleet is rented */ export const SAGE_ERROR__RENTED_FLEET = 0x5189002e; // 1367932974 /** Crew roster page index does not match the instruction's page_index */ export const SAGE_ERROR__ROSTER_PAGE_MISMATCH = 0x5189002f; // 1367932975 /** A supplied crew asset id was not found on the roster page */ export const SAGE_ERROR__CREW_ASSET_MISMATCH = 0x51890030; // 1367932976 /** Crew feature is disabled (Game.crew_config is None) */ export const SAGE_ERROR__CREW_FEATURE_DISABLED = 0x51890031; // 1367932977 /** Crew record not found on the roster page */ export const SAGE_ERROR__CREW_RECORD_NOT_FOUND = 0x51890032; // 1367932978 /** Crew is in the wrong status for this action */ export const SAGE_ERROR__CREW_BAD_STATUS = 0x51890033; // 1367932979 /** Crew is busy (reserved by a quest / garrison) */ export const SAGE_ERROR__CREW_BUSY = 0x51890034; // 1367932980 /** Perk offer-gate not satisfied (rarity/aptitude/personality) */ export const SAGE_ERROR__PERK_OFFER_GATE = 0x51890035; // 1367932981 /** Target gear slot is already occupied */ export const SAGE_ERROR__GEAR_SLOT_OCCUPIED = 0x51890036; // 1367932982 /** * Crew asset id already has a record on this roster page (duplicate bind/migrate rejected; * PR #732 review — the double-bind guard) */ export const SAGE_ERROR__CREW_ALREADY_BOUND = 0x51890037; // 1367932983 /** AwardCrewActivityXp per-category award exceeds the per-call cap (PR #732 review) */ export const SAGE_ERROR__CREW_XP_AWARD_TOO_LARGE = 0x51890038; // 1367932984 /** * SetPerkDefinitions was called but the runtime perk-definition map is not yet wired * (the folds read the static catalogue). Explicit failure beats silently accepting and * discarding the supplied definitions (PR #732 second review). */ export const SAGE_ERROR__SET_PERK_DEFINITIONS_UNSUPPORTED = 0x51890039; // 1367932985 /** * The supplied CrewRoster is not the expected (character, page_index) PDA — a caller * tried to operate on a roster page that does not belong to the validated character * (PR #732 second review — the roster owner binding) */ export const SAGE_ERROR__CREW_ROSTER_OWNER_MISMATCH = 0x5189003a; // 1367932986 /** * The crew attestation authority did not sign / does not match `Game.crew_config` * (PR #732 second review — Bind/Migrate are authority-gated until Phase-2 attestation) */ export const SAGE_ERROR__CREW_AUTHORITY_MISMATCH = 0x5189003b; // 1367932987 /** * The FleetCrewBinding is pinned to a different roster page (one-page-per-fleet * invariant — PR #732 second review) */ export const SAGE_ERROR__FLEET_CREW_PAGE_CONFLICT = 0x5189003c; // 1367932988 /** * A mission's settled action would DRAIN the rightful incumbent of a sector the actor's OWN * faction holds, and the actor is not a declared outlaw — the own-faction anti-grief gate * (doc 180 §3 Phase-2 faction-stance). Declare outlaw to act against your own faction. */ export const SAGE_ERROR__FACTION_DRAIN_BLOCKED = 0x5189003d; // 1367932989 /** * ClearOutlaw was attempted while the 2-epoch commitment window is still active — the outlaw * flag is locked until `now >= pvp_until` (doc 180 §3d, the PvP-flag commitment). */ export const SAGE_ERROR__COMMITMENT_WINDOW_ACTIVE = 0x5189003e; // 1367932990 /** Reserved faction id (0 = null; 1/2/3 = majors, seed-only) */ export const SAGE_ERROR__RESERVED_FACTION_ID = 0x5189003f; // 1367932991 /** Capability flags contain unknown bits */ export const SAGE_ERROR__INVALID_FACTION_FLAGS = 0x51890040; // 1367932992 /** Caller may not grant the requested high-trust flags */ export const SAGE_ERROR__FACTION_FLAG_NOT_PERMITTED = 0x51890041; // 1367932993 /** Illegal faction status transition */ export const SAGE_ERROR__INVALID_FACTION_STATUS_TRANSITION = 0x51890042; // 1367932994 /** alignment<->faction_id bridge inconsistent at seed */ export const SAGE_ERROR__FACTION_BRIDGE_INCONSISTENT = 0x51890043; // 1367932995 /** Standing account's profile doesn't match the settling profile */ export const SAGE_ERROR__STANDING_PROFILE_MISMATCH = 0x51890044; // 1367932996 /** Standing account's faction_id doesn't match the credited faction */ export const SAGE_ERROR__STANDING_FACTION_MISMATCH = 0x51890045; // 1367932997 /** Standing account PDA doesn't match its derived address */ export const SAGE_ERROR__STANDING_PDA_MISMATCH = 0x51890046; // 1367932998 /** Per-faction per-epoch standing-emission cap exceeded */ export const SAGE_ERROR__STANDING_EPOCH_CAP_EXCEEDED = 0x51890047; // 1367932999 /** Standing too low for this action */ export const SAGE_ERROR__STANDING_TOO_LOW = 0x51890048; // 1367933000 /** A standing/config/meter account is required for accrual but was not supplied (partial set) */ export const SAGE_ERROR__STANDING_ACCOUNT_REQUIRED = 0x51890049; // 1367933001 /** Faction market PDA doesn't match its derived address */ export const SAGE_ERROR__FACTION_MARKET_PDA_MISMATCH = 0x5189004a; // 1367933002 /** Faction market's bound treasury doesn't match the supplied treasury */ export const SAGE_ERROR__FACTION_MARKET_TREASURY_MISMATCH = 0x5189004b; // 1367933003 /** An Ask would draw a faction treasury reserve below its strategic floor */ export const SAGE_ERROR__FACTION_RESERVE_FLOOR = 0x5189004c; // 1367933004 /** Faction market is not Active */ export const SAGE_ERROR__FACTION_NOT_ACTIVE = 0x5189004d; // 1367933005 /** Cannot attack an allied faction (in its homeland) */ export const SAGE_ERROR__FACTION_ALLIED = 0x5189004e; // 1367933006 /** Cannot attack during an active ceasefire */ export const SAGE_ERROR__FACTION_CEASEFIRE = 0x5189004f; // 1367933007 /** Faction lacks the COMBATANT capability (declared in P3, thrown in P4) */ export const SAGE_ERROR__FACTION_NOT_COMBATANT = 0x51890050; // 1367933008 /** A faction cannot have a relation with itself */ export const SAGE_ERROR__SELF_RELATION = 0x51890051; // 1367933009 /** Faction account/id is invalid or not Active */ export const SAGE_ERROR__INVALID_FACTION = 0x51890052; // 1367933010 /** A faction has reached its maximum simultaneous allies */ export const SAGE_ERROR__MAX_ALLIES_EXCEEDED = 0x51890053; // 1367933011 /** Invalid relation argument (e.g. ceasefire timestamp in the past) */ export const SAGE_ERROR__INVALID_RELATION_ARG = 0x51890054; // 1367933012 /** Requested ceasefire is shorter than the configured minimum */ export const SAGE_ERROR__CEASEFIRE_TOO_SHORT = 0x51890055; // 1367933013 /** Re-entering a ceasefire on this pair is still on cooldown */ export const SAGE_ERROR__CEASEFIRE_COOLDOWN = 0x51890056; // 1367933014 /** * P4: the dynamic-ownership sidecar is required-but-absent, stale (wrong generation), or carries an * unknown asset_kind. */ export const SAGE_ERROR__FACTION_OWNERSHIP_MISMATCH = 0x51890057; // 1367933015 /** * P4: the starbase is in its post-capture contested window (`now < contested_until`) and cannot be * re-flipped yet (anti capture-and-camp); also a too-far-future/over-cap pre-seeded window. */ export const SAGE_ERROR__STARBASE_CONTESTED = 0x51890058; // 1367933016 /** * P5b: a directive payload is malformed — unknown `FleetDirectiveKind`, or a timestamp that does not * fit the i32 epoch-relative encoding (`directive_ts_out_of_range`). */ export const SAGE_ERROR__INVALID_FLEET_DIRECTIVE = 0x51890059; // 1367933017 /** P5b: `SetFleetDirective` was called again before `last_update + DIRECTIVE_COOLDOWN_SECS` elapsed. */ export const SAGE_ERROR__FACTION_DIRECTIVE_RATE_LIMITED = 0x5189005a; // 1367933018 /** * P5b: the supplied fleet's `FactionOwnership(FLEET)` sidecar does not name this faction as controller, * or the operator profile does not match `FactionAccount.operator_profile`. */ export const SAGE_ERROR__FLEET_NOT_OWNED_BY_FACTION = 0x5189005b; // 1367933019 /** P5b: `MintNpcFleet` would exceed `FactionAccount.max_npc_fleets` (the primary anti-flood headcount cap). */ export const SAGE_ERROR__FACTION_FLEET_CAP_EXCEEDED = 0x5189005c; // 1367933020 /** * P5b: an NPC faction tried to capture again before its per-faction `last_capture_at + * faction_capture_cooldown_secs` elapsed (the on-chain anti-blitz brake). */ export const SAGE_ERROR__FACTION_CAPTURE_RATE_LIMITED = 0x5189005d; // 1367933021 /** * The Character's pending research-modifier resync exceeds the eager per-instruction bound * (`MAX_EAGER_SYNC_NODE_LEVELS`). Replaying it inline would exhaust the transaction compute * budget, bricking every instruction that validates the Character. Run the bounded, * permissionless `SyncCharacter` instruction until it returns 0 remaining nodes, then retry. */ export const SAGE_ERROR__CHARACTER_SYNC_REQUIRED = 0x5189005e; // 1367933022 /** * The game's XP runtime is sealed for the legacy-to-v1 reconciliation: registration, * ordinary sync, admin threshold/renown edits and every XP write are rejected until * `ActivateXpMigration` flips the game to v1. Only `ReconcileLegacyCharacter` may write XP. */ export const SAGE_ERROR__XP_MIGRATION_IN_PROGRESS = 0x5189005f; // 1367933023 /** * The migration instruction was called in a phase that does not allow it * (`Prepare -> Sealed -> Active` is one-way). */ export const SAGE_ERROR__XP_MIGRATION_PHASE_MISMATCH = 0x51890060; // 1367933024 /** * The game runs the v1 XP runtime, but the acting Character's canonical `CareerXpBudget` * PDA was not supplied (or was not writable). XP settlement is mandatory: fail closed. */ export const SAGE_ERROR__CAREER_XP_BUDGET_REQUIRED = 0x51890061; // 1367933025 /** * The game runs the v1 XP runtime, but the game's `XpBudgetConfig` PDA was not supplied. * Program defaults are never a substitute once a game is active. */ export const SAGE_ERROR__XP_BUDGET_CONFIG_REQUIRED = 0x51890062; // 1367933026 /** * A `CareerXpBudget` was supplied whose permanent `reconciled_threshold_version` marker is * still zero: the Character never went through `ReconcileLegacyCharacter`. */ export const SAGE_ERROR__CAREER_XP_BUDGET_UNRECONCILED = 0x51890063; // 1367933027 /** * XP budget accounts were supplied to a game whose XP runtime is still legacy. The legacy * path never settles through the PDA; passing one is a client error, not a rollout switch. */ export const SAGE_ERROR__XP_BUDGET_NOT_ACTIVE = 0x51890064; // 1367933028 /** * The staged `CareerXpTargetDefinitionsV1` payload does not hash to the approved digest * pinned in `CareerXpMigrationConfig` (tampered rows, wrong header, or wrong approval). */ export const SAGE_ERROR__XP_MIGRATION_DIGEST_MISMATCH = 0x51890065; // 1367933029 /** * The Character is not a member of the committed finalized-seal manifest, the manifest was * not committed yet, or the supplied Merkle proof is invalid. */ export const SAGE_ERROR__XP_MIGRATION_MANIFEST_MISMATCH = 0x51890066; // 1367933030 /** * Activation requires every manifest member migrated and audited (`migrated == audited == * manifest_count`); the cohort is still incomplete. */ export const SAGE_ERROR__XP_MIGRATION_INCOMPLETE = 0x51890067; // 1367933031 /** * The game runs the v1 XP runtime, but the structure's `StructureXpAccrual` ledger was not * supplied to an instruction that ticks or changes the structure's state. Building XP is * derived from every such observation, so the ledger is mandatory: fail closed. */ export const SAGE_ERROR__STRUCTURE_XP_ACCRUAL_REQUIRED = 0x51890068; // 1367933032 /** * Rent Option B: a price-source history account (catalog, head or page) is malformed, is not the one the * write/read requires, or a writer premise (monotonic clock, contiguous pages) would be violated. */ export const SAGE_ERROR__RENT_HISTORY_INVALID = 0x51890069; // 1367933033 /** * Rent Option B: the rent-epoch writer's `expected_write_version` is stale (another write landed since * the caller reviewed the head, including a same-second coalesced one). */ export const SAGE_ERROR__RENT_WRITE_VERSION_MISMATCH = 0x5189006a; // 1367933034 /** * Rent Option B: `UpdatePlanetTables`' rent field is retired for this planet (its grid source head * exists or the rent catalog left Disabled); use `SetPlanetRentGrid`. */ export const SAGE_ERROR__RENT_FIELD_RETIRED = 0x5189006b; // 1367933035 /** Rent Option B: the rent catalog is in a state that does not allow this operation. */ export const SAGE_ERROR__RENT_CATALOG_STATE_MISMATCH = 0x5189006c; // 1367933036 /** * Rent Option B: a history record the settlement needs exists but its page was not presented, or the * presented history has a gap (a missing revision) or cannot prove coverage to the cutoff. */ export const SAGE_ERROR__RENT_HISTORY_MISSING = 0x5189006d; // 1367933037 /** * Rent Option B: a caller hint does not name the baseline record (the last record at or before the * settlement start). */ export const SAGE_ERROR__RENT_HINT_INVALID = 0x5189006e; // 1367933038 /** Rent Option B: a starbase level or definition tier indexes outside the rent grid. */ export const SAGE_ERROR__RENT_SELECTOR_INVALID = 0x5189006f; // 1367933039 /** Rent Option B: a rent value, duration or budget is outside the fixed-point domain. */ export const SAGE_ERROR__RENT_NUMERIC_DOMAIN = 0x51890070; // 1367933040 /** * Rent Option B: the settlement evaluation is not in a state that allows this (not initialized, coverage * not proven, or the underfunded walk unresolved). */ export const SAGE_ERROR__RENT_EVALUATION_INCOMPLETE = 0x51890071; // 1367933041 /** Rent Option B: the balance the evaluation priced is no longer the stake's live balance. */ export const SAGE_ERROR__RENT_BUDGET_STALE = 0x51890072; // 1367933042 /** Rent Option B: the frozen pre-activation baseline is missing or newer than the history at activation. */ export const SAGE_ERROR__RENT_BASELINE_INCONSISTENT = 0x51890073; // 1367933043 /** * Rent Option B: the stake's eviction grace has expired — no settlement may begin (the pinned eviction * gate); the stake can only be evicted. */ export const SAGE_ERROR__RENT_STAKE_EVICTABLE = 0x51890074; // 1367933044 /** Rent Option B: the stake is already paid through the (clamped) cutoff; nothing is installed. */ export const SAGE_ERROR__RENT_NOTHING_TO_SETTLE = 0x51890075; // 1367933045 /** Rent Option B: another evaluation is active for this stake over a different interval. */ export const SAGE_ERROR__RENT_EVALUATION_CONFLICT = 0x51890076; // 1367933046 /** * Rent Option B: the evaluation is not the stake's active one, or the stake's paid clock moved since it * began. */ export const SAGE_ERROR__RENT_EVALUATION_STALE = 0x51890077; // 1367933047 /** Rent Option B: the cancel is not allowed (keeper evaluation, allowance exhausted, or cooldown). */ export const SAGE_ERROR__RENT_CANCEL_REFUSED = 0x51890078; // 1367933048 /** * Rent Option B: under an Active catalog this operation needs rent priced from the history, which it cannot * do yet (slice 5b) — refused rather than priced at the live grid. */ export const SAGE_ERROR__RENT_SETTLEMENT_REQUIRED = 0x51890079; // 1367933049 /** Rent Option B: the terminal Commit needs a stake its planet already evicted (a live stake uses Commit). */ export const SAGE_ERROR__RENT_STAKE_NOT_INVALIDATED = 0x5189007a; // 1367933050 /** * P2 faction markets: `EditFactionMarket` requires the market to be in `Draft` (an Active market * must be paused via `SetFactionMarketStatus` first). */ export const SAGE_ERROR__FACTION_MARKET_NOT_DRAFT = 0x5189007b; // 1367933051 /** * A claim-stake design mutation (Place / Cancel / Finalize) on a stake its planet still knows but that is * not operable there: evicted (its plot entry is no longer active) or registered above the starbase's * current level. Recovery is respawn (`RespawnClaimStakeInstance`) once the planet has synced the eviction — * never a rent payment. An entry the planet does not know at all is `NotFound`; rent delinquency keeps its * own errors. */ export const SAGE_ERROR__CLAIM_STAKE_NOT_OPERABLE = 0x5189007c; // 1367933052 export type SageError = | typeof SAGE_ERROR__ALREADY_EXISTS | typeof SAGE_ERROR__BOUNDING_BOX_FAILED | typeof SAGE_ERROR__CAPACITY_EXCEEDED | typeof SAGE_ERROR__CAREER_XP_BUDGET_REQUIRED | typeof SAGE_ERROR__CAREER_XP_BUDGET_UNRECONCILED | typeof SAGE_ERROR__CEASEFIRE_COOLDOWN | typeof SAGE_ERROR__CEASEFIRE_TOO_SHORT | typeof SAGE_ERROR__CELESTIAL_BODY_TYPE_MISMATCH | typeof SAGE_ERROR__CHARACTER_SYNC_REQUIRED | typeof SAGE_ERROR__CLAIM_STAKE_NOT_OPERABLE | typeof SAGE_ERROR__COMMITMENT_WINDOW_ACTIVE | typeof SAGE_ERROR__COOLDOWN_ACTIVE | typeof SAGE_ERROR__CRAFTING_HAB_NOT_EVICTED | typeof SAGE_ERROR__CRAFTING_JOB_LIMIT_REACHED | typeof SAGE_ERROR__CREW_ALREADY_BOUND | typeof SAGE_ERROR__CREW_ASSET_MISMATCH | typeof SAGE_ERROR__CREW_AUTHORITY_MISMATCH | typeof SAGE_ERROR__CREW_BAD_STATUS | typeof SAGE_ERROR__CREW_BUSY | typeof SAGE_ERROR__CREW_FEATURE_DISABLED | typeof SAGE_ERROR__CREW_RECORD_NOT_FOUND | typeof SAGE_ERROR__CREW_ROSTER_OWNER_MISMATCH | typeof SAGE_ERROR__CREW_XP_AWARD_TOO_LARGE | typeof SAGE_ERROR__DUPLICATE_RESOURCE | typeof SAGE_ERROR__EPOCH_DIVISION_ERROR | typeof SAGE_ERROR__ESCROW_UNDERFLOW | typeof SAGE_ERROR__EVICTION_NOT_DELINQUENT | typeof SAGE_ERROR__FACTION_ALLIED | typeof SAGE_ERROR__FACTION_BRIDGE_INCONSISTENT | typeof SAGE_ERROR__FACTION_CAPTURE_RATE_LIMITED | typeof SAGE_ERROR__FACTION_CEASEFIRE | typeof SAGE_ERROR__FACTION_DIRECTIVE_RATE_LIMITED | typeof SAGE_ERROR__FACTION_DRAIN_BLOCKED | typeof SAGE_ERROR__FACTION_FLAG_NOT_PERMITTED | typeof SAGE_ERROR__FACTION_FLEET_CAP_EXCEEDED | typeof SAGE_ERROR__FACTION_MARKET_NOT_DRAFT | typeof SAGE_ERROR__FACTION_MARKET_PDA_MISMATCH | typeof SAGE_ERROR__FACTION_MARKET_TREASURY_MISMATCH | typeof SAGE_ERROR__FACTION_MISMATCH | typeof SAGE_ERROR__FACTION_NOT_ACTIVE | typeof SAGE_ERROR__FACTION_NOT_COMBATANT | typeof SAGE_ERROR__FACTION_OWNERSHIP_MISMATCH | typeof SAGE_ERROR__FACTION_RESERVE_FLOOR | typeof SAGE_ERROR__FLEET_CREW_PAGE_CONFLICT | typeof SAGE_ERROR__FLEET_NOT_OWNED_BY_FACTION | typeof SAGE_ERROR__GAME_MISMATCH | typeof SAGE_ERROR__GEAR_SLOT_OCCUPIED | typeof SAGE_ERROR__GLOBAL_CEASEFIRE_ACTIVE | typeof SAGE_ERROR__HUB_ALREADY_PLACED | typeof SAGE_ERROR__ID_MISMATCH | typeof SAGE_ERROR__INACTIVE_CLAIM_STAKE | typeof SAGE_ERROR__INSTANCE_DEACTIVATED | typeof SAGE_ERROR__INSUFFICIENT_AMOUNT | typeof SAGE_ERROR__INVALID_FACTION | typeof SAGE_ERROR__INVALID_FACTION_FLAGS | typeof SAGE_ERROR__INVALID_FACTION_STATUS_TRANSITION | typeof SAGE_ERROR__INVALID_FLEET_DIRECTIVE | typeof SAGE_ERROR__INVALID_FLEET_SIZE | typeof SAGE_ERROR__INVALID_INPUT | typeof SAGE_ERROR__INVALID_PATH | typeof SAGE_ERROR__INVALID_RELATION_ARG | typeof SAGE_ERROR__INVALID_TIMESTAMP | typeof SAGE_ERROR__INVARIANT_VIOLATION | typeof SAGE_ERROR__MAX_ALLIES_EXCEEDED | typeof SAGE_ERROR__MUST_BE_ONLY_INSTRUCTION | typeof SAGE_ERROR__NOT_AT_CENTRAL_SPACE_STATION | typeof SAGE_ERROR__NOT_FOUND | typeof SAGE_ERROR__NOT_WITHIN_RANGE | typeof SAGE_ERROR__NUMERIC_OVERFLOW | typeof SAGE_ERROR__PERK_OFFER_GATE | typeof SAGE_ERROR__PROFILE_MISMATCH | typeof SAGE_ERROR__PROGRAM_MISMATCH | typeof SAGE_ERROR__REGION_INVALID | typeof SAGE_ERROR__REGION_NOT_FOUND | typeof SAGE_ERROR__RENT_BASELINE_INCONSISTENT | typeof SAGE_ERROR__RENT_BUDGET_STALE | typeof SAGE_ERROR__RENT_CANCEL_REFUSED | typeof SAGE_ERROR__RENT_CATALOG_STATE_MISMATCH | typeof SAGE_ERROR__RENTED_FLEET | typeof SAGE_ERROR__RENT_EVALUATION_CONFLICT | typeof SAGE_ERROR__RENT_EVALUATION_INCOMPLETE | typeof SAGE_ERROR__RENT_EVALUATION_STALE | typeof SAGE_ERROR__RENT_FIELD_RETIRED | typeof SAGE_ERROR__RENT_HINT_INVALID | typeof SAGE_ERROR__RENT_HISTORY_INVALID | typeof SAGE_ERROR__RENT_HISTORY_MISSING | typeof SAGE_ERROR__RENT_NOTHING_TO_SETTLE | typeof SAGE_ERROR__RENT_NUMERIC_DOMAIN | typeof SAGE_ERROR__RENT_SELECTOR_INVALID | typeof SAGE_ERROR__RENT_SETTLEMENT_REQUIRED | typeof SAGE_ERROR__RENT_STAKE_EVICTABLE | typeof SAGE_ERROR__RENT_STAKE_NOT_INVALIDATED | typeof SAGE_ERROR__RENT_WRITE_VERSION_MISMATCH | typeof SAGE_ERROR__REQUIREMENTS_NOT_MET | typeof SAGE_ERROR__RESERVED_FACTION_ID | typeof SAGE_ERROR__ROSTER_PAGE_MISMATCH | typeof SAGE_ERROR__SELF_RELATION | typeof SAGE_ERROR__SEQUENCE_ID_MISMATCH | typeof SAGE_ERROR__SET_PERK_DEFINITIONS_UNSUPPORTED | typeof SAGE_ERROR__STANDING_ACCOUNT_REQUIRED | typeof SAGE_ERROR__STANDING_EPOCH_CAP_EXCEEDED | typeof SAGE_ERROR__STANDING_FACTION_MISMATCH | typeof SAGE_ERROR__STANDING_PDA_MISMATCH | typeof SAGE_ERROR__STANDING_PROFILE_MISMATCH | typeof SAGE_ERROR__STANDING_TOO_LOW | typeof SAGE_ERROR__STARBASE_CONTESTED | typeof SAGE_ERROR__STARBASE_DESTROYED | typeof SAGE_ERROR__STARBASE_NOT_DESTROYED | typeof SAGE_ERROR__STATE_MISMATCH | typeof SAGE_ERROR__STATUS_MISMATCH | typeof SAGE_ERROR__STRUCTURE_XP_ACCRUAL_REQUIRED | typeof SAGE_ERROR__SYSTEM_MISMATCH | typeof SAGE_ERROR__TYPE_MISMATCH | typeof SAGE_ERROR__UNAUTHORIZED | typeof SAGE_ERROR__UNDER_CONSTRUCTION | typeof SAGE_ERROR__USAGE_LIMIT_EXCEEDED | typeof SAGE_ERROR__WITHDRAWAL_LIMIT_EXCEEDED | typeof SAGE_ERROR__WITHDRAW_DISABLED | typeof SAGE_ERROR__XP_BUDGET_CONFIG_REQUIRED | typeof SAGE_ERROR__XP_BUDGET_NOT_ACTIVE | typeof SAGE_ERROR__XP_MIGRATION_DIGEST_MISMATCH | typeof SAGE_ERROR__XP_MIGRATION_INCOMPLETE | typeof SAGE_ERROR__XP_MIGRATION_IN_PROGRESS | typeof SAGE_ERROR__XP_MIGRATION_MANIFEST_MISMATCH | typeof SAGE_ERROR__XP_MIGRATION_PHASE_MISMATCH; let sageErrorMessages: Record | undefined; if (process.env.NODE_ENV !== 'production') { sageErrorMessages = { [SAGE_ERROR__ALREADY_EXISTS]: `Already exists`, [SAGE_ERROR__BOUNDING_BOX_FAILED]: `Bounding box failed`, [SAGE_ERROR__CAPACITY_EXCEEDED]: `Capacity exceeded`, [SAGE_ERROR__CAREER_XP_BUDGET_REQUIRED]: `Career XP budget required`, [SAGE_ERROR__CAREER_XP_BUDGET_UNRECONCILED]: `Career XP budget not reconciled`, [SAGE_ERROR__CEASEFIRE_COOLDOWN]: `Ceasefire cooldown active`, [SAGE_ERROR__CEASEFIRE_TOO_SHORT]: `Ceasefire too short`, [SAGE_ERROR__CELESTIAL_BODY_TYPE_MISMATCH]: `Celestial body type mismatch`, [SAGE_ERROR__CHARACTER_SYNC_REQUIRED]: `Character research sync required`, [SAGE_ERROR__CLAIM_STAKE_NOT_OPERABLE]: `Claim stake not operable`, [SAGE_ERROR__COMMITMENT_WINDOW_ACTIVE]: `Outlaw commitment window still active`, [SAGE_ERROR__COOLDOWN_ACTIVE]: `Cooldown active`, [SAGE_ERROR__CRAFTING_HAB_NOT_EVICTED]: `Crafting hab not evicted`, [SAGE_ERROR__CRAFTING_JOB_LIMIT_REACHED]: `Crafting job limit reached`, [SAGE_ERROR__CREW_ALREADY_BOUND]: `Crew already bound`, [SAGE_ERROR__CREW_ASSET_MISMATCH]: `Crew asset mismatch`, [SAGE_ERROR__CREW_AUTHORITY_MISMATCH]: `Crew authority mismatch`, [SAGE_ERROR__CREW_BAD_STATUS]: `Crew bad status`, [SAGE_ERROR__CREW_BUSY]: `Crew busy`, [SAGE_ERROR__CREW_FEATURE_DISABLED]: `Crew feature disabled`, [SAGE_ERROR__CREW_RECORD_NOT_FOUND]: `Crew record not found`, [SAGE_ERROR__CREW_ROSTER_OWNER_MISMATCH]: `Crew roster owner mismatch`, [SAGE_ERROR__CREW_XP_AWARD_TOO_LARGE]: `Crew XP award too large`, [SAGE_ERROR__DUPLICATE_RESOURCE]: `Duplicate resource`, [SAGE_ERROR__EPOCH_DIVISION_ERROR]: `Epoch division error`, [SAGE_ERROR__ESCROW_UNDERFLOW]: `Escrow underflow`, [SAGE_ERROR__EVICTION_NOT_DELINQUENT]: `Eviction not delinquent`, [SAGE_ERROR__FACTION_ALLIED]: `Faction is allied`, [SAGE_ERROR__FACTION_BRIDGE_INCONSISTENT]: `Faction bridge inconsistent`, [SAGE_ERROR__FACTION_CAPTURE_RATE_LIMITED]: `Faction capture rate limited`, [SAGE_ERROR__FACTION_CEASEFIRE]: `Faction ceasefire active`, [SAGE_ERROR__FACTION_DIRECTIVE_RATE_LIMITED]: `Faction directive rate limited`, [SAGE_ERROR__FACTION_DRAIN_BLOCKED]: `Faction drain blocked: own-faction opposition requires an outlaw declaration`, [SAGE_ERROR__FACTION_FLAG_NOT_PERMITTED]: `Faction flag not permitted`, [SAGE_ERROR__FACTION_FLEET_CAP_EXCEEDED]: `Faction fleet cap exceeded`, [SAGE_ERROR__FACTION_MARKET_NOT_DRAFT]: `Faction market not draft`, [SAGE_ERROR__FACTION_MARKET_PDA_MISMATCH]: `Faction market PDA mismatch`, [SAGE_ERROR__FACTION_MARKET_TREASURY_MISMATCH]: `Faction market treasury mismatch`, [SAGE_ERROR__FACTION_MISMATCH]: `Faction mismatch`, [SAGE_ERROR__FACTION_NOT_ACTIVE]: `Faction market not active`, [SAGE_ERROR__FACTION_NOT_COMBATANT]: `Faction is not a combatant`, [SAGE_ERROR__FACTION_OWNERSHIP_MISMATCH]: `Faction ownership mismatch`, [SAGE_ERROR__FACTION_RESERVE_FLOOR]: `Faction reserve floor`, [SAGE_ERROR__FLEET_CREW_PAGE_CONFLICT]: `Fleet crew page conflict`, [SAGE_ERROR__FLEET_NOT_OWNED_BY_FACTION]: `Fleet not owned by faction`, [SAGE_ERROR__GAME_MISMATCH]: `Game mismatch`, [SAGE_ERROR__GEAR_SLOT_OCCUPIED]: `Gear slot occupied`, [SAGE_ERROR__GLOBAL_CEASEFIRE_ACTIVE]: `Global ceasefire active`, [SAGE_ERROR__HUB_ALREADY_PLACED]: `Multiple hubs placed`, [SAGE_ERROR__ID_MISMATCH]: `Id mismatch`, [SAGE_ERROR__INACTIVE_CLAIM_STAKE]: `Claim stake status mismatch`, [SAGE_ERROR__INSTANCE_DEACTIVATED]: `Instance deactivated`, [SAGE_ERROR__INSUFFICIENT_AMOUNT]: `Insufficient amount`, [SAGE_ERROR__INVALID_FACTION]: `Invalid faction`, [SAGE_ERROR__INVALID_FACTION_FLAGS]: `Invalid faction flags`, [SAGE_ERROR__INVALID_FACTION_STATUS_TRANSITION]: `Invalid faction status transition`, [SAGE_ERROR__INVALID_FLEET_DIRECTIVE]: `Invalid fleet directive`, [SAGE_ERROR__INVALID_FLEET_SIZE]: `Invalid fleet size`, [SAGE_ERROR__INVALID_INPUT]: `Invalid input`, [SAGE_ERROR__INVALID_PATH]: `Invalid path`, [SAGE_ERROR__INVALID_RELATION_ARG]: `Invalid relation argument`, [SAGE_ERROR__INVALID_TIMESTAMP]: `Invalid timestamp`, [SAGE_ERROR__INVARIANT_VIOLATION]: `Invariant violation`, [SAGE_ERROR__MAX_ALLIES_EXCEEDED]: `Max allies exceeded`, [SAGE_ERROR__MUST_BE_ONLY_INSTRUCTION]: `Must be only instruction`, [SAGE_ERROR__NOT_AT_CENTRAL_SPACE_STATION]: `Not At Central Space Station`, [SAGE_ERROR__NOT_FOUND]: `Not found`, [SAGE_ERROR__NOT_WITHIN_RANGE]: `Not within range`, [SAGE_ERROR__NUMERIC_OVERFLOW]: `Numeric overflow`, [SAGE_ERROR__PERK_OFFER_GATE]: `Perk offer gate`, [SAGE_ERROR__PROFILE_MISMATCH]: `Profile mismatch`, [SAGE_ERROR__PROGRAM_MISMATCH]: `Program mismatch`, [SAGE_ERROR__REGION_INVALID]: `Region invalid`, [SAGE_ERROR__REGION_NOT_FOUND]: `Region not found`, [SAGE_ERROR__RENT_BASELINE_INCONSISTENT]: `Rent baseline inconsistent`, [SAGE_ERROR__RENT_BUDGET_STALE]: `Rent budget stale`, [SAGE_ERROR__RENT_CANCEL_REFUSED]: `Rent cancel refused`, [SAGE_ERROR__RENT_CATALOG_STATE_MISMATCH]: `Rent catalog state mismatch`, [SAGE_ERROR__RENTED_FLEET]: `Fleet is rented`, [SAGE_ERROR__RENT_EVALUATION_CONFLICT]: `Rent evaluation conflict`, [SAGE_ERROR__RENT_EVALUATION_INCOMPLETE]: `Rent evaluation incomplete`, [SAGE_ERROR__RENT_EVALUATION_STALE]: `Rent evaluation stale`, [SAGE_ERROR__RENT_FIELD_RETIRED]: `Rent field retired: use SetPlanetRentGrid`, [SAGE_ERROR__RENT_HINT_INVALID]: `Rent hint invalid`, [SAGE_ERROR__RENT_HISTORY_INVALID]: `Rent history invalid`, [SAGE_ERROR__RENT_HISTORY_MISSING]: `Rent history missing`, [SAGE_ERROR__RENT_NOTHING_TO_SETTLE]: `Rent nothing to settle`, [SAGE_ERROR__RENT_NUMERIC_DOMAIN]: `Rent numeric domain`, [SAGE_ERROR__RENT_SELECTOR_INVALID]: `Rent selector invalid`, [SAGE_ERROR__RENT_SETTLEMENT_REQUIRED]: `Rent settlement required`, [SAGE_ERROR__RENT_STAKE_EVICTABLE]: `Rent stake evictable`, [SAGE_ERROR__RENT_STAKE_NOT_INVALIDATED]: `Rent stake not invalidated`, [SAGE_ERROR__RENT_WRITE_VERSION_MISMATCH]: `Rent write version mismatch`, [SAGE_ERROR__REQUIREMENTS_NOT_MET]: `Requirements not met`, [SAGE_ERROR__RESERVED_FACTION_ID]: `Reserved faction id`, [SAGE_ERROR__ROSTER_PAGE_MISMATCH]: `Crew roster page mismatch`, [SAGE_ERROR__SELF_RELATION]: `Self relation`, [SAGE_ERROR__SEQUENCE_ID_MISMATCH]: `Sequence ids do not match`, [SAGE_ERROR__SET_PERK_DEFINITIONS_UNSUPPORTED]: `Set perk definitions unsupported`, [SAGE_ERROR__STANDING_ACCOUNT_REQUIRED]: `Standing account required`, [SAGE_ERROR__STANDING_EPOCH_CAP_EXCEEDED]: `Standing epoch cap exceeded`, [SAGE_ERROR__STANDING_FACTION_MISMATCH]: `Standing faction mismatch`, [SAGE_ERROR__STANDING_PDA_MISMATCH]: `Standing PDA mismatch`, [SAGE_ERROR__STANDING_PROFILE_MISMATCH]: `Standing profile mismatch`, [SAGE_ERROR__STANDING_TOO_LOW]: `Standing too low`, [SAGE_ERROR__STARBASE_CONTESTED]: `Starbase contested`, [SAGE_ERROR__STARBASE_DESTROYED]: `Starbase destroyed`, [SAGE_ERROR__STARBASE_NOT_DESTROYED]: `Starbase not destroyed`, [SAGE_ERROR__STATE_MISMATCH]: `State mismatch`, [SAGE_ERROR__STATUS_MISMATCH]: `Status mismatch`, [SAGE_ERROR__STRUCTURE_XP_ACCRUAL_REQUIRED]: `Structure XP accrual ledger required`, [SAGE_ERROR__SYSTEM_MISMATCH]: `System mismatch`, [SAGE_ERROR__TYPE_MISMATCH]: `Type mismatch`, [SAGE_ERROR__UNAUTHORIZED]: `Unauthorized`, [SAGE_ERROR__UNDER_CONSTRUCTION]: `Under construction`, [SAGE_ERROR__USAGE_LIMIT_EXCEEDED]: `Usage limit exceeded`, [SAGE_ERROR__WITHDRAWAL_LIMIT_EXCEEDED]: `Withdrawal limit exceeded`, [SAGE_ERROR__WITHDRAW_DISABLED]: `Withdraw disabled`, [SAGE_ERROR__XP_BUDGET_CONFIG_REQUIRED]: `XP budget config required`, [SAGE_ERROR__XP_BUDGET_NOT_ACTIVE]: `XP budget not active for this game`, [SAGE_ERROR__XP_MIGRATION_DIGEST_MISMATCH]: `XP migration digest mismatch`, [SAGE_ERROR__XP_MIGRATION_INCOMPLETE]: `XP migration incomplete`, [SAGE_ERROR__XP_MIGRATION_IN_PROGRESS]: `XP migration in progress`, [SAGE_ERROR__XP_MIGRATION_MANIFEST_MISMATCH]: `XP migration manifest mismatch`, [SAGE_ERROR__XP_MIGRATION_PHASE_MISMATCH]: `XP migration phase mismatch`, }; } export function getSageErrorMessage(code: SageError): string { if (process.env.NODE_ENV !== 'production') { return (sageErrorMessages as Record)[code]; } return 'Error message not available in production bundles.'; } export function isSageError( error: unknown, transactionMessage: { instructions: Record; }, code?: TProgramErrorCode, ): error is SolanaError & Readonly<{ context: Readonly<{ code: TProgramErrorCode }> }> { return isProgramError( error, transactionMessage, SAGE_PROGRAM_ADDRESS, code, ); }