mirror of
https://github.com/status-im/nimbus-eth2.git
synced 2025-02-02 09:46:26 +00:00
parent
34e7181b0d
commit
34a81f56c3
@ -11,6 +11,7 @@
|
||||
|
||||
import
|
||||
std/typetraits,
|
||||
stew/byteutils,
|
||||
json_rpc/[rpcserver, errors],
|
||||
web3/[conversions, engine_api_types],
|
||||
chronicles
|
||||
@ -26,6 +27,14 @@ proc setupEngineAPI*(server: RpcServer) =
|
||||
status: PayloadExecutionStatus.syncing,
|
||||
)
|
||||
|
||||
# https://github.com/ethereum/execution-apis/blob/v1.0.0-beta.3/src/engine/shanghai.md#engine_newpayloadv2
|
||||
server.rpc("engine_newPayloadV2") do(payload: ExecutionPayloadV2) -> PayloadStatusV1:
|
||||
info "engine_newPayloadV2", payload
|
||||
|
||||
return PayloadStatusV1(
|
||||
status: PayloadExecutionStatus.syncing,
|
||||
)
|
||||
|
||||
# https://github.com/ethereum/execution-apis/blob/v1.0.0-beta.3/src/engine/paris.md#engine_getpayloadv1
|
||||
server.rpc("engine_getPayloadV1") do(payloadId: PayloadID) -> ExecutionPayloadV1:
|
||||
info "engine_getPayloadV1",
|
||||
@ -57,6 +66,36 @@ proc setupEngineAPI*(server: RpcServer) =
|
||||
payloadStatus: PayloadStatusV1(
|
||||
status: PayloadExecutionStatus.syncing))
|
||||
|
||||
# https://github.com/ethereum/execution-apis/blob/v1.0.0-beta.3/src/engine/shanghai.md#engine_forkchoiceupdatedv2
|
||||
server.rpc("engine_forkchoiceUpdatedV2") do(
|
||||
forkchoiceState: ForkchoiceStateV1, payloadAttributes: Option[PayloadAttributesV2]) -> ForkchoiceUpdatedResponse:
|
||||
info "engine_forkchoiceUpdatedV2",
|
||||
forkchoiceState, payloadAttributes
|
||||
|
||||
return ForkchoiceUpdatedResponse(
|
||||
payloadStatus: PayloadStatusV1(
|
||||
status: PayloadExecutionStatus.syncing))
|
||||
|
||||
server.rpc("eth_getBlockByNumber") do(
|
||||
quantityTag: string, fullTransactions: bool) -> JsonNode:
|
||||
info "eth_getBlockByNumber", quantityTag, fullTransactions
|
||||
|
||||
return if quantityTag == "latest":
|
||||
%BlockObject(number: 1000.Quantity)
|
||||
else:
|
||||
newJObject()
|
||||
|
||||
server.rpc("eth_getBlockByHash") do(
|
||||
data: string, fullTransactions: bool) -> BlockObject:
|
||||
info "eth_getBlockByHash", data = toHex(data), fullTransactions
|
||||
|
||||
return BlockObject(number: 1000.Quantity)
|
||||
|
||||
server.rpc("eth_chainId") do() -> Quantity:
|
||||
info "eth_chainId"
|
||||
|
||||
return 1.Quantity
|
||||
|
||||
when isMainModule:
|
||||
let server = newRpcHttpServer(
|
||||
# authHooks = @[httpJwtAuthHook, httpCorsHook],
|
||||
|
2
vendor/nim-web3
vendored
2
vendor/nim-web3
vendored
@ -1 +1 @@
|
||||
Subproject commit c4fefea387303e88449339a3051a6779c7b4d226
|
||||
Subproject commit fcc7d7e8b18827e5ed0f89f55bbd0bb1081b85ae
|
Loading…
x
Reference in New Issue
Block a user