pub trait TransactionDataAPI {
Show 45 methods
// Required methods
fn sender(&self) -> IotaAddress;
fn kind(&self) -> &TransactionKind;
fn kind_mut(&mut self) -> &mut TransactionKind;
fn into_kind(self) -> TransactionKind;
fn signers(&self) -> NonEmpty<IotaAddress>;
fn gas_data(&self) -> &GasData;
fn gas_owner(&self) -> IotaAddress;
fn gas(&self) -> &[ObjectRef];
fn gas_price(&self) -> u64;
fn gas_budget(&self) -> u64;
fn expiration(&self) -> &TransactionExpiration;
fn shared_input_objects(&self) -> Vec<SharedObjectRef>;
fn move_calls(&self) -> Vec<(&ObjectID, &str, &str)>;
fn input_objects(&self) -> UserInputResult<Vec<InputObjectKind>>;
fn receiving_objects(&self) -> Vec<ObjectRef>;
fn validity_check(&self, config: &ProtocolConfig) -> UserInputResult;
fn validity_check_no_gas_check(
&self,
config: &ProtocolConfig,
) -> UserInputResult;
fn check_sponsorship(&self) -> UserInputResult;
fn is_system_tx(&self) -> bool;
fn is_genesis_tx(&self) -> bool;
fn is_end_of_epoch_tx(&self) -> bool;
fn is_sponsored_tx(&self) -> bool;
fn sender_mut_for_testing(&mut self) -> &mut IotaAddress;
fn gas_data_mut(&mut self) -> &mut GasData;
fn expiration_mut_for_testing(&mut self) -> &mut TransactionExpiration;
fn new_system_transaction(kind: TransactionKind) -> TransactionData;
fn new(
kind: TransactionKind,
sender: IotaAddress,
gas_payment: ObjectRef,
gas_budget: u64,
gas_price: u64,
) -> TransactionData;
fn new_with_gas_coins(
kind: TransactionKind,
sender: IotaAddress,
gas_payment: Vec<ObjectRef>,
gas_budget: u64,
gas_price: u64,
) -> TransactionData;
fn new_with_gas_coins_allow_sponsor(
kind: TransactionKind,
sender: IotaAddress,
gas_payment: Vec<ObjectRef>,
gas_budget: u64,
gas_price: u64,
gas_sponsor: IotaAddress,
) -> TransactionData;
fn new_with_gas_data(
kind: TransactionKind,
sender: IotaAddress,
gas_data: GasData,
) -> TransactionData;
fn new_move_call(
sender: IotaAddress,
package: ObjectID,
module: Identifier,
function: Identifier,
type_arguments: Vec<TypeTag>,
gas_payment: ObjectRef,
arguments: Vec<CallArg>,
gas_budget: u64,
gas_price: u64,
) -> Result<TransactionData>;
fn new_move_call_with_gas_coins(
sender: IotaAddress,
package: ObjectID,
module: Identifier,
function: Identifier,
type_arguments: Vec<TypeTag>,
gas_payment: Vec<ObjectRef>,
arguments: Vec<CallArg>,
gas_budget: u64,
gas_price: u64,
) -> Result<TransactionData>;
fn new_transfer(
recipient: IotaAddress,
object_ref: ObjectRef,
sender: IotaAddress,
gas_payment: ObjectRef,
gas_budget: u64,
gas_price: u64,
) -> TransactionData;
fn new_transfer_iota(
recipient: IotaAddress,
sender: IotaAddress,
amount: Option<u64>,
gas_payment: ObjectRef,
gas_budget: u64,
gas_price: u64,
) -> TransactionData;
fn new_transfer_iota_allow_sponsor(
recipient: IotaAddress,
sender: IotaAddress,
amount: Option<u64>,
gas_payment: ObjectRef,
gas_budget: u64,
gas_price: u64,
gas_sponsor: IotaAddress,
) -> TransactionData;
fn new_pay(
sender: IotaAddress,
coins: Vec<ObjectRef>,
recipients: Vec<IotaAddress>,
amounts: Vec<u64>,
gas_payment: ObjectRef,
gas_budget: u64,
gas_price: u64,
) -> Result<TransactionData>;
fn new_pay_iota(
sender: IotaAddress,
coins: Vec<ObjectRef>,
recipients: Vec<IotaAddress>,
amounts: Vec<u64>,
gas_payment: ObjectRef,
gas_budget: u64,
gas_price: u64,
) -> Result<TransactionData>;
fn new_pay_all_iota(
sender: IotaAddress,
coins: Vec<ObjectRef>,
recipient: IotaAddress,
gas_payment: ObjectRef,
gas_budget: u64,
gas_price: u64,
) -> TransactionData;
fn new_split_coin(
sender: IotaAddress,
coin: ObjectRef,
amounts: Vec<u64>,
gas_payment: ObjectRef,
gas_budget: u64,
gas_price: u64,
) -> TransactionData;
fn new_module(
sender: IotaAddress,
gas_payment: ObjectRef,
modules: Vec<Vec<u8>>,
dep_ids: Vec<ObjectID>,
gas_budget: u64,
gas_price: u64,
) -> TransactionData;
fn new_upgrade(
sender: IotaAddress,
gas_payment: ObjectRef,
package_id: ObjectID,
modules: Vec<Vec<u8>>,
dep_ids: Vec<ObjectID>,
upgrade_capability_and_owner: (ObjectRef, Owner),
upgrade_policy: u8,
digest: Vec<u8>,
gas_budget: u64,
gas_price: u64,
) -> Result<TransactionData>;
fn new_programmable(
sender: IotaAddress,
gas_payment: Vec<ObjectRef>,
pt: ProgrammableTransaction,
gas_budget: u64,
gas_price: u64,
) -> TransactionData;
fn new_programmable_allow_sponsor(
sender: IotaAddress,
gas_payment: Vec<ObjectRef>,
pt: ProgrammableTransaction,
gas_budget: u64,
gas_price: u64,
sponsor: IotaAddress,
) -> TransactionData;
fn message_version(&self) -> u64;
fn execution_parts(&self) -> (TransactionKind, IotaAddress, GasData);
}Expand description
API for accessing and constructing TransactionData.
This trait provides node-internal methods for:
- Accessors: reading transaction fields (sender, kind, gas, expiration, etc.)
- Queries: inspecting transaction properties (shared objects, Move calls, sponsorship)
- Validation: checking transaction validity against protocol config
- Constructors: building new transactions (transfers, Move calls, programmable txs, etc.)
Note: The iota-rust-sdk crate (iota-sdk-types) defines its own
Transaction type with additional client-facing methods.
Required Methods§
Sourcefn sender(&self) -> IotaAddress
fn sender(&self) -> IotaAddress
Returns the address of the transaction sender.
Sourcefn kind(&self) -> &TransactionKind
fn kind(&self) -> &TransactionKind
Returns a reference to the transaction kind.
Sourcefn kind_mut(&mut self) -> &mut TransactionKind
fn kind_mut(&mut self) -> &mut TransactionKind
Returns a mutable reference to the transaction kind.
Sourcefn into_kind(self) -> TransactionKind
fn into_kind(self) -> TransactionKind
Consumes self and returns the transaction kind.
Sourcefn signers(&self) -> NonEmpty<IotaAddress>
fn signers(&self) -> NonEmpty<IotaAddress>
Returns the transaction signer(s). Includes both the sender and the gas owner if they differ (i.e. for sponsored transactions).
Sourcefn gas_data(&self) -> &GasData
fn gas_data(&self) -> &GasData
Returns a reference to the gas data (owner, payment objects, price, budget).
Sourcefn gas_owner(&self) -> IotaAddress
fn gas_owner(&self) -> IotaAddress
Returns the address that owns the gas payment objects.
Sourcefn gas_budget(&self) -> u64
fn gas_budget(&self) -> u64
Returns the gas budget for this transaction.
Sourcefn expiration(&self) -> &TransactionExpiration
fn expiration(&self) -> &TransactionExpiration
Returns the transaction expiration.
Returns a list of the transaction data shared input objects.
IMPORTANT: This function does not return shared objects associated with
MoveAuthenticator signatures. To check those objects as well, use the
corresponding function from SenderSignedData.
Sourcefn move_calls(&self) -> Vec<(&ObjectID, &str, &str)>
fn move_calls(&self) -> Vec<(&ObjectID, &str, &str)>
Returns a list of Move calls as (package_id, module_name, function_name) tuples.
Sourcefn input_objects(&self) -> UserInputResult<Vec<InputObjectKind>>
fn input_objects(&self) -> UserInputResult<Vec<InputObjectKind>>
Returns all input objects required by this transaction.
Sourcefn receiving_objects(&self) -> Vec<ObjectRef>
fn receiving_objects(&self) -> Vec<ObjectRef>
Returns object references for all objects being received in this transaction.
Sourcefn validity_check(&self, config: &ProtocolConfig) -> UserInputResult
fn validity_check(&self, config: &ProtocolConfig) -> UserInputResult
Validates the transaction data against the given protocol config, including gas checks.
Sourcefn validity_check_no_gas_check(
&self,
config: &ProtocolConfig,
) -> UserInputResult
fn validity_check_no_gas_check( &self, config: &ProtocolConfig, ) -> UserInputResult
Validates the transaction data against the given protocol config, skipping gas-related checks.
Sourcefn check_sponsorship(&self) -> UserInputResult
fn check_sponsorship(&self) -> UserInputResult
Check if the transaction is compliant with sponsorship.
Sourcefn is_system_tx(&self) -> bool
fn is_system_tx(&self) -> bool
Returns true if this is a system transaction.
Sourcefn is_genesis_tx(&self) -> bool
fn is_genesis_tx(&self) -> bool
Returns true if this is the genesis transaction.
Sourcefn is_end_of_epoch_tx(&self) -> bool
fn is_end_of_epoch_tx(&self) -> bool
returns true if the transaction is one that is specially sequenced to run at the very end of the epoch
Sourcefn is_sponsored_tx(&self) -> bool
fn is_sponsored_tx(&self) -> bool
Check if the transaction is sponsored (namely gas owner != sender)
Sourcefn sender_mut_for_testing(&mut self) -> &mut IotaAddress
fn sender_mut_for_testing(&mut self) -> &mut IotaAddress
Returns a mutable reference to the sender address. Testing only.
Sourcefn gas_data_mut(&mut self) -> &mut GasData
fn gas_data_mut(&mut self) -> &mut GasData
Returns a mutable reference to the gas data.
Sourcefn expiration_mut_for_testing(&mut self) -> &mut TransactionExpiration
fn expiration_mut_for_testing(&mut self) -> &mut TransactionExpiration
Returns a mutable reference to the expiration. Testing only.
Sourcefn new_system_transaction(kind: TransactionKind) -> TransactionData
fn new_system_transaction(kind: TransactionKind) -> TransactionData
Creates a new system transaction with no gas payment. Used for validator-initiated transactions (epoch changes, checkpoints, etc.).
Sourcefn new(
kind: TransactionKind,
sender: IotaAddress,
gas_payment: ObjectRef,
gas_budget: u64,
gas_price: u64,
) -> TransactionData
fn new( kind: TransactionKind, sender: IotaAddress, gas_payment: ObjectRef, gas_budget: u64, gas_price: u64, ) -> TransactionData
Creates a new transaction with a single gas payment coin. The sender is also the gas owner.
Sourcefn new_with_gas_coins(
kind: TransactionKind,
sender: IotaAddress,
gas_payment: Vec<ObjectRef>,
gas_budget: u64,
gas_price: u64,
) -> TransactionData
fn new_with_gas_coins( kind: TransactionKind, sender: IotaAddress, gas_payment: Vec<ObjectRef>, gas_budget: u64, gas_price: u64, ) -> TransactionData
Creates a new transaction with multiple gas payment coins. The sender is also the gas owner.
Sourcefn new_with_gas_coins_allow_sponsor(
kind: TransactionKind,
sender: IotaAddress,
gas_payment: Vec<ObjectRef>,
gas_budget: u64,
gas_price: u64,
gas_sponsor: IotaAddress,
) -> TransactionData
fn new_with_gas_coins_allow_sponsor( kind: TransactionKind, sender: IotaAddress, gas_payment: Vec<ObjectRef>, gas_budget: u64, gas_price: u64, gas_sponsor: IotaAddress, ) -> TransactionData
Creates a new transaction with multiple gas payment coins and a separate gas sponsor. Use this for sponsored transactions where the gas owner differs from the sender.
Sourcefn new_with_gas_data(
kind: TransactionKind,
sender: IotaAddress,
gas_data: GasData,
) -> TransactionData
fn new_with_gas_data( kind: TransactionKind, sender: IotaAddress, gas_data: GasData, ) -> TransactionData
Creates a new transaction from a pre-built GasData struct.
Sourcefn new_move_call(
sender: IotaAddress,
package: ObjectID,
module: Identifier,
function: Identifier,
type_arguments: Vec<TypeTag>,
gas_payment: ObjectRef,
arguments: Vec<CallArg>,
gas_budget: u64,
gas_price: u64,
) -> Result<TransactionData>
fn new_move_call( sender: IotaAddress, package: ObjectID, module: Identifier, function: Identifier, type_arguments: Vec<TypeTag>, gas_payment: ObjectRef, arguments: Vec<CallArg>, gas_budget: u64, gas_price: u64, ) -> Result<TransactionData>
Creates a transaction that calls a single Move function with a single gas payment coin.
Sourcefn new_move_call_with_gas_coins(
sender: IotaAddress,
package: ObjectID,
module: Identifier,
function: Identifier,
type_arguments: Vec<TypeTag>,
gas_payment: Vec<ObjectRef>,
arguments: Vec<CallArg>,
gas_budget: u64,
gas_price: u64,
) -> Result<TransactionData>
fn new_move_call_with_gas_coins( sender: IotaAddress, package: ObjectID, module: Identifier, function: Identifier, type_arguments: Vec<TypeTag>, gas_payment: Vec<ObjectRef>, arguments: Vec<CallArg>, gas_budget: u64, gas_price: u64, ) -> Result<TransactionData>
Creates a transaction that calls a single Move function with multiple gas payment coins.
Sourcefn new_transfer(
recipient: IotaAddress,
object_ref: ObjectRef,
sender: IotaAddress,
gas_payment: ObjectRef,
gas_budget: u64,
gas_price: u64,
) -> TransactionData
fn new_transfer( recipient: IotaAddress, object_ref: ObjectRef, sender: IotaAddress, gas_payment: ObjectRef, gas_budget: u64, gas_price: u64, ) -> TransactionData
Creates a transaction that transfers an object to a recipient.
Sourcefn new_transfer_iota(
recipient: IotaAddress,
sender: IotaAddress,
amount: Option<u64>,
gas_payment: ObjectRef,
gas_budget: u64,
gas_price: u64,
) -> TransactionData
fn new_transfer_iota( recipient: IotaAddress, sender: IotaAddress, amount: Option<u64>, gas_payment: ObjectRef, gas_budget: u64, gas_price: u64, ) -> TransactionData
Creates a transaction that transfers IOTA coins to a recipient.
If amount is None, the entire gas coin balance (minus gas fees)
is transferred.
Sourcefn new_transfer_iota_allow_sponsor(
recipient: IotaAddress,
sender: IotaAddress,
amount: Option<u64>,
gas_payment: ObjectRef,
gas_budget: u64,
gas_price: u64,
gas_sponsor: IotaAddress,
) -> TransactionData
fn new_transfer_iota_allow_sponsor( recipient: IotaAddress, sender: IotaAddress, amount: Option<u64>, gas_payment: ObjectRef, gas_budget: u64, gas_price: u64, gas_sponsor: IotaAddress, ) -> TransactionData
Creates a sponsored transaction that transfers IOTA coins to a
recipient. If amount is None, the entire gas coin balance
(minus gas fees) is transferred.
Sourcefn new_pay(
sender: IotaAddress,
coins: Vec<ObjectRef>,
recipients: Vec<IotaAddress>,
amounts: Vec<u64>,
gas_payment: ObjectRef,
gas_budget: u64,
gas_price: u64,
) -> Result<TransactionData>
fn new_pay( sender: IotaAddress, coins: Vec<ObjectRef>, recipients: Vec<IotaAddress>, amounts: Vec<u64>, gas_payment: ObjectRef, gas_budget: u64, gas_price: u64, ) -> Result<TransactionData>
Creates a transaction that pays multiple recipients from a set of input coins. The coins are merged and then split to satisfy the specified amounts.
Sourcefn new_pay_iota(
sender: IotaAddress,
coins: Vec<ObjectRef>,
recipients: Vec<IotaAddress>,
amounts: Vec<u64>,
gas_payment: ObjectRef,
gas_budget: u64,
gas_price: u64,
) -> Result<TransactionData>
fn new_pay_iota( sender: IotaAddress, coins: Vec<ObjectRef>, recipients: Vec<IotaAddress>, amounts: Vec<u64>, gas_payment: ObjectRef, gas_budget: u64, gas_price: u64, ) -> Result<TransactionData>
Creates a transaction that pays multiple recipients using IOTA coins.
Similar to Self::new_pay but the gas coin is also used as an
input coin.
Sourcefn new_pay_all_iota(
sender: IotaAddress,
coins: Vec<ObjectRef>,
recipient: IotaAddress,
gas_payment: ObjectRef,
gas_budget: u64,
gas_price: u64,
) -> TransactionData
fn new_pay_all_iota( sender: IotaAddress, coins: Vec<ObjectRef>, recipient: IotaAddress, gas_payment: ObjectRef, gas_budget: u64, gas_price: u64, ) -> TransactionData
Creates a transaction that sends all IOTA from the given coins to a single recipient. The gas coin is included as an input coin.
Sourcefn new_split_coin(
sender: IotaAddress,
coin: ObjectRef,
amounts: Vec<u64>,
gas_payment: ObjectRef,
gas_budget: u64,
gas_price: u64,
) -> TransactionData
fn new_split_coin( sender: IotaAddress, coin: ObjectRef, amounts: Vec<u64>, gas_payment: ObjectRef, gas_budget: u64, gas_price: u64, ) -> TransactionData
Creates a transaction that splits a coin into multiple coins with the specified amounts.
Sourcefn new_module(
sender: IotaAddress,
gas_payment: ObjectRef,
modules: Vec<Vec<u8>>,
dep_ids: Vec<ObjectID>,
gas_budget: u64,
gas_price: u64,
) -> TransactionData
fn new_module( sender: IotaAddress, gas_payment: ObjectRef, modules: Vec<Vec<u8>>, dep_ids: Vec<ObjectID>, gas_budget: u64, gas_price: u64, ) -> TransactionData
Creates a transaction that publishes new Move modules.
Sourcefn new_upgrade(
sender: IotaAddress,
gas_payment: ObjectRef,
package_id: ObjectID,
modules: Vec<Vec<u8>>,
dep_ids: Vec<ObjectID>,
upgrade_capability_and_owner: (ObjectRef, Owner),
upgrade_policy: u8,
digest: Vec<u8>,
gas_budget: u64,
gas_price: u64,
) -> Result<TransactionData>
fn new_upgrade( sender: IotaAddress, gas_payment: ObjectRef, package_id: ObjectID, modules: Vec<Vec<u8>>, dep_ids: Vec<ObjectID>, upgrade_capability_and_owner: (ObjectRef, Owner), upgrade_policy: u8, digest: Vec<u8>, gas_budget: u64, gas_price: u64, ) -> Result<TransactionData>
Creates a transaction that upgrades an existing Move package. Requires the upgrade capability object and the upgrade policy.
Sourcefn new_programmable(
sender: IotaAddress,
gas_payment: Vec<ObjectRef>,
pt: ProgrammableTransaction,
gas_budget: u64,
gas_price: u64,
) -> TransactionData
fn new_programmable( sender: IotaAddress, gas_payment: Vec<ObjectRef>, pt: ProgrammableTransaction, gas_budget: u64, gas_price: u64, ) -> TransactionData
Creates a programmable transaction with multiple gas payment coins. The sender is also the gas owner.
Sourcefn new_programmable_allow_sponsor(
sender: IotaAddress,
gas_payment: Vec<ObjectRef>,
pt: ProgrammableTransaction,
gas_budget: u64,
gas_price: u64,
sponsor: IotaAddress,
) -> TransactionData
fn new_programmable_allow_sponsor( sender: IotaAddress, gas_payment: Vec<ObjectRef>, pt: ProgrammableTransaction, gas_budget: u64, gas_price: u64, sponsor: IotaAddress, ) -> TransactionData
Creates a programmable transaction with multiple gas payment coins and a separate gas sponsor.
Sourcefn message_version(&self) -> u64
fn message_version(&self) -> u64
Returns the internal message version number.
Sourcefn execution_parts(&self) -> (TransactionKind, IotaAddress, GasData)
fn execution_parts(&self) -> (TransactionKind, IotaAddress, GasData)
Consumes self and returns the transaction kind, sender address, and gas payment object references as a tuple.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.