Skip to content

Commit 143ddfa

Browse files
authored
add engine_getBlobsV1 (#187)
* add engine_getBlobsV1 * don't overload for versions
1 parent a3bc5ad commit 143ddfa

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

web3/engine_api.nim

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ createRpcSigsFromNim(RpcClient):
3838
proc engine_getPayloadV4(payloadId: Bytes8): GetPayloadV4Response
3939
proc engine_getPayloadBodiesByHashV1(hashes: seq[Hash32]): seq[Opt[ExecutionPayloadBodyV1]]
4040
proc engine_getPayloadBodiesByRangeV1(start: Quantity, count: Quantity): seq[Opt[ExecutionPayloadBodyV1]]
41+
proc engine_getBlobsV1(blob_versioned_hashes: Bytes32): GetBlobsV1Response
4142

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

111+
template getBlobs*(
112+
rpcClient: RpcClient,
113+
T: type GetBlobsV1Response,
114+
blob_versioned_hashes: Bytes32):
115+
Future[GetBlobsV1Response] =
116+
engine_getBlobsV1(rpcClient, blob_versioned_hashes)
117+
110118
template newPayload*(
111119
rpcClient: RpcClient,
112120
payload: ExecutionPayloadV1): Future[PayloadStatusV1] =

web3/engine_api_types.nim

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,10 @@ type
127127
proofs*: seq[KzgProof]
128128
blobs*: seq[Blob]
129129

130+
BlobAndProofV1* = object
131+
blob*: Blob
132+
proof*: KzgProof
133+
130134
# https://github.com/ethereum/execution-apis/blob/v1.0.0-beta.4/src/engine/shanghai.md#executionpayloadbodyv1
131135
# For optional withdrawals field, see:
132136
# https://github.com/ethereum/execution-apis/blob/v1.0.0-beta.4/src/engine/shanghai.md#engine_getpayloadbodiesbyhashv1
@@ -223,6 +227,9 @@ type
223227
shouldOverrideBuilder*: bool
224228
executionRequests*: seq[seq[byte]]
225229

230+
GetBlobsV1Response* = object
231+
blobAndProof*: BlobAndProofV1
232+
226233
SomeGetPayloadResponse* =
227234
ExecutionPayloadV1 |
228235
GetPayloadV2Response |

0 commit comments

Comments
 (0)