/** * Auto-healing serialization for Adrena trade builders. * * When the pre-sign simulation fails with a multi-oracle error (6088 * MissingOraclePrice, 6098 SwitchboardMissingAccounts, 6102 QuoteTooStale, * 6103 FeedMappingMissing), the trade can be made valid by refreshing the * Switchboard price feed on-chain and pulling it into the Adrena oracle PDA * right before the trade instruction: * * [update_oracle (switchboard_oracle_prices + quote account remaining)] * [original trade ix] * * @module perps/adrena/adrena-oracle-autoheal */ import { Connection, PublicKey, TransactionInstruction } from '@solana/web3.js'; import { type SerializeResult } from './adrena-builder-core.js'; /** Result of the auto-heal attempt. */ export interface AutoHealResult { /** True when the retry produced a passing simulation. */ healed: boolean; /** Re-serialized transaction base64 (with the update_oracle prepended). */ transactionBase64?: string; /** Updated simulation metadata. */ serializeResult?: SerializeResult; /** True when TX A (Switchboard refresh) still needs to be signed+submitted * by the caller BEFORE the healed trade tx. */ requiresOracleRefreshTx: boolean; /** The unsigned refresh transaction (sign+submit first) when required. */ oracleRefreshTransactionBase64?: string; /** Canonical SB quote account updated by the refresh tx. */ quoteAccount?: string; /** Failure description if healing was not possible. */ failure?: string; } /** Check a SerializeResult for a recoverable multi-oracle failure. */ export declare function hasOracleRecoverableFailure(result: Pick): boolean; /** * Retry a failing trade-build with the Adrena Switchboard oracle refresh * prepended to the instruction list. * * NOTE: the update_oracle ix reads a Switchboard quote account that must be * refreshed on-chain first (TX A from buildAdrenaSbOracleRefresh). This * helper detects that case and returns `requiresOracleRefreshTx: true` with * the unsigned refresh transaction, so the caller can drive the two-step * sign+submit flow. * * @param connection — Solana RPC connection. * @param feePayer — Transaction fee payer. * @param instructions — The original (failing) trade instructions. * @param instructionNames — Instruction names for error messages. * @param failedSimulation — The failed serialize result that triggered healing. */ export declare function serializeUnsignedTxWithOracleAutoHeal(connection: Connection, feePayer: PublicKey, instructions: readonly TransactionInstruction[], instructionNames: readonly string[], failedSimulation: Pick): Promise; //# sourceMappingURL=adrena-oracle-autoheal.d.ts.map