Open uhbif19 opened 2 years ago
UFix64 works like this:
In [7]: cadence.UFix64(1).encode() Out[7]: {'type': 'UFix64', 'value': '0.00000001'}
This is binding library API to details of Flow (that UFix64 uses 8 decimals ) and is error-prone (thats why JSON-Cadence stores UFix64 as strings: https://docs.onflow.org/cadence/json-cadence-spec/#fixed-point-numbers).
If propose this API:
In [17]: UFix64(Decimal('123.4')).encode() Out[17]: {'type': 'UFix64', 'value': '123.4'}```
If that change is okay, I can make a PR.
That is a good point. I did not notice.
A PR would be wonderful, thank you very much!
UFix64 works like this:
This is binding library API to details of Flow (that UFix64 uses 8 decimals ) and is error-prone (thats why JSON-Cadence stores UFix64 as strings: https://docs.onflow.org/cadence/json-cadence-spec/#fixed-point-numbers).
If propose this API:
If that change is okay, I can make a PR.