Skip to content

Commit a90b556

Browse files
authored
Merge pull request #269 from synonymdev/local-fundend-channels-rn-run-fix
Fix Example app on Android for Local funded channels PR
2 parents 39a6143 + 369f0e1 commit a90b556

File tree

6 files changed

+521
-60
lines changed

6 files changed

+521
-60
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
.vscode/
12
.idea/
23
**/.DS_Store
34
example/.watchman*

README.md

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,21 @@ This library hopes to simplify the process of adding Lightning via LDK to any Re
1212
yarn add @synonymdev/react-native-ldk
1313
#or
1414
npm i -S @synonymdev/react-native-ldk
15-
````
15+
```
1616

1717
### iOS installation
1818
```bash
1919
cd ios && pod install && cd ../
20-
````
20+
```
2121

2222
### Android installation
2323
1. Add the following line to `dependencies` in `/android/app/build.gradle`
24-
```
25-
dependencies {
26-
...
27-
implementation files("../../node_modules/@synonymdev/react-native-ldk/android/libs/LDK-release.aar")
28-
}
29-
```
24+
```groovy
25+
dependencies {
26+
//...
27+
implementation files("../../node_modules/@synonymdev/react-native-ldk/android/libs/LDK-release.aar") // <- this
28+
}
29+
```
3030
2. Ensure `minSdkVersion` is set to at least `24` in `/android/build.gradle`
3131
3232
## Development
@@ -40,19 +40,32 @@ dependencies {
4040
5. In the popup that appears select `JavaDocs` and tap `OK` then `OK` again
4141
4242
## Running example app
43+
See also [`./example/README.md`](./example/README.md)
4344
```bash
44-
45-
#Build dist files
45+
# Build dist files
4646
git clone https://github.com/synonymdev/react-native-ldk.git
4747
cd react-native-ldk/lib/ && yarn install && yarn build && cd ../
4848
4949
cd example/ && yarn install && yarn rn-setup
5050
5151
yarn ios
52-
#or
52+
# or
5353
yarn android
5454
```
5555

56+
### Update config to match your local setup
57+
In `constants.ts` update `peers.lnd` if you're using Polar locally.
58+
### Example for Android
59+
```ts
60+
// export const peers = {
61+
// lnd: {
62+
pubKey:
63+
'_033f4d3032ce7f54224f4bd9747b50b7cd72074a859758e40e1ca46ffa79a34324_',
64+
address: '10.0.2.2',
65+
port: 9737,
66+
// },
67+
```
68+
5669
## Notes
5770
- It is important to not mix and match account names and seeds when starting LDK. Doing so can result in a corrupt save.
5871

example/babel.config.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
11
module.exports = {
22
presets: ['module:metro-react-native-babel-preset'],
3+
plugins: [
4+
['@babel/plugin-transform-class-properties', { loose: false }],
5+
['@babel/plugin-proposal-private-methods', { loose: false }],
6+
['@babel/plugin-transform-private-property-in-object', { loose: false }],
7+
],
38
};

example/metro.config.js

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,26 @@
1-
const {getDefaultConfig, mergeConfig} = require('@react-native/metro-config');
1+
const { getDefaultConfig, mergeConfig } = require('@react-native/metro-config');
2+
const path = require('path');
23

34
/**
45
* Metro configuration
56
* https://facebook.github.io/metro/docs/configuration
67
*
78
* @type {import('metro-config').MetroConfig}
89
*/
9-
const config = {};
10+
const defaultConfig = getDefaultConfig(__dirname);
1011

11-
module.exports = mergeConfig(getDefaultConfig(__dirname), config);
12+
const config = {
13+
resolver: {
14+
extraNodeModules: {
15+
stream: path.resolve(__dirname, 'node_modules/stream-browserify'),
16+
buffer: path.resolve(__dirname, 'node_modules/buffer/'),
17+
assert: path.resolve(__dirname, 'node_modules/assert/'),
18+
events: path.resolve(__dirname, 'node_modules/events/'),
19+
crypto: path.resolve(__dirname, 'node_modules/crypto-browserify/'),
20+
vm: path.resolve(__dirname, 'node_modules/vm-browserify/'),
21+
process: path.resolve(__dirname, 'node_modules/process/'),
22+
},
23+
},
24+
};
25+
26+
module.exports = mergeConfig(defaultConfig, config);

example/package.json

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,16 +31,17 @@
3131
"@react-native-async-storage/async-storage": "1.19.4",
3232
"@react-native-clipboard/clipboard": "1.12.1",
3333
"@synonymdev/react-native-ldk": "../lib",
34-
"assert": "1.5.0",
34+
"assert": "^2.1.0",
3535
"b4a": "^1.6.4",
3636
"bip32": "2.0.6",
3737
"bip39": "3.0.4",
3838
"bitcoinjs-lib": "6.0.2",
39-
"buffer": "4.9.2",
39+
"buffer": "^6.0.3",
4040
"chai": "^4.3.7",
41-
"events": "1.1.1",
41+
"crypto-browserify": "^3.12.0",
42+
"events": "^3.3.0",
4243
"mocha-remote-client": "^1.6.1",
43-
"process": "0.11.10",
44+
"process": "^0.11.10",
4445
"query-string": "^8.1.0",
4546
"react": "18.2.0",
4647
"react-native": "0.72.4",
@@ -52,10 +53,13 @@
5253
"readable-stream": "4.4.2",
5354
"rn-electrum-client": "github:synonymdev/react-native-electrum-client#dfbe9ebba4e4cf0d16e3ccea3dc49e05285d860f",
5455
"stream-browserify": "^3.0.0",
55-
"vm-browserify": "0.0.4"
56+
"vm-browserify": "^1.1.2"
5657
},
5758
"devDependencies": {
5859
"@babel/core": "^7.20.0",
60+
"@babel/plugin-proposal-private-methods": "^7.18.6",
61+
"@babel/plugin-proposal-private-property-in-object": "^7.21.11",
62+
"@babel/plugin-transform-private-property-in-object": "^7.24.7",
5963
"@babel/preset-env": "^7.20.0",
6064
"@babel/runtime": "^7.20.0",
6165
"@react-native/eslint-config": "^0.72.2",

0 commit comments

Comments
 (0)