Open notmandatory opened 1 year ago
I have some code that I'm using to do this currently as a basic rust function that @vnprc helped me out with. It takes a policy string as an input like this:
let policy = Concrete::<String>::from_str(&policy)?;
let segwit_policy: Miniscript<String, Segwitv0> = policy
.compile()
.map_err(|e| Error::Generic(e.to_string()))?;
let descriptor = Descriptor::new_wsh(segwit_policy).unwrap().to_string();
Its been a few days so I'm fuzzy on the details, were we talking about adding additional functionality around this?
Ah yes sorry - yes Python bindings that supports this functionality would be great. For now we have a rust binary that we call to execute this code, which provides us with sufficient utility for an MVP. Having python bindings would allow me to have faster iterations in updating code, but I've been tag teaming learning the rust bdk library with @vnrpc to learn how its done in rust.
Here's the rust script I slapped together for Rob. It's very rough but apparently super useful. https://github.com/vnprc/rob_script
Very cool. Wondering if you'd be interested in adding your script to the bitcoindevkit-scripts repo @vnprc?
Oh cool. It needs some cleanup work but sure!
Describe the enhancement
Add function to construct a
Descriptor
from a miniscript policy string. See thebdk-cli
compiler docs for usage and handle_compile_subcommand() for example code.Use case
Supporting wallets or tools that let a user create a descriptor from a miniscript policy string.
Additional context
This enhancement was inspired by a conversation with @rob1ham who could use this feature with python.