aepp-sdk-js
aepp-sdk-js copied to clipboard
rethink & consolidate usage of BigInt / BigNumber throughout the SDK
known related issues / PRs:
- https://github.com/aeternity/aepp-sdk-js/issues/1251
- https://github.com/aeternity/aepp-sdk-js/pull/1259
we should maybe also consult with @dincho here.
we should make a proposal how to proceed here.
here the calldata-lib implementation:
- https://github.com/aeternity/aepp-calldata-js
one important note here:
- we can change code in both repositories! ... we should decide how to proceed with each component (SDK and calldata-lib)
- we don't have to adapt everything in one repo of course ;-)
another library related to that which is included in the SDK right now:
- https://github.com/aeternity/json-bigint
Some time before I was investigating the ability to implement a custom wrapper around bigint to represent ae coints, but this feature on TS side is missed https://github.com/microsoft/TypeScript/issues/2361
Approximate roadmap (each step may be done separately):
- [ ] don't use strings as numbers
- [ ] use BigInt instead of BigNumber (drop BigNumber completely)
- [ ] implement Ae wrapper around BigInt (uncertain)
I've touched on this topic in #1762 but it is too heavy for sdk@13
almost forgot about this one 😅 good to see it being tackled 👍
Optionally we can have a fancy way to define ae amounts
const aeAmount = ae`42.4`;
const fee = aettos`19320000000000`;
Also, may be useful to define something between ae
and aettos
, a multiple of MIN_GAS_PRICE
(1e9). Because in the protocol amounts less than MIN_GAS_PRICE
don't make sense.
Some time before I was investigating the ability to implement a custom wrapper around bigint to represent ae coints, but this feature on TS side is missed microsoft/TypeScript#2361
That's the right way to go IMO