Skip to content
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

Make SDK work with React Native #75

Open
elsirion opened this issue Oct 21, 2024 · 6 comments
Open

Make SDK work with React Native #75

elsirion opened this issue Oct 21, 2024 · 6 comments
Labels
enhancement New feature or request

Comments

@elsirion
Copy link
Contributor

@alexlwn123 can you add some context please?

1M bounty once scoped out.

@elsirion elsirion added the enhancement New feature or request label Oct 21, 2024
@alexlwn123
Copy link
Member

alexlwn123 commented Oct 21, 2024

Make the Fedimint Web SDK Work with React Native

Scope overview: Enable the fedimint-client SDK to function within React Native environments, sharing library code with the existing web SDK.

Background

Our current SDK includes a WebAssembly (WASM) bundle that exposes the Rust-based fedimint-client to web applications. This setup allows web environments to interact seamlessly with the fedimint client.

However, React Native—a popular framework for building native/mobile apps using React—cannot directly leverage the existing WASM bundle due to environment differences between web and native mobile platforms.

Objective

  • Build React Native Compatibility:
  • Utilize UniFFI to generate bindings for the fedimint-client, making it compatible with React Native applications on both iOS and Android platforms.
  • Architect Shared Library Code:
  • Structure the React Native package to share as much library code as possible with the existing web SDK, minimizing code duplication and easing future maintenance.

Scope of Work

1. UniFFI Bindings for React Native

  • Generate UniFFI Bindings:
  • Configure the fedimint-client Rust codebase to produce UniFFI bindings suitable for React Native.
  • Ensure all necessary functionalities are exposed through these bindings.
  • Address any platform-specific issues on iOS and Android, ensuring smooth operation across devices.

2. Architecting Shared Library Code

  • Implement a modular architecture that allows both SDKs to import shared code without conflicts.

3. Testing and Validation

  • Ensure tests run successfully on both iOS and Android platforms.
  • (Optional but Preferred) Develop a sample React Native app demonstrating the SDK’s capabilities.

Deliverables

  • React Native Compatible SDK: A fully functional React Native package of the fedimint-client.
  • Sample App (Optional): A demo React Native application showcasing the SDK in action.

Acceptance Criteria

  • The React Native SDK must support all features currently available in the web SDK.
  • The SDK should work on both iOS and Android devices.
  • Shared code must be cleanly abstracted with no unnecessary duplication.

Additional Information

  • Coordinate with the maintainers of the existing web SDK (@alexlwn123) to ensure compatibility.

Challenges to Anticipate

  • Handling differences in threading models between Rust and React Native.
  • Managing asynchronous operations and callbacks across the FFI boundary.

References:

Note: This bounty aims to expand our SDK’s reach to mobile platforms via React Native, promoting broader adoption and community engagement. Your contribution will play a crucial role in achieving this goal.

@alexlwn123
Copy link
Member

@maan2003 take a look

@maan2003
Copy link
Member

maan2003 commented Nov 5, 2024

fedimint react native is not going to be fun

we have to bundle rocksdb, and doing it as a library is not great :/
Maybe we can just force nix on all developers. But, forcing it for existing wallets is not great.

@alexlwn123
Copy link
Member

sad... any way around using rocks? Can we get a lighter-weight version of the DB with similar guarantees?

@elsirion
Copy link
Contributor Author

elsirion commented Nov 6, 2024

we have to bundle rocksdb, and doing it as a library is not great :/

Is that a problem if we just leave it to the rust RocksDB crate? That is statically linking by default anyway, right? We only do dynamic linking because it avoids recompiling it all the time.

@maan2003
Copy link
Member

maan2003 commented Nov 6, 2024

yea that sounds like the way to go

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants