Skip to main content

TransactionAPI

Trait TransactionAPI 

Source
pub trait TransactionAPI {
Show 46 methods // Required methods fn sender(&self) -> Address; fn kind(&self) -> &TransactionKind; fn kind_mut(&mut self) -> &mut TransactionKind; fn into_kind(self) -> TransactionKind; fn signers(&self) -> NonEmpty<Address>; fn gas_data(&self) -> &GasPayment; fn gas_owner(&self) -> Address; fn gas(&self) -> &[ObjectReference]; fn gas_price(&self) -> u64; fn gas_budget(&self) -> u64; fn expiration(&self) -> &TransactionExpiration; fn shared_input_objects(&self) -> Vec<SharedObjectReference>; fn move_calls(&self) -> Vec<(&ObjectId, &str, &str)>; fn input_objects(&self) -> UserInputResult<Vec<InputObjectKind>>; fn receiving_objects(&self) -> Vec<ObjectReference>; fn validity_check(&self, config: &ProtocolConfig) -> UserInputResult; fn validity_check_no_gas_check( &self, config: &ProtocolConfig, ) -> UserInputResult; fn check_gas_payment_size(&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 Address; fn gas_data_mut(&mut self) -> &mut GasPayment; fn expiration_mut_for_testing(&mut self) -> &mut TransactionExpiration; fn new_system_transaction(kind: TransactionKind) -> Transaction; fn new( kind: TransactionKind, sender: Address, gas_payment: ObjectReference, gas_budget: u64, gas_price: u64, ) -> Transaction; fn new_with_gas_coins( kind: TransactionKind, sender: Address, gas_payment: Vec<ObjectReference>, gas_budget: u64, gas_price: u64, ) -> Transaction; fn new_with_gas_coins_allow_sponsor( kind: TransactionKind, sender: Address, gas_payment: Vec<ObjectReference>, gas_budget: u64, gas_price: u64, gas_sponsor: Address, ) -> Transaction; fn new_with_gas_data( kind: TransactionKind, sender: Address, gas_data: GasPayment, ) -> Transaction; fn new_move_call( sender: Address, package: ObjectId, module: Identifier, function: Identifier, type_arguments: Vec<TypeTag>, gas_payment: ObjectReference, arguments: Vec<CallArg>, gas_budget: u64, gas_price: u64, ) -> Result<Transaction>; fn new_move_call_with_gas_coins( sender: Address, package: ObjectId, module: Identifier, function: Identifier, type_arguments: Vec<TypeTag>, gas_payment: Vec<ObjectReference>, arguments: Vec<CallArg>, gas_budget: u64, gas_price: u64, ) -> Result<Transaction>; fn new_transfer( recipient: Address, object_ref: ObjectReference, sender: Address, gas_payment: ObjectReference, gas_budget: u64, gas_price: u64, ) -> Transaction; fn new_transfer_iota( recipient: Address, sender: Address, amount: Option<u64>, gas_payment: ObjectReference, gas_budget: u64, gas_price: u64, ) -> Transaction; fn new_transfer_iota_allow_sponsor( recipient: Address, sender: Address, amount: Option<u64>, gas_payment: ObjectReference, gas_budget: u64, gas_price: u64, gas_sponsor: Address, ) -> Transaction; fn new_pay( sender: Address, coins: Vec<ObjectReference>, recipients: Vec<Address>, amounts: Vec<u64>, gas_payment: ObjectReference, gas_budget: u64, gas_price: u64, ) -> Result<Transaction>; fn new_pay_iota( sender: Address, coins: Vec<ObjectReference>, recipients: Vec<Address>, amounts: Vec<u64>, gas_payment: ObjectReference, gas_budget: u64, gas_price: u64, ) -> Result<Transaction>; fn new_pay_all_iota( sender: Address, coins: Vec<ObjectReference>, recipient: Address, gas_payment: ObjectReference, gas_budget: u64, gas_price: u64, ) -> Transaction; fn new_split_coin( sender: Address, coin: ObjectReference, amounts: Vec<u64>, gas_payment: ObjectReference, gas_budget: u64, gas_price: u64, ) -> Transaction; fn new_module( sender: Address, gas_payment: ObjectReference, modules: Vec<Vec<u8>>, dep_ids: Vec<ObjectId>, gas_budget: u64, gas_price: u64, ) -> Transaction; fn new_upgrade( sender: Address, gas_payment: ObjectReference, package_id: ObjectId, modules: Vec<Vec<u8>>, dep_ids: Vec<ObjectId>, upgrade_capability_and_owner: (ObjectReference, Owner), upgrade_policy: u8, digest: Vec<u8>, gas_budget: u64, gas_price: u64, ) -> Result<Transaction>; fn new_programmable( sender: Address, gas_payment: Vec<ObjectReference>, pt: ProgrammableTransaction, gas_budget: u64, gas_price: u64, ) -> Transaction; fn new_programmable_allow_sponsor( sender: Address, gas_payment: Vec<ObjectReference>, pt: ProgrammableTransaction, gas_budget: u64, gas_price: u64, sponsor: Address, ) -> Transaction; fn message_version(&self) -> u64; fn execution_parts(&self) -> (TransactionKind, Address, GasPayment);
}
Expand description

