bdk-ffi icon indicating copy to clipboard operation
bdk-ffi copied to clipboard

Beef up the Descriptor type

Open thunderbiscuit opened this issue 10 months ago • 3 comments

The Descriptor type is one of the most complex types coming from BDK/Miniscript, and we expose a simplified version of what's available in Rust, partly because it's a whole lot of generics on top of generics.

I still need to play around with the Rust code to figure out a few things we could add to make the type more powerful in the bindings, but the first thing that I realized only today is that given a descriptor, there is currently not a lot of introspection available into it.

For example, at any point your Descriptor probably came from either the domain layer (you created it yourself from entropy or a recovery phrase) and used our descriptor templates, in which case you know the script type (P2TR, P2WPKH, etc.), or it was given to you by a user in the form of a string. In this case, you can create the descriptor but cannot query it directly for metadata (script type, checksum, etc.). The only way to do this currently is to manually parse the string, but surely we can do better because those methods are available in some form in Rust.

thunderbiscuit avatar Mar 02 '25 02:03 thunderbiscuit

See #688 for an example of what I have in mind.

thunderbiscuit avatar Mar 02 '25 02:03 thunderbiscuit

Related to #357.

cc @andreasgriffin

thunderbiscuit avatar Mar 12 '25 13:03 thunderbiscuit