Improve type safety in RBF service by replacing any types with proper interfaces#461
Merged
Conversation
- Add ECCLibrary interface for ecc parameter - Add EsploraTransaction interfaces for transaction types - Change parseSequenceNumber parameter from any to unknown - Add deprecation comment for TransactionBuilder Co-authored-by: jamespepper81 <84083764+jamespepper81@users.noreply.github.com>
- Update tsconfig.json to include ES2015+ and DOM libs - Install @types/node for Node.js type definitions - Add null/undefined checks in rbf-service.ts - Fix all TypeScript compilation errors without changing functionality Co-authored-by: jamespepper81 <84083764+jamespepper81@users.noreply.github.com>
Improve type safety in RBF service by replacing `any` types with proper interfaces
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request enhances type safety and robustness in the RBF (Replace-By-Fee) service, especially around Esplora transaction handling and ECC library validation. The changes introduce stricter TypeScript interfaces, improve error handling, and add future-proofing notes for Bitcoin transaction building.
Type safety and interface improvements:
EsploraTransaction,EsploraTransactionVin, andEsploraTransactionVout, and updated all relevant usages in the RBF service to use these types instead ofany. This makes the code more robust and easier to maintain. [1] [2]ECCLibraryinterface, improving clarity and reducing the risk of runtime errors.Error handling and robustness:
?? 0) when summing output values, ensuring that missing or undefined values do not cause calculation errors. [1] [2]parseSequenceNumberfunction to use a stricter type signature (unknown), improving type safety.Developer guidance:
TransactionBuilderis deprecated and suggesting migration to PSBT for future compatibility withbitcoinjs-lib. [1] [2]Dependency update:
@types/nodedevelopment dependency to version^24.10.7inpackage.json.