@@ -8,7 +8,7 @@ use serde::{Deserialize, Deserializer, Serialize};
8
8
9
9
use crate :: constants:: { DEFAULT_FACTORY_ADDRESS_V0_7 , ENTRYPOINT_ADDRESS_V0_7 } ;
10
10
11
- #[ derive( Deserialize , Serialize , Debug , JsonSchema , Clone , Copy ) ]
11
+ #[ derive( Deserialize , Serialize , Debug , JsonSchema , Clone , Copy , utoipa :: ToSchema ) ]
12
12
pub enum EntrypointVersion {
13
13
#[ serde( rename = "0.6" ) ]
14
14
V0_6 ,
@@ -28,55 +28,58 @@ pub struct EntrypointAndFactoryDetails {
28
28
pub factory_address : Address ,
29
29
}
30
30
31
- /// # ERC-4337 Execution Options
31
+ /// ### ERC-4337 Execution Options
32
32
/// This struct allows flexible configuration of ERC-4337 execution options,
33
33
/// with intelligent defaults and inferences based on provided values.
34
34
///
35
- /// ## Field Inference
35
+ /// ### Field Inference
36
36
/// When fields are omitted, the system uses the following inference rules:
37
37
///
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
43
43
///
44
- /// 2. ** Entrypoint Address Inference** :
44
+ /// 2. Entrypoint Address Inference:
45
45
/// - If provided explicitly, it's used as-is
46
46
/// - Otherwise, uses the default address corresponding to the inferred version:
47
47
/// - V0.6: 0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789
48
48
/// - V0.7: 0x0576a174D229E3cFA37253523E645A78A0C91B57
49
49
///
50
- /// 3. ** Factory Address Inference** :
50
+ /// 3. Factory Address Inference:
51
51
/// - If provided explicitly, it's used as-is
52
52
/// - 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]
55
55
///
56
- /// 4. ** Account Salt** :
56
+ /// 4. Account Salt:
57
57
/// - If provided explicitly, it's used as-is
58
58
/// - Otherwise, defaults to "0x" (commonly used as the defauult "null" salt for smart accounts)
59
59
///
60
- /// 5. ** Smart Account Address** :
60
+ /// 5. Smart Account Address:
61
61
/// - If provided explicitly, it's used as-is
62
62
/// - Otherwise, it's read from the smart account factory
63
63
///
64
64
/// 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 ) ]
66
66
#[ serde( rename_all = "camelCase" ) ]
67
67
pub struct Erc4337ExecutionOptions {
68
68
#[ schemars( with = "AddressDef" ) ]
69
+ #[ schema( value_type = AddressDef ) ]
69
70
pub signer_address : Address ,
70
71
71
72
#[ serde( flatten) ]
72
73
#[ schemars( with = "EntrypointAndFactoryDetailsDeserHelper" ) ]
74
+ #[ schema( value_type = EntrypointAndFactoryDetailsDeserHelper ) ]
73
75
pub entrypoint_details : EntrypointAndFactoryDetails ,
74
76
75
77
#[ serde( default = "default_account_salt" ) ]
76
78
pub account_salt : String ,
77
79
78
80
#[ serde( skip_serializing_if = "Option::is_none" ) ]
79
81
#[ schemars( with = "Option::<AddressDef>" ) ]
82
+ #[ schema( value_type = Option <AddressDef >) ]
80
83
pub smart_account_address : Option < Address > ,
81
84
}
82
85
@@ -91,41 +94,41 @@ pub fn default_entrypoint_address() -> Address {
91
94
pub fn default_account_salt ( ) -> String {
92
95
"0x" . to_string ( )
93
96
}
94
- #[ derive( Deserialize , JsonSchema ) ]
97
+ #[ derive( Deserialize , JsonSchema , utoipa :: ToSchema ) ]
95
98
struct EntrypointAndFactoryDetailsDeserHelper {
96
- /// # Entrypoint Contract Address
99
+ /// ### Entrypoint Contract Address
97
100
/// The address of the ERC-4337 entrypoint contract.
98
101
///
99
102
/// If omitted, defaults to the standard address for the specified/inferred version.
100
103
///
101
104
/// Known addresses:
102
105
///
103
106
/// - V0.6: 0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789
104
- ///
105
107
/// - V0.7: 0x0000000071727De22E5E9d8BAf0edAc6f37da032
106
108
#[ serde( rename = "entrypointAddress" ) ]
107
109
#[ schemars( with = "Option<AddressDef>" ) ]
110
+ #[ schema( value_type = Option <AddressDef >) ]
108
111
entrypoint_address : Option < Address > ,
109
112
110
- /// # Entrypoint Version
113
+ /// ### Entrypoint Version
111
114
/// The version of the ERC-4337 standard to use.
112
115
///
113
116
/// If omitted, the version will be inferred from the entrypoint address,
114
117
/// then from factory address, or defaults to V0.7.
115
118
#[ serde( rename = "entrypointVersion" ) ]
116
119
version : Option < EntrypointVersion > ,
117
120
118
- /// # Account Factory Address
121
+ /// ### Account Factory Address
119
122
/// The address of the smart account factory contract.
120
123
/// If omitted, defaults to the thirweb default account factory for the specified/inferred version.
121
124
///
122
125
/// Known addresses:
123
126
///
124
127
/// - V0.6: 0x85e23b94e7F5E9cC1fF78BCe78cfb15B81f0DF00
125
- ///
126
128
/// - V0.7: 0x4bE0ddfebcA9A5A4a617dee4DeCe99E7c862dceb
127
129
#[ serde( rename = "factoryAddress" ) ]
128
130
#[ schemars( with = "Option<AddressDef>" ) ]
131
+ #[ schema( value_type = Option <AddressDef >) ]
129
132
factory_address : Option < Address > ,
130
133
}
131
134
0 commit comments