convex-js
convex-js copied to clipboard
[FEATURE REQUEST] ✨ use a `BigInt` polyfill for Lynx support
Context
Currently, Lynx doesn't support Convex because its JavaScript Engine (PrimJS) doesn't support BigInt for tricky reasons as we can read here:
- https://github.com/lynx-family/lynx/issues/941
- https://github.com/lynx-family/primjs/issues/37
Request
So, can you consider using a Polyfill for BigInt?
(JSBI's one seems to be a proper one)
Implementation
For instance, this:
// The sign bit is the most significant bit (bit 63)
const v1Sign = (v1Bits & 0x8000000000000000n) !== 0n;
would look like this then:
// outside of the function(s)
const BIT_0 = JSBI.BigInt(0);
const BIT_63 = JSBI.BigInt("0x8000000000000000");
and
// The sign bit is the most significant bit (bit 63)
const v1Sign = JSBI.notEqual(JSBI.bitwiseAnd(v1Bits, BIT_63), BIT_0);
Note
I don't know if there will be extra steps before Lynx fully supports Convex (I hope not), but it seems to be a major (and simple) one.
For instance, I have in mind a potential WebSocket issue, but it seems to be quick & easy to fix:
- https://github.com/lynx-family/lynx/issues/951