Skip to content

Commit 31a94d0

Browse files
authored
Merge pull request #26 from bitcoinerlab/outputs-class
v2.0.0 - Improved usability
2 parents 8a786a8 + 173189c commit 31a94d0

23 files changed

+2435
-654
lines changed

CHANGELOG.md

Lines changed: 68 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,78 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8-
## [Unreleased]
8+
## [2.0.0] - 2023-10-19
9+
10+
### Changed
11+
12+
- **Main Class Renaming**:
13+
- Deprecated the old naming convention.
14+
- Renamed the main class from "Descriptor" to "Output".
15+
- This change emphasizes that a descriptor describes an "Output".
16+
17+
- **Parameter Refactoring**:
18+
- Refactored the main input parameter in the constructor of the "Output" class.
19+
- Previously: "expression" (string).
20+
- Now: "descriptor" (string).
21+
- This modification better aligns with the principle above that a descriptor describes an Output.
22+
23+
- **Function Updates**:
24+
- All functions that utilized "expression" have been updated to use "descriptor".
25+
26+
- **Ledger Hardware Wallet & PSBT Finalizers Improvements**:
27+
- Refined functions related to the Ledger Hardware Wallet and PSBT finalizers.
28+
- These refinements greatly simplify and enhance the library's usability. See details below.
29+
30+
- **Finalizers Update**:
31+
- Deprecated `updatePsbt` in favor of `updatePsbtAsInput`.
32+
- The new function returns the finalizer directly instead of the input number.
33+
- This change eliminates the need to explicitly call the `finalizePsbtInput` method of the Output class.
34+
- Previous implementations were error-prone due to the need to keep track of the input number of the PSBT input being finalized and the Output instance of the previous output.
35+
36+
- **Ledger Enhancements**:
37+
- Simplified the signer's requirements before v2.0.0, which previously required tracking the Output instances of each input and passing them to the signer.
38+
- The essential information is now directly extracted from the PSBT, facilitating usability.
39+
- Unified `ledgerClient` and `ledgerState` parameters into a new type `LedgerManager`, which also includes an instance to the Elliptic Curve Library (`ecc`).
40+
- To initialize: `const ledgerManager = {ledgerClient, ledgerState: {}, ecc};`, where `import * as ecc from '@bitcoinerlab/secp256k1'`.
41+
42+
- **Deprecation Notices**:
43+
- While the old functions and classes with former signatures remain available in 2.0.0, they are now deprecated.
44+
- Transitioning to v2.0.0 requires no immediate action, but you may encounter "deprecated" warnings if your code editor supports typedoc/jsdoc linting.
45+
- It's highly recommended to start updating to the new functions and classes.
46+
47+
- **Key Updates to Consider**:
48+
- Substitute `new Descriptor({expression})` with `new Output({descriptor})`.
49+
- Transition from `expand({expression})` to `expand({descriptor})`.
50+
- Use `updatePsbtAsInput` as `updatePsbt` is now deprecated.
51+
- Introduced `updatePsbtAsOutput` for completeness.
52+
- Opt for finalizers returned by `updatePsbtAsInput` as `finalizePsbtInput` and `finalizePsbt` have been deprecated.
53+
54+
- **Additional Ledger Updates**:
55+
- Functions previously expecting `ledgerClient` and `ledgerState` should now receive `ledgerManager` instead.
56+
- This change affects multiple functions, including `signLedger`, all Ledger script expression functions and also: `keyExpressionLedger`, `registerLedgerWallet`, `getLedgerMasterFingerPrint`, and `assertLedgerApp`.
57+
- `signLedger` and `signInputLedger` no longer necessitate passing an instance to the former `Descriptor` class. All relevant information is automatically retrieved from the psbt now.
58+
59+
- **Testing Enhancements**:
60+
- **Deprecated Function Testing**:
61+
- Retained old tests, now suffixed with `-deprecated`, to continue testing the deprecated functions and classes.
62+
- **New API Testing**:
63+
- Introduced additional tests specifically designed to evaluate the new API's functionality.
64+
65+
- **Documentation Enhancements**:
66+
- Extensively documented all methods using typedoc.
67+
- This facilitates the generation of a comprehensive API reference for developers.
68+
- Updated the README.md to mirror the latest changes, optimizing clarity by referencing the API for intricate details.
969

1070
### Fixed
1171

1272
- **Descriptor Buffer Comparison**:
13-
- Addressed a bug related to buffer comparisons in `src/descriptors.ts`.
14-
- Modified the comparison logic for `witnessScript` and `redeemScript` to handle cases where one of the buffers may be `undefined`.
15-
- Introduced the `eqBuffers` function to compare two buffers, ensuring that it correctly handles `undefined` values.
16-
- This fix ensures accurate and error-free descriptor comparisons, particularly crucial for finalizing psbt indexes.
17-
- Refer to [issue-20](https://github.com/bitcoinerlab/descriptors/issues/20) for more details.
73+
- Resolved a bug associated with buffer comparisons in `src/descriptors.ts`.
74+
- Adjusted the comparison logic for `witnessScript` and `redeemScript` to manage scenarios where one buffer may be `undefined`.
75+
- Introduced the `eqBuffers` function for accurate buffer comparisons, particularly when handling `undefined` values.
76+
- This correction is vital for precise descriptor comparisons, especially when determining psbt indexes.
77+
- For an in-depth analysis, consult [issue-20](https://github.com/bitcoinerlab/descriptors/issues/20).
1878

19-
## [1.1.1] - 2023-10-12
79+
## [1.1.1] - 2023-9-12
2080

2181
### Changed
2282

@@ -26,7 +86,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2686
- The new approach bypasses this by using a direct `require` statement. For more details on the underlying issue, refer to [this React Native discussion](https://github.com/react-native-community/discussions-and-proposals/issues/120).
2787
- This update ensures smoother integration for developers using this library in React Native projects.
2888

29-
## [1.1.0] - 2023-10-7
89+
## [1.1.0] - 2023-9-7
3090

3191
### Changed
3292

0 commit comments

Comments
 (0)