API for accessing and constructing [Transaction].

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 additional client-facing methods on [Transaction] itself.

Required Methods§

Source

fn sender(&self) -> Address

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<Address>

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) -> &GasPayment

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

Source

fn gas_owner(&self) -> Address

Returns the address that owns the gas payment objects.

Source

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

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<SharedObjectReference>

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

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 the input objects required by the transaction body.

Note: this does NOT include the objects read by any MoveAuthenticators (abstract-account authenticators); those are carried by the transaction envelope, not by TransactionData. For the full set including authenticator inputs, use SenderSignedData::input_objects or SenderSignedData::collect_all_input_object_kind_for_reading.

Source

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

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_gas_payment_size(&self, config: &ProtocolConfig) -> UserInputResult

Checks the gas payment against the protocol’s cap on how many objects it may name.

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 Address

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

Source

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

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

Creates a new system transaction with no gas payment. Used for validator-initiated transactions (epoch changes, checkpoints, etc.).

Source

fn new( kind: TransactionKind, sender: Address, gas_payment: ObjectReference, gas_budget: u64, gas_price: u64, ) -> Transaction

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: Address, gas_payment: Vec<ObjectReference>, gas_budget: u64, gas_price: u64, ) -> Transaction

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: Address, gas_payment: Vec<ObjectReference>, gas_budget: u64, gas_price: u64, gas_sponsor: Address, ) -> Transaction

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: Address, gas_data: GasPayment, ) -> Transaction

Creates a new transaction from a pre-built [GasPayment] struct.

Source

fn new_move_call( sender: Address, package: ObjectId, module: Identifier, function: Identifier, type_arguments: Vec<TypeTag>, gas_payment: ObjectReference, arguments: Vec<CallArg>, gas_budget: u64, gas_price: u64, ) -> Result<Transaction>

Creates a transaction that calls a single Move function with a single gas payment coin.

Source

fn new_move_call_with_gas_coins( sender: Address, package: ObjectId, module: Identifier, function: Identifier, type_arguments: Vec<TypeTag>, gas_payment: Vec<ObjectReference>, arguments: Vec<CallArg>, gas_budget: u64, gas_price: u64, ) -> Result<Transaction>

Creates a transaction that calls a single Move function with multiple gas payment coins.

Source

fn new_transfer( recipient: Address, object_ref: ObjectReference, sender: Address, gas_payment: ObjectReference, gas_budget: u64, gas_price: u64, ) -> Transaction

Creates a transaction that transfers an object to a recipient.

Source

fn new_transfer_iota( recipient: Address, sender: Address, amount: Option<u64>, gas_payment: ObjectReference, gas_budget: u64, gas_price: u64, ) -> Transaction

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: Address, sender: Address, amount: Option<u64>, gas_payment: ObjectReference, gas_budget: u64, gas_price: u64, gas_sponsor: Address, ) -> Transaction

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: Address, coins: Vec<ObjectReference>, recipients: Vec<Address>, amounts: Vec<u64>, gas_payment: ObjectReference, gas_budget: u64, gas_price: u64, ) -> Result<Transaction>

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: Address, coins: Vec<ObjectReference>, recipients: Vec<Address>, amounts: Vec<u64>, gas_payment: ObjectReference, gas_budget: u64, gas_price: u64, ) -> Result<Transaction>

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: Address, coins: Vec<ObjectReference>, recipient: Address, gas_payment: ObjectReference, gas_budget: u64, gas_price: u64, ) -> Transaction

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: Address, coin: ObjectReference, amounts: Vec<u64>, gas_payment: ObjectReference, gas_budget: u64, gas_price: u64, ) -> Transaction

Creates a transaction that splits a coin into multiple coins with the specified amounts.

Source

fn new_module( sender: Address, gas_payment: ObjectReference, modules: Vec<Vec<u8>>, dep_ids: Vec<ObjectId>, gas_budget: u64, gas_price: u64, ) -> Transaction

Creates a transaction that publishes new Move modules.

Source

fn new_upgrade( sender: Address, gas_payment: ObjectReference, package_id: ObjectId, modules: Vec<Vec<u8>>, dep_ids: Vec<ObjectId>, upgrade_capability_and_owner: (ObjectReference, Owner), upgrade_policy: u8, digest: Vec<u8>, gas_budget: u64, gas_price: u64, ) -> Result<Transaction>

Creates a transaction that upgrades an existing Move package. Requires the upgrade capability object and the upgrade policy.

Source

fn new_programmable( sender: Address, gas_payment: Vec<ObjectReference>, pt: ProgrammableTransaction, gas_budget: u64, gas_price: u64, ) -> Transaction

Creates a programmable transaction with multiple gas payment coins. The sender is also the gas owner.

Source

fn new_programmable_allow_sponsor( sender: Address, gas_payment: Vec<ObjectReference>, pt: ProgrammableTransaction, gas_budget: u64, gas_price: u64, sponsor: Address, ) -> Transaction

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, Address, GasPayment)

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.

