Skip to content

Commit

Permalink
Add newPayload template for engine_newPayloadV4 and restore eth_getBl…
Browse files Browse the repository at this point in the history
…ockReceipts callsig (#182)
  • Loading branch information
jangko authored Nov 27, 2024
1 parent c8f36f5 commit 2bdffd6
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 12 deletions.
14 changes: 14 additions & 0 deletions tests/test_execution_api.nim
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,20 @@ suite "Test eth api":
check res.isSome
waitFor client.close()

test "eth_getBlockReceipts with Quantity param":
let client = newRpcHttpClient()
waitFor client.connect("http://" & $srv.localAddress()[0])
let res = waitFor client.eth_getBlockReceipts(blockId(0))
check res.isSome
waitFor client.close()

test "eth_getBlockReceipts with string param":
let client = newRpcHttpClient()
waitFor client.connect("http://" & $srv.localAddress()[0])
let res = waitFor client.eth_getBlockReceipts("latest")
check res.isSome
waitFor client.close()

waitFor srv.stop()
waitFor srv.closeWait()

Expand Down
13 changes: 1 addition & 12 deletions web3/eth_api.nim
Original file line number Diff line number Diff line change
Expand Up @@ -39,18 +39,7 @@ createRpcSigsFromNim(RpcClient):
proc eth_getTransactionCount(data: Address, blockId: BlockIdentifier): Quantity
proc eth_getBlockTransactionCountByHash(data: Hash32): Quantity
proc eth_getBlockTransactionCountByNumber(blockId: BlockIdentifier): Quantity

# TODO: Investigate why nim v2 cannot instantiate generic functions
# with oneof params `blockId: BlockIdentifier` and and return type
# Opt[seq[ReceiptObject]], this is a regression after all
# https://github.com/nim-lang/Nim/issues/23310
when false:
proc eth_getBlockReceipts(blockId: BlockIdentifier): Opt[seq[ReceiptObject]]

proc eth_getBlockReceipts(blockId: string): Opt[seq[ReceiptObject]]
proc eth_getBlockReceipts(blockId: Quantity): Opt[seq[ReceiptObject]]
proc eth_getBlockReceipts(blockId: RtBlockIdentifier): Opt[seq[ReceiptObject]]

proc eth_getBlockReceipts(blockId: BlockIdentifier): Opt[seq[ReceiptObject]]
proc eth_getUncleCountByBlockHash(data: Hash32): Quantity
proc eth_getUncleCountByBlockNumber(blockId: BlockIdentifier): Quantity
proc eth_getCode(data: Address, blockId: BlockIdentifier): seq[byte]
Expand Down

0 comments on commit 2bdffd6

Please sign in to comment.