-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
(draft)Add transactions_sort_by
#592
Conversation
Wanted to get your feedback on this in general: This is a pretty simplistic (and possibly opinionated from the ffi/mobile side) version of what we could do with this, it is similar to the example for good reason, IMO that's what you might expect out of the box (consistency + newest items first). (and is what I'd expect when building BDKSwiftExampleWallet and is why I was wanting it added in bdk and exposed in bdk-ffi!) But there is obviously room for expansion of this and more flexibility, but the more I've thought about it I've not landed on something I'm immediately convinced to do right now. For example, I could add a |
My only thought is that as is, the method would need to be renamed (something like But that's quite far from the Rust idea of passing it a sorting lambda. I'd need to look into the method a bit more to see if we can use the foreign trait implementation workflow of uniffi on this |
Good thoughts, I'm going to think over them a little bit myself too now- |
I believe a trait that has one associated function |
yup that totally makes sense to me right now, was just messing with something somewhat similar to that right now (kind of taking inspiration from some of the stuff I did previously with callbacks on sync requests related to script inspection, etc), so thanks for spelling out your thoughts and the return type of the Ordering enum, that helped me clarify what this should look like, so that was helpful to get your feedback and specific idea! |
This actually has a few different directions it can go, so am going to save the discussion for the next bindings call after having tried out a few things and thought thru what I'd want/expect as an iOS dev to color my thinking, and then get everyone's feedback again- |
I agree we either need to rename this if using a static sorting, or preferably have it take a compare function callback as a parameter. |
Description
Adds transactions_sort_by.
The example is the sorting I wanted and would sort of expect as a user of bdk-ffi, so that's what I went for in actual implementation.
Notes to the reviewers
I've wanted this for myself so I'm grateful Steve added it in bdk.
Obviously could do this sorting on client side, but its nice to get something out of the box that sorts consistently if you are a consumer of bdk-ffi.
Screenshots
~After
~Before
Changelog notice
Added
transactions_sort_by
inWallet
Checklists
All Submissions:
cargo fmt
andcargo clippy
before committingNew Features:
Bugfixes: