0

I'm trying to get do a eth_getLogs call, but I'm having problems getting a response with the Polygon chains. Strangely, I make the request with Polygon Mainnet data that I know exists, but when I do I get the following error

{"code":-32602,"message":"missing value for required argument 0"}

but when I make the same request on the Eth mainnet, it works.

My failing request is

curl https://polygon-mainnet.infura.io/v3/myKey \
    -X POST \
    -H "Content-Type: application/json" \
    -d '{"jsonrpc":"2.0","method":"eth_getLogs","parameters":[{"fromBlock":"29597527","toBlock":"29597529","topics":["0x788f224aea8528cb3199d1615151d4b851c884ad39e72c306356520ec6d2cf95"]}],"id":1}'

However this request works.

curl https://mainnet.infura.io/v3/myKey \
    -X POST \
    -H "Content-Type: application/json" \
    -d '{"jsonrpc":"2.0","method":"eth_getLogs","parameters":[{"fromBlock":"29597527","toBlock":"29597529","topics":["0x788f224aea8528cb3199d1615151d4b851c884ad39e72c306356520ec6d2cf95"]}],"id":1}'

Could anyone help me to understand this? Thanks!

1 Answer 1

0

Figured it out by reading the docs more closely.

fromBlock [optional, default is "latest"] - hexadecimal block number, or the string "latest", "earliest" or "pending"

toBlock [optional, default is "latest"] - hexadecimal block number, or the string "latest", "earliest" or "pending"

My block numbers needed to be hexademicals, starting with 0x

Strange how the request worked for Eth

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.