Add newPayload4 and getPayload4 convenience API (#142)

This commit is contained in:
andri lim 2024-03-28 07:13:52 +07:00 committed by GitHub
parent e049d14855
commit 9e370474fb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 17 additions and 0 deletions

View File

@ -51,6 +51,9 @@ createRpcSigsFromNim(RpcClient):
proc engine_newPayloadV3(payload: ExecutionPayload,
expectedBlobVersionedHashes: Option[seq[VersionedHash]],
parentBeaconBlockRoot: Option[FixedBytes[32]]): PayloadStatusV1
proc engine_newPayloadV4(payload: ExecutionPayload,
expectedBlobVersionedHashes: Option[seq[VersionedHash]],
parentBeaconBlockRoot: Option[FixedBytes[32]]): PayloadStatusV1
proc engine_forkchoiceUpdatedV2(forkchoiceState: ForkchoiceStateV1, payloadAttributes: Option[PayloadAttributes]): ForkchoiceUpdatedResponse
proc engine_forkchoiceUpdatedV3(forkchoiceState: ForkchoiceStateV1, payloadAttributes: Option[PayloadAttributes]): ForkchoiceUpdatedResponse
@ -96,6 +99,12 @@ template getPayload*(
payloadId: PayloadID): Future[GetPayloadV3Response] =
engine_getPayloadV3(rpcClient, payloadId)
template getPayload*(
rpcClient: RpcClient,
T: type GetPayloadV4Response,
payloadId: PayloadID): Future[GetPayloadV4Response] =
engine_getPayloadV4(rpcClient, payloadId)
template newPayload*(
rpcClient: RpcClient,
payload: ExecutionPayloadV1): Future[PayloadStatusV1] =
@ -114,6 +123,14 @@ template newPayload*(
engine_newPayloadV3(
rpcClient, payload, versionedHashes, parentBeaconBlockRoot)
template newPayload*(
rpcClient: RpcClient,
payload: ExecutionPayloadV4,
versionedHashes: seq[VersionedHash],
parentBeaconBlockRoot: FixedBytes[32]): Future[PayloadStatusV1] =
engine_newPayloadV4(
rpcClient, payload, versionedHashes, parentBeaconBlockRoot)
template exchangeCapabilities*(
rpcClient: RpcClient,
methods: seq[string]): Future[seq[string]] =