Skip to content

Commit

Permalink
add engine_getBlobsV1
Browse files Browse the repository at this point in the history
  • Loading branch information
agnxsh authored and tersec committed Jan 11, 2025
1 parent a3bc5ad commit 8d67229
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
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

0 comments on commit 8d67229

Please sign in to comment.