Skip to content

Commit 85eac29

Browse files
Merge pull request #46 from LtbLightning/upgrade-v0.3.0
Upgrade v0.3.0
2 parents a6b9be7 + 0fd8885 commit 85eac29

55 files changed

Lines changed: 62995 additions & 10166 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/precompile_binaries.yml

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,16 @@
11
on:
22
push:
3-
branches: [v0.2.2-dev, main]
3+
branches: [main, v0.3.0]
44

55
name: Precompile Binaries
66

77
jobs:
88
Precompile:
9-
runs-on: ${{ matrix.os }}
109
strategy:
11-
fail-fast: false
10+
fail-fast: true
1211
matrix:
13-
os:
14-
- ubuntu-20.04
15-
- macOS-latest
16-
- windows-latest
12+
os: [ubuntu-20.04, macOS-latest]
13+
runs-on: ${{ matrix.os }}
1714
steps:
1815
- uses: actions/checkout@v4
1916
- uses: actions-rs/toolchain@v1
@@ -25,32 +22,23 @@ jobs:
2522
run: |
2623
mkdir -p .cargo
2724
echo "[profile.release]" >> .cargo/config.toml
28-
echo "opt-level = 'z'" >> .cargo/config.toml
25+
echo "opt-level = 3" >> .cargo/config.toml
2926
echo "lto = true" >> .cargo/config.toml
3027
echo "codegen-units = 1" >> .cargo/config.toml
3128
echo "panic = 'abort'" >> .cargo/config.toml
3229
- uses: dart-lang/setup-dart@v1
3330
- uses: subosito/flutter-action@v2
3431
with:
3532
channel: 'stable'
36-
- name: Configure git with access token
37-
run: |
38-
git config --global url."https://x-access-token:${GITHUB_TOKEN}@github.com/".insteadOf "https://github.com/"
39-
shell: bash
40-
env:
41-
GITHUB_TOKEN: ${{ secrets.CARGOKIT_PRIVATE_KEY }}
42-
- name: Install GTK
43-
if: (matrix.os == 'ubuntu-20.04')
44-
run: sudo apt-get update && sudo apt-get install libgtk-3-dev
4533
- name: Precompile (with iOS)
46-
if: (matrix.os == 'macOS-latest') || (matrix.os == 'windows-latest')
34+
if: matrix.os == 'macOS-latest'
4735
run: dart run build_tool precompile-binaries -v --manifest-dir=../../rust --repository=LtbLightning/ldk-node-flutter
4836
working-directory: cargokit/build_tool
4937
env:
5038
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
5139
PRIVATE_KEY: ${{ secrets.CARGOKIT_PRIVATE_KEY }}
5240
- name: Precompile (with Android)
53-
if: (matrix.os == 'ubuntu-20.04')
41+
if: matrix.os == 'ubuntu-20.04'
5442
run: dart run build_tool precompile-binaries -v --manifest-dir=../../rust --repository=LtbLightning/ldk-node-flutter --android-sdk-location=/usr/local/lib/android/sdk --android-ndk-version=24.0.8215888 --android-min-sdk-version=23
5543
working-directory: cargokit/build_tool
5644
env:

CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
## [0.3.0]
2+
13
## [0.2.2-dev]
24
Updated Rust and Flutter dependencies.
35
#### APIs added
@@ -117,4 +119,4 @@ This is the first release of `ldk_node`. It features support for sourcing chain
117119

118120
`stop`- Disconnects all peers, stops all running background tasks, and shuts down Node.
119121

120-
`syncWallets`- Sync the `LDK & BDK` wallets with the current chain state.
122+
`syncWallets`- Sync the `LDK & BDK` wallets with the current chain state.

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,12 @@ To use the `ldk_node` package in your project, add it as a dependency in your pr
4040

4141
```dart
4242
dependencies:
43-
ldk_node: ^0.2.2-dev
43+
ldk_node: ^0.3.0
4444
```
4545
or add from pub.dev using `pub add` command
4646

