Skip to content
This repository was archived by the owner on Feb 9, 2026. It is now read-only.

Commit 5ae3b9a

Browse files
authored
Merge pull request #189 from synonymdev/ldk-118
LDK 0.0.118
2 parents a5b2692 + bc39ac0 commit 5ae3b9a

38 files changed

Lines changed: 41074 additions & 39387 deletions

File tree

example/ios/Podfile.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ PODS:
302302
- React-jsinspector (0.70.6)
303303
- React-logger (0.70.6):
304304
- glog
305-
- react-native-ldk (0.0.113):
305+
- react-native-ldk (0.0.120):
306306
- React
307307
- react-native-randombytes (3.6.1):
308308
- React-Core
@@ -593,7 +593,7 @@ SPEC CHECKSUMS:
593593
React-jsiexecutor: b4a65947391c658450151275aa406f2b8263178f
594594
React-jsinspector: 60769e5a0a6d4b32294a2456077f59d0266f9a8b
595595
React-logger: 1623c216abaa88974afce404dc8f479406bbc3a0
596-
react-native-ldk: dd463969f46a47599bd622fc02a67d878f13abe5
596+
react-native-ldk: fc83520c891e58888c8f975a02ed394a4c4e1c36
597597
react-native-randombytes: 421f1c7d48c0af8dbcd471b0324393ebf8fe7846
598598
react-native-tcp-socket: c1b7297619616b4c9caae6889bcb0aba78086989
599599
React-perflogger: 8c79399b0500a30ee8152d0f9f11beae7fc36595

