File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -229,18 +229,22 @@ extension EncodableTransaction: Codable {
229
229
}
230
230
231
231
public func encode( to encoder: Encoder ) throws {
232
+ // FIXME: There's a huge mess here, please take a look here at code review if any.
232
233
var containier = encoder. container ( keyedBy: CodingKeys . self)
233
- try containier. encode ( type. rawValue. hexString, forKey: . type)
234
234
try containier. encode ( nonce. hexString, forKey: . nonce)
235
235
try containier. encode ( accessList, forKey: . accessList)
236
236
try containier. encode ( data. toHexString ( ) . addHexPrefix ( ) , forKey: . data)
237
237
try containier. encode ( value. hexString, forKey: . value)
238
238
239
239
// Encoding only fields with value.
240
240
// TODO: Rewrite me somehow better.
241
- if let chainID = chainID {
242
- // try containier.encode(chainID.hexString, forKey: .chainID)
241
+ if type != . legacy {
242
+ try containier. encode ( type. rawValue. hexString, forKey: . type)
243
+ if let chainID = chainID, !chainID. isZero {
244
+ try containier. encode ( chainID. hexString, forKey: . chainID)
245
+ }
243
246
}
247
+
244
248
if !gasLimit. isZero {
245
249
try containier. encode ( gasLimit. hexString, forKey: . gasLimit)
246
250
}
You can’t perform that action at this time.
0 commit comments