I am writing runtime rpc with multiple parameters:
#[rpc]
pub trait ShivarthuApi<BlockHash> {
#[rpc(name = "shivarthu_challengerevidence")]
fn get_challengers_evidence(
&self,
at: Option<BlockHash>,
profile_citizenid: u128,
offset: u64,
limit: u16,
) -> Result<Vec<Vec<u8>>>;
}
It successfully compiled, but gives invalid params error when called through curl
curl http://localhost:9933 -H "Content-Type:application/json;charset=utf-8" -d '{
"jsonrpc":"2.0",
"id":1,
"method":"shivarthu_challengerevidence",
"params": [0, 3, 5]
}'
{"jsonrpc":"2.0","error":{"code":-32602,"message":"Invalid params: invalid type: number, expected a (both 0x-prefixed or not) hex string with length of 64."},"id":1}
rpc call with named parameters
curl http://localhost:9933 -H "Content-Type:application/json;charset=utf-8" -d '{
"jsonrpc":"2.0",
"id":1,
"method":"shivarthu_challengerevidence",
"params": {"profile_citizenid" :0, "offset": 2, "limit":5}
}'
{"jsonrpc":"2.0","error":{"code":-32602,"message":"Invalid params: invalid type: map, expected a tuple of size 4."},"id":1}