example/ldk/index.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -120,10 +120,13 @@ export const setupLdk = async (
120120
getScriptPubKeyHistory,
121121
getFees: () =>
122122
Promise.resolve({
123-
highPriority: 10,
124-
normal: 5,
125-
background: 1,
126-
mempoolMinimum: 1,
123+
anchorChannelFee: 10,
124+
nonAnchorChannelFee: 10,
125+
channelCloseMinimum: 10,
126+
minAllowedAnchorChannelRemoteFee: 10,
127+
maxAllowedNonAnchorChannelRemoteFee: 10,
128+
onChainSweep: 10,
129+
minAllowedNonAnchorChannelRemoteFee: 10,
127130
}),
128131
getTransactionData,
129132
getTransactionPosition,

lib/android/libs/LDK-release.aar

93.9 KB
Binary file not shown.

lib/android/src/main/java/com/reactnativeldk/LdkModule.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -512,8 +512,8 @@ class LdkModule(reactContext: ReactApplicationContext) : ReactContextBaseJavaMod
512512
//MARK: Update methods
513513

514514
@ReactMethod
515-
fun updateFees(high: Double, normal: Double, low: Double, mempoolMinimum: Double, promise: Promise) {
516-
feeEstimator.update(high.toInt(), normal.toInt(), low.toInt(), mempoolMinimum.toInt())
515+
fun updateFees(anchorChannelFee: Double, nonAnchorChannelFee: Double, channelCloseMinimum: Double, minAllowedAnchorChannelRemoteFee: Double, maxAllowedNonAnchorChannelRemoteFee: Double, onChainSweep: Double, minAllowedNonAnchorChannelRemoteFee: Double, promise: Promise) {
516+
feeEstimator.update(anchorChannelFee.toInt(), nonAnchorChannelFee.toInt(), channelCloseMinimum.toInt(), minAllowedAnchorChannelRemoteFee.toInt(), maxAllowedNonAnchorChannelRemoteFee.toInt(), onChainSweep.toInt(), minAllowedNonAnchorChannelRemoteFee.toInt())
517517
handleResolve(promise, LdkCallbackResponses.fees_updated)
518518
}
519519

lib/android/src/main/java/com/reactnativeldk/classes/LdkFeeEstimator.kt

Lines changed: 31 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -5,39 +5,40 @@ import org.ldk.enums.ConfirmationTarget
55
import org.ldk.structs.FeeEstimator
66

77
class LdkFeeEstimator {
8-
var high: Int = 0
9-
var normal: Int = 0
10-
var low: Int = 0
11-
var mempoolMinimum: Int = 0
12-
var feeEstimator = FeeEstimator.new_impl { target: ConfirmationTarget ->
13-
if (target.equals(ConfirmationTarget.LDKConfirmationTarget_HighPriority)) {
14-
return@new_impl high
15-
}
16-
17-
if (target.equals(ConfirmationTarget.LDKConfirmationTarget_Normal)) {
18-
return@new_impl normal
19-
}
20-
21-
if (target.equals(ConfirmationTarget.LDKConfirmationTarget_Background)) {
22-
return@new_impl low
23-
}
24-
25-
if (target.equals(ConfirmationTarget.LDKConfirmationTarget_MempoolMinimum)) {
26-
return@new_impl mempoolMinimum
27-
}
28-
29-
LdkEventEmitter.send(EventTypes.native_log, "WARNING: New ConfirmationTarget added. Update LdkFeeEstimator.")
8+
var anchorChannelFee: Int = 0
9+
var nonAnchorChannelFee: Int = 0
10+
var channelCloseMinimum: Int = 0
11+
var minAllowedAnchorChannelRemoteFee: Int = 0
12+
var maxAllowedNonAnchorChannelRemoteFee: Int = 0
13+
var onChainSweep: Int = 0
14+
var minAllowedNonAnchorChannelRemoteFee: Int = 0
15+
16+
fun update(anchorChannelFee: Int, nonAnchorChannelFee: Int, channelCloseMinimum: Int, minAllowedAnchorChannelRemoteFee: Int, maxAllowedNonAnchorChannelRemoteFee: Int, onChainSweep: Int, minAllowedNonAnchorChannelRemoteFee: Int) {
17+
this.anchorChannelFee = anchorChannelFee
18+
this.nonAnchorChannelFee = nonAnchorChannelFee
19+
this.channelCloseMinimum = channelCloseMinimum
20+
this.minAllowedAnchorChannelRemoteFee = minAllowedAnchorChannelRemoteFee
21+
this.maxAllowedNonAnchorChannelRemoteFee = maxAllowedNonAnchorChannelRemoteFee
22+
this.onChainSweep = onChainSweep
23+
this.minAllowedNonAnchorChannelRemoteFee = minAllowedNonAnchorChannelRemoteFee
3024

31-
return@new_impl normal
25+
LdkEventEmitter.send(EventTypes.native_log, "Fee estimator updated")
3226
}
3327

34-
fun update(high: Int, normal: Int, low: Int, mempoolMinimum: Int) {
35-
this.high = high
36-
this.normal = normal
37-
this.low = low
38-
this.mempoolMinimum = mempoolMinimum
39-
40-
LdkEventEmitter.send(EventTypes.native_log, "Fee estimator updated")
28+
var feeEstimator = FeeEstimator.new_impl { target: ConfirmationTarget ->
29+
return@new_impl when (target) {
30+
ConfirmationTarget.LDKConfirmationTarget_AnchorChannelFee -> anchorChannelFee
31+
ConfirmationTarget.LDKConfirmationTarget_NonAnchorChannelFee -> nonAnchorChannelFee
32+
ConfirmationTarget.LDKConfirmationTarget_ChannelCloseMinimum -> channelCloseMinimum
33+
ConfirmationTarget.LDKConfirmationTarget_MinAllowedAnchorChannelRemoteFee -> minAllowedAnchorChannelRemoteFee
34+
ConfirmationTarget.LDKConfirmationTarget_MaxAllowedNonAnchorChannelRemoteFee -> maxAllowedNonAnchorChannelRemoteFee
35+
ConfirmationTarget.LDKConfirmationTarget_OnChainSweep -> onChainSweep
36+
ConfirmationTarget.LDKConfirmationTarget_MinAllowedNonAnchorChannelRemoteFee -> minAllowedNonAnchorChannelRemoteFee
37+
else -> {
38+
LdkEventEmitter.send(EventTypes.native_log, "ERROR: New ConfirmationTarget added. Update LdkFeeEstimator.")
39+
return@new_impl 0
40+
}
41+
}
4142
}
4243
}
4344

lib/ios/Classes/LdkFeeEstimator.swift

Lines changed: 33 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -9,41 +9,47 @@ import Foundation
99
import LightningDevKit
1010

1111
class LdkFeeEstimator: FeeEstimator {
12-
private var high: UInt32 = 0
13-
private var normal: UInt32 = 0
14-
private var low: UInt32 = 0
15-
private var mempoolMinimum: UInt32 = 0
12+
private var anchorChannelFee: UInt32 = 0
13+
private var nonAnchorChannelFee: UInt32 = 0
14+
private var channelCloseMinimum: UInt32 = 0
15+
private var minAllowedAnchorChannelRemoteFee: UInt32 = 0
16+
private var maxAllowedNonAnchorChannelRemoteFee: UInt32 = 0
17+
private var onChainSweep: UInt32 = 0
18+
private var minAllowedNonAnchorChannelRemoteFee: UInt32 = 0
1619

17-
func update(high: UInt32, normal: UInt32, low: UInt32, mempoolMinimum: UInt32) {
18-
self.high = high
19-
self.normal = normal
20-
self.low = low
21-
self.mempoolMinimum = mempoolMinimum
20+
func update(anchorChannelFee: UInt32, nonAnchorChannelFee: UInt32, channelCloseMinimum: UInt32, minAllowedAnchorChannelRemoteFee: UInt32, maxAllowedNonAnchorChannelRemoteFee: UInt32, onChainSweep: UInt32, minAllowedNonAnchorChannelRemoteFee: UInt32) {
21+
self.anchorChannelFee = anchorChannelFee
22+
self.nonAnchorChannelFee = nonAnchorChannelFee
23+
self.channelCloseMinimum = channelCloseMinimum
24+
self.minAllowedAnchorChannelRemoteFee = minAllowedAnchorChannelRemoteFee
25+
self.maxAllowedNonAnchorChannelRemoteFee = maxAllowedNonAnchorChannelRemoteFee
26+
self.onChainSweep = onChainSweep
27+
self.minAllowedNonAnchorChannelRemoteFee = minAllowedNonAnchorChannelRemoteFee
2228

2329
LdkEventEmitter.shared.send(withEvent: .native_log, body: "Fee estimator updated")
2430
}
2531

2632
override func getEstSatPer1000Weight(confirmationTarget: Bindings.ConfirmationTarget) -> UInt32 {
2733
let target = confirmationTarget
2834

29-
if case ConfirmationTarget.HighPriority = target {
30-
return high
35+
switch target {
36+
case .AnchorChannelFee:
37+
return anchorChannelFee
38+
case .NonAnchorChannelFee:
39+
return nonAnchorChannelFee
40+
case .ChannelCloseMinimum:
41+
return channelCloseMinimum
42+
case .MinAllowedAnchorChannelRemoteFee:
43+
return minAllowedAnchorChannelRemoteFee
44+
case .MaxAllowedNonAnchorChannelRemoteFee:
45+
return maxAllowedNonAnchorChannelRemoteFee
46+
case .OnChainSweep:
47+
return onChainSweep
48+
case .MinAllowedNonAnchorChannelRemoteFee:
49+
return minAllowedNonAnchorChannelRemoteFee
50+
@unknown default:
51+
LdkEventEmitter.shared.send(withEvent: .native_log, body: "ERROR: New ConfirmationTarget added. Update LdkFeeEstimator.")
52+
return 0
3153
}
32-
33-
if case ConfirmationTarget.Normal = target {
34-
return normal
35-
}
36-
37-
if case ConfirmationTarget.Background = target {
38-
return low
39-
}
40-
41-
if case ConfirmationTarget.MempoolMinimum = target {
42-
return mempoolMinimum
43-
}
44-
45-
LdkEventEmitter.shared.send(withEvent: .native_log, body: "WARNING: New ConfirmationTarget added. Update LdkFeeEstimator.")
46-
47-
return normal
4854
}
4955
}

lib/ios/Ldk.m

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,13 @@ @interface RCT_EXTERN_MODULE(Ldk, NSObject)
3737
reject:(RCTPromiseRejectBlock)reject)
3838

3939
//MARK: Update methods
40-
RCT_EXTERN_METHOD(updateFees:(NSInteger *)high
41-
normal:(NSInteger *)normal
42-
low:(NSInteger *)low
43-
mempoolMinimum:(NSInteger *)mempoolMinimum
40+
RCT_EXTERN_METHOD(updateFees:(NSInteger *)anchorChannelFee
41+
nonAnchorChannelFee:(NSInteger *)nonAnchorChannelFee
42+
channelCloseMinimum:(NSInteger *)channelCloseMinimum
43+
minAllowedAnchorChannelRemoteFee:(NSInteger *)minAllowedAnchorChannelRemoteFee
44+
maxAllowedNonAnchorChannelRemoteFee:(NSInteger *)maxAllowedNonAnchorChannelRemoteFee
45+
onChainSweep:(NSInteger *)onChainSweep
46+
minAllowedNonAnchorChannelRemoteFee:(NSInteger *)minAllowedNonAnchorChannelRemoteFee
4447
resolve:(RCTPromiseResolveBlock)resolve
4548
reject:(RCTPromiseRejectBlock)reject)
4649
RCT_EXTERN_METHOD(setLogLevel:(NSString *)level

lib/ios/Ldk.swift

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -525,8 +525,16 @@ class Ldk: NSObject {
525525
//MARK: Update methods
526526

527527
@objc
528-
func updateFees(_ high: NSInteger, normal: NSInteger, low: NSInteger, mempoolMinimum: NSInteger, resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) {
529-
feeEstimator.update(high: UInt32(high), normal: UInt32(normal), low: UInt32(low), mempoolMinimum: UInt32(mempoolMinimum))
528+
func updateFees(_ anchorChannelFee: NSInteger, nonAnchorChannelFee: NSInteger, channelCloseMinimum: NSInteger, minAllowedAnchorChannelRemoteFee: NSInteger, maxAllowedNonAnchorChannelRemoteFee: NSInteger, onChainSweep: NSInteger, minAllowedNonAnchorChannelRemoteFee: NSInteger, resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) {
529+
feeEstimator.update(
530+
anchorChannelFee: UInt32(anchorChannelFee),
531+
nonAnchorChannelFee: UInt32(nonAnchorChannelFee),
532+
channelCloseMinimum: UInt32(channelCloseMinimum),
533+
minAllowedAnchorChannelRemoteFee: UInt32(minAllowedAnchorChannelRemoteFee),
534+
maxAllowedNonAnchorChannelRemoteFee: UInt32(maxAllowedNonAnchorChannelRemoteFee),
535+
onChainSweep: UInt32(onChainSweep),
536+
minAllowedNonAnchorChannelRemoteFee: UInt32(minAllowedNonAnchorChannelRemoteFee)
537+
)
530538
return handleResolve(resolve, .fees_updated)
531539
}
532540

lib/ios/LightningDevKit.xcframework/Info.plist

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,32 +8,32 @@
88
<key>DebugSymbolsPath</key>
99
<string>dSYMs</string>
1010
<key>LibraryIdentifier</key>
11-
<string>ios-arm64</string>
11+
<string>ios-arm64_x86_64-simulator</string>
1212
<key>LibraryPath</key>
1313
<string>LightningDevKit.framework</string>
1414
<key>SupportedArchitectures</key>
1515
<array>
1616
<string>arm64</string>
17+
<string>x86_64</string>
1718
</array>
1819
<key>SupportedPlatform</key>
1920
<string>ios</string>
21+
<key>SupportedPlatformVariant</key>
22+
<string>simulator</string>
2023
</dict>
2124
<dict>
2225
<key>DebugSymbolsPath</key>
2326
<string>dSYMs</string>
2427
<key>LibraryIdentifier</key>
25-
<string>ios-arm64_x86_64-simulator</string>
28+
<string>ios-arm64</string>
2629
<key>LibraryPath</key>
2730
<string>LightningDevKit.framework</string>
2831
<key>SupportedArchitectures</key>
2932
<array>
3033
<string>arm64</string>
31-
<string>x86_64</string>
3234
</array>
3335
<key>SupportedPlatform</key>
3436
<string>ios</string>
35-
<key>SupportedPlatformVariant</key>
36-
<string>simulator</string>
3737
</dict>
3838
</array>
3939
<key>CFBundlePackageType</key>

lib/ios/LightningDevKit.xcframework/ios-arm64/LightningDevKit.framework/Headers/ldk_rust_types.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ struct nativeDelayedPaymentOutputDescriptorOpaque;
2424
typedef struct nativeDelayedPaymentOutputDescriptorOpaque LDKnativeDelayedPaymentOutputDescriptor;
2525
struct nativeStaticPaymentOutputDescriptorOpaque;
2626
typedef struct nativeStaticPaymentOutputDescriptorOpaque LDKnativeStaticPaymentOutputDescriptor;
27+
struct nativeChannelDerivationParametersOpaque;
28+
typedef struct nativeChannelDerivationParametersOpaque LDKnativeChannelDerivationParameters;
29+
struct nativeHTLCDescriptorOpaque;
30+
typedef struct nativeHTLCDescriptorOpaque LDKnativeHTLCDescriptor;
2731
struct LDKChannelSigner;
2832
struct nativeInMemorySignerOpaque;
2933
typedef struct nativeInMemorySignerOpaque LDKnativeInMemorySigner;
@@ -121,12 +125,8 @@ struct nativeNodeAliasOpaque;
121125
typedef struct nativeNodeAliasOpaque LDKnativeNodeAlias;
122126
struct nativeNodeInfoOpaque;
123127
typedef struct nativeNodeInfoOpaque LDKnativeNodeInfo;
124-
struct nativeChannelDerivationParametersOpaque;
125-
typedef struct nativeChannelDerivationParametersOpaque LDKnativeChannelDerivationParameters;
126128
struct nativeAnchorDescriptorOpaque;
127129
typedef struct nativeAnchorDescriptorOpaque LDKnativeAnchorDescriptor;
128-
struct nativeHTLCDescriptorOpaque;
129-
typedef struct nativeHTLCDescriptorOpaque LDKnativeHTLCDescriptor;
130130
struct nativeInputOpaque;
131131
typedef struct nativeInputOpaque LDKnativeInput;
132132
struct nativeUtxoOpaque;

0 commit comments

Comments
 (0)