refactor forkchoiceUpdated response type
This commit is contained in:
parent
649b0bf42f
commit
0012deda79
|
@ -73,16 +73,6 @@ func getEnumStringTable(enumType: typedesc): Table[string, enumType] {.compileTi
|
|||
res[$value] = value
|
||||
res
|
||||
|
||||
proc fromJson*(
|
||||
n: JsonNode, argName: string, result: var ForkchoiceUpdatedStatus) {.inline.} =
|
||||
n.kind.expect(JString, argName)
|
||||
const enumStrings = static: getEnumStringTable(type(result))
|
||||
try:
|
||||
result = enumStrings[n.getStr]
|
||||
except KeyError:
|
||||
raise newException(
|
||||
ValueError, "Parameter \"" & argName & "\" value invalid: " & n.getStr)
|
||||
|
||||
proc fromJson*(
|
||||
n: JsonNode, argName: string, result: var PayloadExecutionStatus) {.inline.} =
|
||||
n.kind.expect(JString, argName)
|
||||
|
|
|
@ -33,16 +33,10 @@ type
|
|||
finalizedBlockHash*: BlockHash
|
||||
|
||||
# https://github.com/ethereum/execution-apis/blob/v1.0.0-alpha.6/src/engine/specification.md#response-1
|
||||
ForkchoiceUpdatedStatus* {.pure.} = enum
|
||||
valid = "VALID"
|
||||
invalid = "INVALID"
|
||||
syncing = "SYNCING"
|
||||
invalid_terminal_block = "INVALID_TERMINAL_BLOCK"
|
||||
|
||||
PayloadID* = FixedBytes[8]
|
||||
|
||||
ForkchoiceUpdatedResponse* = object
|
||||
payloadStatus*: ForkchoiceUpdatedStatus
|
||||
payloadStatus*: PayloadStatusV1
|
||||
payloadId*: Option[PayloadID]
|
||||
|
||||
const
|
||||
|
|
Loading…
Reference in New Issue