diff --git a/beacon_chain/spec/eth2_apis/eth2_rest_serialization.nim b/beacon_chain/spec/eth2_apis/eth2_rest_serialization.nim index 72d503980..c70ebffce 100644 --- a/beacon_chain/spec/eth2_apis/eth2_rest_serialization.nim +++ b/beacon_chain/spec/eth2_apis/eth2_rest_serialization.nim @@ -464,6 +464,7 @@ proc readValue*(reader: var JsonReader[RestJson], value: var uint64) {. else: reader.raiseUnexpectedValue($res.error() & ": " & svalue) +## uint8 proc writeValue*(w: var JsonWriter[RestJson], value: uint8) {. raises: [IOError, Defect].} = writeValue(w, Base10.toString(value)) @@ -477,6 +478,7 @@ proc readValue*(reader: var JsonReader[RestJson], value: var uint8) {. else: reader.raiseUnexpectedValue($res.error() & ": " & svalue) +## JustificationBits proc writeValue*(w: var JsonWriter[RestJson], value: JustificationBits) {. raises: [IOError, Defect].} = w.writeValue hexOriginal([uint8(value)]) @@ -579,6 +581,7 @@ proc readValue*(reader: var JsonReader[RestJson], value: var ValidatorIndex) else: reader.raiseUnexpectedValue($res.error()) +## IndexInSyncCommittee proc writeValue*(writer: var JsonWriter[RestJson], value: IndexInSyncCommittee) {.raises: [IOError, Defect].} = writeValue(writer, Base10.toString(distinctBase(value))) @@ -778,6 +781,7 @@ proc writeValue*(writer: var JsonWriter[RestJson], value: Eth1Address) {. raises: [IOError, Defect].} = writeValue(writer, hexOriginal(distinctBase(value))) +## GraffitiBytes proc writeValue*(writer: var JsonWriter[RestJson], value: GraffitiBytes) {.raises: [IOError, Defect].} = writeValue(writer, hexOriginal(distinctBase(value))) @@ -789,7 +793,7 @@ proc readValue*(reader: var JsonReader[RestJson], T: type GraffitiBytes): T except ValueError as err: reader.raiseUnexpectedValue err.msg -## Version +## Version | ForkDigest | DomainType | GraffitiBytes proc readValue*( reader: var JsonReader[RestJson], value: var (Version | ForkDigest | DomainType | GraffitiBytes)) {. @@ -1442,7 +1446,7 @@ proc writeValue*(writer: var JsonWriter[RestJson], value: ForkedHashedBeaconStat writer.writeField("data", value.bellatrixData.data) writer.endRecord() -# Web3SignerRequest +## Web3SignerRequest proc writeValue*(writer: var JsonWriter[RestJson], value: Web3SignerRequest) {. raises: [IOError, Defect].} = @@ -2103,6 +2107,7 @@ proc readValue*(reader: var JsonReader[RestJson], keystores: keystores, passwords: passwords, slashing_protection: slashing ) +## RestActivityItem proc writeValue*(writer: var JsonWriter[RestJson], value: RestActivityItem) {. raises: [IOError, Defect].} = @@ -2149,6 +2154,7 @@ proc readValue*(reader: var JsonReader[RestJson], value = RestActivityItem(index: index.get(), epoch: epoch.get(), active: active.get()) +## HeadChangeInfoObject proc writeValue*(writer: var JsonWriter[RestJson], value: HeadChangeInfoObject) {. raises: [IOError, Defect].} = @@ -2165,6 +2171,7 @@ proc writeValue*(writer: var JsonWriter[RestJson], writer.writeField("execution_optimistic", value.optimistic.get()) writer.endRecord() +## ReorgInfoObject proc writeValue*(writer: var JsonWriter[RestJson], value: ReorgInfoObject) {. raises: [IOError, Defect].} = @@ -2179,6 +2186,7 @@ proc writeValue*(writer: var JsonWriter[RestJson], writer.writeField("execution_optimistic", value.optimistic.get()) writer.endRecord() +## FinalizationInfoObject proc writeValue*(writer: var JsonWriter[RestJson], value: FinalizationInfoObject) {. raises: [IOError, Defect].} = @@ -2190,6 +2198,7 @@ proc writeValue*(writer: var JsonWriter[RestJson], writer.writeField("execution_optimistic", value.optimistic.get()) writer.endRecord() +## EventBeaconBlockObject proc writeValue*(writer: var JsonWriter[RestJson], value: EventBeaconBlockObject) {. raises: [IOError, Defect].} = @@ -2200,6 +2209,7 @@ proc writeValue*(writer: var JsonWriter[RestJson], writer.writeField("execution_optimistic", value.optimistic.get()) writer.endRecord() +## RestSyncInfo proc writeValue*(writer: var JsonWriter[RestJson], value: RestSyncInfo) {. raises: [IOError, Defect].} =