Improve Amount and remove AmountStr. #609

Closed
opened 2025-02-19 15:09:15 +00:00 by crodas · 0 comments
crodas commented 2025-02-19 15:09:15 +00:00 (Migrated from github.com)
          You can just use the `Amount` there no need to wrap it in the `AmoutnStr`. The reason we have to use `AmountStr` is for when the Keys response is json serialized it needs to be as a string and not an int, so that's really the only place we should use `AmountStr` everywhere else is `Amount`.

EDIT: I see you're creating a Keys which currently does expect the AmountStr github.com/cashubtc/cdk@e1458b07a8/crates/cashu/src/nuts/nut01/mod.rs (L63). But since whats needed is as i described above we should change this and that can be an amount and we can just create a custom serialize deserilization, that maybe a better way to handle this and then we don't need the AmountStr type?

cc @crodas

Originally posted by @thesimplekid in https://github.com/cashubtc/cdk/pull/605#discussion_r1960749597

You can just use the `Amount` there no need to wrap it in the `AmoutnStr`. The reason we have to use `AmountStr` is for when the Keys response is json serialized it needs to be as a string and not an int, so that's really the only place we should use `AmountStr` everywhere else is `Amount`. EDIT: I see you're creating a `Keys` which currently does expect the `AmountStr` https://github.com/cashubtc/cdk/blob/e1458b07a898f19742656d95bc83c5c954d9f855/crates/cashu/src/nuts/nut01/mod.rs#L63. But since whats needed is as i described above we should change this and that can be an amount and we can just create a custom serialize deserilization, that maybe a better way to handle this and then we don't need the `AmountStr` type? cc @crodas _Originally posted by @thesimplekid in https://github.com/cashubtc/cdk/pull/605#discussion_r1960749597_
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
cashubtc/cdk#609
No description provided.