diff --git a/web3/engine_api.nim b/web3/engine_api.nim index 5c2fafc..9bc54fa 100644 --- a/web3/engine_api.nim +++ b/web3/engine_api.nim @@ -36,6 +36,12 @@ template getPayload*( payloadId: PayloadID): Future[GetPayloadV2Response] = engine_getPayloadV2(rpcClient, payloadId) +template getPayload*( + rpcClient: RpcClient, + T: type GetPayloadV3Response, + payloadId: PayloadID): Future[GetPayloadV3Response] = + engine_getPayloadV3(rpcClient, payloadId) + template newPayload*( rpcClient: RpcClient, payload: ExecutionPayloadV1): Future[PayloadStatusV1] = diff --git a/web3/engine_api_callsigs.nim b/web3/engine_api_callsigs.nim index 83ddd4a..52677ab 100644 --- a/web3/engine_api_callsigs.nim +++ b/web3/engine_api_callsigs.nim @@ -4,8 +4,11 @@ import ethtypes, engine_api_types proc engine_newPayloadV1(payload: ExecutionPayloadV1): PayloadStatusV1 proc engine_newPayloadV2(payload: ExecutionPayloadV2): PayloadStatusV1 +proc engine_newPayloadV3(payload: ExecutionPayloadV3): PayloadStatusV1 proc engine_forkchoiceUpdatedV1(forkchoiceState: ForkchoiceStateV1, payloadAttributes: Option[PayloadAttributesV1]): ForkchoiceUpdatedResponse proc engine_forkchoiceUpdatedV2(forkchoiceState: ForkchoiceStateV1, payloadAttributes: Option[PayloadAttributesV2]): ForkchoiceUpdatedResponse proc engine_getPayloadV1(payloadId: PayloadID): ExecutionPayloadV1 proc engine_getPayloadV2(payloadId: PayloadID): GetPayloadV2Response +proc engine_getPayloadV3(payloadId: PayloadID): GetPayloadV3Response proc engine_exchangeTransitionConfigurationV1(transitionConfiguration: TransitionConfigurationV1): TransitionConfigurationV1 +proc engine_getBlobsBundleV1(payloadId: PayloadID): BlobsBundleV1 diff --git a/web3/engine_api_types.nim b/web3/engine_api_types.nim index 1444b61..99c1e86 100644 --- a/web3/engine_api_types.nim +++ b/web3/engine_api_types.nim @@ -56,9 +56,14 @@ type executionPayload*: ExecutionPayloadV2 blockValue*: Quantity + GetPayloadV3Response* = object + executionPayload*: ExecutionPayloadV3 + blockValue*: Quantity + SomeGetPayloadResponse* = ExecutionPayloadV1 | - GetPayloadV2Response + GetPayloadV2Response | + GetPayloadV3Response const # https://github.com/ethereum/execution-apis/blob/v1.0.0-beta.1/src/engine/specification.md#errors diff --git a/web3/ethtypes.nim b/web3/ethtypes.nim index 5eda432..7adb8eb 100644 --- a/web3/ethtypes.nim +++ b/web3/ethtypes.nim @@ -38,6 +38,9 @@ type Quantity* = distinct uint64 + KZGCommitment* = FixedBytes[48] + Blob* = FixedBytes[4096 * 32] + EthSend* = object source*: Address # the address the transaction is send from. to*: Option[Address] # (optional when creating new contract) the address the transaction is directed to. @@ -233,9 +236,35 @@ type transactions*: seq[TypedTransaction] withdrawals*: seq[WithdrawalV1] + # https://github.com/ethereum/execution-apis/blob/d072d080b92d26a1087337c7e2da4147a0ed0347/src/engine/experimental/blob-extension.md#executionpayloadv3 + ExecutionPayloadV3* = object + parentHash*: BlockHash + feeRecipient*: Address + stateRoot*: BlockHash + receiptsRoot*: BlockHash + logsBloom*: FixedBytes[256] + prevRandao*: FixedBytes[32] + blockNumber*: Quantity + gasLimit*: Quantity + gasUsed*: Quantity + timestamp*: Quantity + extraData*: DynamicBytes[0, 32] + baseFeePerGas*: UInt256 + excessDataGas*: UInt256 + blockHash*: BlockHash + transactions*: seq[TypedTransaction] + withdrawals*: seq[WithdrawalV1] + SomeExecutionPayload* = ExecutionPayloadV1 | - ExecutionPayloadV2 + ExecutionPayloadV2 | + ExecutionPayloadV3 + + # https://github.com/ethereum/execution-apis/blob/d072d080b92d26a1087337c7e2da4147a0ed0347/src/engine/experimental/blob-extension.md#BlobsBundleV1 + BlobsBundleV1* = object + blockHash*: BlockHash + kzgs*: seq[KZGCommitment] + blobs*: seq[Blob] RlpEncodedBytes* = distinct seq[byte]