400 Client Error: Bad Request for url: https://api.defender.openzeppelin.com/txs

I'm seeing a 400 error when sending this transaction to the /txs endpoint {'speed': 'fast', 'to': <address>, 'data': '<data>', 'gasLimit': '131342'}. The response body carries the following error message: {'message': "data should have required property 'gasLimit'"} even though the gasLimit param is present in the request payload. I tried using integer, string and hex string values for gasLimit parameter but see the same error. What could be the cause of this / a good way to diagnose?

:computer: Environment


:1234: Code to reproduce

Hey @akshaan, thanks for reporting.

This is a message from our validators. Turns out the only required field at JSON Schema level is gasLimit, and it's the first one checked, which is making me think that the request is not appropriately crafted, so none of the values are actually making it into the body of the request.

Can you provide a reproducible script, so I can look further into it?


Hey @ernestognw, you were right about the fact that the request was malformed. My request was formatted like a regular JSON-RPC request with the transaction in the params field (i.e. {'id': x, 'jsonrpc': 2.0, 'params': {'gasLimit: x, 'nonce': x, ...}). I changed it so that the request body is the transaction itself and that fixed things. Appreciate the pointer!

1 Like