A TypeScript library for parsing Bitcoin Descriptors, including Miniscript-based ones. Streamlines creating Partially Signed Bitcoin Transactions (PSBTs) from Descriptors. Features BIP32, single-signature, and Hardware Wallet signing capabilities, and facilitates finalizing transactions.
This Pull Request introduces a series of enhancements and optimizations to the descriptor methods in the @bitcoinerlab/descriptors package. Key updates include the addition of new methods for weight calculation, improvements in memoization, and updates to dependencies and configurations. These changes are aimed at improving the performance and functionality of the module, especially in scenarios involving coinselector algorithms.
Key Changes:
New Descriptor Methods:
guessOutput: Identifies the output type (PKH, WPKH, SH) based on a given script.
inputWeight: Calculates the Weight Unit contributions of an Output as an input in a transaction.
outputWeight: Computes the Weight Unit contributions of an Output as an output in a transaction.
Memoization Implementation:
Applied memoization to guessOutput, getSequence, getLockTime, getScriptSatisfaction, inputWeight, and outputWeight for enhanced performance and reduced redundant computations.
Behavioral Changes:
The isSegwit() method now assumes addr(SH_TYPE_ADDRESS) descriptors as Segwit SH_WPKH. For non-standard script inputs, the format sh(MINISCRIPT) should be used.
Dependency and Configuration Updates:
Updated package version from "2.0.4" to "2.1.0".
Modified the build:test script to include --resolveJsonModule.
Added lodash.memoize for memoization functionality.
Included varuint-bitcoin explicitelly.
Enhanced TypeScript configuration to allow importing JSON files, supporting new test fixtures.
Additional Improvements:
Fixed formatting issues with Prettier.
Utilized explicit varuint-bitcoin functions from the official npm package.
Testing:
Added comprehensive tests for the new methods: inputWeight, outputWeight, and guessOutput.
Rationale for Changes:
The relocation of guessOutput, inputWeight, and outputWeight from @bitcoinerlab/coinselect to @bitcoinerlab/descriptors aligns these methods more closely with the module's purpose. The implementation of a caching strategy and memoization significantly boosts performance, particularly for algorithms that frequently access these weight calculation methods.
Documentation:
Updated code comments and documentation to reflect the new logic and changes made.
This Pull Request introduces a series of enhancements and optimizations to the descriptor methods in the
@bitcoinerlab/descriptors
package. Key updates include the addition of new methods for weight calculation, improvements in memoization, and updates to dependencies and configurations. These changes are aimed at improving the performance and functionality of the module, especially in scenarios involvingcoinselector
algorithms.Key Changes:
New Descriptor Methods:
guessOutput
: Identifies the output type (PKH, WPKH, SH) based on a given script.inputWeight
: Calculates the Weight Unit contributions of an Output as an input in a transaction.outputWeight
: Computes the Weight Unit contributions of an Output as an output in a transaction.Memoization Implementation:
guessOutput
,getSequence
,getLockTime
,getScriptSatisfaction
,inputWeight
, andoutputWeight
for enhanced performance and reduced redundant computations.Behavioral Changes:
isSegwit()
method now assumesaddr(SH_TYPE_ADDRESS)
descriptors as SegwitSH_WPKH
. For non-standard script inputs, the formatsh(MINISCRIPT)
should be used.Dependency and Configuration Updates:
build:test
script to include--resolveJsonModule
.lodash.memoize
for memoization functionality.varuint-bitcoin
explicitelly.Additional Improvements:
varuint-bitcoin
functions from the official npm package.Testing:
inputWeight
,outputWeight
, andguessOutput
.Rationale for Changes: The relocation of
guessOutput
,inputWeight
, andoutputWeight
from@bitcoinerlab/coinselect
to@bitcoinerlab/descriptors
aligns these methods more closely with the module's purpose. The implementation of a caching strategy and memoization significantly boosts performance, particularly for algorithms that frequently access these weight calculation methods.Documentation: