@fhevm-sdk/setup-react-native
v0.1.0-beta.1
Published
Automated setup script for FHEVM SDK in React Native (beta)
Downloads
7
Maintainers
Readme
@fhevm-sdk/setup-react-native
Automated setup script for using FHEVM SDK in React Native projects.
What It Does
This script automatically:
- ✅ Installs required dependencies (@callstack/polygen, polyfills)
- ✅ Initializes Polygen configuration
- ✅ Scans WASM modules from Zama SDK
- ✅ Generates native code for iOS/Android
- ✅ Sets up iOS pods
- ✅ Provides clear next steps
Usage
In your React Native project, run:
npx @fhevm-sdk/setup-react-nativeThat's it! The script will handle everything.
What You'll See
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
🚀 FHEVM SDK - React Native Setup
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
✔ React Native project detected
✔ Prerequisites OK
✔ Dependencies installed
✔ Polygen initialized
✔ Polygen config created
✔ WASM modules scanned
✔ Native code generated
✔ iOS pods installed
✅ Setup Complete!Prerequisites
macOS
brew install wabtLinux
sudo apt install wabtWindows
Download from: https://github.com/WebAssembly/wabt/releases
After Setup
Add these imports to the very top of your index.js:
import '@callstack/polygen/polyfill';
import 'react-native-get-random-values';
import '@ethersproject/shims';
import { Buffer } from 'buffer';
global.Buffer = Buffer;Then use the FHEVM SDK normally:
import { initFHEVM, encryptInput } from '@fhevm-sdk/core';
await initFHEVM({ network: 'sepolia' });
const encrypted = await encryptInput({
contract: '0x...',
user: '0x...',
schema: { value: 'uint32' },
values: { value: 42 },
});Troubleshooting
"wabt not found"
Install wabt first (see Prerequisites above), then run the script again.
"Not a React Native project"
Make sure you're running this in a React Native project directory (one with react-native in package.json).
Build errors after setup
Try:
iOS:
cd ios && pod install && cd ..
npx react-native run-iosAndroid:
cd android && ./gradlew clean && cd ..
npx react-native run-androidWhat Gets Installed
@callstack/polygen- Converts WASM to native codereact-native-get-random-values- Crypto polyfillbuffer- Buffer polyfill@ethersproject/shims- Ethereum utilities polyfill
Manual Setup
If you prefer to set up manually, see the core package README.
License
BSD-3-Clause-Clear
