I have a question, is this even possible? I'm trying to call an ETH RPC using HTTP outcalls. Everything works for simple requests, but when I need to send more complex parameters I'm hitting a blocker.
The required JSON to query for example, a chainlink feed to get the latest ETH/USD price is as such:
However, this type I think is impossible to construct in Motoko? As the params field looks like a mixed type array of object + strings?
Can you think of a structure that can support this for serialization/deserialization using serde? I came up with this but doesn't work as the compiler throws a warning if you try to put mixed types in an array. I'm thinking this type of call is not possible using custom types as the compiler will never allow an array of [?{}, ?Text] correct?
In one debug screenshot you can see the resulting serde jsonRequest params field is an empty object array
Set jsonRequest: "{"id": 1, "jsonrpc": "2.0", "method": "eth_call", "params": [{}]}"
Thanks again for your wonderful library..
I have a question, is this even possible? I'm trying to call an ETH RPC using HTTP outcalls. Everything works for simple requests, but when I need to send more complex parameters I'm hitting a blocker.
The required JSON to query for example, a chainlink feed to get the latest ETH/USD price is as such:
{"jsonrpc":"2.0","id":5423031679576389,"method":"eth_call","params":[{"data":"0xfeaf968c","to":"0x5f4ec3df9cbd43714fe2740f5e3616155c5b8419"},"latest"]}
However, this type I think is impossible to construct in Motoko? As the params field looks like a mixed type array of object + strings?
Can you think of a structure that can support this for serialization/deserialization using serde? I came up with this but doesn't work as the compiler throws a warning if you try to put mixed types in an array. I'm thinking this type of call is not possible using custom types as the compiler will never allow an array of [?{}, ?Text] correct?
In one debug screenshot you can see the resulting serde jsonRequest params field is an empty object array
Set jsonRequest: "{"id": 1, "jsonrpc": "2.0", "method": "eth_call", "params": [{}]}"