This is a sample application demonstrating how to integrate and use the @fedimint/react-native SDK.
This app serves two primary purposes:
- Developer Sandbox: A convenient environment for the SDK maintainers to test local changes to the native bindings and JavaScript APIs.
- Usage Example: A reference implementation for developers on how to initialize a Fedimint client, connect to a federation, and perform basic operations using the React Native SDK.
It opens a wallet backed by a seed (generated on first launch or restored from existing words), joins a federation from an invite code, shows the ecash balance live, and walks through ecash, lightning and on-chain sends and receives against that federation.
Before running this example, ensure you have the standard React Native environment set up for your platform (Node.js, Watchman, Xcode for iOS, Android Studio for Android).
You must also build the local monorepo packages first, as this example depends on the local workspace versions of the Fedimint SDK.
From the repository root, ensure all dependencies are installed and the native bindings are built.
The pnpm workspace lives in js/, hence --dir js:
pnpm --dir js install
just build-rn-android # nix-built Android libraries, regenerated bindings, JS build
just build-rn-ios # macOS with Xcode onlyThen, navigate to this example directory:
cd js/examples/react-nativeFirst, install the CocoaPods dependencies. Since this app uses local paths to reference the React Native bindings, you must run pod install after the just build-rn-ios step above.
cd ios
bundle install # only needed the first time
bundle exec pod install
cd ..Start the application:
pnpm iosWith a device connected over USB debugging, start the application:
pnpm androidWithout a device, the repository provides an emulator. From the repository root, boot it in one
terminal and leave that terminal running: it is the device, and Ctrl-C shuts it down. Install the
app from a second terminal. Both commands run in the .#rn-android-emulator shell, so the same
adb owns the device:
just rn-android-emulator # terminal 1; add -no-window for a headless boot
just rn-android-example react-nativeThe virtual device is created on first use and needs KVM access. The first just rn-android-example is
quiet for several minutes while Gradle downloads its distribution and the app's dependencies.
On a host enforcing SELinux (Fedora) the emulator segfaults at startup until a local policy
module allows it; scripts/rn-android-emulator.sh describes the fix. If your login shell also has
another Android SDK's adb server running, stop it first (pkill -x adb): two adb builds keep
restarting each other's server and the device shows as offline.
If you prefer to start the Metro bundler manually:
pnpm start