File tree Expand file tree Collapse file tree 2 files changed +23
-0
lines changed Expand file tree Collapse file tree 2 files changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -445,4 +445,14 @@ extension EthereumTransaction {
445445 return self . envelope. encode ( for: . transaction)
446446 }
447447
448+ @available ( * , deprecated, message: " use Decodable instead " )
449+ public static func fromJSON( _ json: [ String : Any ] ) -> EthereumTransaction ? {
450+ do {
451+ let jsonData : Data = try JSONSerialization . data ( withJSONObject: json, options: [ ] )
452+ return try JSONDecoder ( ) . decode ( EthereumTransaction . self, from: jsonData)
453+ } catch {
454+ return nil
455+ }
456+ }
457+
448458}
Original file line number Diff line number Diff line change @@ -280,3 +280,16 @@ extension TransactionOptions: Decodable {
280280 }
281281 }
282282}
283+
284+ extension TransactionOptions {
285+ @available ( * , deprecated, message: " use Decodable instead " )
286+ public static func fromJSON( _ json: [ String : Any ] ) -> TransactionOptions ? {
287+ do {
288+ let jsonData : Data = try JSONSerialization . data ( withJSONObject: json, options: [ ] )
289+ return try JSONDecoder ( ) . decode ( TransactionOptions . self, from: jsonData)
290+ } catch {
291+ return nil
292+ }
293+ }
294+
295+ }
You can’t perform that action at this time.
0 commit comments