Error calling eth_estimateGas with Relay's JSON RPC Endpoint

I'm following along the docs in order to call eth_estimateGas with Relay's JSON RPC endpoint:

https://eth.wiki/json-rpc/API#parameters-25

Here's my code:

const params = JSON.stringify({
  to: '0xD79FFD274Bc1c0c9695fda8f774bf6E7B9225EAF',
  data: '0x4641257d',
})
const result = await relayer.call('eth_estimateGas', [params, 'latest'])

But, I'm getting this error:

{
  jsonrpc: '2.0',
  id: 1,
  error: {
    code: -32602,
    message: 'invalid argument 0: json: cannot unmarshal string into Go value of type ethapi.CallArgs'
  }
}

Anyone know what the error means?

Hi @jg22,

Can you try without stringifying your params

const params = {
  to: '0xD79FFD274Bc1c0c9695fda8f774bf6E7B9225EAF',
  data: '0x4641257d',
}
const result = await relayer.call('eth_estimateGas', [params, 'latest'])

I'm not able to. The function signature for call is call(method: string, params: string[]): Promise<JsonRpcResponse>;. I'm on node ts btw.

Regardless, I did try to force the object as a param like you suggested by transpiling without type checking, but that didn't work either (forgot what the error was).

(post deleted by author)

@dylkil any updates on this issue? I'm running into the same problem when trying to call eth_estimateGas via a relayer