Closed fracek closed 2 months ago
Intersting. I didn't know this before. Will implement soon. Thanks!
That would mean we need to make the method calls return some intermedia representation of the requests though, pretty much like we did with Account::execute()
.
Yes, that's the best way to add batching.
Also notice a couple of things:
id
to reorder them to the caller. Notice that notifications don't produce responses (I don't think starknet rpc uses them so not an issue).Vec<Result<Response>>
.Thanks for that! I guess a downside of such batching is you'd lose strong typing, unless you only allow batching the same request type.
The library would need a response enum that contains all type of response values. An alternative is to return the raw json values then let users deserialize them (all types support deserialization anyway).
Yeah I mean then you have to do some kind of unwrap. Lemme have a think about how this can be best implemented. Will update this soon :)
Superseded by #593.
JSON RPC supports batching multiple requests into one (batching). The performance gain is quite high, for example it takes around 80-100 ms to fetch a single block, but ~200ms to fetch 25 with batching.