-
Notifications
You must be signed in to change notification settings - Fork 126
refactor: convert new TS files to async/await #1270
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
base: ts1
Are you sure you want to change the base?
Conversation
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.
Pull request overview
This PR refactors recently converted TypeScript files to use modern async/await syntax instead of promise .then() chains, improving code readability and maintainability. The changes are purely structural with no functional modifications.
Key Changes:
- Converted promise chains to async/await pattern across multiple rippled service files
- Improved type annotations and simplified logic in transaction and ledger summary utilities
- Modernized export syntax to use inline re-exports
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/rippled/transactions.ts | Converted getTransaction to async/await with try/catch error handling |
| src/rippled/quorum.ts | Converted getQuorum to async/await with try/catch error handling |
| src/rippled/nUNL.ts | Converted getNegativeUNL to async/await with try/catch error handling |
| src/rippled/lib/txSummary/index.ts | Added explicit type annotation and simplified conditional logic in summarizeTransaction |
| src/rippled/lib/summarizeLedger.ts | Refactored to use functional map/reduce pattern and added type annotation for parameter |
| src/rippled/lib/rippled.ts | Converted 20+ functions from promise chains to async/await pattern |
| src/rippled/ledgers.ts | Converted getLedger to async/await and added return type annotation |
| src/rippled/index.ts | Simplified exports using inline re-export syntax |
| src/rippled/accountTransactions.ts | Converted getAccountTransactions to async/await with try/catch error handling |
The refactoring is clean, consistent, and follows TypeScript best practices. All error handling has been properly maintained, and the async/await conversion is correctly implemented throughout.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| rippledSocket: XrplClient, | ||
| params: any, | ||
| ): Promise<any> => | ||
| rippledSocket.send(params).catch((error: any) => { |
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.
Can this be converted to async/await as well?
High Level Overview of Change
This PR is a fast follow from #1269 to refactor the files converted to TS to use proper async/await structure instead of
thenstructure.There is no functionality change, only refactors.
Context of Change
Best practices, easier to read/write
Type of Change
Codebase Modernization
Already done ;)
Before / After
No changes
Test Plan
CI passes.