{"id":18928846,"url":"https://github.com/lightninglabs/lnc-rn","last_synced_at":"2025-04-15T14:31:41.471Z","repository":{"id":64084313,"uuid":"523555659","full_name":"lightninglabs/lnc-rn","owner":"lightninglabs","description":"Lightning Node Connect npm module for React Native","archived":false,"fork":false,"pushed_at":"2024-07-30T16:36:28.000Z","size":145862,"stargazers_count":8,"open_issues_count":12,"forks_count":1,"subscribers_count":14,"default_branch":"main","last_synced_at":"2025-04-14T09:18:43.516Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lightninglabs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-08-11T02:03:04.000Z","updated_at":"2024-10-25T19:46:20.000Z","dependencies_parsed_at":"2024-02-26T20:26:53.079Z","dependency_job_id":"29d8de20-0739-4d5e-82de-f224f3b27793","html_url":"https://github.com/lightninglabs/lnc-rn","commit_stats":{"total_commits":52,"total_committers":2,"mean_commits":26.0,"dds":"0.019230769230769273","last_synced_commit":"f8657ac3ae4050650c89816609424ffe76e76258"},"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lightninglabs%2Flnc-rn","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lightninglabs%2Flnc-rn/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lightninglabs%2Flnc-rn/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lightninglabs%2Flnc-rn/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lightninglabs","download_url":"https://codeload.github.com/lightninglabs/lnc-rn/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249088793,"owners_count":21210863,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-08T11:28:24.080Z","updated_at":"2025-04-15T14:31:41.116Z","avatar_url":"https://github.com/lightninglabs.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# @lightninglabs/lnc-rn\n\n## Lightning Node Connect npm module for React Native\n\n## Install\n\nFirst, install the npm module\n`npm i @lightninglabs/lnc-rn`\n\nNavigate to the lnc-rn npm module folder\n`cd node_modules/@lightninglabs/lnc-rn`\n\nFetch the required LNC libraries\n`yarn run fetch-libraries`\n\n### Android\n\nIn your app's `android/app/build.gradle` file, add the following line to your `dependency` block:\n\n```implementation files(\"../../node_modules/@lightninglabs/lnc-rn/android/libs/lnc-mobile.aar\")```\n\n### iOS\n\nFirst, in Xcode, drag the `Lncmobile.xcframework` folder into your Xcode project - ideally grouped in the project's Framework folder. Make sure you add it to your project's primary target.\n\nThe `Lncmobile.xcframework` folder can be found in the `node_modules/@lightninglabs/lnc-rn/ios` directory.\n\nThen, in your project's `ios` folder, run `pod install`.\n\n### Building library files manually\n\nThe library files can be built manually from the [Lightning Node Connect](https://github.com/lightninglabs/lightning-node-connect) repo using the `make android` and `make ios` commands.\n\n## Persistent storage\n\nUnlike [lnc-web](https://github.com/lightninglabs/lnc-web), lnc-rn does not store users' credentials by defaults. We recommend taking a look at one of the [credentialStores](https://github.com/lightninglabs/lnc-rn/blob/main/demos/connect-demo/credentialStore.ts) from our demo apps to see how you can store users' credentials securely using [react-native-encrypted-storage](https://github.com/emeraldsanto/react-native-encrypted-storage).\n\n## API Design\n\n#### Set-up and connection\n\nThe constructor for the LNC object takes a parameters object with the three following fields:\n\n-   `pairingPhrase` (string): Your LNC pairing phrase\n-   `serverHost` (string): Specify a custom Lightning Node Connect proxy server. If not specified we'll default to `mailbox.terminal.lightning.today:443`.\n\n```\nimport LNC from ‘@lightninglabs/lnc-rn’;\n\nconst pairingPhrase = ‘artefact morning piano photo consider light’;\n\n// default connection\n// default host: mailbox.terminal.lightning.today:443\nconst lnc = new LNC({\n   pairingPhrase\n});\n\n// using custom Lightning Node Connect proxy server\nconst lnc = new LNC({\n   pairingPhrase,\n   serverHost: ‘custom.lnd-server.host:443’\n});\n\n// connect\nlnc.connect();\n\n// check connection status\nlnc.isConnected();\n\n// disconnect\nlnc.disconnect();\n```\n\n#### Base functions\n\nAll of the services (lnd, loop, pool, faraday) will be objects under the main lnc object. Each services’ sub-services will be underneath each service object, and each sub-service function below that (except in the case of faraday which only has one service - its functions will live directly under it). All service, function, and param names will be camel-cased.\n\n```\nconst { lnd, loop, pool, faraday } = lnc;\n\n// all functions on the base object should have proper types\n// sub-servers exist as objects on each main service\nlnd.lightning.listInvoices();\nlnd.lightning.connectPeer({ addr: ‘03aa49c1e98ff4f216d886c09da9961c516aca22812c108af1b187896ded89807e@m3keajflswtfq3bw4kzvxtbru7r4z4cp5stlreppdllhp5a7vuvjzqyd.onion:9735’ });\n\nconst signature = lnd.signer.signMessage({...params});\n\nconst swaps = await loop.swapClient.listSwaps();\nconst poolAccount = await pool.trader.initAccount({\n   accountValue: 100000000,\n   relativeHeight: 1000\n });\n\nconst insights = await faraday.channelInsights();\n```\n\n#### Subscriptions\n\n```\nimport { NativeEventEmitter } from 'react-native';\nconst { LncModule } = NativeModules;\n\nconst request = {};\nconst eventName = lnc.lnd.lightning.subscribePeerEvents(request);\nconst eventEmitter = new NativeEventEmitter(LncModule);\nlistener = eventEmitter.addListener(eventName, (event: any) =\u003e {\n    console.log('Got response', event.result);\n});\n\n// when ready to stop listener\nlistener.stop();\n```\n\n## Demos\n\nTo highlight the functionality of `lnc-rn` we've included two demos in the repo: `connect-demo` and `multi-connect-demo`. To run these you must run `yarn run install-lnc` after installing their npm dependencies to fetch the LNC mobile binaries, which are not bundled into the module directly.\n\n## Further documentation\n\n- https://docs.lightning.engineering/lightning-network-tools/lightning-terminal/lnc-npm\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flightninglabs%2Flnc-rn","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flightninglabs%2Flnc-rn","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flightninglabs%2Flnc-rn/lists"}