Open JeremyRubin opened 1 year ago
AmountF64 cannot be canonicalized as a json, and the Amount type doesn't have a Serialize impl at all (you have to manually specify, which doesn't compose well with data structures), and if you use a Amount{F,U}64 then it doesn't necessarily create an unambiguous Schema or serialization validation to know which is which.
Do we want to keep the AmountF64 at all then? Do we lose anything by moving purely to integer sats as a representation?
people expect to be able to write 1.5 and have it be understood as bitcoin, see https://learn.sapio-lang.org/ch03-01-amounts.html
Understood. I don't see this as a problem though, ideally we should just have a singular internal representation (which is the only one that actually needs to be serializable) and have multiple constructors, one from float space from_btc
and one from integer space from_sats
which I believe we already have. The reasonable approach here seems to be to make everything Serialize via integer space since it is lossless, and relegate the float vs int problem to be one of the UX on the compiler frontend.
What is currently insane about Amount/AmountF64/AmountU64/AmountRange?