Skip to content

Commit

Permalink
Add engine_getClientVersionV1 and ClientVersionV1
Browse files Browse the repository at this point in the history
  • Loading branch information
jangko committed May 28, 2024
1 parent 46b4b4c commit ac93b9a
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
1 change: 1 addition & 0 deletions web3/conversions.nim
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ GetPayloadV2Response.useDefaultSerializationIn JrpcConv
GetPayloadV2ResponseExact.useDefaultSerializationIn JrpcConv
GetPayloadV3Response.useDefaultSerializationIn JrpcConv
GetPayloadV4Response.useDefaultSerializationIn JrpcConv
ClientVersionV1.useDefaultSerializationIn JrpcConv

#------------------------------------------------------------------------------
# execution_types
Expand Down
11 changes: 10 additions & 1 deletion web3/engine_api.nim
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ createRpcSigsFromNim(RpcClient):
# https://github.com/ethereum/execution-apis/blob/9301c0697e4c7566f0929147112f6d91f65180f6/src/engine/common.md
proc engine_exchangeCapabilities(methods: seq[string]): seq[string]

# https://github.com/ethereum/execution-apis/blob/v1.0.0-beta.4/src/engine/identification.md#engine_getclientversionv1
proc engine_getClientVersionV1(version: ClientVersionV1): seq[ClientVersionV1]

# convenience apis
proc engine_newPayloadV1(payload: ExecutionPayload): PayloadStatusV1
proc engine_newPayloadV2(payload: ExecutionPayload): PayloadStatusV1
Expand Down Expand Up @@ -134,4 +137,10 @@ template newPayload*(
template exchangeCapabilities*(
rpcClient: RpcClient,
methods: seq[string]): Future[seq[string]] =
engine_exchangeCapabilities(rpcClient, methods)
engine_exchangeCapabilities(rpcClient, methods)

template getClientVersion*(
rpcClient: RpcClient,
version: ClientVersionV1): Future[seq[ClientVersionV1]] =
engine_getClientVersionV1(rpcClient, version)

7 changes: 7 additions & 0 deletions web3/engine_api_types.nim
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,13 @@ type
GetPayloadV3Response |
GetPayloadV4Response

# https://github.com/ethereum/execution-apis/blob/v1.0.0-beta.4/src/engine/identification.md#engine_getclientversionv1
ClientVersionV1* = object
code*: string # e.g. NB or BU
name*: string # Human-readable name of the client, e.g. Lighthouse or go-ethereum
version*: string # the version string of the current implementation e.g. v4.6.0 or 1.0.0-alpha.1 or 1.0.0+20130313144700
commit*: FixedBytes[4]

const
# https://github.com/ethereum/execution-apis/blob/v1.0.0-beta.3/src/engine/common.md#errors
engineApiParseError* = -32700
Expand Down

0 comments on commit ac93b9a

Please sign in to comment.