successfulSingleTransactionPlanResult

function successfulSingleTransactionPlanResult<
    TContext,
    TTransactionMessage,
>(
    plannedMessage,
    context,
): SuccessfulSingleTransactionPlanResult<TContext, TTransactionMessage>;

Creates a successful SingleTransactionPlanResult from a transaction message and context.

This function creates a single result with a 'successful' status, indicating that the transaction was successfully executed. It also includes the original transaction message and a context object, which becomes the result's context as-is, typed as TContext. Passing a context containing a signature — the common case — yields the default TransactionPlanResultContextWithSignature shape; supply a different context shape when the transaction has no fee payer signature to report.

Type Parameters

Type ParameterDefault typeDescription
TContext extends TransactionPlanResultContextTransactionPlanResultContextWithSignatureThe 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
contextTContextThe context object to be included with the result, as TContext

Returns

SuccessfulSingleTransactionPlanResult<TContext, TTransactionMessage>

Example

const result = successfulSingleTransactionPlanResult(
  transactionMessage,
  { signature },
);
result satisfies SingleTransactionPlanResult;

See

SingleTransactionPlanResult

On this page