Skip to content

Commit 0012ded

Browse files
committed
refactor forkchoiceUpdated response type
1 parent 649b0bf commit 0012ded

File tree

2 files changed

+1
-17
lines changed

2 files changed

+1
-17
lines changed

web3/conversions.nim

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -73,16 +73,6 @@ func getEnumStringTable(enumType: typedesc): Table[string, enumType] {.compileTi
7373
res[$value] = value
7474
res
7575

76-
proc fromJson*(
77-
n: JsonNode, argName: string, result: var ForkchoiceUpdatedStatus) {.inline.} =
78-
n.kind.expect(JString, argName)
79-
const enumStrings = static: getEnumStringTable(type(result))
80-
try:
81-
result = enumStrings[n.getStr]
82-
except KeyError:
83-
raise newException(
84-
ValueError, "Parameter \"" & argName & "\" value invalid: " & n.getStr)
85-
8676
proc fromJson*(
8777
n: JsonNode, argName: string, result: var PayloadExecutionStatus) {.inline.} =
8878
n.kind.expect(JString, argName)

web3/engine_api_types.nim

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,16 +33,10 @@ type
3333
finalizedBlockHash*: BlockHash
3434

3535
# https://github.com/ethereum/execution-apis/blob/v1.0.0-alpha.6/src/engine/specification.md#response-1
36-
ForkchoiceUpdatedStatus* {.pure.} = enum
37-
valid = "VALID"
38-
invalid = "INVALID"
39-
syncing = "SYNCING"
40-
invalid_terminal_block = "INVALID_TERMINAL_BLOCK"
41-
4236
PayloadID* = FixedBytes[8]
4337

4438
ForkchoiceUpdatedResponse* = object
45-
payloadStatus*: ForkchoiceUpdatedStatus
39+
payloadStatus*: PayloadStatusV1
4640
payloadId*: Option[PayloadID]
4741

4842
const

0 commit comments

Comments
 (0)