1
- # import std/json
2
1
import std/ strformat
3
2
import std/ strutils
4
- import std/ sugar
5
- # import pkg/eth/common/eth_types_json_serialization
6
3
import pkg/ chronicles except fromJson, `%`, `%*`, toJson
7
4
import pkg/ json_rpc/ jsonmarshal
8
5
import pkg/ questionable/ results
@@ -17,14 +14,7 @@ export jsonmarshal
17
14
export json
18
15
export chronicles except fromJson, `%`, `%*`, toJson
19
16
20
- # {.push raises: [].}
21
-
22
- type JsonSerializationError = object of EthersError
23
-
24
- func toException * (v: ref CatchableError ): ref SerializationError = (ref SerializationError )(msg: v.msg)
25
-
26
- template raiseSerializationError (message: string ) =
27
- raise newException (JsonSerializationError , message)
17
+ {.push raises : [].}
28
18
29
19
proc getOrRaise * [T, E](self: ?! T, exc: typedesc [E]): T {.raises : [E].} =
30
20
let val = self.valueOr:
@@ -117,10 +107,10 @@ proc fromJson*[E: TransactionStatus | TransactionType](
117
107
let integer = ? fromHex [int ](json.str).catch.mapFailure (SerializationError )
118
108
success T (integer)
119
109
120
- # Generic conversions to use nim-json instead of nim-json-serialization for
121
- # json rpc serialization purposes
122
- # writeValue => `%`
123
- # readValue => fromJson
110
+ # # Generic conversions to use nim-json instead of nim-json-serialization for
111
+ # # json rpc serialization purposes
112
+ # # writeValue => `%`
113
+ # # readValue => fromJson
124
114
125
115
proc writeValue * [T: not JsonNode ](
126
116
writer: var JsonWriter [JrpcConv ],
0 commit comments