Batch Transactions
One of the most powerful features of the Tempo Transaction type is batching multiple operations into a single transaction. This allows you to execute several actions atomically (i.e., they all succeed or all fail together). This helps reduce gas costs, prevents partial failures, and creates better user experiences by combining multiple steps into one transaction.
Example: Sending a Batch of Transactions
batchTransactions.ts
const { address, hash, id } = await client.sendTransaction({
calls: [{
to: tokenAddress,
data: transferCalldata // Transfer tokens
},
{
to: anotherTokenAddress,
data: approveCalldata // Approve spending
},
{
to: dexAddress,
data: swapCalldata // Execute swap
}],
}) How It Works
Unlike traditional EVM transactions which only support a single call per transaction, the Tempo Transaction type natively supports a calls vector—enabling multiple operations in a single atomic transaction.
Native Protocol Support
Batching is built directly into the transaction type at the protocol level. This means:
- Atomic execution: All calls succeed or all calls revert together—no partial failures
- Single signature: Sign once for the entire batch, reducing UX friction
- Lower gas costs: Avoid the overhead of multiple transaction submissions
- No smart contract required: Works with any EOA, no need to deploy a separate batching contract
Transaction Structure
The TempoTransaction includes a calls field that accepts a list of operations:
pub struct TempoTransaction {
// ... other fields
calls: Vec<Call>, // Batch of calls to execute atomically
// ...
}
pub struct Call {
to: TxKind, // Target address or Create for contract deployment
value: U256, // ETH value to send
input: Bytes, // Calldata for the call
}