@@ -22,6 +22,15 @@ use crate::{
2222} ;
2323use error:: TransactionError ;
2424
25+ /// Represents a transaction inside the starknet network.
26+ /// The transaction are actions that may modified the state of the network.
27+ /// it can be one of:
28+ /// - Declare
29+ /// - DeclareV2
30+ /// - Deploy
31+ /// - DeployAccount
32+ /// - InvokeFunction
33+ /// - L1Handler
2534pub enum Transaction {
2635 /// A declare transaction.
2736 Declare ( Declare ) ,
@@ -38,6 +47,7 @@ pub enum Transaction {
3847}
3948
4049impl Transaction {
50+ /// returns the contract address of the transaction.
4151 pub fn contract_address ( & self ) -> Address {
4252 match self {
4353 Transaction :: Deploy ( tx) => tx. contract_address . clone ( ) ,
@@ -49,6 +59,11 @@ impl Transaction {
4959 }
5060 }
5161
62+ /// execute the transaction in cairo-vm and returns a TransactionExecutionInfo structure.
63+ ///## Parameters:
64+ ///- state: a structure that implements State and StateReader traits.
65+ ///- block_context: The block context of the transaction that is about to be executed.
66+ ///- remaining_gas: The gas supplied to execute the transaction.
5267 pub fn execute < S : State + StateReader > (
5368 & self ,
5469 state : & mut S ,
@@ -64,7 +79,11 @@ impl Transaction {
6479 Transaction :: L1Handler ( tx) => tx. execute ( state, block_context, remaining_gas) ,
6580 }
6681 }
67-
82+ /// It creates a new transaction structure modificating the skip flags. It is meant to be used only to run a simulation
83+ ///## Parameters:
84+ ///- skip_validate: the transaction will not be verified.
85+ ///- skip_execute: the transaction will not be executed in the cairo vm.
86+ ///- skip_fee_transfer: the transaction will not pay the fee.
6887 pub fn create_for_simulation (
6988 & self ,
7089 skip_validate : bool ,
0 commit comments