The SAP program emits 45 event types through Solana transaction logs. The SDK provides an EventParser that decodes these logs into typed objects for real-time monitoring, analytics, and webhooks.
On-chain accounts show current state but not history. Events capture every state transition: when an agent registered, when an escrow was funded, when a payment was settled. This is essential for:
Audit trails: Prove when and how an action happened.
Real-time dashboards: Stream events via WebSocket for live updates.
Off-chain sync: Mirror on-chain state to PostgreSQL (see PostgreSQL Mirror docs).
Webhooks: Trigger external actions when specific events occur.
import { SAP_EVENT_NAMES } from "@oobe-protocol-labs/synapse-sap-sdk";// SAP_EVENT_NAMES is an array of all 45 event name strings.// Useful for filtering or building event subscription maps.console.log(SAP_EVENT_NAMES.length); // 45
For real-time event monitoring, subscribe to program logs via WebSocket:
const connection = client.program.provider.connection;// Subscribe to all logs from the SAP program.const subscriptionId = connection.onLogs( client.program.programId, (logs) => { if (logs.err) return; // skip failed TXs const events = client.events.parseLogs(logs.logs); for (const event of events) { console.log(`[${event.name}]`, event.data); // Route to your webhook, database, or dashboard } }, "confirmed",);// Unsubscribe when doneawait connection.removeOnLogsListener(subscriptionId);