2023-02-10 09:43:16 +00:00
|
|
|
import
|
2023-02-14 08:19:06 +00:00
|
|
|
stew/byteutils,
|
|
|
|
json,
|
|
|
|
json_rpc/rpcserver
|
|
|
|
|
|
|
|
|
|
|
|
func invalidMsg*(name: string): string =
|
|
|
|
"When marshalling from JSON, parameter \"" & name & "\" is not valid"
|
|
|
|
|
2023-02-10 09:43:16 +00:00
|
|
|
|
2023-02-14 08:19:06 +00:00
|
|
|
## JSON marshalling
|
2023-02-10 09:43:16 +00:00
|
|
|
|
2023-02-14 08:19:06 +00:00
|
|
|
# seq[byte]
|
2023-02-10 09:43:16 +00:00
|
|
|
|
2023-02-14 08:19:06 +00:00
|
|
|
proc `%`*(value: seq[byte]): JsonNode =
|
|
|
|
if value.len > 0:
|
|
|
|
%("0x" & value.toHex())
|
|
|
|
else:
|
|
|
|
newJArray()
|