Add `apiVersion` option to Client constructor
High Level Overview of Change
Fixes #2872
Context of Change
- Changed to allow the apiVersion to be specified from
Clientconstructor.- If you specify the apiVersion from the constructor, the type definitions for the request and requestAll responses will also be based on that apiVersion (due to Generics).
Type of Change
- [ ] Bug fix (non-breaking change which fixes an issue)
- [x ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
- [ ] Refactor (non-breaking change that only restructures code)
- [ ] Tests (You added tests for code that already exists, or your new feature included in this PR)
- [ ] Documentation Updates
- [ ] Release
Did you update HISTORY.md?
- [x ] Yes
- [ ] No, this change does not impact library users
Test Plan
[!WARNING]
Rate limit exceeded
@tequdev has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 24 minutes and 54 seconds before requesting another review.
⌛ How to resolve this issue?
After the wait time has elapsed, a review can be triggered using the
@coderabbitai reviewcommand as a PR comment. Alternatively, push new commits to this PR.We recommend that you space out your commits to avoid hitting the rate limit.
🚦 How do rate limits work?
CodeRabbit enforces hourly rate limits for each developer per organization.
Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.
Please see our FAQ for further information.
📥 Commits
Reviewing files that changed from the base of the PR and between 8a560e6ac68f394e4dcb2fffe6baee7a6f038f6c and 6e1627a54bd72eedc25b459bd5a65bd5e739602a.
📒 Files selected for processing (1)
packages/xrpl/HISTORY.md(1 hunks)
Walkthrough
The pull request introduces enhancements to the xrpl.js library, focusing on API versioning support and flexibility. Key changes include the addition of a generic apiVersion option in the Client class constructor and related methods, allowing for improved handling of different API versions. A new utility function, convertTxFlagsToNumber, is introduced, while the deprecated function setTransactionFlagsToNumber is replaced. The modifications also ensure that various interfaces and methods are updated to support dynamic API versioning, enhancing type safety and configurability.
Changes
| File | Change Summary |
|---|---|
packages/xrpl/HISTORY.md |
Added support for AMMClawback (XLS-73) and Permissioned Domains (XLS-80); introduced convertTxFlagsToNumber; deprecated setTransactionFlagsToNumber; updated Client constructor to accept apiVersion. |
packages/xrpl/src/client/index.ts |
Updated ClientOptions and Client class to support generic API versioning; modified request and requestAll methods to use dynamic API versioning. |
packages/xrpl/src/models/methods/accountTx.ts |
Changed AccountTxResponseBase to an exported interface for broader accessibility. |
packages/xrpl/src/models/methods/subscribe.ts |
Updated OnEventToListenerMap to include a generic API version parameter. |
packages/xrpl/src/models/methods/tx.ts |
Updated TxResponse interface to support dynamic API versioning. |
packages/xrpl/src/sugar/autofill.ts |
Enhanced multiple functions to accept a generic type parameter for API versioning. |
packages/xrpl/src/sugar/getFeeXrp.ts |
Updated getFeeXrp function to support a generic API version parameter. |
packages/xrpl/src/sugar/getOrderbook.ts |
Modified requestAllOffers to accept a generic API version parameter. |
packages/xrpl/src/sugar/submit.ts |
Updated submitRequest, getSignedTx, and waitForFinalTransactionOutcome to include a generic API version parameter. |
Possibly related PRs
- XRPLF/xrpl.js#2825: Related to the introduction of the
convertTxFlagsToNumberfunction and the deprecation ofsetTransactionFlagsToNumber, impacting transaction flag handling. - XRPLF/xrpl.js#2726: Involves enhancements to transaction handling, including the addition of the
convertTxFlagsToNumberfunction and updates related to theNFTokenModifytransaction. - XRPLF/xrpl.js#2896: Introduces support for the AMMClawback amendment (XLS-73) and Permissioned Domains amendment (XLS-80), directly connected to the changes in this PR.
Suggested reviewers
- mvadari
- khancode
- achowdhry-ripple
- ckeshava
Poem
🐰 Hop, hop, API version dance!
Flexible client, take your stance
Generic types, a rabbit's delight
XRPL code now shines so bright
Version control with coding grace 🚀
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
🪧 Tips
Chat
There are 3 ways to chat with CodeRabbit:
- Review comments: Directly reply to a review comment made by CodeRabbit. Example:
-
I pushed a fix in commit <commit_id>, please review it. -
Generate unit testing code for this file. -
Open a follow-up GitHub issue for this discussion.
-
- Files and specific lines of code (under the "Files changed" tab): Tag
@coderabbitaiin a new review comment at the desired location with your query. Examples:-
@coderabbitai generate unit testing code for this file. -
@coderabbitai modularize this function.
-
- PR comments: Tag
@coderabbitaiin a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:-
@coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase. -
@coderabbitai read src/utils.ts and generate unit testing code. -
@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format. -
@coderabbitai help me debug CodeRabbit configuration file.
-
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.
CodeRabbit Commands (Invoked using PR comments)
-
@coderabbitai pauseto pause the reviews on a PR. -
@coderabbitai resumeto resume the paused reviews. -
@coderabbitai reviewto trigger an incremental review. This is useful when automatic reviews are disabled for the repository. -
@coderabbitai full reviewto do a full review from scratch and review all the files again. -
@coderabbitai summaryto regenerate the summary of the PR. -
@coderabbitai generate docstringsto generate docstrings for this PR. (Beta) -
@coderabbitai resolveresolve all the CodeRabbit review comments. -
@coderabbitai configurationto show the current CodeRabbit configuration for the repository. -
@coderabbitai helpto get help.
Other keywords and placeholders
- Add
@coderabbitai ignoreanywhere in the PR description to prevent this PR from being reviewed. - Add
@coderabbitai summaryto generate the high-level summary at a specific location in the PR description. - Add
@coderabbitaianywhere in the PR title to generate the title automatically.
Documentation and Community
- Visit our Documentation for detailed information on how to use CodeRabbit.
- Join our Discord Community to get help, request features, and share feedback.
- Follow us on X/Twitter for updates and announcements.
const xrpl = require("xrpl") const batchClient = new xrpl.Client("wss://batch.nerdnest.xyz") await batchClient.connect()
What is this?