Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add engine_getClientVersionV1 and ClientVersionV1 #151

Merged
merged 1 commit into from
May 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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