-
Notifications
You must be signed in to change notification settings - Fork 4
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
[2.6] Use of native BigInt in BigNumber library breaks support for several browsers #60
Comments
Thanks for opening this issue! A maintainer will review this in the next few days and explicitly select labels so you know what's going on. If no reviewer appears after a week, a reminder will be sent out. |
The lack of browsers is intentional and won't change anytime soon due to the performance impact on core with new transaction types. This package isn't meant to be used in browsers and neither is our crypto package, meaning if either of those work in the browser it's a coincidence but not a feature or supported circumstance. In the future there might be a stripped down version of the crypto package for browsers but I am not willing to compromise performance for the sake of browser support. |
This issue has been closed. If you wish to re-open it please provide additional information. |
@faustbrian What if an app could set an env var to select the preferred library on build e.g. |
Another possible fix might be to select the lib to use for BigNumber (default or jsbi) by checking |
This would still come at the cost of performance because every time you create an instance of the BigNumber class it will need to figure out what to use internally instead of simply doing whatever it is told to do. |
Somewhat related to ArkEcosystem/core#3423
Native BigInt (which is used in the
toBigNumber()
method in the@arkecosystem/utils
big-number.ts
library) is not yet supported in all popular browsers (e.g. Safari).Possible Solution
Replace native BigInt with JSBI BigInt in utils: https://github.com/GoogleChromeLabs/jsbi.
The only thing it doesn't support is floats, but from what I observed that isn't supported in the current BigNumber implementation either.
Your Environment
The text was updated successfully, but these errors were encountered: