Making HTTP calls from mobile apps

OK so quick disclaimer: I’m not using Expo so not 100% how or if this will work.

BigInt should be available on iOS (at least iOS 14), but the issue is Android. The problem is that the default JSC bundled with an Android RN app doesn’t support BigInt AFAIK. I’m currently using v8 instead of JSC for Android. Make sure you enable JIT if you care about performance (see the docs).

You’ll probably hit errors with BigInt syntax for iOS and/or Android:

  1. The exponentiation ** operator might not be supported. You’ll have to manually patch the @dfinity/agent library to replace the ** code (in 6 files) with hardcoded static values.
  2. The BigInt ...n literal syntax (e.g. 128n) might not be supported. You’ll also need to replace that with the BigInt constructor (e.g. 128n becomes BigInt(128)).

Some of these errors only happened when I built my RN app in release mode, so you might not see them initially… but they are there.

Oh yeah, after you solve BigInt, you’ll need to deal with WebAssembly. :sweat_smile:

2 Likes