@@ -8,7 +8,7 @@ use serde::{Deserialize, Deserializer, Serialize};
88
99use crate :: constants:: { DEFAULT_FACTORY_ADDRESS_V0_7 , ENTRYPOINT_ADDRESS_V0_7 } ;
1010
11- #[ derive( Deserialize , Serialize , Debug , JsonSchema , Clone , Copy ) ]
11+ #[ derive( Deserialize , Serialize , Debug , JsonSchema , Clone , Copy , utoipa :: ToSchema ) ]
1212pub enum EntrypointVersion {
1313 #[ serde( rename = "0.6" ) ]
1414 V0_6 ,
@@ -28,55 +28,58 @@ pub struct EntrypointAndFactoryDetails {
2828 pub factory_address : Address ,
2929}
3030
31- /// # ERC-4337 Execution Options
31+ /// ### ERC-4337 Execution Options
3232/// This struct allows flexible configuration of ERC-4337 execution options,
3333/// with intelligent defaults and inferences based on provided values.
3434///
35- /// ## Field Inference
35+ /// ### Field Inference
3636/// When fields are omitted, the system uses the following inference rules:
3737///
38- /// 1. ** Version Inference** :
39- /// - If `entrypointVersion` is provided, it's used directly
40- /// - Otherwise, tries to infer from `entrypointAddress` (if provided)
41- /// - If that fails, tries to infer from `factoryAddress` (if provided)
42- /// - Defaults to version 0.7 if no inference is possible
38+ /// 1. Version Inference:
39+ /// - If `entrypointVersion` is provided, it's used directly
40+ /// - Otherwise, tries to infer from `entrypointAddress` (if provided)
41+ /// - If that fails, tries to infer from `factoryAddress` (if provided)
42+ /// - Defaults to version 0.7 if no inference is possible
4343///
44- /// 2. ** Entrypoint Address Inference** :
44+ /// 2. Entrypoint Address Inference:
4545/// - If provided explicitly, it's used as-is
4646/// - Otherwise, uses the default address corresponding to the inferred version:
4747/// - V0.6: 0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789
4848/// - V0.7: 0x0576a174D229E3cFA37253523E645A78A0C91B57
4949///
50- /// 3. ** Factory Address Inference** :
50+ /// 3. Factory Address Inference:
5151/// - If provided explicitly, it's used as-is
5252/// - Otherwise, uses the default factory corresponding to the inferred version:
53- /// - V0.6: [DEFAULT_FACTORY_ADDRESS_V0_6]
54- /// - V0.7: [DEFAULT_FACTORY_ADDRESS_V0_7]
53+ /// - V0.6: 0x85e23b94e7F5E9cC1fF78BCe78cfb15B81f0DF00 [DEFAULT_FACTORY_ADDRESS_V0_6]
54+ /// - V0.7: 0x4bE0ddfebcA9A5A4a617dee4DeCe99E7c862dceb [DEFAULT_FACTORY_ADDRESS_V0_7]
5555///
56- /// 4. ** Account Salt** :
56+ /// 4. Account Salt:
5757/// - If provided explicitly, it's used as-is
5858/// - Otherwise, defaults to "0x" (commonly used as the defauult "null" salt for smart accounts)
5959///
60- /// 5. ** Smart Account Address** :
60+ /// 5. Smart Account Address:
6161/// - If provided explicitly, it's used as-is
6262/// - Otherwise, it's read from the smart account factory
6363///
6464/// All optional fields can be omitted for a minimal configuration using version 0.7 defaults.
65- #[ derive( Deserialize , Serialize , Debug , Clone , JsonSchema ) ]
65+ #[ derive( Deserialize , Serialize , Debug , Clone , JsonSchema , utoipa :: ToSchema ) ]
6666#[ serde( rename_all = "camelCase" ) ]
6767pub struct Erc4337ExecutionOptions {
6868 #[ schemars( with = "AddressDef" ) ]
69+ #[ schema( value_type = AddressDef ) ]
6970 pub signer_address : Address ,
7071
7172 #[ serde( flatten) ]
7273 #[ schemars( with = "EntrypointAndFactoryDetailsDeserHelper" ) ]
74+ #[ schema( value_type = EntrypointAndFactoryDetailsDeserHelper ) ]
7375 pub entrypoint_details : EntrypointAndFactoryDetails ,
7476
7577 #[ serde( default = "default_account_salt" ) ]
7678 pub account_salt : String ,
7779
7880 #[ serde( skip_serializing_if = "Option::is_none" ) ]
7981 #[ schemars( with = "Option::<AddressDef>" ) ]
82+ #[ schema( value_type = Option <AddressDef >) ]
8083 pub smart_account_address : Option < Address > ,
8184}
8285
@@ -91,41 +94,41 @@ pub fn default_entrypoint_address() -> Address {
9194pub fn default_account_salt ( ) -> String {
9295 "0x" . to_string ( )
9396}
94- #[ derive( Deserialize , JsonSchema ) ]
97+ #[ derive( Deserialize , JsonSchema , utoipa :: ToSchema ) ]
9598struct EntrypointAndFactoryDetailsDeserHelper {
96- /// # Entrypoint Contract Address
99+ /// ### Entrypoint Contract Address
97100 /// The address of the ERC-4337 entrypoint contract.
98101 ///
99102 /// If omitted, defaults to the standard address for the specified/inferred version.
100103 ///
101104 /// Known addresses:
102105 ///
103106 /// - V0.6: 0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789
104- ///
105107 /// - V0.7: 0x0000000071727De22E5E9d8BAf0edAc6f37da032
106108 #[ serde( rename = "entrypointAddress" ) ]
107109 #[ schemars( with = "Option<AddressDef>" ) ]
110+ #[ schema( value_type = Option <AddressDef >) ]
108111 entrypoint_address : Option < Address > ,
109112
110- /// # Entrypoint Version
113+ /// ### Entrypoint Version
111114 /// The version of the ERC-4337 standard to use.
112115 ///
113116 /// If omitted, the version will be inferred from the entrypoint address,
114117 /// then from factory address, or defaults to V0.7.
115118 #[ serde( rename = "entrypointVersion" ) ]
116119 version : Option < EntrypointVersion > ,
117120
118- /// # Account Factory Address
121+ /// ### Account Factory Address
119122 /// The address of the smart account factory contract.
120123 /// If omitted, defaults to the thirweb default account factory for the specified/inferred version.
121124 ///
122125 /// Known addresses:
123126 ///
124127 /// - V0.6: 0x85e23b94e7F5E9cC1fF78BCe78cfb15B81f0DF00
125- ///
126128 /// - V0.7: 0x4bE0ddfebcA9A5A4a617dee4DeCe99E7c862dceb
127129 #[ serde( rename = "factoryAddress" ) ]
128130 #[ schemars( with = "Option<AddressDef>" ) ]
131+ #[ schema( value_type = Option <AddressDef >) ]
129132 factory_address : Option < Address > ,
130133}
131134
0 commit comments