Skip to content

Commit

Permalink
Merge pull request #43 from LtbLightning/Upgrade-v0.2.2
Browse files Browse the repository at this point in the history
Upgrade v0.2.2
  • Loading branch information
StaxoLotl authored Jun 4, 2024
2 parents 4dcf696 + ac2627f commit a0b2a85
Show file tree
Hide file tree
Showing 33 changed files with 4,884 additions and 17,357 deletions.
14 changes: 12 additions & 2 deletions .github/workflows/precompile_binaries.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
on:
push:
branches: [main, v0.2.2-dev]
branches: [v0.2.2-dev, main]

name: Precompile Binaries

Expand All @@ -13,6 +13,7 @@ jobs:
os:
- ubuntu-20.04
- macOS-latest
- windows-latest
steps:
- uses: actions/checkout@v4
- uses: actions-rs/toolchain@v1
Expand All @@ -32,8 +33,17 @@ jobs:
- uses: subosito/flutter-action@v2
with:
channel: 'stable'
- name: Configure git with access token
run: |
git config --global url."https://x-access-token:${GITHUB_TOKEN}@github.com/".insteadOf "https://github.com/"
shell: bash
env:
GITHUB_TOKEN: ${{ secrets.CARGOKIT_PRIVATE_KEY }}
- name: Install GTK
if: (matrix.os == 'ubuntu-20.04')
run: sudo apt-get update && sudo apt-get install libgtk-3-dev
- name: Precompile (with iOS)
if: (matrix.os == 'macOS-latest')
if: (matrix.os == 'macOS-latest') || (matrix.os == 'windows-latest')
run: dart run build_tool precompile-binaries -v --manifest-dir=../../rust --repository=LtbLightning/ldk-node-flutter
working-directory: cargokit/build_tool
env:
Expand Down
20 changes: 8 additions & 12 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,29 +1,25 @@
## [0.2.2-dev]
Updated Rust and Flutter dependencies.
#### APIs added
- Expose `nextEventAsync()`, `config()`, `status()`, `receiveVariableAmountPaymentViaJitChannel` & `receivePaymentViaJitChannel` in `Node`
#### API changed
- Replaced `totalOnchainBalanceSats()` & `spendableOnchainBalanceSats()` with `listBalances()`.
- `connectOpenChannel` returns a `UserChannelId` object.
- `updateChannelConfig` & `closeChannel` accepts a `UserChannelId` object instead of `ChannelId`

