ClientWithTransactionSending

type ClientWithTransactionSending = object;

Represents a client that can send transactions to the Solana network.

Transaction sending handles signing, submission, and confirmation of transactions. It supports flexible input formats including instructions, instruction plans, transaction messages or transaction plans.

Example

async function executeTransfer(client: ClientWithTransactionSending) {
    const instructions = [createTransferInstruction(...)];
 
    // Send a single transaction
    const result = await client.sendTransaction(instructions);
    console.log(`Transaction confirmed: ${result.context.signature}`);
 
    // Or send potentially multiple transactions
    const results = await client.sendTransactions(instructions);
}

Properties

sendTransaction()

sendTransaction: (input, config?) => Promise<SuccessfulSingleTransactionPlanResult>;

Sends a single transaction to the network.

Accepts flexible input: instructions, instruction plans, a single transaction message or a single transaction plan.

Parameters

ParameterTypeDescription
input| InstructionPlanInput | SingleTransactionPlan | SingleTransactionPlan["message"]Instructions, a transaction plan, or a transaction message.
config?ConfigOptional configuration including an abort signal.

Returns

Promise<SuccessfulSingleTransactionPlanResult>

A promise resolving to the successful transaction result.

See

  • InstructionPlanInput
  • SingleTransactionPlan

sendTransactions()

sendTransactions: (input, config?) => Promise<TransactionPlanResult>;

Sends one or more transactions to the network.

Accepts flexible input: instructions, instruction plans, transaction messages or transaction plans.

Parameters

ParameterTypeDescription
inputInstructionPlanInput | TransactionPlanInputAny instruction or a transaction plan input.
config?ConfigOptional configuration including an abort signal.

Returns

Promise<TransactionPlanResult>

A promise resolving to the results for all transactions.

See

  • InstructionPlanInput
  • TransactionPlanInput

On this page