ClientWithTransactionPlanning

type ClientWithTransactionPlanning = object;

Represents a client that can plan transactions from instruction inputs.

Transaction planning converts high-level instruction plans into concrete transaction messages, handling concerns like blockhash fetching, transaction splitting for size limits, and instruction ordering.

Example

async function prepareTransfer(client: ClientWithTransactionPlanning) {
    const instructions = [createTransferInstruction(...)];
 
    // Plan a single transaction
    const message = await client.planTransaction(instructions);
 
    // Or plan potentially multiple transactions if needed
    const plan = await client.planTransactions(instructions);
}

Properties

planTransaction()

planTransaction: (input, config?) => Promise<SingleTransactionPlan["message"]>;

Plans a single transaction from the given instruction input.

Use this when you expect all instructions to fit in a single transaction.

Parameters

ParameterTypeDescription
inputInstructionPlanInputThe instruction plan input (instructions or instruction plans).
config?ConfigOptional configuration including an abort signal.

Returns

Promise<SingleTransactionPlan["message"]>

A promise resolving to the planned transaction message.

See

InstructionPlanInput


planTransactions()

planTransactions: (input, config?) => Promise<TransactionPlan>;

Plans one or more transactions from the given instruction input.

Use this when instructions might need to be split across multiple transactions due to size limits.

Parameters

ParameterTypeDescription
inputInstructionPlanInputThe instruction plan input (instructions or instruction plans).
config?ConfigOptional configuration including an abort signal.

Returns

Promise<TransactionPlan>

A promise resolving to the full transaction plan.

See

InstructionPlanInput

On this page