Does Infura support named parameters?

Hi,

I’m trying to invoke eth_getBalance with named parameters. Does Infura support that?

Positional parameters work well:

{
    "jsonrpc": "2.0",
    "method": "eth_getBalance",
    "params": [
        "0x__________________",
        "latest"
    ],
    "id": 0
}

However, the named parameter approach doesn’t work:

{
    "jsonrpc": "2.0",
    "method": "eth_getBalance",
    "params": [
        {
            "Address": "0x__________________",
            "Block": "latest"
        }
    ],
    "id": 0
}

Am I doing it wrong, or is it simply not supported?
Thanks!
—Seb

hi @seb, as far as I know the JSON-RPC 2.0 ethereum node spec has no support for notifications or named parameters, not sure if anything changed lately, see Accessing Contracts and Transactions — Ethereum Homestead 0.1 documentation

Traian

Hey @traian.vila! Thanks for your response.

I was referring to the specs here: JSON-RPC 2.0 Specification (jsonrpc.org)
Just search for named parameters in section 7 Examples.

I can also see different styles in the various calls (from the link you posted), such as eth_sendTransaction (vs. eth_getBalance), where they could have used positional parameters as well, but instead, accepted an object of named parameters.

{
   "jsonrpc":"2.0",
   "method":"eth_sendTransaction",
   "params":[
      {
         "from":"0xeb85a5557e5bdc18ee1934a89d8bb402398ee26a",
         "to":"0x6ff93b4b46b41c0c3c9baee01c255d3b4675963d",
         "data":"0xc6888fa10000000000000000000000000000000000000000000000000000000000000006"
      }
   ],
   "id":8
}

Maybe it is just the eth_getBalance method that wasn’t implemented in line with the rest? WDYT?

You’re right, I’ve totally missed these methods, it looks like eth_getBallance doesn’t have the params defined as objects in the spec OPEN-RPC Playground

I don’t know why but probably someone here would have the answer: https://github.com/ethereum/execution-apis

Infura simply exposes the eth node api, it’s not something we can modify.

Traian

Hello @traian.vila,
thanks for your help!
I’ve opened an issue on the execution-apis repo. Let’s see.
—seb

2 Likes