rest: fix GraffitiBytes serialization (#3299)

This commit is contained in:
Jacek Sieka 2022-01-20 13:31:55 +01:00 committed by GitHub
parent 570379d3d9
commit 1df549143e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 0 deletions

View File

@ -629,6 +629,17 @@ proc writeValue*(writer: var JsonWriter[RestJson], value: Eth1Address) {.
raises: [IOError, Defect].} =
writeValue(writer, hexOriginal(distinctBase(value)))
proc writeValue*(writer: var JsonWriter[RestJson], value: GraffitiBytes)
{.raises: [IOError, Defect].} =
writeValue(writer, hexOriginal(distinctBase(value)))
proc readValue*(reader: var JsonReader[RestJson], T: type GraffitiBytes): T
{.raises: [IOError, SerializationError, Defect].} =
try:
init(GraffitiBytes, reader.readValue(string))
except ValueError as err:
reader.raiseUnexpectedValue err.msg
## Version
proc readValue*(
reader: var JsonReader[RestJson],