Simulation
getSimulationResult
Simulates a transaction and returns compute units consumed and any errors.Solana connection instance
Array of transaction instructions to simulate
Transaction fee payer
Optional address lookup tables
Whether to use staging environment for error resolution
Compute units consumed (if successful)
Error object (if simulation failed)
Base64 encoded serialized transaction
Error parsing
parseProgramLogs
Parses program logs to extract a human-readable error message.Array of program log strings from transaction simulation or execution
Whether to use staging environment for error code resolution
Human-readable error message. Checks in order:
- Anchor “Error Message:” from program logs
- Insufficient funds/lamports errors
- Custom program error codes (resolved via IDL)
- Returns “Unknown error” if no pattern matches