Retired: ICDevs.org Bounty 0 - React-Native Agent

This is his profile: Kudo (Kudo Chien) · GitHub

We’ve accelerated this bounty with 10 more ICP from the DFINITY Acceleration Grant.

We are going to set aside 5 ICP for the dec that added the wasm stuff to the android build. This is now a 26 ICP bounty for basically setting up some config files. If you want to get involved in building for the IC, this is a great spot to do it!

2 Likes

Thank you to the moon and back. This unblocked me after months. I’m the founder of DSocial, we are YouTube on the IC.

Mobile app is back in development now :slight_smile: Thank you!

1 Like

Working on iOS but not Android: GitHub - decentralised-social/expo-rn-dfinity-icp-example: Example React Native (in Expo) using ICP

Expo (React Native) JS Engine when running in Debug

Shake phone, and tap Debug Remote JS, you’ll notice the app now works on Android. This is because the JS Engine on Android in Debug mode supports BigInt :man_facepalming:

But that means normal mode and native builds do not #FunTimes :wink:

This is amazing :rofl:

I wonder why a polyfill does not work?

LOL

Basically the * / ** === & | etc etc ops, don’t work reliably via the polyfill. These seem to give unexpected results and as such the while loops runs forever.

This only happens is the typeof of a bigint is object, thus not native support. If typeof is bigint it works.

iOS device/simulator: debugger on/off: bigint
Android simulator/device, debugger on: bigint
Android simulator/device, debugger off: object

@dpdp - did you pull the bls verification code that you’re patching in from an existing package, or did you write it yourself? If it is from Origyn, do we have your permission to add it to agent-js? I’ve just merged support to polyfill BLS verification without patching feat: support for bls verification polyfill by krpeacock · Pull Request #626 · dfinity/agent-js · GitHub, and I’d like to make this process simple by shipping the polyfill as an additional package on NPM as @dfinity/bls-verify, so that we don’t have to ask people to copy a large file around

Oh wait, I see that it was auto-generated from the wasm

@kuchmenko did work on this and can explain a bit more; I think we just converted the wasm to js; but there is some caveats;

@kuchmenko mentioned Plug has another solution which is to run the Rust code via FFI;

Do you have a link to the code? I just had a look and couldn’t find anything in the Plug repo.

Ha it seems they just use the whole agent-rs via ffi… plug-mobile/rust/.cargo/mobile_app at develop · Psychedelic/plug-mobile · GitHub

1 Like

Thanks! Wrong repo :sweat_smile:

Seems only the verify function is exposed though, but I can’t find a place where it’s actually called.

FWIW I also went down the Rust FFI route. It works and is really fast, but it requires a lot of platform-specific setup and code, which makes it less like a library and more like a framework.

Thanks. I saw this as well, but I still don’t understand how this is actually getting called.

Update: Ah, it patches agent-js to use the verify function form agent-rs/ic-agent via FFI

At the very least, going forward you’ll be able to pass a blsVerify option to an Actor and polyfill it however you choose without needing to patch node_modules. I’m also going to provide a pure JS package for it, but it is very slow. I’ll see if I can optimize it by stripping out overhead in the miracl implementation

2 Likes

I don’t know if this discussion is still open, but here I have my solution for this:

GitHub - bundlydev/motoko-nextjs-react-native.

I still have to publish official docs, but this is my MVP example using Expo GitHub - krpeacock/ic-expo-counter: very basic counter example for a react native IC app

There’s no more need for a dedicated React Native agent now that we’ve removed the wasm import for bls verification

2 Likes