createFailedToSendTransactionError
Creates a SolanaError with the SOLANA_ERROR__FAILED_TO_SEND_TRANSACTION error code from a failed or canceled SingleTransactionPlanResult.
This is a high-level error designed for user-facing transaction send failures.
It unwraps simulation errors (such as preflight failures) to expose the
underlying transaction error as the cause, and extracts preflight data
and logs into the error context for easy access.
The error message includes an indicator showing whether the failure was a preflight error or includes the on-chain transaction signature for easy copy-pasting into block explorers.
Parameters
| Parameter | Type | Description |
|---|---|---|
result | | CanceledSingleTransactionPlanResult | FailedSingleTransactionPlanResult | A failed or canceled single transaction plan result. |
abortReason? | unknown | An optional abort reason if the transaction was canceled. |
Returns
SolanaError<11>
A SolanaError with the appropriate error code, context, and cause.
Example
Creating an error from a failed transaction plan result.