useSendTransactions

function useSendTransactions(
    client,
): ActionResult<
    [InstructionPlanInput | TransactionPlanInput],
    TransactionPlanResult
>;

Sends one or more transactions to the network, as a reactive action.

Wraps client.sendTransactions with useAction, which handles signing, submission, and confirmation. Each dispatch(input) runs with a fresh AbortSignal and tracks its lifecycle through React state; calling dispatch again while a previous send is in flight aborts the first. Accepts flexible input: instructions, an instruction plan, or a transaction plan. Use useSendTransaction for the single-transaction case.

Parameters

ParameterTypeDescription
clientClientWithTransactionSendingA client with a transaction-sending plugin installed.

Returns

ActionResult<[InstructionPlanInput | TransactionPlanInput], TransactionPlanResult>

An ActionResult whose dispatch/dispatchAsync take the input and resolve with the TransactionPlanResult for all transactions.

Example

const { dispatch, data, isRunning } = useSendTransactions(client);
<button disabled={isRunning} onClick={() => dispatch(instructions)}>Send</button>

See

On this page