(draft) feat: add from_string to Transaction#804
(draft) feat: add from_string to Transaction#804reez wants to merge 1 commit intobitcoindevkit:masterfrom
from_string to Transaction#804Conversation
|
I'm not against this per se and will certainly not oppose merging, but notice that this is not part of the Rust API (you cannot create a transaction using something like In general I think if we add these sorts of utility APIs, we should have a way to mark them as our own (and not coming from our Rust dependencies). They should also get special attention in tests because of that fact (since they're not tested on the dependencies' side). |
Discussion definitely here but I'm interested in touching on this at Bindings call tomorrow too, I just took a quick scan of how many ffi convenience methods that dont mirror the Rust API we have in bdk-ffi (just so I could contextualize for myself) |
|
|
||
| /// Creates a new `Transaction` instance from a hexadecimal string representation. | ||
| #[uniffi::constructor] | ||
| pub fn from_string(tx_hex: String) -> Result<Self, TransactionError> { |
| /// Creates a new `Transaction` instance from a hexadecimal string representation. | ||
| #[uniffi::constructor] | ||
| pub fn from_string(tx_hex: String) -> Result<Self, TransactionError> { | ||
| let tx_bytes = Vec::from_hex(&tx_hex)?; |
There was a problem hiding this comment.
enforce consensus transaction?
There was a problem hiding this comment.
TODO: move away from UDL in PR once other PR's merged (had to use UDL until then)
Description
relates to 803 issue
Dont mind the UDL stuff, will rebase on recent changes that move that error out of UDL.
Notes to the reviewers
Added a From trait for automatic error conversion to make things cleaner, consistent with what we usually try to do anyway.
Changelog notice
Checklists
All Submissions:
cargo fmtandcargo clippybefore committingNew Features:
Bugfixes: