1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
// Copyright (c) Mysten Labs, Inc.
// SPDX-License-Identifier: Apache-2.0
//! 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`](sui_sdk_types::Transaction).
//!
//! [Sui]: https://sui.io
//!
//! # Feature flags
//!
//! - `intents` *(enabled by default)*: Enables high-level transaction intents (e.g.,
//! [`Coin`](intent::Coin) and [`Balance`](intent::Balance)) 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 sui_sdk_types::Address;
//! use sui_sdk_types::Digest;
//! use sui_transaction_builder::ObjectInput;
//! use sui_transaction_builder::TransactionBuilder;
//!
//! let mut tx = TransactionBuilder::new();
//!
//! // Split 1 SUI from the gas coin
//! let amount = tx.pure(&1_000_000_000u64);
//! let gas = tx.gas();
//! let coins = tx.split_coins(gas, vec![amount]);
//!
//! // Transfer to recipient
//! let recipient = tx.pure(&Address::ZERO);
//! tx.transfer_objects(coins, recipient);
//!
//! // Set required metadata
//! tx.set_sender(Address::ZERO);
//! tx.set_gas_budget(500_000_000);
//! tx.set_gas_price(1000);
//! tx.add_gas_objects([ObjectInput::owned(Address::ZERO, 1, Digest::ZERO)]);
//!
//! let transaction = tx.try_build().expect("build should succeed");
//! ```
pub use Argument;
pub use Function;
pub use ObjectInput;
pub use TransactionBuilder;
pub use Error;
pub use SimulationFailure;