diff --git a/.gitignore b/.gitignore index 061b1ac5..4b9f3d03 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +.vscode/ .idea/ **/.DS_Store example/.watchman* diff --git a/README.md b/README.md index 5d824b92..6b31020e 100644 --- a/README.md +++ b/README.md @@ -12,21 +12,21 @@ This library hopes to simplify the process of adding Lightning via LDK to any Re yarn add @synonymdev/react-native-ldk #or npm i -S @synonymdev/react-native-ldk -```` +``` ### iOS installation ```bash cd ios && pod install && cd ../ -```` +``` ### Android installation 1. Add the following line to `dependencies` in `/android/app/build.gradle` -``` -dependencies { - ... - implementation files("../../node_modules/@synonymdev/react-native-ldk/android/libs/LDK-release.aar") -} -``` + ```groovy + dependencies { + //... + implementation files("../../node_modules/@synonymdev/react-native-ldk/android/libs/LDK-release.aar") // <- this + } + ``` 2. Ensure `minSdkVersion` is set to at least `24` in `/android/build.gradle` ## Development @@ -40,19 +40,32 @@ dependencies { 5. In the popup that appears select `JavaDocs` and tap `OK` then `OK` again ## Running example app +See also [`./example/README.md`](./example/README.md) ```bash - -#Build dist files +# Build dist files git clone https://github.com/synonymdev/react-native-ldk.git cd react-native-ldk/lib/ && yarn install && yarn build && cd ../ cd example/ && yarn install && yarn rn-setup yarn ios -#or +# or yarn android ``` +### Update config to match your local setup +In `constants.ts` update `peers.lnd` if you're using Polar locally. +### Example for Android +```ts +// export const peers = { +// lnd: { + pubKey: + '_033f4d3032ce7f54224f4bd9747b50b7cd72074a859758e40e1ca46ffa79a34324_', + address: '10.0.2.2', + port: 9737, +// }, +``` + ## Notes - It is important to not mix and match account names and seeds when starting LDK. Doing so can result in a corrupt save. diff --git a/example/Dev.tsx b/example/Dev.tsx index ab2086f6..442b600c 100644 --- a/example/Dev.tsx +++ b/example/Dev.tsx @@ -25,7 +25,12 @@ import lm, { TChannelUpdate, } from '@synonymdev/react-native-ldk'; import { backupServerDetails, peers } from './utils/constants'; -import { createNewAccount, getAccount, getAddress } from './utils/helpers'; +import { + createNewAccount, + getAccount, + getAddress, + getAddressFromScriptPubKey, +} from './utils/helpers'; import RNFS from 'react-native-fs'; let logSubscription: EmitterSubscription | undefined; @@ -41,6 +46,7 @@ const Dev = (): ReactElement => { const [nodeStarted, setNodeStarted] = useState(false); const [showLogs, setShowLogs] = useState(false); const [logContent, setLogContent] = useState(''); + const [temporaryChannelId, setTemporaryChannelId] = useState(''); //For funding channels locally useEffect(() => { //Restarting LDK on each code update causes constant errors. @@ -231,7 +237,6 @@ const Dev = (): ReactElement => { } }} /> -