-
Notifications
You must be signed in to change notification settings - Fork 4
feat: add support for batched JSON-RPC requests #65
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
8f0a69c to
0309f4f
Compare
0309f4f to
0410582
Compare
8b24b98 to
dce5081
Compare
|
@gregorydemay I did quite a bit of experimenting here with different solutions to make this as easy to use as possible despite all the generics involved with |
|
@gregorydemay One thing in particular I thought we could discuss: JSON-RPC batch responses are not necessarily in the same order as the requests. At some point, we will need to match responses to requests using IDs. I actually thought we could do this in the response filter where we check for consistent IDs. We could then return a vector of Generally, I think in the end we might have per-response errors and overall errors for the batch so the return type from the |
gregorydemay
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot @lpahlavi for starting this effort!
lpahlavi
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot for the review and input @gregorydemay! I've left some comments and made some improvements to the examples. Let me know what you think!
gregorydemay
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the improvements @lpahlavi ! some minor comments but otherwise starting to look good!
lpahlavi
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot for the feedback @gregorydemay! I've incorporated all of your comments in, and this should now be ready for another round of review 🙏
gregorydemay
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @lpahlavi !
## 🤖 New release * `canhttp`: 0.4.0 -> 0.5.0 (✓ API compatible changes) * `ic-canister-runtime`: 0.1.1 -> 0.1.2 (✓ API compatible changes) * `ic-pocket-canister-runtime`: 0.2.0 -> 0.3.0 (⚠ API breaking changes) * `ic-agent-canister-runtime`: 0.1.1 -> 0.1.2 (✓ API compatible changes) <details><summary><i><b>Changelog</b></i></summary><p> ## `canhttp` <blockquote> ## [0.5.0] - 2026-01-30 ### Added - Add support for batched JSON-RPC requests ([#65](#65)) - Add replicated request extension ([#70](#70)) ### Changed - Update dependencies ([#72](#72)) [0.5.0]: https://github.com/dfinity/canhttp/compare/canhttp-0.4.0..canhttp-0.5.0 </blockquote> ## `ic-canister-runtime` <blockquote> ## [0.1.2] - 2026-01-30 ### Changed - Update dependencies ([#72](#72)) [0.1.2]: https://github.com/dfinity/canhttp/compare/ic-canister-runtime-v0.1.1..ic-canister-runtime-v0.1.2 </blockquote> ## `ic-pocket-canister-runtime` <blockquote> ## [0.3.0] - 2026-01-30 ### Changed - **Breaking:** Bump `pocket-ic` to v12.0.0 ([#72](#72)) [0.3.0]: https://github.com/dfinity/canhttp/compare/ic-pocket-canister-runtime-v0.2.0..ic-pocket-canister-runtime-v0.3.0 </blockquote> ## `ic-agent-canister-runtime` <blockquote> ## [0.1.2] - 2026-01-30 ### Changed - Update dependencies ([#72](#72)) [0.1.2]: https://github.com/dfinity/canhttp/compare/ic-agent-canister-runtime-v0.1.1..ic-agent-canister-runtime-v0.1.2 </blockquote> </p></details> --- This PR was generated with [release-plz](https://github.com/release-plz/release-plz/). --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Louis Pahlavi <louis.pahlavi@dfinity.org>
(DEFI-2565) Add support for JSON-RPC batch requests and responses. This mostly involves implementing existing JSON-RPC middlewares for JSON-RPC batches in addition to JSON-RPC single requests.