BP-WG / bp-std

Modern & lightweight implementation of bitcoin standards without rust-bitcoin/miniscript dependencies
Apache License 2.0
16 stars 17 forks source link

obtain a XpubDerivable without manual string manipulation #27

Closed zoedberg closed 3 months ago

zoedberg commented 4 months ago

Currently to obtain an XpubDerivable (which I need to create an RgbDescr) I start from a MemorySigningAccount, call the to_account method on it to obtain a DerivationAccount and then I convert the latter to a string to manually replace the keychain part (from * to <0;1;9;10>) to finally call XpubDerivable::from_str (which seems the only way to construct an XpubDerivable). I think this approach is not very robust and we should have a method to create an XpubDerivable from a DerivationAccount.

In case there is already a convenience method to do this without the need to manually edit the string then I'm sorry I haven't found it.