/** * @module parser/complete * @description Full SAP transaction parser: instructions + args + accounts + events. * * This is "Case 2 Complete": given a raw transaction response, produce a * single {@link ParsedSapTransaction} containing every decoded instruction, * all inner (CPI) calls, and all SAP events extracted from the logs. * * Designed for indexer pipelines where the decode step must be pure, * deterministic, and fully testable without an RPC connection. * * @category Parser * @since v0.5.0 * * @example * ```ts * import { parseSapTransactionComplete } from "@synapse-sap/sdk/parser"; * import { SAP_PROGRAM_ID, SAP_IDL } from "@synapse-sap/sdk"; * import { Program } from "\@coral-xyz/anchor"; * * const program = new Program(SAP_IDL, provider); * const tx = await connection.getTransaction(sig, { * commitment: "confirmed", * maxSupportedTransactionVersion: 0, * }); * * const parsed = parseSapTransactionComplete(tx, program, SAP_PROGRAM_ID); * console.log(parsed.instructions.map(i => i.name)); * console.log(parsed.events.map(e => e.name)); * ``` */ import { AddressLookupTableAccount, type PublicKey, type TransactionResponse, type VersionedTransactionResponse } from "@solana/web3.js"; import type { Program } from "@coral-xyz/anchor"; import type { ParsedSapTransaction, ParseFilterOptions } from "./types"; /** * Parse a complete SAP transaction into a unified result. * * Combines three stages: * 1. **Instruction decode** - top-level SAP instructions with args and accounts * 2. **Inner instruction decode** - CPI calls with full account reconstruction * 3. **Event extraction** - SAP events decoded from the transaction logs * * All three stages are safe: malformed data produces `null` fields * rather than exceptions. This makes the function suitable for * batch-processing in indexer workers where a single bad transaction * must not halt the pipeline. * * @param tx - The raw transaction response from `connection.getTransaction`. * @param program - An Anchor `Program` instance built from the SAP IDL. * The coder and program ID are extracted automatically. * @param sapProgramId - The SAP program public key. Passed explicitly so * callers can target devnet/localnet deployments independently. * @param options - Optional filters for instructions, events, and inner calls. * @param addressLookupTables - Resolved lookup table accounts for v0 transactions. * @returns A fully parsed transaction, or `null` if the input is `null`/`undefined`. * * @category Parser * @since v0.5.0 */ export declare function parseSapTransactionComplete(tx: TransactionResponse | VersionedTransactionResponse | null | undefined, program: Program, sapProgramId: PublicKey, options?: ParseFilterOptions, addressLookupTables?: AddressLookupTableAccount[]): ParsedSapTransaction | null; /** * Parse multiple transactions in batch. * * Convenience wrapper for indexer pipelines that process pages of * transactions. Skips `null` entries and failed decodes silently. * * @param txs - Array of transaction responses (may contain `null` entries). * @param program - The Anchor SAP program instance. * @param sapProgramId - The SAP program public key. * @param options - Optional parse filters applied to every transaction. * @param addressLookupTables - Lookup tables for v0 transactions. * @returns An array of non-null parsed transactions. * * @category Parser * @since v0.5.0 * * @example * ```ts * const signatures = await connection.getSignaturesForAddress(agentPda); * const txs = await Promise.all( * signatures.map(s => connection.getTransaction(s.signature, { ... })) * ); * const parsed = parseSapTransactionBatch(txs, program, SAP_PROGRAM_ID, { * includeEvents: true, * includeInner: true, * }); * ``` */ export declare function parseSapTransactionBatch(txs: (TransactionResponse | VersionedTransactionResponse | null | undefined)[], program: Program, sapProgramId: PublicKey, options?: ParseFilterOptions, addressLookupTables?: AddressLookupTableAccount[]): ParsedSapTransaction[]; //# sourceMappingURL=complete.d.ts.map