From c7a5b4e0b3e7102fbb2a08132586fcf52228cec8 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 8 Dec 2025 01:40:22 +0000 Subject: [PATCH 1/6] Initial plan From 6fede5666a9988474f47aae1a28df36b67068a98 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 8 Dec 2025 01:44:57 +0000 Subject: [PATCH 2/6] Rename package from lni_react_native to react-native-lni Co-authored-by: ntheile <1273575+ntheile@users.noreply.github.com> --- bindings/lni_react_native/README.md | 8 +++---- .../lni_react_native/example/package.json | 2 +- bindings/lni_react_native/example/src/App.tsx | 2 +- bindings/lni_react_native/package.json | 6 +++--- bindings/lni_react_native/tsconfig.json | 2 +- readme.md | 21 +++++++++++++------ 6 files changed, 25 insertions(+), 16 deletions(-) diff --git a/bindings/lni_react_native/README.md b/bindings/lni_react_native/README.md index 8d56db7..2a3c550 100644 --- a/bindings/lni_react_native/README.md +++ b/bindings/lni_react_native/README.md @@ -1,11 +1,11 @@ -# lni_react_native +# react-native-lni -lni_react_native +React Native bindings for LNI (Lightning Node Interface) ## Installation ```sh -npm install lni_react_native +npm install react-native-lni ``` ## Usage @@ -21,7 +21,7 @@ import { Transaction, BlinkConfig, BlinkNode, -} from 'lni_react_native'; +} from 'react-native-lni'; // ... diff --git a/bindings/lni_react_native/example/package.json b/bindings/lni_react_native/example/package.json index 8abed59..3a11305 100644 --- a/bindings/lni_react_native/example/package.json +++ b/bindings/lni_react_native/example/package.json @@ -1,5 +1,5 @@ { - "name": "lni_react_native-example", + "name": "react-native-lni-example", "version": "0.0.1", "private": true, "types": "../lib/typescript/commonjs/src/index.d.ts", diff --git a/bindings/lni_react_native/example/src/App.tsx b/bindings/lni_react_native/example/src/App.tsx index 1b03a83..09dee63 100644 --- a/bindings/lni_react_native/example/src/App.tsx +++ b/bindings/lni_react_native/example/src/App.tsx @@ -23,7 +23,7 @@ import { LookupInvoiceParams, CreateOfferParams, Offer -} from 'lni_react_native'; +} from 'react-native-lni'; import { LND_URL, LND_MACAROON, diff --git a/bindings/lni_react_native/package.json b/bindings/lni_react_native/package.json index 16a6ea0..101ab68 100644 --- a/bindings/lni_react_native/package.json +++ b/bindings/lni_react_native/package.json @@ -1,7 +1,7 @@ { - "name": "lni_react_native", + "name": "react-native-lni", "version": "0.1.1", - "description": "lni_react_native", + "description": "React Native bindings for LNI (Lightning Node Interface)", "source": "./src/index.tsx", "main": "./lib/commonjs/index.js", "module": "./lib/module/index.js", @@ -52,7 +52,7 @@ "ubrn:android": "ubrn build android --config ubrn.config.yaml --release --and-generate", "ubrn:checkout": "ubrn checkout --config ubrn.config.yaml", "ubrn:clean": "rm -Rf cpp/ android/src/main/java ios/ src/Native* src/generated/ src/index.ts*", - "example": "yarn workspace lni_react_native-example", + "example": "yarn workspace react-native-lni-example", "test": "jest", "typecheck": "tsc", "lint": "eslint \"**/*.{js,ts,tsx}\"", diff --git a/bindings/lni_react_native/tsconfig.json b/bindings/lni_react_native/tsconfig.json index 640ecca..f54e650 100644 --- a/bindings/lni_react_native/tsconfig.json +++ b/bindings/lni_react_native/tsconfig.json @@ -2,7 +2,7 @@ "compilerOptions": { "rootDir": ".", "paths": { - "lni_react_native": ["./src/index"] + "react-native-lni": ["./src/index"] }, "allowUnreachableCode": false, "allowUnusedLabels": false, diff --git a/readme.md b/readme.md index 518350f..0c30a2f 100644 --- a/readme.md +++ b/readme.md @@ -324,8 +324,17 @@ Language Bindings - `cd bindings/lni_react_native && ./build.sh` **To include it in your react-native project:** - 1. In this project run `cd bindings/lni_react_native && ./build.sh && yarn package --out lni.tgz` - 2. This creates a `lni.tgz`. Copy this to your target React Native project in the root. + + **Option 1: Install from npm (recommended)** + ```bash + npm install react-native-lni + # or + yarn add react-native-lni + ``` + + **Option 2: Install from local build** + 1. In this project run `cd bindings/lni_react_native && ./build.sh && yarn package --out react-native-lni.tgz` + 2. This creates a `react-native-lni.tgz`. Copy this to your target React Native project in the root. 3. Prereq: In the React Native project that you want to include `lni`, make sure the new architecure is enabled. And include `lni` in the podfile - android @@ -363,7 +372,7 @@ Language Bindings ENV['RCT_NEW_ARCH_ENABLED'] = '1' - pod 'lni-react-native', :path => '../node_modules/lni_react_native' + pod 'lni-react-native', :path => '../node_modules/react-native-lni' # Fix for New Architecture - remove compiler overrides that conflict with -index-store-path installer.pods_project.targets.each do |target| @@ -379,7 +388,7 @@ Language Bindings end end ``` - 4. `yarn add ./lni.tgz` + 4. `yarn add ./react-native-lni.tgz` 5. `cd ios && pod install` 6. `yarn clean` package.json @@ -405,7 +414,7 @@ Language Bindings yarn # if the app does not recognize change try deleting the lni node module - rm node_modules/lni_react_native + rm node_modules/react-native-lni ``` ios open xcworkspace in xcode and `Product > Clean` and build project @@ -483,7 +492,7 @@ Inspiration Project Structure ================== This project structure was inpired by this https://github.com/ianthetechie/uniffi-starter/ with the intention of -automating the creation of `lni_react_native` https://jhugman.github.io/uniffi-bindgen-react-native/guides/getting-started.html +automating the creation of `react-native-lni` https://jhugman.github.io/uniffi-bindgen-react-native/guides/getting-started.html LNI Sequence Diagram ================== From 811763fe468713ad2e9ea2281d0a7e690d63b991 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 8 Dec 2025 01:49:03 +0000 Subject: [PATCH 3/6] Add npm publishing configuration and documentation Co-authored-by: ntheile <1273575+ntheile@users.noreply.github.com> --- bindings/lni_react_native/.npmignore | 71 +++++++++++ bindings/lni_react_native/PUBLISHING.md | 159 ++++++++++++++++++++++++ bindings/lni_react_native/yarn.lock | 110 ++++++++-------- 3 files changed, 285 insertions(+), 55 deletions(-) create mode 100644 bindings/lni_react_native/.npmignore create mode 100644 bindings/lni_react_native/PUBLISHING.md diff --git a/bindings/lni_react_native/.npmignore b/bindings/lni_react_native/.npmignore new file mode 100644 index 0000000..a91f6fe --- /dev/null +++ b/bindings/lni_react_native/.npmignore @@ -0,0 +1,71 @@ +# Development and testing files +example/ +__tests__/ +__fixtures__/ +__mocks__/ +*.test.ts +*.test.tsx +*.test.js + +# Build artifacts that shouldn't be published +android/build/ +android/gradle/ +android/gradlew +android/gradlew.bat +android/local.properties +ios/build/ +rust_modules/ + +# Configuration files +.editorconfig +.eslintrc +.eslintrc.js +.eslintrc.json +.prettierrc +.prettierrc.js +.watchmanconfig +.nvmrc +lefthook.yml +tsconfig.json +babel.config.js +eslint.config.mjs +turbo.json + +# CI/CD files +.github/ + +# Documentation for development (keep PUBLISHING.md out of package) +CONTRIBUTING.md +CODE_OF_CONDUCT.md +PUBLISHING.md + +# Build scripts (keep build.sh out since it's for development) +build.sh +ubrn.config.yaml + +# Version control +.git/ +.gitignore +.gitattributes + +# Package manager +yarn.lock +package.tgz +*.tgz + +# Logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* + +# OS files +.DS_Store +Thumbs.db + +# Yarn +.yarn/cache +.yarn/unplugged +.yarn/build-state.yml +.yarn/install-state.gz +.pnp.* diff --git a/bindings/lni_react_native/PUBLISHING.md b/bindings/lni_react_native/PUBLISHING.md new file mode 100644 index 0000000..6a95b06 --- /dev/null +++ b/bindings/lni_react_native/PUBLISHING.md @@ -0,0 +1,159 @@ +# Publishing react-native-lni to npm + +This guide explains how to build and publish the `react-native-lni` package to npm. + +## Prerequisites + +- Node.js 18+ and Yarn +- Rust toolchain (rustc, cargo) +- uniffi-bindgen-react-native CLI (`npm install -g uniffi-bindgen-react-native`) +- iOS development tools (Xcode) for building the iOS framework +- Android NDK for building Android libraries +- npm account with publish permissions + +## Build Process + +The package requires a multi-step build process because it combines Rust native code with React Native bindings: + +### 1. Clean Previous Builds (Optional) + +```bash +cd bindings/lni_react_native +yarn ubrn:clean +``` + +### 2. Generate Native Bindings + +Generate the React Native bindings from the Rust code using uniffi-bindgen-react-native: + +**For iOS:** +```bash +yarn ubrn:ios +cd example/ios && pod install +``` + +**For Android:** +```bash +yarn ubrn:android +``` + +This generates: +- `src/generated/` - TypeScript/JavaScript bindings +- `ios/generated/` - iOS native code +- `android/generated/` - Android native code +- `cpp/` - C++ bridge code +- `LniReactNativeFramework.xcframework` - iOS framework + +### 3. Build JavaScript/TypeScript + +Once the generated files exist, build the JS/TS output: + +```bash +yarn build +``` + +This creates: +- `lib/commonjs/` - CommonJS modules +- `lib/module/` - ES modules +- `lib/typescript/` - TypeScript definitions + +### 4. Create Package + +Create a tarball for testing: + +```bash +yarn pack +``` + +This creates `react-native-lni-v0.1.1.tgz` (or similar based on version). + +## Testing the Package Locally + +Before publishing, test the package in a React Native app: + +1. Copy the `.tgz` file to your test project +2. Install it: `yarn add ./react-native-lni-v0.1.1.tgz` +3. Follow the installation instructions in the README +4. Test all major functionality + +## Publishing to npm + +### First Time Setup + +1. Create an npm account if you don't have one: https://www.npmjs.com/signup +2. Login to npm: `npm login` +3. Ensure you have publish permissions for the `react-native-lni` package + +### Version Management + +Update the version in `package.json` following semantic versioning: +- Patch (0.1.1 → 0.1.2): Bug fixes +- Minor (0.1.1 → 0.2.0): New features, backward compatible +- Major (0.1.1 → 1.0.0): Breaking changes + +Or use the release-it tool: +```bash +yarn release +``` + +### Publish + +```bash +npm publish +``` + +Or with the `public` flag if it's the first publish: +```bash +npm publish --access public +``` + +## Automated Publishing + +For automated publishing via CI/CD: + +1. Set up npm authentication token in your CI environment +2. Ensure the build steps run in order: + - Install dependencies + - Run ubrn build (iOS and Android) + - Build JS/TS + - Publish + +## Files Included in Package + +The package includes (as specified in `package.json` files array): +- `src/` - Source TypeScript files including generated bindings +- `lib/` - Compiled JavaScript and TypeScript definitions +- `android/` - Android native code +- `ios/` - iOS native code +- `cpp/` - C++ bridge code +- `*.podspec` - CocoaPods specification +- `LniReactNativeFramework.xcframework` - Prebuilt iOS framework +- `react-native.config.js` - React Native configuration + +Excluded files: +- Build artifacts (`android/build`, `ios/build`) +- Development files (`__tests__`, `example/`) +- Configuration files (`.gitignore`, etc.) + +## Troubleshooting + +### TypeScript Build Fails + +If TypeScript compilation fails but the generated files exist, the build script has fallback logic. Check that `src/generated/` directory exists and contains the `lni.ts` file. + +### Missing Native Frameworks + +Ensure you've run the ubrn build steps (`yarn ubrn:ios` and/or `yarn ubrn:android`) before building the JS package. + +### Version Conflicts + +If you get "version already published" error, increment the version number in package.json. + +## Verification + +After publishing, verify the package: + +1. Check on npm: https://www.npmjs.com/package/react-native-lni +2. Install in a test project: `npm install react-native-lni` +3. Verify all files are present: `ls node_modules/react-native-lni/` +4. Test that imports work: `import { LndNode } from 'react-native-lni'` diff --git a/bindings/lni_react_native/yarn.lock b/bindings/lni_react_native/yarn.lock index 0483e58..dd1ccea 100644 --- a/bindings/lni_react_native/yarn.lock +++ b/bindings/lni_react_native/yarn.lock @@ -8393,61 +8393,6 @@ __metadata: languageName: node linkType: hard -"lni_react_native-example@workspace:example": - version: 0.0.0-use.local - resolution: "lni_react_native-example@workspace:example" - dependencies: - "@babel/core": ^7.25.2 - "@babel/preset-env": ^7.25.3 - "@babel/runtime": ^7.25.0 - "@react-native-community/cli": 15.0.1 - "@react-native-community/cli-platform-android": 15.0.1 - "@react-native-community/cli-platform-ios": 15.0.1 - "@react-native/babel-preset": 0.78.1 - "@react-native/metro-config": 0.78.1 - "@react-native/typescript-config": 0.78.1 - "@types/react": ^19.0.0 - react: 19.0.0 - react-native: 0.78.1 - react-native-builder-bob: ^0.39.0 - react-native-dotenv: ^3.4.11 - languageName: unknown - linkType: soft - -"lni_react_native@workspace:.": - version: 0.0.0-use.local - resolution: "lni_react_native@workspace:." - dependencies: - "@commitlint/config-conventional": ^19.6.0 - "@eslint/compat": ^1.2.7 - "@eslint/eslintrc": ^3.3.0 - "@eslint/js": ^9.22.0 - "@evilmartians/lefthook": ^1.5.0 - "@react-native-community/cli": 15.0.1 - "@react-native/eslint-config": ^0.78.0 - "@release-it/conventional-changelog": ^9.0.2 - "@types/jest": ^29.5.5 - "@types/react": ^19.0.0 - commitlint: ^19.6.1 - del-cli: ^5.1.0 - eslint: ^9.22.0 - eslint-config-prettier: ^10.1.1 - eslint-plugin-prettier: ^5.2.3 - jest: ^29.7.0 - prettier: ^3.0.3 - react: 19.0.0 - react-native: 0.78.1 - react-native-builder-bob: ^0.39.0 - release-it: ^17.10.0 - turbo: ^1.10.7 - typescript: ^5.2.2 - uniffi-bindgen-react-native: 0.29.0-0 - peerDependencies: - react: "*" - react-native: "*" - languageName: unknown - linkType: soft - "locate-path@npm:^3.0.0": version: 3.0.0 resolution: "locate-path@npm:3.0.0" @@ -10595,6 +10540,61 @@ __metadata: languageName: node linkType: hard +"react-native-lni-example@workspace:example": + version: 0.0.0-use.local + resolution: "react-native-lni-example@workspace:example" + dependencies: + "@babel/core": ^7.25.2 + "@babel/preset-env": ^7.25.3 + "@babel/runtime": ^7.25.0 + "@react-native-community/cli": 15.0.1 + "@react-native-community/cli-platform-android": 15.0.1 + "@react-native-community/cli-platform-ios": 15.0.1 + "@react-native/babel-preset": 0.78.1 + "@react-native/metro-config": 0.78.1 + "@react-native/typescript-config": 0.78.1 + "@types/react": ^19.0.0 + react: 19.0.0 + react-native: 0.78.1 + react-native-builder-bob: ^0.39.0 + react-native-dotenv: ^3.4.11 + languageName: unknown + linkType: soft + +"react-native-lni@workspace:.": + version: 0.0.0-use.local + resolution: "react-native-lni@workspace:." + dependencies: + "@commitlint/config-conventional": ^19.6.0 + "@eslint/compat": ^1.2.7 + "@eslint/eslintrc": ^3.3.0 + "@eslint/js": ^9.22.0 + "@evilmartians/lefthook": ^1.5.0 + "@react-native-community/cli": 15.0.1 + "@react-native/eslint-config": ^0.78.0 + "@release-it/conventional-changelog": ^9.0.2 + "@types/jest": ^29.5.5 + "@types/react": ^19.0.0 + commitlint: ^19.6.1 + del-cli: ^5.1.0 + eslint: ^9.22.0 + eslint-config-prettier: ^10.1.1 + eslint-plugin-prettier: ^5.2.3 + jest: ^29.7.0 + prettier: ^3.0.3 + react: 19.0.0 + react-native: 0.78.1 + react-native-builder-bob: ^0.39.0 + release-it: ^17.10.0 + turbo: ^1.10.7 + typescript: ^5.2.2 + uniffi-bindgen-react-native: 0.29.0-0 + peerDependencies: + react: "*" + react-native: "*" + languageName: unknown + linkType: soft + "react-native@npm:0.78.1": version: 0.78.1 resolution: "react-native@npm:0.78.1" From fdbc5411005a65da1837231ae17a42c790ab6d17 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 8 Dec 2025 01:50:53 +0000 Subject: [PATCH 4/6] Enhance README with comprehensive installation and usage guide Co-authored-by: ntheile <1273575+ntheile@users.noreply.github.com> --- bindings/lni_react_native/README.md | 186 +++++++++++++++++++++++++--- 1 file changed, 168 insertions(+), 18 deletions(-) diff --git a/bindings/lni_react_native/README.md b/bindings/lni_react_native/README.md index 2a3c550..869bf72 100644 --- a/bindings/lni_react_native/README.md +++ b/bindings/lni_react_native/README.md @@ -1,40 +1,190 @@ # react-native-lni -React Native bindings for LNI (Lightning Node Interface) +React Native bindings for LNI (Lightning Node Interface) - a unified interface for interacting with multiple Lightning Network node implementations. + +## Features + +- 🔌 **Multi-Node Support**: Works with LND, Core Lightning (CLN), Phoenixd, Strike, Blink, Speed, and NWC +- ⚡ **Lightning Operations**: Create invoices, pay invoices/offers, manage transactions +- 🔐 **Secure**: Built with Rust using UniFFI for type-safe native bindings +- 🎯 **TypeScript**: Full TypeScript support with generated type definitions +- 🌐 **Tor Support**: Built-in SOCKS5 proxy support for privacy +- 🏗️ **New Architecture**: Built for React Native's new architecture with TurboModules ## Installation ```sh npm install react-native-lni +# or +yarn add react-native-lni +``` + +### Prerequisites + +This package requires React Native's New Architecture to be enabled: + +**iOS** - Add to your Podfile: +```ruby +ENV['RCT_NEW_ARCH_ENABLED'] = '1' +``` + +**Android** - Add to `gradle.properties`: +```properties +newArchEnabled=true +hermesEnabled=true +``` + +Then install iOS dependencies: +```sh +cd ios && pod install && cd .. ``` ## Usage +### LND (Lightning Network Daemon) ```js -import { - LndNode, - LndConfig, - PhoenixdNode, - PhoenixdConfig, - type OnInvoiceEventCallback, - Transaction, - BlinkConfig, - BlinkNode, -} from 'react-native-lni'; - -// ... +import { LndNode, LndConfig } from 'react-native-lni'; const node = new LndNode( - LndConfig.create({ - url: '', - macaroon: '', - socks5Proxy: undefined, // 'socks5h://127.0.0.1:9050', - }) + LndConfig.create({ + url: 'https://your-lnd-node:8080', + macaroon: 'your-macaroon-hex', + socks5Proxy: undefined, // Optional: 'socks5h://127.0.0.1:9050' for Tor + acceptInvalidCerts: false, // Optional: true for self-signed certs + }) +); + +// Get node information +const info = await node.getInfo(); +console.log('Node pubkey:', info.pubkey); + +// Create an invoice +const invoice = await node.createInvoice({ + amountSats: 1000, + description: 'Test payment', +}); +console.log('Payment request:', invoice.bolt11); + +// Pay an invoice +const payment = await node.payInvoice({ + bolt11: 'lnbc...', + amountSats: undefined, // Use invoice amount +}); +``` + +### Phoenixd + +```js +import { PhoenixdNode, PhoenixdConfig } from 'react-native-lni'; + +const node = new PhoenixdNode( + PhoenixdConfig.create({ + url: 'https://your-phoenixd-node:9740', + password: 'your-password', + }) +); + +const info = await node.getInfo(); +``` + +### Core Lightning (CLN) + +```js +import { ClnNode, ClnConfig } from 'react-native-lni'; + +const node = new ClnNode( + ClnConfig.create({ + url: 'https://your-cln-node:3010', + rune: 'your-rune', + }) ); + const info = await node.getInfo(); ``` +### Strike + +```js +import { StrikeNode, StrikeConfig } from 'react-native-lni'; + +const node = new StrikeNode( + StrikeConfig.create({ + apiKey: 'your-api-key', + baseUrl: 'https://api.strike.me/v1', // Optional + }) +); + +const info = await node.getInfo(); +``` + +### Blink (Bitcoin Beach Wallet) + +```js +import { BlinkNode, BlinkConfig } from 'react-native-lni'; + +const node = new BlinkNode( + BlinkConfig.create({ + apiKey: 'your-api-key', + baseUrl: 'https://api.blink.sv/graphql', // Optional + }) +); + +const info = await node.getInfo(); +``` + +### Event Polling + +Subscribe to invoice events: + +```js +const eventHandle = await node.onInvoiceEvent( + { + type: 'ALL', // or 'BOLT11', 'BOLT12' + }, + { + success: (transaction) => { + console.log('Invoice paid!', transaction); + }, + pending: (transaction) => { + console.log('Invoice pending', transaction); + }, + failure: (transaction) => { + console.log('Payment failed', transaction); + }, + } +); + +// Later, stop polling +await eventHandle.stop(); +``` + +## API Overview + +All node implementations share a common interface: + +- `getInfo()` - Get node information +- `createInvoice(params)` - Create a Lightning invoice +- `payInvoice(params)` - Pay a Lightning invoice +- `lookupInvoice(params)` - Look up invoice details +- `createOffer(params)` - Create a BOLT12 offer (where supported) +- `fetchOffer(params)` - Fetch offer details +- `payOffer(params)` - Pay a BOLT12 offer +- `onInvoiceEvent(params, callbacks)` - Subscribe to invoice events + +## TypeScript Support + +This package includes full TypeScript definitions. All types are automatically generated from the Rust implementation, ensuring type safety across the FFI boundary. + +```typescript +import type { + NodeInfo, + Transaction, + CreateInvoiceParams, + OnInvoiceEventCallback +} from 'react-native-lni'; +``` + ## Contributing From bcfa780641b06f0c7eaa87122f35f769e71cd011 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 8 Dec 2025 01:51:51 +0000 Subject: [PATCH 5/6] Clarify directory vs package naming in PUBLISHING.md Co-authored-by: ntheile <1273575+ntheile@users.noreply.github.com> --- bindings/lni_react_native/PUBLISHING.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/bindings/lni_react_native/PUBLISHING.md b/bindings/lni_react_native/PUBLISHING.md index 6a95b06..dbb81bc 100644 --- a/bindings/lni_react_native/PUBLISHING.md +++ b/bindings/lni_react_native/PUBLISHING.md @@ -13,10 +13,13 @@ This guide explains how to build and publish the `react-native-lni` package to n ## Build Process -The package requires a multi-step build process because it combines Rust native code with React Native bindings: +The package requires a multi-step build process because it combines Rust native code with React Native bindings. + +> **Note**: The package directory is located at `bindings/lni_react_native` in the repository, but the published npm package name is `react-native-lni`. ### 1. Clean Previous Builds (Optional) +From the repository root: ```bash cd bindings/lni_react_native yarn ubrn:clean From 81f66f046ee5eea2db0aa8637fc3a146e09ab01c Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 9 Dec 2025 15:41:23 +0000 Subject: [PATCH 6/6] Add Expo compatibility information and setup instructions Co-authored-by: ntheile <1273575+ntheile@users.noreply.github.com> --- bindings/lni_react_native/README.md | 56 +++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) diff --git a/bindings/lni_react_native/README.md b/bindings/lni_react_native/README.md index 869bf72..10ef1f2 100644 --- a/bindings/lni_react_native/README.md +++ b/bindings/lni_react_native/README.md @@ -19,6 +19,18 @@ npm install react-native-lni yarn add react-native-lni ``` +### Compatibility + +- ✅ **React Native**: Fully supported (requires New Architecture) +- ✅ **Expo (Development Builds)**: Supported with custom dev client +- ❌ **Expo Go**: Not supported (contains native code) + +This package contains native Rust code compiled via UniFFI and requires React Native's New Architecture. It works with: +- Standard React Native CLI projects +- Expo projects using [EAS Build](https://docs.expo.dev/develop/development-builds/introduction/) with development builds + +It does **not** work with Expo Go since it includes custom native modules that aren't pre-built into Expo Go. + ### Prerequisites This package requires React Native's New Architecture to be enabled: @@ -39,6 +51,50 @@ Then install iOS dependencies: cd ios && pod install && cd .. ``` +### Expo Setup (Development Builds) + +If you're using Expo, you'll need to create a [development build](https://docs.expo.dev/develop/development-builds/introduction/) since this package includes custom native code: + +1. **Install the package**: + ```sh + npx expo install react-native-lni + ``` + +2. **Create a development build**: + ```sh + # For iOS simulator + npx expo run:ios + + # For Android emulator + npx expo run:android + + # Or use EAS Build for production + eas build --profile development --platform all + ``` + +3. **Enable New Architecture** - Add to `app.json`: + ```json + { + "expo": { + "plugins": [ + [ + "expo-build-properties", + { + "ios": { + "newArchEnabled": true + }, + "android": { + "newArchEnabled": true + } + } + ] + ] + } + } + ``` + +Note: After adding the package, you'll need to rebuild your development build since native code has changed. + ## Usage ### LND (Lightning Network Daemon)