Skip to content

Commit 4b63b63

Browse files
authored
[ETH]: Makes factory and paymaster optional while serialising UserOpV07 (trustwallet#4345)
1 parent ea38450 commit 4b63b63

File tree

1 file changed

+4
-12
lines changed

1 file changed

+4
-12
lines changed

rust/tw_evm/src/transaction/user_operation_v0_7.rs

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -188,23 +188,15 @@ impl SignedTransaction for SignedUserOperationV0_7 {
188188
let tx = SignedUserOperationV0_7Serde {
189189
sender: self.unsigned.sender.to_string(),
190190
nonce: self.unsigned.nonce.to_string(),
191-
factory: self
192-
.unsigned
193-
.factory
194-
.map(|addr| addr.to_string())
195-
.unwrap_or_default(),
191+
factory: self.unsigned.factory.map(|addr| addr.to_string()),
196192
factory_data: hex::encode(&self.unsigned.factory_data, prefix),
197193
call_data: hex::encode(&self.unsigned.call_data, prefix),
198194
call_data_gas_limit: self.unsigned.call_data_gas_limit.to_string(),
199195
verification_gas_limit: self.unsigned.verification_gas_limit.to_string(),
200196
pre_verification_gas: self.unsigned.pre_verification_gas.to_string(),
201197
max_fee_per_gas: self.unsigned.max_fee_per_gas.to_string(),
202198
max_priority_fee_per_gas: self.unsigned.max_priority_fee_per_gas.to_string(),
203-
paymaster: self
204-
.unsigned
205-
.paymaster
206-
.map(|addr| addr.to_string())
207-
.unwrap_or_default(),
199+
paymaster: self.unsigned.paymaster.map(|addr| addr.to_string()),
208200
paymaster_verification_gas_limit: self
209201
.unsigned
210202
.paymaster_verification_gas_limit
@@ -229,15 +221,15 @@ impl SignedTransaction for SignedUserOperationV0_7 {
229221
struct SignedUserOperationV0_7Serde {
230222
sender: String,
231223
nonce: String,
232-
factory: String,
224+
factory: Option<String>,
233225
factory_data: String,
234226
call_data: String,
235227
call_data_gas_limit: String,
236228
verification_gas_limit: String,
237229
pre_verification_gas: String,
238230
max_fee_per_gas: String,
239231
max_priority_fee_per_gas: String,
240-
paymaster: String,
232+
paymaster: Option<String>,
241233
paymaster_verification_gas_limit: String,
242234
paymaster_post_op_gas_limit: String,
243235
paymaster_data: String,

0 commit comments

Comments
 (0)