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_getBlobsV1 #187

Merged
merged 2 commits into from
Jan 11, 2025
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
8 changes: 8 additions & 0 deletions web3/engine_api.nim
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ createRpcSigsFromNim(RpcClient):
proc engine_getPayloadV4(payloadId: Bytes8): GetPayloadV4Response
proc engine_getPayloadBodiesByHashV1(hashes: seq[Hash32]): seq[Opt[ExecutionPayloadBodyV1]]
proc engine_getPayloadBodiesByRangeV1(start: Quantity, count: Quantity): seq[Opt[ExecutionPayloadBodyV1]]
proc engine_getBlobsV1(blob_versioned_hashes: Bytes32): GetBlobsV1Response

# https://github.com/ethereum/execution-apis/blob/9301c0697e4c7566f0929147112f6d91f65180f6/src/engine/common.md
proc engine_exchangeCapabilities(methods: seq[string]): seq[string]
Expand Down Expand Up @@ -107,6 +108,13 @@ template getPayload*(
payloadId: Bytes8): Future[GetPayloadV4Response] =
engine_getPayloadV4(rpcClient, payloadId)

template getBlobs*(
rpcClient: RpcClient,
T: type GetBlobsV1Response,
blob_versioned_hashes: Bytes32):
Future[GetBlobsV1Response] =
engine_getBlobsV1(rpcClient, blob_versioned_hashes)

template newPayload*(
rpcClient: RpcClient,
payload: ExecutionPayloadV1): Future[PayloadStatusV1] =
Expand Down
7 changes: 7 additions & 0 deletions web3/engine_api_types.nim
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,10 @@ type
proofs*: seq[KzgProof]
blobs*: seq[Blob]

BlobAndProofV1* = object
blob*: Blob
proof*: KzgProof

# https://github.com/ethereum/execution-apis/blob/v1.0.0-beta.4/src/engine/shanghai.md#executionpayloadbodyv1
# For optional withdrawals field, see:
# https://github.com/ethereum/execution-apis/blob/v1.0.0-beta.4/src/engine/shanghai.md#engine_getpayloadbodiesbyhashv1
Expand Down Expand Up @@ -223,6 +227,9 @@ type
shouldOverrideBuilder*: bool
executionRequests*: seq[seq[byte]]

GetBlobsV1Response* = object
blobAndProof*: BlobAndProofV1

SomeGetPayloadResponse* =
ExecutionPayloadV1 |
GetPayloadV2Response |
Expand Down
Loading