addSelfPlanAndSendFunctions
Adds self-planning and self-sending methods to an instruction or instruction plan.
This function augments the provided instruction or instruction plan with methods
that allow it to plan and send itself using the provided client. It enables a fluent API
where you can call methods like .sendTransaction() directly on the instruction.
The function supports both synchronous inputs (instructions, instruction plans) and promise-like inputs, making it suitable for use with async instruction builders.
Type Parameters
| Type Parameter | Description |
|---|---|
TItem extends | Instruction<string, readonly (AccountMeta<string> | AccountLookupMeta<string, string>)[]> | InstructionPlan | PromiseLike<Instruction<string, readonly (AccountMeta<string> | AccountLookupMeta<string, string>)[]>> | PromiseLike<InstructionPlan> | The type of the instruction, instruction plan, or a promise resolving to one. |
Parameters
| Parameter | Type | Description |
|---|---|---|
client | ClientWithTransactionPlanning & ClientWithTransactionSending | A client that provides transaction planning and sending capabilities. |
input | TItem | The instruction, instruction plan, or promise to augment with self-plan/send methods. |
Returns
SelfPlanAndSendFunctions & TItem
The input augmented with SelfPlanAndSendFunctions methods.
Examples
Adding self-plan and send to a transfer instruction.
Using with an async instruction builder.