bitcoinerlab / descriptors

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.
https://bitcoinerlab.com/modules/descriptors
41 stars 14 forks source link

Add tr(KEY) support #24

Open Zero-1729 opened 10 months ago

Zero-1729 commented 10 months ago

For brief context, I have been using this library for work with descriptors in a separate ts-based project, and I noticed it didn't handle parsing single-key taproot descriptors tr(KEY).

This PR adds support for parsing single-key taproot descriptors (i.e., tr(KEY)). I've used the existing p2tr and regex pattern definitions. Happy to make any adjustments to fit the repo code style or any other related changes.

landabaso commented 10 months ago

Hi @Zero-1729,

Thank you so much for this PR! I'm thrilled to see contributors joining in. :)

I'll need a bit of time to review it thoroughly. Have you implemented this as a proof of concept, or is it already functioning well within your project?

From a quick look, I believe we'll need some basic tests. This ensures that the functionality works as intended and helps prevent unintentional breakages in future releases.

Zero-1729 commented 9 months ago

@landabaso Thanks for working on the library.

I'Il need a bit of time to review it thoroughly. Have you implemented this as a proof of concept, or is it already functioning well within your project?

Yes, it works as expected. I use the library to parse descriptors and modify their formats; it returns all the useful bits of the descriptor (e.g., key, key path, fingerprint, etc.) for other helper functions to wrangle and create private or public external and internal versions of a given descriptor.

From a quick look, I believe we'll need some basic tests. This ensures that the functionality works as intended and helps prevent unintentional breakages in future releases.

Fair point, l'Il include some test cases.