Skip to content
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

rethink & consolidate usage of BigInt / BigNumber throughout the SDK #1290

Open
marc0olo opened this issue Oct 11, 2021 · 8 comments
Open

rethink & consolidate usage of BigInt / BigNumber throughout the SDK #1290

marc0olo opened this issue Oct 11, 2021 · 8 comments
Assignees
Milestone

Comments

@marc0olo
Copy link
Contributor

marc0olo commented Oct 11, 2021

known related issues / PRs:

we should maybe also consult with @dincho here.

@marc0olo
Copy link
Contributor Author

we should make a proposal how to proceed here.

@marc0olo
Copy link
Contributor Author

here the calldata-lib implementation:

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 ;-)

@marc0olo
Copy link
Contributor Author

another library related to that which is included in the SDK right now:

@davidyuk
Copy link
Member

davidyuk commented Feb 8, 2023

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

@davidyuk
Copy link
Member

davidyuk commented Feb 28, 2023

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

@davidyuk davidyuk added this to the next milestone Feb 28, 2023
@marc0olo
Copy link
Contributor Author

almost forgot about this one 😅 good to see it being tackled 👍

@davidyuk
Copy link
Member

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.

@dincho
Copy link
Member

dincho commented Sep 25, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants