Skip to content

Commit

Permalink
alpha.9 engine API
Browse files Browse the repository at this point in the history
  • Loading branch information
tersec committed May 23, 2022
1 parent d260915 commit 755b6dc
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 90 deletions.
14 changes: 0 additions & 14 deletions web3/builder_api.nim

This file was deleted.

10 changes: 0 additions & 10 deletions web3/builder_api_callsigs.nim

This file was deleted.

57 changes: 0 additions & 57 deletions web3/builder_api_types.nim

This file was deleted.

17 changes: 9 additions & 8 deletions web3/engine_api_types.nim
Original file line number Diff line number Diff line change
Expand Up @@ -7,51 +7,52 @@ export
ethtypes

type
# https://github.com/ethereum/execution-apis/blob/v1.0.0-alpha.8/src/engine/specification.md#payloadattributesv1
# https://github.com/ethereum/execution-apis/blob/v1.0.0-alpha.9/src/engine/specification.md#payloadattributesv1
PayloadAttributesV1* = object
timestamp*: Quantity
prevRandao*: FixedBytes[32]
suggestedFeeRecipient*: Address

# https://github.com/ethereum/execution-apis/blob/v1.0.0-alpha.8/src/engine/specification.md#payloadstatusv1
# https://github.com/ethereum/execution-apis/blob/v1.0.0-alpha.9/src/engine/specification.md#payloadstatusv1
PayloadExecutionStatus* {.pure.} = enum
valid = "VALID"
invalid = "INVALID"
syncing = "SYNCING"
accepted = "ACCEPTED"
invalid_block_hash = "INVALID_BLOCK_HASH"
invalid_terminal_block = "INVALID_TERMINAL_BLOCK"

PayloadStatusV1* = object
status*: PayloadExecutionStatus
latestValidHash*: Option[BlockHash]
validationError*: Option[string]

# https://github.com/ethereum/execution-apis/blob/v1.0.0-alpha.8/src/engine/specification.md#forkchoicestatev1
# https://github.com/ethereum/execution-apis/blob/v1.0.0-alpha.9/src/engine/specification.md#forkchoicestatev1
ForkchoiceStateV1* = object
headBlockHash*: BlockHash
safeBlockHash*: BlockHash
finalizedBlockHash*: BlockHash

# https://github.com/ethereum/execution-apis/blob/v1.0.0-alpha.8/src/engine/specification.md#response-1
# https://github.com/ethereum/execution-apis/blob/v1.0.0-alpha.9/src/engine/specification.md#response-1
PayloadID* = FixedBytes[8]

ForkchoiceUpdatedResponse* = object
payloadStatus*: PayloadStatusV1
payloadId*: Option[PayloadID]

# https://github.com/ethereum/execution-apis/blob/v1.0.0-alpha.8/src/engine/specification.md#transitionconfigurationv1
# https://github.com/ethereum/execution-apis/blob/v1.0.0-alpha.9/src/engine/specification.md#transitionconfigurationv1
TransitionConfigurationV1* = object
terminalTotalDifficulty*: UInt256
terminalBlockHash*: BlockHash
terminalBlockNumber*: Quantity

const
# https://github.com/ethereum/execution-apis/blob/v1.0.0-alpha.8/src/engine/specification.md#errors
# https://github.com/ethereum/execution-apis/blob/v1.0.0-alpha.9/src/engine/specification.md#errors
engineApiParseError* = - 32700
engineApiInvalidRequest* = -32600
engineApiMethodNotFound* = -32601
engineApiInvalidParams* = -32602
engineApiInternalError* = -32603
engineApiServerError* = -32000
engineApiUnknownPayload* = -32001
engineApiUnknownPayload* = -38001
engineApiInvalidForkchoiceState* = -38002
engineApiInvalidPayloadAttributes* = -38003
2 changes: 1 addition & 1 deletion web3/ethtypes.nim
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ type

TypedTransaction* = distinct seq[byte]

# https://github.com/ethereum/execution-apis/blob/v1.0.0-alpha.8/src/engine/specification.md#executionpayloadv1
# https://github.com/ethereum/execution-apis/blob/v1.0.0-alpha.9/src/engine/specification.md#executionpayloadv1
ExecutionPayloadV1* = object
parentHash*: BlockHash
feeRecipient*: Address
Expand Down

0 comments on commit 755b6dc

Please sign in to comment.