TransactionDataAPI

Trait TransactionDataAPI 

Source
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§

Source

fn sender(&self) -> IotaAddress

Returns the address of the transaction sender.

Source

fn kind(&self) -> &TransactionKind

Returns a reference to the transaction kind.

Source

fn kind_mut(&mut self) -> &mut TransactionKind

Returns a mutable reference to the transaction kind.

Source

fn into_kind(self) -> TransactionKind

Consumes self and returns the transaction kind.

Source

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).

Source

fn gas_data(&self) -> &GasData

Returns a reference to the gas data (owner, payment objects, price, budget).

Source

fn gas_owner(&self) -> IotaAddress

Returns the address that owns the gas payment objects.

Source

fn gas(&self) -> &[ObjectRef]

Returns the gas payment object references.

Source

fn gas_price(&self) -> u64

Returns the gas price for this transaction.

Source

fn gas_budget(&self) -> u64

Returns the gas budget for this transaction.

Source

fn expiration(&self) -> &TransactionExpiration

Returns the transaction expiration.

Source

fn shared_input_objects(&self) -> Vec<SharedObjectRef>

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.

Source

fn move_calls(&self) -> Vec<(&ObjectID, &str, &str)>

Returns a list of Move calls as (package_id, module_name, function_name) tuples.

Source

fn input_objects(&self) -> UserInputResult<Vec<InputObjectKind>>

Returns all input objects required by this transaction.

Source

fn receiving_objects(&self) -> Vec<ObjectRef>

Returns object references for all objects being received in this transaction.

Source

fn validity_check(&self, config: &ProtocolConfig) -> UserInputResult

Validates the transaction data against the given protocol config, including gas checks.

Source

fn validity_check_no_gas_check( &self, config: &ProtocolConfig, ) -> UserInputResult

Validates the transaction data against the given protocol config, skipping gas-related checks.

Source

fn check_sponsorship(&self) -> UserInputResult

Check if the transaction is compliant with sponsorship.

Source

fn is_system_tx(&self) -> bool

Returns true if this is a system transaction.

Source

fn is_genesis_tx(&self) -> bool

Returns true if this is the genesis transaction.

Source

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

Source

fn is_sponsored_tx(&self) -> bool

Check if the transaction is sponsored (namely gas owner != sender)

Source

fn sender_mut_for_testing(&mut self) -> &mut IotaAddress

Returns a mutable reference to the sender address. Testing only.

Source

fn gas_data_mut(&mut self) -> &mut GasData

Returns a mutable reference to the gas data.

Source

fn expiration_mut_for_testing(&mut self) -> &mut TransactionExpiration

Returns a mutable reference to the expiration. Testing only.

Source

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.).

Source

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.

Source

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.

Source

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.

Source

fn new_with_gas_data( kind: TransactionKind, sender: IotaAddress, gas_data: GasData, ) -> TransactionData

Creates a new transaction from a pre-built GasData struct.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

fn message_version(&self) -> u64

Returns the internal message version number.

Source

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.

Implementors§