Transaction building API for the Sui blockchain.
This crate provides [TransactionBuilder], for constructing user transactions or PTBs
(programmable transaction blocks). Inputs and commands are added incrementally, and the builder
resolves them into a finalized Transaction.
Feature flags
intents(enabled by default): Enables high-level transaction intents (e.g.,CoinandBalance) and the async [TransactionBuilder::build] method that resolves intents and gas via an RPC client.
Example
Build a simple SUI transfer transaction offline using [TransactionBuilder::try_build]:
use Address;
use Digest;
use ObjectInput;
use TransactionBuilder;
let mut tx = new;
// Split 1 SUI from the gas coin
let amount = tx.pure;
let gas = tx.gas;
let coins = tx.split_coins;
// Transfer to recipient
let recipient = tx.pure;
tx.transfer_objects;
// Set required metadata
tx.set_sender;
tx.set_gas_budget;
tx.set_gas_price;
tx.add_gas_objects;
let transaction = tx.try_build.expect;