Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v0.2.0 #31

Merged
merged 20 commits into from
Jan 19, 2024
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## [0.1.4]
Updated `Rust` and `Flutter` dependencies.


## [0.1.3]
Updated `Rust` and `Flutter` dependencies.
Invalid `BuilderException` bug resolved
Expand Down
9 changes: 7 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,12 @@ Please note: This release is considered experimental, and should not be run in p
### How to use ldk_node

To use the `ldk_node` package in your project, add it as a dependency in your project's pubspec.yaml:
psql -h testnetdb.cfvpbm1gzia5.us-east-2.rds.amazonaws.com -p 5432 -U postgres -d postgres -f ./app/src/main/java/org/vss/impl/postgres/sql/v0_create_vss_db.sql
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mh, I'm not sure if VSS should be included here, as it's not released yet?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I have removed this now.



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

Expand Down Expand Up @@ -68,7 +70,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.
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
26 changes: 13 additions & 13 deletions example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -178,10 +178,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 +191,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 +257,7 @@ packages:
path: ".."
relative: true
source: path
version: "0.1.3"
version: "0.1.4"
lints:
dependency: transitive
description:
Expand Down Expand Up @@ -374,10 +374,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 +467,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 +547,10 @@ packages:
dependency: transitive
description:
name: uuid
sha256: df5a4d8f22ee4ccd77f8839ac7cb274ebc11ef9adcce8b92be14b797fe889921
sha256: "22c94e5ad1e75f9934b766b53c742572ee2677c56bc871d850a57dad0f82127f"
url: "https://pub.dev"
source: hosted
version: "4.2.1"
version: "4.2.2"
vector_math:
dependency: transitive
description:
Expand Down Expand Up @@ -587,10 +587,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 Down
Loading