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

Commit bc39ac0

Browse files
committed
chore: update java bindings to ldk 0.0.118
1 parent 3846c43 commit bc39ac0

2 files changed

Lines changed: 33 additions & 32 deletions

File tree

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

0 commit comments

Comments
 (0)