-
Notifications
You must be signed in to change notification settings - Fork 31
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
Amount Preferences Fixes #140
base: development
Are you sure you want to change the base?
Amount Preferences Fixes #140
Conversation
This looks good to me, great job! However we should wait for |
Now the changes are isolated. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Really like this PR. We have to decide wether this should be a breaking change in the API or not. We could also deprecate the old method for setting the amount preference (see my comment).
src/CashuWallet.ts
Outdated
preference?: Array<AmountPreference>; | ||
preference?: Preferences; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about we deprecate preference
, do the new thing in a new option called outputAmounts
, and write a thin translation method that maps preference
to outputAmounts
, and issue a deprecation warning?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I second this
Maybe this is out of scope for this PR but we should also get rid of this behavior of the lib where it overwrites Example: if (options?.preference) {
amount = options?.preference?.reduce((acc, curr) => acc + curr.amount * curr.count, 0);
} |
looks like this PR needs some conflict resolution. What's the status on this? @lollerfirst |
13dfedd
to
322cc01
Compare
…le, adding a deprecation warn layer.
Conflicts resolved and I made this into a non-breaking change. Now issues a deprecation warning and converts |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work!
To me it looks good. What do you think about the suggestions @lollerfirst ?
I think it would be a bit more expressive, but maybe that's just my opinion. You can either accept or reject all suggestions, and then we'll merge this
Co-authored-by: gandlafbtc <[email protected]>
@gandlafbtc Thank you! I applied the suggestions. |
Fixes: #129
Changes
but from the amounts of the keyset instead.
PR Tasks
npm run test
--> no failing unit testsnpm run format