4747
```
48-
flutter pub add ldk_node@0.2.2-dev
48+
flutter pub add ldk_node
4949
```
5050

5151
### Examples
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
import 'package:flutter/cupertino.dart';
2+
import 'package:flutter_test/flutter_test.dart';
3+
import 'package:integration_test/integration_test.dart';
4+
import 'package:ldk_node/ldk_node.dart' as ldk;
5+
import 'package:path_provider/path_provider.dart';
6+
7+
void main() {
8+
BigInt satsToMsats(int sats) => BigInt.from(sats * 1000);
9+
String mSatsToSats(BigInt mSats) => '${mSats.toInt() ~/ 1000}sats';
10+
IntegrationTestWidgetsFlutterBinding.ensureInitialized();
11+
12+
group('bolt11_&_bolt12', () {
13+
setUp(() async {});
14+
testWidgets('bolt11_full_cycle', (WidgetTester tester) async {
15+
final directory = await getApplicationDocumentsDirectory();
16+
final ldkCache = "${directory.path}/ldk_cache";
17+
final aliceStoragePath = "$ldkCache/integration/alice";
18+
debugPrint('Alice Storage Path: $aliceStoragePath');
19+
final alice_builder = ldk.Builder.mutinynet()
20+
.setEntropyBip39Mnemonic(
21+
mnemonic: ldk.Mnemonic(
22+
seedPhrase:
23+
"replace force spring cruise nothing select glass erupt medal raise consider pull"))
24+
.setStorageDirPath(aliceStoragePath);
25+
final aliceNode = await alice_builder.build();
26+
await aliceNode.start();
27+
final bobStoragePath = "$ldkCache/integration/bob";
28+
final bob_builder = ldk.Builder.mutinynet()
29+
.setEntropyBip39Mnemonic(
30+
mnemonic: ldk.Mnemonic(
31+
seedPhrase:
32+
"skin hospital fee risk health theory actor kiwi solution desert unhappy hello"))
33+
.setStorageDirPath(bobStoragePath);
34+
debugPrint('Bob Storage Path: $bobStoragePath');
35+
final bobNode = await bob_builder.build();
36+
await bobNode.start();
37+
debugPrint("Manually syncing Alice's node");
38+
await aliceNode.syncWallets();
39+
debugPrint("Manually syncing Bob's node");
40+
final aliceBalance =
41+
(await aliceNode.listBalances()).spendableOnchainBalanceSats;
42+
await bobNode.syncWallets();
43+
expect(aliceBalance, 0);
44+
debugPrint("Alice's onChain balance ${aliceBalance.toString()}");
45+
final bobBalance =
46+
(await bobNode.listBalances()).spendableOnchainBalanceSats;
47+
debugPrint("Bob's onChain balance ${bobBalance.toString()}");
48+
49+
final bobBolt11PaymentHandler = await bobNode.bolt11Payment();
50+
final bobJitInvoice = await bobBolt11PaymentHandler.receiveViaJitChannel(
51+
amountMsat: satsToMsats(10000),
52+
description: 'test',
53+
expirySecs: 9000,
54+
);
55+
debugPrint("Bob's onChain balance ${bobBalance.toString()}");
56+
final aliceBolt11PaymentHandler = await aliceNode.bolt11Payment();
57+
final aliceJitInvoice =
58+
await aliceBolt11PaymentHandler.receiveViaJitChannel(
59+
amountMsat: satsToMsats(10000),
60+
description: 'test',
61+
expirySecs: 9000,
62+
);
63+
final aliceLBalance =
64+
(await aliceNode.listBalances()).totalLightningBalanceSats;
65+
debugPrint("Alice's Lightning balance ${aliceLBalance.toString()}");
66+
final bobInvoice = await bobBolt11PaymentHandler.receive(
67+
amountMsat: satsToMsats(10000),
68+
description: 'test',
69+
expirySecs: 9000);
70+
final paymentId =
71+
await aliceBolt11PaymentHandler.send(invoice: bobInvoice);
72+
debugPrint("Alice's payment id ${paymentId.field0}");
73+
});
74+
});
75+
}
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
import 'package:flutter/cupertino.dart';
2+
import 'package:flutter_test/flutter_test.dart';
3+
import 'package:integration_test/integration_test.dart';
4+
import 'package:ldk_node/ldk_node.dart' as ldk;
5+
import 'package:path_provider/path_provider.dart';
6+
7+
void main() {
8+
BigInt satsToMsats(int sats) => BigInt.from(sats * 1000);
9+
IntegrationTestWidgetsFlutterBinding.ensureInitialized();
10+
11+
group('bolt11_integration', () {
12+
setUp(() async {});
13+
testWidgets('full_cycle', (WidgetTester tester) async {
14+
final directory = await getApplicationDocumentsDirectory();
15+
final ldkCache = "${directory.path}/ldk_cache";
16+
final aliceStoragePath = "$ldkCache/integration/alice";
17+
debugPrint('Alice Storage Path: $aliceStoragePath');
18+
final alice_builder = ldk.Builder.mutinynet()
19+
.setEntropyBip39Mnemonic(
20+
mnemonic: ldk.Mnemonic(
21+
seedPhrase:
22+
"replace force spring cruise nothing select glass erupt medal raise consider pull"))
23+
.setStorageDirPath(aliceStoragePath);
24+
final aliceNode = await alice_builder.build();
25+
await aliceNode.start();
26+
final bobStoragePath = "$ldkCache/integration/bob";
27+
final bob_builder = ldk.Builder.mutinynet()
28+
.setEntropyBip39Mnemonic(
29+
mnemonic: ldk.Mnemonic(
30+
seedPhrase:
31+
"skin hospital fee risk health theory actor kiwi solution desert unhappy hello"))
32+
.setStorageDirPath(bobStoragePath);
33+
debugPrint('Bob Storage Path: $bobStoragePath');
34+
final bobNode = await bob_builder.build();
35+
await bobNode.start();
36+
debugPrint("Manually syncing Alice's node");
37+
await aliceNode.syncWallets();
38+
debugPrint("Manually syncing Bob's node");
39+
final aliceBalance =
40+
(await aliceNode.listBalances()).spendableOnchainBalanceSats;
41+
await bobNode.syncWallets();
42+
expect(aliceBalance, 0);
43+
debugPrint("Alice's onChain balance ${aliceBalance.toString()}");
44+
final bobBalance =
45+
(await bobNode.listBalances()).spendableOnchainBalanceSats;
46+
debugPrint("Bob's onChain balance ${bobBalance.toString()}");
47+
48+
final bobBolt11PaymentHandler = await bobNode.bolt11Payment();
49+
final bobJitInvoice = await bobBolt11PaymentHandler.receiveViaJitChannel(
50+
amountMsat: satsToMsats(10000),
51+
description: 'test',
52+
expirySecs: 9000,
53+
);
54+
debugPrint("Bob's onChain balance ${bobBalance.toString()}");
55+
final aliceBolt11PaymentHandler = await aliceNode.bolt11Payment();
56+
final aliceJitInvoice =
57+
await aliceBolt11PaymentHandler.receiveViaJitChannel(
58+
amountMsat: satsToMsats(10000),
59+
description: 'test',
60+
expirySecs: 9000,
61+
);
62+
final aliceLBalance =
63+
(await aliceNode.listBalances()).totalLightningBalanceSats;
64+
debugPrint("Alice's Lightning balance ${aliceLBalance.toString()}");
65+
final bobInvoice = await bobBolt11PaymentHandler.receive(
66+
amountMsat: satsToMsats(10000),
67+
description: 'test',
68+
expirySecs: 9000);
69+
final paymentId =
70+
await aliceBolt11PaymentHandler.send(invoice: bobInvoice);
71+
debugPrint("Alice's payment id ${paymentId.field0}");
72+
});
73+
});
74+
}

0 commit comments

Comments
 (0)