TridentTransaction#
The TridentTransaction
macro is used to derive required methods for Transactions
. This procedural macro automatically implements transaction-related functionality for structs that represent transactions.
Derived Traits#
The macro implements the following traits:
TransactionGetters
- Methods to retrieve transaction dataTransactionSetters
- Methods to set up transaction state
Manual Implementation Note
There is no need to manually implement the TransactionGetters and TransactionSetters. The macro handles these implementations automatically based on the structure of your transaction.
Transaction Getters#
Internal Method
These methods are used internally by Trident and it is not expected to use them manually.
get_transaction_name
#
Returns the name of the transaction. If a custom name is provided via the #[name("...")]
attribute, that name will be used; otherwise, the struct name is used.
get_instruction_discriminators
#
Returns the instruction discriminators (identifiers) for all instructions in the transaction.
get_instruction_program_ids
#
Returns the program IDs that will process the instructions.
get_instruction_data
#
Returns the instruction-specific data/parameters for all instructions in the transaction.
get_instruction_accounts
#
Returns the account metadata needed for the instructions.
Transaction Setters#
Internal Method
set_snapshot_before
, set_snapshot_after
and set_instructions
methods are used internally by Trident and is not expected to use them manually.
build
#
Creates a new transaction instance from fuzzer data.
set_snapshot_before
#
Captures the state of all accounts before transaction execution.
set_snapshot_after
#
Captures the state of all accounts after transaction execution.
set_instructions
#
Sets up all instructions for the transaction.
Instruction Setup Order
The order in which the instruction inputs are set is:
set_data
- Sets up instruction-specific dataresolve_accounts
- Resolves account addressesset_accounts
- Sets up account metadataset_remaining_accounts
- Sets up any additional accounts