Skip to content

Commit a0b2a85

Browse files
authored
Merge pull request #43 from LtbLightning/Upgrade-v0.2.2
Upgrade v0.2.2
2 parents 4dcf696 + ac2627f commit a0b2a85

33 files changed

+4884
-17357
lines changed

.github/workflows/precompile_binaries.yml

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

55
name: Precompile Binaries
66

@@ -13,6 +13,7 @@ jobs:
1313
os:
1414
- ubuntu-20.04
1515
- macOS-latest
16+
- windows-latest
1617
steps:
1718
- uses: actions/checkout@v4
1819
- uses: actions-rs/toolchain@v1
@@ -32,8 +33,17 @@ jobs:
3233
- uses: subosito/flutter-action@v2
3334
with:
3435
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
3545
- name: Precompile (with iOS)
36-
if: (matrix.os == 'macOS-latest')
46+
if: (matrix.os == 'macOS-latest') || (matrix.os == 'windows-latest')
3747
run: dart run build_tool precompile-binaries -v --manifest-dir=../../rust --repository=LtbLightning/ldk-node-flutter
3848
working-directory: cargokit/build_tool
3949
env:

CHANGELOG.md

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,25 @@
11
## [0.2.2-dev]
22
Updated Rust and Flutter dependencies.
33
#### APIs added
4-
- Expose `nextEventAsync()`, `config()`, `status()`, `receiveVariableAmountPaymentViaJitChannel` & `receivePaymentViaJitChannel` in `Node`
5-
#### API changed
6-
- Replaced `totalOnchainBalanceSats()` & `spendableOnchainBalanceSats()` with `listBalances()`.
7-
- `connectOpenChannel` returns a `UserChannelId` object.
8-
- `updateChannelConfig` & `closeChannel` accepts a `UserChannelId` object instead of `ChannelId`
9-
10-
## [0.2.1]
11-
Updated Rust and Flutter dependencies.
4+
- Expose `isRunning()` in `Node` class.
125
#### API changed
136
- Renamed `waitUntilNextHandled()` to `waitNextHandled`.
14-
- Renamed `listeningAddress()` to `listeningAddresses`
15-
- Upgraded `BuilderException` to handle Invalid SocketAddress.
7+
- Renamed `listeningAddress()` to `listeningAddresses`.
8+
- Upgraded `BuilderException` to handle invalid `socketAddress` & `trustedPeers.
9+
- Upgraded `NodeException` to handle invalid `txid`.
1610
#### Fixed
1711
- Functions hang indefinitely on iOs devices
1812
- Android support bug resolved
13+
- Thread `frb_workerpool` panic on `SocketAddress`, `PublicKey`, `Address` `Bolt11Invoice`, `Config` and `Txid`.
1914

2015
## [0.2.0]
2116
Updated `Rust` and `Flutter` dependencies.
22-
Invalid `BuilderException` bug resolved
2317

18+
## [0.1.3]
19+
Updated `Rust` and `Flutter` dependencies.
20+
Invalid `BuilderException` bug resolved
2421
#### APIs added
2522
- Expose `generate()` in `Mnemonic` class.
26-
2723
#### API changed
2824
- Remove `generateEntropyMnemonic()`.
2925

cargokit/build_tool/lib/src/options.dart

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,10 @@ class CargokitUserOptions {
298298
}
299299
userProjectDir = userProjectDir.parent;
300300
}
301-
return CargokitUserOptions._();
301+
return CargokitUserOptions(
302+
usePrecompiledBinaries: true,
303+
verboseLogging: false,
304+
);
302305
}
303306

304307
final bool usePrecompiledBinaries;
File renamed without changes.

example/ios/Flutter/AppFrameworkInfo.plist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,6 @@
2121
<key>CFBundleVersion</key>
2222
<string>1.0</string>
2323
<key>MinimumOSVersion</key>
24-
<string>11.0</string>
24+
<string>12.0</string>
2525
</dict>
2626
</plist>

example/ios/Podfile.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ EXTERNAL SOURCES:
2020
:path: ".symlinks/plugins/path_provider_foundation/darwin"
2121

2222
SPEC CHECKSUMS:
23-
Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854
23+
Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7
2424
ldk_node: 5b3cacf9e7a5d5ae0d5c24e133af5c37c3da338b
2525
path_provider_foundation: 3784922295ac71e43754bd15e0653ccfd36a147c
2626

example/ios/Runner.xcodeproj/project.pbxproj

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@
159159
97C146E61CF9000F007C117D /* Project object */ = {
160160
isa = PBXProject;
161161
attributes = {
162-
LastUpgradeCheck = 1430;
162+
LastUpgradeCheck = 1510;
163163
ORGANIZATIONNAME = "";
164164
TargetAttributes = {
165165
97C146ED1CF9000F007C117D = {
@@ -346,7 +346,7 @@
346346
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
347347
GCC_WARN_UNUSED_FUNCTION = YES;
348348
GCC_WARN_UNUSED_VARIABLE = YES;
349-
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
349+
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
350350
MTL_ENABLE_DEBUG_INFO = NO;
351351
SDKROOT = iphoneos;
352352
SUPPORTED_PLATFORMS = iphoneos;
@@ -424,7 +424,7 @@
424424
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
425425
GCC_WARN_UNUSED_FUNCTION = YES;
426426
GCC_WARN_UNUSED_VARIABLE = YES;
427-
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
427+
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
428428
MTL_ENABLE_DEBUG_INFO = YES;
429429
ONLY_ACTIVE_ARCH = YES;
430430
SDKROOT = iphoneos;
@@ -473,7 +473,7 @@
473473
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
474474
GCC_WARN_UNUSED_FUNCTION = YES;
475475
GCC_WARN_UNUSED_VARIABLE = YES;
476-
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
476+
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
477477
MTL_ENABLE_DEBUG_INFO = NO;
478478
SDKROOT = iphoneos;
479479
SUPPORTED_PLATFORMS = iphoneos;
@@ -576,7 +576,7 @@
576576
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
577577
GCC_WARN_UNUSED_FUNCTION = YES;
578578
GCC_WARN_UNUSED_VARIABLE = YES;
579-
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
579+
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
580580
MTL_ENABLE_DEBUG_INFO = YES;
581581
ONLY_ACTIVE_ARCH = YES;
582582
SDKROOT = iphoneos;
@@ -648,7 +648,7 @@
648648
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
649649
GCC_WARN_UNUSED_FUNCTION = YES;
650650
GCC_WARN_UNUSED_VARIABLE = YES;
651-
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
651+
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
652652
MTL_ENABLE_DEBUG_INFO = NO;
653653
SDKROOT = iphoneos;
654654
SUPPORTED_PLATFORMS = iphoneos;

example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "1430"
3+
LastUpgradeVersion = "1510"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"

example/lib/main.dart

Lines changed: 48 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class _MyAppState extends State<MyApp> {
2626
String displayText = "";
2727
ldk.SocketAddress? bobAddr;
2828
ldk.Bolt11Invoice? invoice;
29-
ldk.UserChannelId? userChannelId;
29+
ldk.ChannelId? channelId;
3030

3131
// Replace this with your local esplora url
3232
String esploraUrl =
@@ -63,7 +63,7 @@ class _MyAppState extends State<MyApp> {
6363

6464
closeChannel() async {
6565
await aliceNode.closeChannel(
66-
userChannelId: userChannelId!, counterpartyNodeId: bobNodeId!);
66+
channelId: channelId!, counterpartyNodeId: bobNodeId!);
6767
}
6868

6969
Future initAliceNode() async {
@@ -81,7 +81,7 @@ class _MyAppState extends State<MyApp> {
8181
final res = await aliceNode.nodeId();
8282
setState(() {
8383
aliceNodeId = res;
84-
displayText = "${aliceNodeId?.hexCode} started successfully";
84+
displayText = "${aliceNodeId?.hex} started successfully";
8585
});
8686
}
8787

@@ -113,16 +113,18 @@ class _MyAppState extends State<MyApp> {
113113
}
114114

115115
totalOnchainBalanceSats() async {
116-
final alice = await aliceNode.listBalances();
117-
final bob = await bobNode.listBalances();
116+
final alice = await aliceNode.totalOnchainBalanceSats();
117+
final bob = await bobNode.totalOnchainBalanceSats();
118118
if (kDebugMode) {
119-
print("alice's balance: ${alice.totalOnchainBalanceSats}");
120-
print("alice's spendable balance: ${alice.spendableOnchainBalanceSats}");
121-
print("bob's balance: ${bob.totalOnchainBalanceSats}");
122-
print("bob's spendable balance: ${bob.spendableOnchainBalanceSats}");
119+
print("alice's balance: $alice");
120+
print(
121+
"alice's spendable balance: ${await aliceNode.spendableOnchainBalanceSats()}");
122+
print("bob's balance: $bob");
123+
print(
124+
"bob's spendable balance: ${await bobNode.spendableOnchainBalanceSats()}");
123125
}
124126
setState(() {
125-
aliceBalance = alice.spendableOnchainBalanceSats;
127+
aliceBalance = alice;
126128
});
127129
}
128130

@@ -140,8 +142,7 @@ class _MyAppState extends State<MyApp> {
140142
if (res.isNotEmpty) {
141143
print("======Channels========");
142144
for (var e in res) {
143-
print("nodeId: ${aliceNodeId!.hexCode}");
144-
print("userChannelId: ${e.userChannelId.data}");
145+
print("nodeId: ${aliceNodeId!.hex}");
145146
print("channelId: ${e.channelId.data}");
146147
print("isChannelReady: ${e.isChannelReady}");
147148
print("isUsable: ${e.isUsable}");
@@ -211,10 +212,10 @@ class _MyAppState extends State<MyApp> {
211212
connectOpenChannel() async {
212213
final funding_amount_sat = 80000;
213214
final push_msat = (funding_amount_sat / 2) * 1000;
214-
userChannelId = await aliceNode.connectOpenChannel(
215+
await aliceNode.connectOpenChannel(
215216
channelAmountSats: funding_amount_sat,
216217
announceChannel: true,
217-
address: bobAddr!,
218+
socketAddress: bobAddr!,
218219
pushToCounterpartyMsat: push_msat.toInt(),
219220
nodeId: bobNodeId!);
220221
}
@@ -232,6 +233,24 @@ class _MyAppState extends State<MyApp> {
232233
});
233234
}
234235

236+
setChannelId() async {
237+
final channelInfos = await aliceNode.listChannels();
238+
if (channelInfos.isNotEmpty) {
239+
channelId = channelInfos.first.channelId;
240+
if (kDebugMode) {
241+
print(channelId?.data);
242+
}
243+
244+
setState(() {
245+
displayText = channelId!.data.toString();
246+
});
247+
} else {
248+
if (kDebugMode) {
249+
print("No open channels available");
250+
}
251+
}
252+
}
253+
235254
stop() async {
236255
await bobNode.stop();
237256
await aliceNode.stop();
@@ -443,6 +462,20 @@ class _MyAppState extends State<MyApp> {
443462
fontSize: 12,
444463
height: 1.5,
445464
fontWeight: FontWeight.w800))),
465+
TextButton(
466+
onPressed: () async {
467+
await setChannelId();
468+
},
469+
child: Text(
470+
'Set channelId',
471+
overflow: TextOverflow.clip,
472+
textAlign: TextAlign.center,
473+
style: GoogleFonts.nunito(
474+
color: Colors.indigoAccent,
475+
fontSize: 12,
476+
height: 1.5,
477+
fontWeight: FontWeight.w800),
478+
)),
446479
TextButton(
447480
onPressed: () async {
448481
await receiveAndSendPayments();
@@ -512,7 +545,7 @@ class _MyAppState extends State<MyApp> {
512545
Text(
513546
aliceNodeId == null
514547
? "Node not initialized"
515-
: "@Id_:${aliceNodeId!.hexCode}",
548+
: "@Id_:${aliceNodeId!.hex}",
516549
maxLines: 1,
517550
overflow: TextOverflow.ellipsis,
518551
textAlign: TextAlign.center,

0 commit comments

Comments
 (0)