Skip to main content
Tx Builder hero

Overview

The TxBuilder provides a fluent API for batching multiple operations into a single atomic transaction. This saves gas and guarantees all-or-nothing execution—either all operations succeed together, or none of them execute.

Basic Usage

Mixing Operations

Combine transfers, staking, approvals, and raw calls:
The .stake() method is smart — it automatically calls enter_delegation_pool for new members or add_to_delegation_pool for existing members.

Preflight with Builder

Fee Estimation

Extracting Calls

You can also extract the raw calls for inspection:

Available Builder Methods

Best Practices

  1. Use the transaction builder for complex operations to save gas
  2. Always preflight non-trivial batches before submitting
  3. Combine related operations into a single transaction when possible
  4. Use .estimateFee() to show users the cost before executing

Next Steps