diff --git a/web3/engine_api.nim b/web3/engine_api.nim index 5a6b2f8..5917887 100644 --- a/web3/engine_api.nim +++ b/web3/engine_api.nim @@ -24,6 +24,12 @@ template forkchoiceUpdated*( payloadAttributes: Option[PayloadAttributesV2]): Future[ForkchoiceUpdatedResponse] = engine_forkchoiceUpdatedV2(rpcClient, forkchoiceState, payloadAttributes) +template forkchoiceUpdated*( + rpcClient: RpcClient, + forkchoiceState: ForkchoiceStateV1, + payloadAttributes: Option[PayloadAttributesV3]): Future[ForkchoiceUpdatedResponse] = + engine_forkchoiceUpdatedV3(rpcClient, forkchoiceState, payloadAttributes) + template getPayload*( rpcClient: RpcClient, T: type ExecutionPayloadV1, @@ -61,5 +67,7 @@ template newPayload*( template newPayload*( rpcClient: RpcClient, payload: ExecutionPayloadV3, - versioned_hashes: seq[VersionedHash]): Future[PayloadStatusV1] = - engine_newPayloadV3(rpcClient, payload, versioned_hashes) + versionedHashes: seq[VersionedHash], + parentBeaconBlockRoot: FixedBytes[32]): Future[PayloadStatusV1] = + engine_newPayloadV3( + rpcClient, payload, versionedHashes, parentBeaconBlockRoot) diff --git a/web3/engine_api_callsigs.nim b/web3/engine_api_callsigs.nim index 2c35987..4d0b248 100644 --- a/web3/engine_api_callsigs.nim +++ b/web3/engine_api_callsigs.nim @@ -1,5 +1,6 @@ # https://github.com/ethereum/execution-apis/blob/v1.0.0-beta.3/src/engine/paris.md#methods # https://github.com/ethereum/execution-apis/blob/v1.0.0-beta.3/src/engine/shanghai.md#methods +# https://github.com/ethereum/execution-apis/blob/ee3df5bc38f28ef35385cefc9d9ca18d5e502778/src/engine/cancun.md#methods import ethtypes, engine_api_types @@ -8,6 +9,7 @@ proc engine_newPayloadV2(payload: ExecutionPayloadV2): PayloadStatusV1 proc engine_newPayloadV3(payload: ExecutionPayloadV3, versioned_hashes: seq[VersionedHash]): PayloadStatusV1 proc engine_forkchoiceUpdatedV1(forkchoiceState: ForkchoiceStateV1, payloadAttributes: Option[PayloadAttributesV1]): ForkchoiceUpdatedResponse proc engine_forkchoiceUpdatedV2(forkchoiceState: ForkchoiceStateV1, payloadAttributes: Option[PayloadAttributesV2]): ForkchoiceUpdatedResponse +proc engine_forkchoiceUpdatedV3(forkchoiceState: ForkchoiceStateV1, payloadAttributes: Option[PayloadAttributesV3]): ForkchoiceUpdatedResponse proc engine_getPayloadV1(payloadId: PayloadID): ExecutionPayloadV1 proc engine_getPayloadV2(payloadId: PayloadID): GetPayloadV2Response proc engine_getPayloadV2_exact(payloadId: PayloadID): GetPayloadV2ResponseExact diff --git a/web3/engine_api_types.nim b/web3/engine_api_types.nim index 5a307bd..de707d1 100644 --- a/web3/engine_api_types.nim +++ b/web3/engine_api_types.nim @@ -25,6 +25,14 @@ type suggestedFeeRecipient*: Address withdrawals*: seq[WithdrawalV1] + # https://github.com/ethereum/execution-apis/blob/ee3df5bc38f28ef35385cefc9d9ca18d5e502778/src/engine/cancun.md#payloadattributesv3 + PayloadAttributesV3* = object + timestamp*: Quantity + prevRandao*: FixedBytes[32] + suggestedFeeRecipient*: Address + withdrawals*: seq[WithdrawalV1] + parentBeaconBlockRoot*: FixedBytes[32] + # This is ugly, but see the comment on ExecutionPayloadV1OrV2. PayloadAttributesV1OrV2* = object timestamp*: Quantity @@ -73,7 +81,7 @@ type executionPayload*: ExecutionPayloadV2 blockValue*: UInt256 - # https://github.com/ethereum/execution-apis/blob/v1.0.0-beta.3/src/engine/experimental/blob-extension.md#response-1 + # https://github.com/ethereum/execution-apis/blob/ee3df5bc38f28ef35385cefc9d9ca18d5e502778/src/engine/cancun.md#response-2 GetPayloadV3Response* = object executionPayload*: ExecutionPayloadV3 blockValue*: UInt256 diff --git a/web3/ethtypes.nim b/web3/ethtypes.nim index b25f99e..e234fb2 100644 --- a/web3/ethtypes.nim +++ b/web3/ethtypes.nim @@ -293,7 +293,7 @@ type transactions*: seq[TypedTransaction] withdrawals*: Option[seq[WithdrawalV1]] - # https://github.com/ethereum/execution-apis/pull/417 + # https://github.com/ethereum/execution-apis/blob/ee3df5bc38f28ef35385cefc9d9ca18d5e502778/src/engine/cancun.md#executionpayloadv3 ExecutionPayloadV3* = object parentHash*: Hash256 feeRecipient*: Address @@ -318,7 +318,7 @@ type ExecutionPayloadV2 | ExecutionPayloadV3 - # https://github.com/ethereum/execution-apis/blob/v1.0.0-beta.3/src/engine/experimental/blob-extension.md#BlobsBundleV1 + # https://github.com/ethereum/execution-apis/blob/ee3df5bc38f28ef35385cefc9d9ca18d5e502778/src/engine/cancun.md#blobsbundlev1 BlobsBundleV1* = object commitments*: seq[KZGCommitment] proofs*: seq[KZGProof]