failedSingleTransactionPlanResult

function failedSingleTransactionPlanResult<
    TContext,
    TTransactionMessage,
>(
    plannedMessage,
    error,
    context?,
): FailedSingleTransactionPlanResult<TContext, TTransactionMessage>;

Creates a failed SingleTransactionPlanResult from a transaction message and error.

This function creates a single result with a 'failed' status, indicating that the transaction execution failed. It includes the original transaction message and the error that caused the failure.

Type Parameters

Type ParameterDefault typeDescription
TContext extends TransactionPlanResultContextTransactionPlanResultContextThe type of the context object
TTransactionMessage extends TransactionMessage & TransactionMessageWithFeePayer<string>TransactionMessage & TransactionMessageWithFeePayer<string>The type of the transaction message

Parameters

ParameterTypeDescription
plannedMessageTTransactionMessageThe original transaction message
errorErrorThe error that caused the transaction to fail
context?TContext-

Returns

FailedSingleTransactionPlanResult<TContext, TTransactionMessage>

Example

const result = failedSingleTransactionPlanResult(
  transactionMessage,
  new SolanaError({
    code: 123,
    message: 'Transaction simulation failed',
  }),
);
result satisfies SingleTransactionPlanResult;

See

SingleTransactionPlanResult

On this page