TRANSACTION CALL OBJECT for eth_estimateGas

Can you please tell me if I am forming a parameter block for the eth_estimateGas method

PHP:
$params = (object)Array(
‘to’ =>‘0x3eF7e69a828e3F9EDF5293241cD64Cc0bbD52743’
);
$result = $this ->request(‘eth_estimateGas’,json_encode($params));

as a result of the request, I get an answer with an error

[code] => -32600 [message] => invalid json request )

Have you checked out the documentation here, https://infura.io/docs/ethereum/json-rpc/eth_estimateGas

Yes, I studied the documentation, but there are no instructions in it how to create a TRANSACTION CALL OBJECT, there is only an example of data. That is what I floatra. in my code, it is completely identical to the example, but returns an error.
In my example code, I create this data json_encode($params)
‘[{“to”: “0xd46e8dd67c5d32be8058bb8eb970870f07244567”}]’;
which is identical to the data in the documentation.

I’m not familiar with PHP, but using the address you provided, this request works in Python

import requests

api_key = "YOURAPIKEY"
url = "https://mainnet.infura.io/v3/"+api_key

ethmethod = "eth_estimateGas"
ethparam = [{"to":"0x3eF7e69a828e3F9EDF5293241cD64Cc0bbD52743"}]
ethheader = {"Content-type":"application/json"}

payload = {"jsonrpc":"2.0","method":ethmethod,"params":ethparam,"id":1}

blockjson = requests.post(url, json=payload, headers=ethheader)

for it in blockjson:
	print(it)

Response:

{"jsonrpc":"2.0","id":1,"result":"0x5208"}

Let me know if this helps.

I tried to substitute the result line in the query.
‘{“jsonrpc”:“2.0”,“method”:“eth_estimateGas”,“params”: [{“to”:“0x3eF7e69a828e3F9EDF5293241cD64Cc0bbD52743”}],“id”:1}’;
also received a response similar to yours. The only question is what is the data type of your “ethparam” variable. May I ask you to display its data type?

I think I found a solution for PHP:

$params = Array(
‘to’ =>‘0x3eF7e69a828e3F9EDF5293241cD64Cc0bbD52743’
);
$params = Array($params);
$result = $this ->request(‘eth_estimateGas’,json_encode($params));

So I use the array nested in each other. It looks very strange, but it works.

ethparam is a python list

I’m glad you got it working though!