createFailedToSignTransactionsError

function createFailedToSignTransactionsError<TContext>(
    result,
    abortReason?,
): SolanaError<14>;

Creates a SolanaError with the SOLANA_ERROR__FAILED_TO_SIGN_TRANSACTIONS error code from a TransactionPlanResult.

This is the signing counterpart to createFailedToSendTransactionsError, designed for user-facing failures raised by executors that sign several transactions without submitting them. It walks the result tree, unwraps simulation errors from each failure, and builds the same failedTransactions array pairing each failure with its unwrapped error, logs, and preflight data.

As with createFailedToSignTransactionError, each line names only the position of the failure in the plan. Nothing was submitted, so there is no preflight to flag and no transaction signature worth quoting.

Type Parameters

Type ParameterDefault typeDescription
TContext extends TransactionPlanResultContextTransactionPlanResultContextThe type of the context object attached to the results. Any context is accepted, since this helper never reads from it.

Parameters

ParameterTypeDescription
resultTransactionPlanResult<TContext>The full transaction plan result tree.
abortReason?unknownAn optional abort reason if the plan was aborted.

Returns

SolanaError<14>

A SolanaError with the appropriate error code, context, and cause.

Example

Creating an error from a failed transaction plan result.

import { createFailedToSignTransactionsError } from '@solana/instruction-plans';
 
const error = createFailedToSignTransactionsError(planResult);
console.log(error.message);
// "Failed to sign transactions.
// [Tx #1] Insufficient funds for fee
// [Tx #3] The user rejected the signing request"
console.log(error.context.failedTransactions);
// [{ index: 0, error: ..., logs: [...], preflightData: {...} }, ...]

See

On this page