## [0.2.1]
Updated Rust and Flutter dependencies.
- Expose `isRunning()` in `Node` class.
#### API changed
- Renamed `waitUntilNextHandled()` to `waitNextHandled`.
- Renamed `listeningAddress()` to `listeningAddresses`
- Upgraded `BuilderException` to handle Invalid SocketAddress.
- Renamed `listeningAddress()` to `listeningAddresses`.
- Upgraded `BuilderException` to handle invalid `socketAddress` & `trustedPeers.
- Upgraded `NodeException` to handle invalid `txid`.
#### Fixed
- Functions hang indefinitely on iOs devices
- Android support bug resolved
- Thread `frb_workerpool` panic on `SocketAddress`, `PublicKey`, `Address` `Bolt11Invoice`, `Config` and `Txid`.

## [0.2.0]
Updated `Rust` and `Flutter` dependencies.
Invalid `BuilderException` bug resolved

## [0.1.3]
Updated `Rust` and `Flutter` dependencies.
Invalid `BuilderException` bug resolved
#### APIs added
- Expose `generate()` in `Mnemonic` class.

#### API changed
- Remove `generateEntropyMnemonic()`.

Expand Down
5 changes: 4 additions & 1 deletion cargokit/build_tool/lib/src/options.dart
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,10 @@ class CargokitUserOptions {
}
userProjectDir = userProjectDir.parent;
}
return CargokitUserOptions._();
return CargokitUserOptions(
usePrecompiledBinaries: true,
verboseLogging: false,
);
}

final bool usePrecompiledBinaries;
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion example/ios/Flutter/AppFrameworkInfo.plist
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@
<key>CFBundleVersion</key>
<string>1.0</string>
<key>MinimumOSVersion</key>
<string>11.0</string>
<string>12.0</string>
</dict>
</plist>
2 changes: 1 addition & 1 deletion example/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/path_provider_foundation/darwin"

SPEC CHECKSUMS:
Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854
Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7
ldk_node: 5b3cacf9e7a5d5ae0d5c24e133af5c37c3da338b
path_provider_foundation: 3784922295ac71e43754bd15e0653ccfd36a147c

Expand Down
12 changes: 6 additions & 6 deletions example/ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@
97C146E61CF9000F007C117D /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 1430;
LastUpgradeCheck = 1510;
ORGANIZATIONNAME = "";
TargetAttributes = {
97C146ED1CF9000F007C117D = {
Expand Down Expand Up @@ -346,7 +346,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SUPPORTED_PLATFORMS = iphoneos;
Expand Down Expand Up @@ -424,7 +424,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
Expand Down Expand Up @@ -473,7 +473,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SUPPORTED_PLATFORMS = iphoneos;
Expand Down Expand Up @@ -576,7 +576,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
Expand Down Expand Up @@ -648,7 +648,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SUPPORTED_PLATFORMS = iphoneos;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1430"
LastUpgradeVersion = "1510"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
63 changes: 48 additions & 15 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class _MyAppState extends State<MyApp> {
String displayText = "";
ldk.SocketAddress? bobAddr;
ldk.Bolt11Invoice? invoice;
ldk.UserChannelId? userChannelId;
ldk.ChannelId? channelId;

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

closeChannel() async {
await aliceNode.closeChannel(
userChannelId: userChannelId!, counterpartyNodeId: bobNodeId!);
channelId: channelId!, counterpartyNodeId: bobNodeId!);
}

Future initAliceNode() async {
Expand All @@ -81,7 +81,7 @@ class _MyAppState extends State<MyApp> {
final res = await aliceNode.nodeId();
setState(() {
aliceNodeId = res;
displayText = "${aliceNodeId?.hexCode} started successfully";
displayText = "${aliceNodeId?.hex} started successfully";
});
}

Expand Down Expand Up @@ -113,16 +113,18 @@ class _MyAppState extends State<MyApp> {
}

totalOnchainBalanceSats() async {
final alice = await aliceNode.listBalances();
final bob = await bobNode.listBalances();
final alice = await aliceNode.totalOnchainBalanceSats();
final bob = await bobNode.totalOnchainBalanceSats();
if (kDebugMode) {
print("alice's balance: ${alice.totalOnchainBalanceSats}");
print("alice's spendable balance: ${alice.spendableOnchainBalanceSats}");
print("bob's balance: ${bob.totalOnchainBalanceSats}");
print("bob's spendable balance: ${bob.spendableOnchainBalanceSats}");
print("alice's balance: $alice");
print(
"alice's spendable balance: ${await aliceNode.spendableOnchainBalanceSats()}");
print("bob's balance: $bob");
print(
"bob's spendable balance: ${await bobNode.spendableOnchainBalanceSats()}");
}
setState(() {
aliceBalance = alice.spendableOnchainBalanceSats;
aliceBalance = alice;
});
}

Expand All @@ -140,8 +142,7 @@ class _MyAppState extends State<MyApp> {
if (res.isNotEmpty) {
print("======Channels========");
for (var e in res) {
print("nodeId: ${aliceNodeId!.hexCode}");
print("userChannelId: ${e.userChannelId.data}");
print("nodeId: ${aliceNodeId!.hex}");
print("channelId: ${e.channelId.data}");
print("isChannelReady: ${e.isChannelReady}");
print("isUsable: ${e.isUsable}");
Expand Down Expand Up @@ -211,10 +212,10 @@ class _MyAppState extends State<MyApp> {
connectOpenChannel() async {
final funding_amount_sat = 80000;
final push_msat = (funding_amount_sat / 2) * 1000;
userChannelId = await aliceNode.connectOpenChannel(
await aliceNode.connectOpenChannel(
channelAmountSats: funding_amount_sat,
announceChannel: true,
address: bobAddr!,
socketAddress: bobAddr!,
pushToCounterpartyMsat: push_msat.toInt(),
nodeId: bobNodeId!);
}
Expand All @@ -232,6 +233,24 @@ class _MyAppState extends State<MyApp> {
});
}

setChannelId() async {
final channelInfos = await aliceNode.listChannels();
if (channelInfos.isNotEmpty) {
channelId = channelInfos.first.channelId;
if (kDebugMode) {
print(channelId?.data);
}

setState(() {
displayText = channelId!.data.toString();
});
} else {
if (kDebugMode) {
print("No open channels available");
}
}
}

stop() async {
await bobNode.stop();
await aliceNode.stop();
Expand Down Expand Up @@ -443,6 +462,20 @@ class _MyAppState extends State<MyApp> {
fontSize: 12,
height: 1.5,
fontWeight: FontWeight.w800))),
TextButton(
onPressed: () async {
await setChannelId();
},
child: Text(
'Set channelId',
overflow: TextOverflow.clip,
textAlign: TextAlign.center,
style: GoogleFonts.nunito(
color: Colors.indigoAccent,
fontSize: 12,
height: 1.5,
fontWeight: FontWeight.w800),
)),
TextButton(
onPressed: () async {
await receiveAndSendPayments();
Expand Down Expand Up @@ -512,7 +545,7 @@ class _MyAppState extends State<MyApp> {
Text(
aliceNodeId == null
? "Node not initialized"
: "@Id_:${aliceNodeId!.hexCode}",
: "@Id_:${aliceNodeId!.hex}",
maxLines: 1,
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.center,
Expand Down
Loading

0 comments on commit a0b2a85

Please sign in to comment.