isSimulationError
A type guard that returns true if the input is a SolanaError thrown because a
transaction simulation failed.
When this returns true, TypeScript will refine the error's
`context` to the simulation result (eg. logs and
unitsConsumed). The underlying transaction error, if any, is available as the error's cause.
The following error codes are considered simulation errors:
- SOLANA_ERROR__JSON_RPC__SERVER_ERROR_SEND_TRANSACTION_PREFLIGHT_FAILURE
- SOLANA_ERROR__TRANSACTION__FAILED_WHEN_SIMULATING_TO_ESTIMATE_COMPUTE_LIMIT
- SOLANA_ERROR__TRANSACTION__FAILED_WHEN_SIMULATING_TO_ESTIMATE_RESOURCE_LIMITS
Parameters
| Parameter | Type | Description |
|---|---|---|
e | unknown | The value to check. |
Returns
e is SolanaError<SolanaErrorCodeWithSimulationResult>
true if the input is a simulation error, false otherwise.
Example
Reading the simulation logs of a failed transaction.