-
Notifications
You must be signed in to change notification settings - Fork 512
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
fix: resolve TransactionStream
and Ledger
model issues
#2779
Conversation
TransactionStream
and Ledger
model issuesTransactionStream
and Ledger
model issues
@coderabbitai full review |
Actions performedFull review triggered. |
WalkthroughThe recent updates to the Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant API
participant TransactionStream
participant Ledger
Client->>API: Request transaction stream
API->>TransactionStream: Provide transaction data
TransactionStream->>Ledger: Include close_time_iso
Ledger-->>API: Return ledger data with close_time_iso
API-->>Client: Send transaction stream with close_time_iso
Assessment against linked issues
Suggested labels
Suggested reviewers
Poem
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? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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)
Other keywords and placeholders
Documentation and Community
|
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.
Actionable comments posted: 0
Outside diff range and nitpick comments (1)
packages/xrpl/HISTORY.md (1)
Line range hint
1-9
: The unreleased changes section looks good! Consider adding a doc link for parseTransactionFlags.The CHANGELOG entry follows the common conventions:
- Unreleased changes come before the latest release
- New features and fixes are listed with sub-bullets
- GitHub references are included
Suggestion: Add a link to the
parseTransactionFlags
docs or implementation so readers can easily find more details on this new utility function.
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (6)
- packages/xrpl/HISTORY.md (1 hunks)
- packages/xrpl/src/client/partialPayment.ts (2 hunks)
- packages/xrpl/src/models/ledger/Ledger.ts (1 hunks)
- packages/xrpl/src/models/methods/index.ts (2 hunks)
- packages/xrpl/src/models/methods/subscribe.ts (4 hunks)
- packages/xrpl/test/fixtures/requests/hashLedger.json (1 hunks)
Files skipped from review due to trivial changes (1)
- packages/xrpl/test/fixtures/requests/hashLedger.json
Additional comments not posted (10)
packages/xrpl/src/models/ledger/Ledger.ts (1)
34-38
: LGTM!The addition of the
close_time_iso
property to theBaseLedger
interface is a valuable enhancement that provides a standardized way to represent the closure time of the ledger. This change aligns with the PR objectives and resolves the linked issue #2715.The property is useful for applications that require precise time information in a universally recognized format, and it does not introduce any breaking changes or new issues.
packages/xrpl/src/client/partialPayment.ts (1)
163-166
: LGTM!The changes to the
handleStreamPartialPayment
function signature and the use of the nullish coalescing operator improve its flexibility and robustness in handling different transaction stream formats. The core functionality of detecting partial payments remains intact, and the updates do not introduce any apparent issues.packages/xrpl/src/models/methods/index.ts (2)
171-171
: LGTM!The import statement for
TransactionV1Stream
is correctly added.
587-587
: LGTM!The export statement for
TransactionV1Stream
is correctly added and is consistent with the import statement.packages/xrpl/src/models/methods/subscribe.ts (4)
Line range hint
269-306
: Excellent work on making theTransactionStreamBase
interface more flexible and adaptable!The introduction of the generic parameter
Version
allows the interface to adapt based on the API version, which is a great way to ensure compatibility with different versions of the rippled API.The addition of the
close_time_iso
property is a nice touch, as it provides a standardized timestamp for the approximate ledger close time.Making the
transaction
andtx_json
properties conditional based on theVersion
parameter is a smart move. It ensures that the correct transaction format is used depending on the API version, preventing potential type mismatches.Overall, these changes enhance the flexibility and robustness of the
TransactionStreamBase
interface.
321-321
: Good simplification of theTransactionStream
type.Aliasing
TransactionStream
toTransactionStreamBase
without specifying theVersion
generic parameter simplifies the usage of the type. It assumes the default API version, which is a reasonable default for most use cases.This change makes the type more concise and easier to use.
328-328
: Great addition of theTransactionV1Stream
type!The introduction of
TransactionV1Stream
provides a clear and specific type for handling transaction stream responses from API version 1. By leveraging the genericTransactionStreamBase
interface and setting theVersion
parameter toRIPPLED_API_V1
, it ensures that the correct transaction format is used for version 1, preventing potential type mismatches.This new type enhances the type safety and clarity of the codebase when dealing with version 1 transaction streams.
Line range hint
400-410
: Nice addition of theModifiedOfferCreateTransaction
interface.The
ModifiedOfferCreateTransaction
interface represents a modified version of theOfferCreate
transaction by extending theOfferCreate
interface and adding a newowner_funds
property.The
owner_funds
property provides the numeric amount of theTakerGets
currency that the account sending theOfferCreate
transaction has after executing the transaction. This information is valuable for tracking and analyzing the account's funds in the context of offer creation.The addition of this interface enhances the expressiveness and usefulness of the code when dealing with modified offer create transactions.
packages/xrpl/HISTORY.md (2)
10-13
: Reviewed the TransactionStream and Ledger model fixes. The changes look good!The fixes appropriately update the
TransactionStream
andLedger
models:
TransactionStream
now supports APIv2 and includes theclose_time_iso
fieldLedger
model now includes the missingclose_time_iso
fieldThese changes align the models with the latest
rippled
API and fill in missing data.
Line range hint
1-24
: The CHANGELOG looks excellent overall! It's well-structured and provides a clear summary of changes.Positive aspects of this CHANGELOG:
- Follows common conventions like reverse chronological ordering
- Provides version headings with dates for easy scanning
- Uses consistent formatting for each release section
- Includes concise, informative bullet points for changes
- References relevant GitHub issues/PRs for more context
- Puts an unreleased section at the top for visibility
The changes themselves seem beneficial, with new features, bug fixes, and various improvements that are clearly summarized.
No major issues stood out during the review. This appears to be a thorough, well-maintained CHANGELOG. Nice work!
The CodeRabbit AI does not make a mention of the changes pertaining to I also don't understand the diagram because |
Co-authored-by: Chenna Keshava B S <[email protected]>
CodeRabbit isn't the smartest. cc @justinr1234 |
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.
Actionable comments posted: 1
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
📒 Files selected for processing (2)
- packages/xrpl/HISTORY.md (1 hunks)
- packages/xrpl/src/client/partialPayment.ts (2 hunks)
🧰 Additional context used
🔇 Additional comments (9)
packages/xrpl/src/client/partialPayment.ts (3)
7-7
: LGTM: Addition of TransactionV1Stream typeThe import of
TransactionV1Stream
type is a good addition. It aligns with the PR objectives to address issues related to the TransactionStream model and provides support for both current and legacy versions of the transaction stream.
163-166
: LGTM: Improved handling of different transaction stream versionsThe changes to the
handleStreamPartialPayment
function are well-implemented:
- The function signature now accepts both
TransactionStream
andTransactionV1Stream
types, improving backwards compatibility.- The use of the nullish coalescing operator (
??
) in theisPartialPayment
function call elegantly handles bothtx_json
andtransaction
properties, accommodating different API versions.These changes align well with the PR objectives to resolve TransactionStream model issues.
Regarding the past review comment, the suggested change has already been implemented in this version of the code.
Line range hint
1-180
: Overall assessment: Well-implemented changes addressing TransactionStream issuesThe changes in this file effectively address the issues related to the TransactionStream model as outlined in the PR objectives. The implementation:
- Adds support for both current and legacy transaction stream types.
- Improves backwards compatibility.
- Handles different API versions gracefully.
These modifications enhance the flexibility and robustness of the partial payment handling logic without introducing any apparent issues.
packages/xrpl/HISTORY.md (6)
Line range hint
16-46
: Version 1.3.0 brings significant changes and new featuresThis release includes several important updates:
Changes to error handling in
prepare*
methods:
- These methods now always reject the Promise when an error occurs, instead of throwing synchronously.
- This change improves consistency in error handling and allows for better error management in asynchronous code.
Improved
RippledError
messages:
- The
error_message
field is now used as themessage
, providing more specific error information.
prepareTransaction
now allows manual setting of theSequence
field:
- This gives users more control over transaction sequencing.
Support for rippled 1.2.1 features:
- Added
delivered_amount
field to theledger
method and transaction subscriptions.- Support for Ed25519 seeds encoded using ripple-lib.
These changes may require updates to existing code, particularly in error handling and transaction preparation.
Line range hint
48-67
: Version 1.3.1 includes minor improvements and bug fixesNotable changes in this version:
- Added
getLedgerSequence
to Remote.- Improved randomness for ECDSA signature generation, enhancing security.
- Performance improvement for
SerializedObject.append
.- Added
Amount.scale
for multiplying an amount's value by a scale factor.- Changed
dropsToXRP
andClient.getXrpBalance
to return anumber
instead of astring
.- Replaced
Buffer
withUInt8Array
for params and return values.These changes improve functionality and performance but may require code adjustments, especially for the
Buffer
toUInt8Array
change.
Line range hint
69-96
: Version 1.3.2 brings important updates and deprecationsKey changes in this version:
- Added support for the ExpandedSignerList amendment.
- New fields added to
ValidationStream
interface.- Improved memo field format checking with more detailed error messages.
- Exported
verifyKeypairSignature
function for use in web apps.- Fixed issues with
Wallet.fromMnemonic
for RFC1751 mnemonics and invalid encoding detection.- Improved error verbosity in
submitAndWait
.Developers should pay attention to these changes, especially the improvements in error handling and new functionality. The expanded signer list support may be particularly relevant for multi-signature setups.
Line range hint
98-116
: Version 1.3.3 introduces new features and bug fixesNotable updates:
- Added support for the
WalletLocator
field.- New helper methods:
- For creating cross-chain payments to/from a sidechain.
- For parsing an NFTokenID.
- Fixed issues with NFT fields to match rippled 1.9.0 changes.
- Updated the
TrustSet
transaction type, specifically theLimitAmount
property type.These changes enhance the library's capabilities for working with new XRP Ledger features like NFTs and cross-chain payments. Developers working with these features should update to take advantage of the new functionality.
Line range hint
118-129
: Versions 1.3.4 and 1.4.0 bring important updates1.3.4 changes:
- Fixed a bug in
submitAndWait
function related to transaction queuing.1.4.0 changes:
- Added support for Node.js v10 LTS.
- Introduced DepositPreauth functionality.
- Fixed typing issues and improved documentation.
- Added
getNFTokenID
function for retrieving NFTokenID after minting.- Added support for
disallowIncoming
account set flags.These versions introduce valuable features and fix important bugs. The support for Node.js v10 LTS and the new DepositPreauth functionality are particularly noteworthy.
Line range hint
1-129
: Summary of recent xrpl.js updatesThe recent versions of xrpl.js (1.2.5 to 1.4.0) have introduced numerous important changes:
- Critical bug fixes, especially in transaction signing and error handling.
- New features supporting recent XRP Ledger amendments (e.g., ExpandedSignerList, DepositPreauth).
- Improved support for NFTs and cross-chain payments.
- Enhanced error reporting and handling.
- Performance improvements and modernization of the codebase.
- Better TypeScript support and documentation updates.
These changes significantly enhance the library's capabilities and reliability. Users of xrpl.js should consider upgrading to the latest version to benefit from these improvements and to ensure compatibility with the latest XRP Ledger features. However, they should be aware of potential breaking changes, particularly in error handling and data type representations, which may require updates to existing code.
High Level Overview of Change
Title says it all.
Context of Change
Fixes #2767
Fixes #2714
Fixes #2715
Type of Change
Did you update HISTORY.md?
Test Plan
The models match the output. CI passes.