Implementations on Foreign Types§

Source§

impl TransactionAPI for Transaction

Source§

fn sender(&self) -> Address

Source§

fn kind(&self) -> &TransactionKind

Source§

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

Source§

fn into_kind(self) -> TransactionKind

Source§

fn signers(&self) -> NonEmpty<Address>

Source§

fn gas_data(&self) -> &GasPayment

Source§

fn gas_owner(&self) -> Address

Source§

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

Source§

fn gas_price(&self) -> u64

Source§

fn gas_budget(&self) -> u64

Source§

fn expiration(&self) -> &TransactionExpiration

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

fn is_sponsored_tx(&self) -> bool

Source§

fn check_sponsorship(&self) -> UserInputResult

Source§

fn is_end_of_epoch_tx(&self) -> bool

Source§

fn is_system_tx(&self) -> bool

Source§

fn is_genesis_tx(&self) -> bool

Source§

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

Source§

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

Source§

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

Source§

fn new_system_transaction(kind: TransactionKind) -> Transaction

Source§

fn new( kind: TransactionKind, sender: Address, gas_payment: ObjectReference, gas_budget: u64, gas_price: u64, ) -> Transaction

Source§

fn new_with_gas_coins( kind: TransactionKind, sender: Address, gas_payment: Vec<ObjectReference>, gas_budget: u64, gas_price: u64, ) -> Transaction

Source§

fn new_with_gas_coins_allow_sponsor( kind: TransactionKind, sender: Address, gas_payment: Vec<ObjectReference>, gas_budget: u64, gas_price: u64, gas_sponsor: Address, ) -> Transaction

Source§

fn new_with_gas_data( kind: TransactionKind, sender: Address, gas_data: GasPayment, ) -> Transaction

Source§

fn new_move_call( sender: Address, package: ObjectId, module: Identifier, function: Identifier, type_arguments: Vec<TypeTag>, gas_payment: ObjectReference, arguments: Vec<CallArg>, gas_budget: u64, gas_price: u64, ) -> Result<Transaction>

Source§

fn new_move_call_with_gas_coins( sender: Address, package: ObjectId, module: Identifier, function: Identifier, type_arguments: Vec<TypeTag>, gas_payment: Vec<ObjectReference>, arguments: Vec<CallArg>, gas_budget: u64, gas_price: u64, ) -> Result<Transaction>

Source§

fn new_transfer( recipient: Address, object_ref: ObjectReference, sender: Address, gas_payment: ObjectReference, gas_budget: u64, gas_price: u64, ) -> Transaction

Source§

fn new_transfer_iota( recipient: Address, sender: Address, amount: Option<u64>, gas_payment: ObjectReference, gas_budget: u64, gas_price: u64, ) -> Transaction

Source§

fn new_transfer_iota_allow_sponsor( recipient: Address, sender: Address, amount: Option<u64>, gas_payment: ObjectReference, gas_budget: u64, gas_price: u64, gas_sponsor: Address, ) -> Transaction

Source§

fn new_pay( sender: Address, coins: Vec<ObjectReference>, recipients: Vec<Address>, amounts: Vec<u64>, gas_payment: ObjectReference, gas_budget: u64, gas_price: u64, ) -> Result<Transaction>

Source§

fn new_pay_iota( sender: Address, coins: Vec<ObjectReference>, recipients: Vec<Address>, amounts: Vec<u64>, gas_payment: ObjectReference, gas_budget: u64, gas_price: u64, ) -> Result<Transaction>

Source§

fn new_pay_all_iota( sender: Address, coins: Vec<ObjectReference>, recipient: Address, gas_payment: ObjectReference, gas_budget: u64, gas_price: u64, ) -> Transaction

Source§

fn new_split_coin( sender: Address, coin: ObjectReference, amounts: Vec<u64>, gas_payment: ObjectReference, gas_budget: u64, gas_price: u64, ) -> Transaction

Source§

fn new_module( sender: Address, gas_payment: ObjectReference, modules: Vec<Vec<u8>>, dep_ids: Vec<ObjectId>, gas_budget: u64, gas_price: u64, ) -> Transaction

Source§

fn new_upgrade( sender: Address, gas_payment: ObjectReference, package_id: ObjectId, modules: Vec<Vec<u8>>, dep_ids: Vec<ObjectId>, (upgrade_capability, capability_owner): (ObjectReference, Owner), upgrade_policy: u8, digest: Vec<u8>, gas_budget: u64, gas_price: u64, ) -> Result<Transaction>

Source§

fn new_programmable( sender: Address, gas_payment: Vec<ObjectReference>, pt: ProgrammableTransaction, gas_budget: u64, gas_price: u64, ) -> Transaction

Source§

fn new_programmable_allow_sponsor( sender: Address, gas_payment: Vec<ObjectReference>, pt: ProgrammableTransaction, gas_budget: u64, gas_price: u64, sponsor: Address, ) -> Transaction

Source§

fn message_version(&self) -> u64

Source§

fn execution_parts(&self) -> (TransactionKind, Address, GasPayment)

Implementors§