Skip to content

Commit

Permalink
Merge pull request #31 from LtbLightning/v0.1.4
Browse files Browse the repository at this point in the history
v0.1.4
  • Loading branch information
BitcoinZavior authored Jan 19, 2024
2 parents 8bd4ac0 + fb5b1a6 commit 7916dfb
Show file tree
Hide file tree
Showing 26 changed files with 2,737 additions and 1,031 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## [0.2.0]
Updated `Rust` and `Flutter` dependencies.


## [0.1.3]
Updated `Rust` and `Flutter` dependencies.
Invalid `BuilderException` bug resolved
Expand Down
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ To use the `ldk_node` package in your project, add it as a dependency in your pr

```dart
dependencies:
ldk_node: ^0.1.3
ldk_node: ^0.2.0
```
or add from pub.dev using `pub add` command

Expand Down Expand Up @@ -68,7 +68,10 @@ final config = Config(
trustedPeers0Conf: [],
storageDirPath: path,
network: Network.Testnet,
listeningAddress: NetAddress.iPv4(addr: "0.0.0.0", port: 3006),
listeningAddresses: [
bridge.SocketAddress.hostname(
hostname: bridge.Hostname(internal: "0.0.0.0"), port: 9735)
],
onchainWalletSyncIntervalSecs: 60,
walletSyncIntervalSecs: 20,
feeRateCacheUpdateIntervalSecs: 600,
Expand Down
Binary file modified android/src/main/jniLibs/arm64-v8a/librust_ldk_node.so
Binary file not shown.
Binary file modified android/src/main/jniLibs/armeabi-v7a/librust_ldk_node.so
Binary file not shown.
Binary file modified android/src/main/jniLibs/x86/librust_ldk_node.so
Binary file not shown.
4 changes: 2 additions & 2 deletions example/ios/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
PODS:
- Flutter (1.0.0)
- ldk_node (0.1.3):
- ldk_node (0.2.0):
- Flutter
- path_provider_foundation (0.0.1):
- Flutter
Expand All @@ -21,7 +21,7 @@ EXTERNAL SOURCES:

SPEC CHECKSUMS:
Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854
ldk_node: 0bcad021798a6c23650ee6024b5e7d175a341aa3
ldk_node: 2c7a711e69412b0e4e03a750a12c7c56110aa93b
path_provider_foundation: 29f094ae23ebbca9d3d0cec13889cd9060c0e943

PODFILE CHECKSUM: ef19549a9bc3046e7bb7d2fab4d021637c0c58a3
Expand Down
44 changes: 25 additions & 19 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import 'dart:io';

import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart';
Expand All @@ -24,31 +22,34 @@ class _MyAppState extends State<MyApp> {
ldk.PublicKey? bobNodeId;
int aliceBalance = 0;
String displayText = "";
ldk.NetAddress? bobAddr;
ldk.SocketAddress? bobAddr;
ldk.Bolt11Invoice? invoice;
ldk.ChannelId? channelId;

// Replace this with your local esplora url
String esploraUrl = Platform.isAndroid
?
//10.0.2.2 to access the AVD
'http://10.0.2.2:30000'
: 'http://127.0.0.1:30000';
String esploraUrl = "https://mempool.space/testnet/api";
// Platform.isAndroid
// ?
// //10.0.2.2 to access the AVD
// 'http://10.0.2.2:30000'
// : '0.0.0.0:30000';

@override
void initState() {
initAliceNode();
super.initState();
}

Future<ldk.Config> initLdkConfig(String path, ldk.NetAddress address) async {
Future<ldk.Config> initLdkConfig(
String path, ldk.SocketAddress address) async {
final directory = await getApplicationDocumentsDirectory();
final nodePath = "${directory.path}/ldk_cache/$path";
final config = ldk.Config(
probingLiquidityLimitMultiplier: 3,
trustedPeers0Conf: [],
storageDirPath: nodePath,
network: ldk.Network.Regtest,
listeningAddress: address,
network: ldk.Network.Testnet,
listeningAddresses: [address],
onchainWalletSyncIntervalSecs: 60,
walletSyncIntervalSecs: 20,
feeRateCacheUpdateIntervalSecs: 600,
Expand All @@ -64,12 +65,14 @@ class _MyAppState extends State<MyApp> {

initAliceNode() async {
final aliceConfig = await initLdkConfig(
'alice_regtest', ldk.NetAddress.iPv4(addr: "0.0.0.0", port: 3006));
'alice_testnet',
ldk.SocketAddress.hostname(
hostname: ldk.Hostname(internal: "0.0.0.0"), port: 9735));
ldk.Builder aliceBuilder = ldk.Builder.fromConfig(config: aliceConfig);
aliceNode = await aliceBuilder
.setEntropyBip39Mnemonic(
mnemonic: ldk.Mnemonic(
'cart super leaf clinic pistol plug replace close super tooth wealth usage'))
'puppy interest whip tonight dad never sudden response push zone pig patch'))
.setEsploraServer(esploraServerUrl: esploraUrl)
.build();
await startNode(aliceNode);
Expand All @@ -90,12 +93,14 @@ class _MyAppState extends State<MyApp> {

initBobNode() async {
final bobConfig = await initLdkConfig(
"bob_regtest", ldk.NetAddress.iPv4(addr: "0.0.0.0", port: 3008));
"bob_testnet",
ldk.SocketAddress.hostname(
hostname: ldk.Hostname(internal: "0.0.0.0"), port: 3006));
ldk.Builder bobBuilder = ldk.Builder.fromConfig(config: bobConfig);
bobNode = await bobBuilder
.setEntropyBip39Mnemonic(
mnemonic: ldk.Mnemonic(
'puppy interest whip tonight dad never sudden response push zone pig patch'))
'cart super leaf clinic pistol plug replace close super tooth wealth usage'))
.setEsploraServer(esploraServerUrl: esploraUrl)
.build();
await startNode(bobNode);
Expand Down Expand Up @@ -189,18 +194,19 @@ class _MyAppState extends State<MyApp> {
listeningAddress() async {
final alice = await aliceNode.listeningAddress();
final bob = await bobNode.listeningAddress();

setState(() {
bobAddr = bob;
bobAddr = bob!.first;
});
if (kDebugMode) {
print("alice's listeningAddress : ${alice!.addr}:${alice.port}");
print("bob's listeningAddress: ${bob!.addr}:${bob.port}");
print("alice's listeningAddress : ${alice!.first.toString()}");
print("bob's listeningAddress: ${bob!.first.toString()}");
}
}

connectOpenChannel() async {
await aliceNode.connectOpenChannel(
channelAmountSats: 5000000,
channelAmountSats: 5000,
announceChannel: true,
netaddress: bobAddr!,
pushToCounterpartyMsat: 50000,
Expand Down
40 changes: 24 additions & 16 deletions example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "7.0.0"
fixnum:
dependency: transitive
description:
name: fixnum
sha256: "25517a4deb0c03aa0f32fd12db525856438902d9c16536311e76cdc57b31d7d1"
url: "https://pub.dev"
source: hosted
version: "1.1.0"
flutter:
dependency: "direct main"
description: flutter
Expand All @@ -178,10 +186,10 @@ packages:
dependency: transitive
description:
name: flutter_rust_bridge
sha256: "7c5e94d037ccb0de7b5f7de3ff2491548d292b5aad01b01f5a5703f8aac9389b"
sha256: "02720226035257ad0b571c1256f43df3e1556a499f6bcb004849a0faaa0e87f0"
url: "https://pub.dev"
source: hosted
version: "1.82.4"
version: "1.82.6"
flutter_test:
dependency: "direct dev"
description: flutter
Expand All @@ -191,10 +199,10 @@ packages:
dependency: transitive
description:
name: freezed
sha256: "21bf2825311de65501d22e563e3d7605dff57fb5e6da982db785ae5372ff018a"
sha256: "6c5031daae12c7072b3a87eff98983076434b4889ef2a44384d0cae3f82372ba"
url: "https://pub.dev"
source: hosted
version: "2.4.5"
version: "2.4.6"
freezed_annotation:
dependency: transitive
description:
Expand Down Expand Up @@ -257,7 +265,7 @@ packages:
path: ".."
relative: true
source: path
version: "0.1.3"
version: "0.2.0"
lints:
dependency: transitive
description:
Expand Down Expand Up @@ -326,10 +334,10 @@ packages:
dependency: "direct main"
description:
name: path_provider
sha256: a1aa8aaa2542a6bc57e381f132af822420216c80d4781f7aa085ca3229208aaa
sha256: b27217933eeeba8ff24845c34003b003b2b22151de3c908d0e679e8fe1aa078b
url: "https://pub.dev"
source: hosted
version: "2.1.1"
version: "2.1.2"
path_provider_android:
dependency: transitive
description:
Expand Down Expand Up @@ -374,10 +382,10 @@ packages:
dependency: transitive
description:
name: petitparser
sha256: eeb2d1428ee7f4170e2bd498827296a18d4e7fc462b71727d111c0ac7707cfa6
sha256: c15605cd28af66339f8eb6fbe0e541bfe2d1b72d5825efc6598f3e0a31b9ad27
url: "https://pub.dev"
source: hosted
version: "6.0.1"
version: "6.0.2"
platform:
dependency: transitive
description:
Expand Down Expand Up @@ -467,10 +475,10 @@ packages:
dependency: transitive
description:
name: source_gen
sha256: fc0da689e5302edb6177fdd964efcb7f58912f43c28c2047a808f5bfff643d16
sha256: "14658ba5f669685cd3d63701d01b31ea748310f7ab854e471962670abcf57832"
url: "https://pub.dev"
source: hosted
version: "1.4.0"
version: "1.5.0"
source_span:
dependency: transitive
description:
Expand Down Expand Up @@ -547,10 +555,10 @@ packages:
dependency: transitive
description:
name: uuid
sha256: df5a4d8f22ee4ccd77f8839ac7cb274ebc11ef9adcce8b92be14b797fe889921
sha256: cd210a09f7c18cbe5a02511718e0334de6559871052c90a90c0cca46a4aa81c8
url: "https://pub.dev"
source: hosted
version: "4.2.1"
version: "4.3.3"
vector_math:
dependency: transitive
description:
Expand Down Expand Up @@ -587,10 +595,10 @@ packages:
dependency: transitive
description:
name: win32
sha256: "7c99c0e1e2fa190b48d25c81ca5e42036d5cac81430ef249027d97b0935c553f"
sha256: b0f37db61ba2f2e9b7a78a1caece0052564d1bc70668156cf3a29d676fe4e574
url: "https://pub.dev"
source: hosted
version: "5.1.0"
version: "5.1.1"
xdg_directories:
dependency: transitive
description:
Expand All @@ -609,4 +617,4 @@ packages:
version: "3.1.2"
sdks:
dart: ">=3.2.0 <4.0.0"
flutter: ">=3.7.0"
flutter: ">=3.10.0"
Loading

0 comments on commit 7916dfb

Please sign in to comment.