js-xdr icon indicating copy to clipboard operation
js-xdr copied to clipboard

[Draft] Experimental fork: replace native usage of `BigInt` with JSBI.

Open Shaptic opened this issue 1 year ago • 0 comments

Due to the fact that React Native does not have strong support for BigInt literals (see https://github.com/facebook/react-native/issues/34603#issuecomment-1241038509), this library (and, by extension, the entire Stellar JavaScript SDK, e.g. stellar-base and stellar-sdk) is not compatible with React Native.

The ecosystem recommendation is to use JSBI as a drop-in replacement for BigInt, then use a Babel plugin (transform-jsbi-to-bigint) to transpile the final code to have native BigInts.

This is an experimental fork to port the codebase to use JSBI.

As far as I understand, we should not use the aforementioned plugin in this codebase and rather let downstream systems with strong BigInt support do the replacement. Unfortunately, this would have to be an "opt-in" action rather than an "opt-out", so the best path forward to getting this into RN projects is still unclear.

Shaptic avatar Nov 15 '23 00:11 Shaptic