Skip to content

Commit 3d89630

Browse files
Merge pull request #8 from synonymdev/feat/expose-cpfp-fee-calculation-
feat: expose calculate_cpfp_fee_rate
2 parents cd77ab1 + 36dd813 commit 3d89630

File tree

12 files changed

+87
-7
lines changed

12 files changed

+87
-7
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "ldk-node"
3-
version = "0.6.0-rc.3"
3+
version = "0.6.0-rc.4"
44
authors = ["Elias Rohrer <[email protected]>"]
55
homepage = "https://lightningdevkit.org/"
66
license = "MIT OR Apache-2.0"

Package.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33

44
import PackageDescription
55

6-
let tag = "v0.6.0-rc.3"
7-
let checksum = "02345d7a9f39c6cdb161976bb00ac1053507aab61845d9e09cafd430368a57f1"
6+
let tag = "v0.6.0-rc.4"
7+
let checksum = "dd0856b962ad886b96839b63de1a24bb3c75fe15c22ce1265b46e1d23697e70d"
88
let url = "https://github.com/synonymdev/ldk-node/releases/download/\(tag)/LDKNodeFFI.xcframework.zip"
99

1010
let package = Package(

bindings/kotlin/ldk-node-android/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ Publishing new version guide.
3131
- add dependency in `libs.versions.toml`:
3232
```toml
3333
# by tag
34-
ldk-node-android = { module = "com.github.ovitrif:ldk-node", version = "v0.6.0-rc.1"
34+
ldk-node-android = { module = "com.github.synonymdev:ldk-node", version = "v0.6.0-rc.4"
3535

3636
# or by branch
37-
ldk-node-android = { module = "com.github.ovitrif:ldk-node", version = "main-SNAPSHOT"
37+
ldk-node-android = { module = "com.github.synonymdev:ldk-node", version = "main-SNAPSHOT"
3838
```
3939
- Run `Sync project with gradle files` action in android studio

bindings/kotlin/ldk-node-android/gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ org.gradle.jvmargs=-Xmx1536m
22
android.useAndroidX=true
33
android.enableJetifier=true
44
kotlin.code.style=official
5-
libraryVersion=v0.6.0-rc.3
5+
libraryVersion=v0.6.0-rc.4
Binary file not shown.
Binary file not shown.
Binary file not shown.

bindings/kotlin/ldk-node-android/lib/src/main/kotlin/org/lightningdevkit/ldknode/ldk_node.kt

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1008,6 +1008,8 @@ internal open class UniffiVTableCallbackInterfaceVssHeaderProvider(
10081008

10091009

10101010

1011+
1012+
10111013

10121014

10131015

@@ -1293,6 +1295,8 @@ internal interface UniffiLib : Library {
12931295
): RustBuffer.ByValue
12941296
fun uniffi_ldk_node_fn_method_onchainpayment_bump_fee_by_rbf(`ptr`: Pointer,`txid`: RustBuffer.ByValue,`feeRate`: Pointer,uniffi_out_err: UniffiRustCallStatus,
12951297
): RustBuffer.ByValue
1298+
fun uniffi_ldk_node_fn_method_onchainpayment_calculate_cpfp_fee_rate(`ptr`: Pointer,`parentTxid`: RustBuffer.ByValue,`urgent`: Byte,uniffi_out_err: UniffiRustCallStatus,
1299+
): Pointer
12961300
fun uniffi_ldk_node_fn_method_onchainpayment_list_spendable_outputs(`ptr`: Pointer,uniffi_out_err: UniffiRustCallStatus,
12971301
): RustBuffer.ByValue
12981302
fun uniffi_ldk_node_fn_method_onchainpayment_new_address(`ptr`: Pointer,uniffi_out_err: UniffiRustCallStatus,
@@ -1657,6 +1661,8 @@ internal interface UniffiLib : Library {
16571661
): Short
16581662
fun uniffi_ldk_node_checksum_method_onchainpayment_bump_fee_by_rbf(
16591663
): Short
1664+
fun uniffi_ldk_node_checksum_method_onchainpayment_calculate_cpfp_fee_rate(
1665+
): Short
16601666
fun uniffi_ldk_node_checksum_method_onchainpayment_list_spendable_outputs(
16611667
): Short
16621668
fun uniffi_ldk_node_checksum_method_onchainpayment_new_address(
@@ -2027,6 +2033,9 @@ private fun uniffiCheckApiChecksums(lib: UniffiLib) {
20272033
if (lib.uniffi_ldk_node_checksum_method_onchainpayment_bump_fee_by_rbf() != 53877.toShort()) {
20282034
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
20292035
}
2036+
if (lib.uniffi_ldk_node_checksum_method_onchainpayment_calculate_cpfp_fee_rate() != 32879.toShort()) {
2037+
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
2038+
}
20302039
if (lib.uniffi_ldk_node_checksum_method_onchainpayment_list_spendable_outputs() != 19144.toShort()) {
20312040
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
20322041
}
@@ -6024,6 +6033,8 @@ public interface OnchainPaymentInterface {
60246033

60256034
fun `bumpFeeByRbf`(`txid`: Txid, `feeRate`: FeeRate): Txid
60266035

6036+
fun `calculateCpfpFeeRate`(`parentTxid`: Txid, `urgent`: kotlin.Boolean): FeeRate
6037+
60276038
fun `listSpendableOutputs`(): List<SpendableUtxo>
60286039

60296040
fun `newAddress`(): Address
@@ -6145,6 +6156,19 @@ open class OnchainPayment: Disposable, AutoCloseable, OnchainPaymentInterface {
61456156

61466157

61476158

6159+
@Throws(NodeException::class)override fun `calculateCpfpFeeRate`(`parentTxid`: Txid, `urgent`: kotlin.Boolean): FeeRate {
6160+
return FfiConverterTypeFeeRate.lift(
6161+
callWithPointer {
6162+
uniffiRustCallWithError(NodeException) { _status ->
6163+
UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_onchainpayment_calculate_cpfp_fee_rate(
6164+
it, FfiConverterTypeTxid.lower(`parentTxid`),FfiConverterBoolean.lower(`urgent`),_status)
6165+
}
6166+
}
6167+
)
6168+
}
6169+
6170+
6171+
61486172
@Throws(NodeException::class)override fun `listSpendableOutputs`(): List<SpendableUtxo> {
61496173
return FfiConverterSequenceTypeSpendableUtxo.lift(
61506174
callWithPointer {

bindings/ldk_node.udl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,8 @@ interface OnchainPayment {
230230
Txid bump_fee_by_rbf([ByRef]Txid txid, FeeRate fee_rate);
231231
[Throws=NodeError]
232232
Txid accelerate_by_cpfp([ByRef]Txid txid, FeeRate? fee_rate, Address? destination_address);
233+
[Throws=NodeError]
234+
FeeRate calculate_cpfp_fee_rate([ByRef]Txid parent_txid, boolean urgent);
233235
};
234236

235237
enum CoinSelectionAlgorithm {

bindings/swift/Sources/LDKNode/LDKNode.swift

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2475,6 +2475,8 @@ public protocol OnchainPaymentProtocol : AnyObject {
24752475

24762476
func bumpFeeByRbf(txid: Txid, feeRate: FeeRate) throws -> Txid
24772477

2478+
func calculateCpfpFeeRate(parentTxid: Txid, urgent: Bool) throws -> FeeRate
2479+
24782480
func listSpendableOutputs() throws -> [SpendableUtxo]
24792481

24802482
func newAddress() throws -> Address
@@ -2547,6 +2549,15 @@ open func bumpFeeByRbf(txid: Txid, feeRate: FeeRate)throws -> Txid {
25472549
})
25482550
}
25492551

2552+
open func calculateCpfpFeeRate(parentTxid: Txid, urgent: Bool)throws -> FeeRate {
2553+
return try FfiConverterTypeFeeRate.lift(try rustCallWithError(FfiConverterTypeNodeError.lift) {
2554+
uniffi_ldk_node_fn_method_onchainpayment_calculate_cpfp_fee_rate(self.uniffiClonePointer(),
2555+
FfiConverterTypeTxid.lower(parentTxid),
2556+
FfiConverterBool.lower(urgent),$0
2557+
)
2558+
})
2559+
}
2560+
25502561
open func listSpendableOutputs()throws -> [SpendableUtxo] {
25512562
return try FfiConverterSequenceTypeSpendableUtxo.lift(try rustCallWithError(FfiConverterTypeNodeError.lift) {
25522563
uniffi_ldk_node_fn_method_onchainpayment_list_spendable_outputs(self.uniffiClonePointer(),$0
@@ -10015,6 +10026,9 @@ private var initializationResult: InitializationResult {
1001510026
if (uniffi_ldk_node_checksum_method_onchainpayment_bump_fee_by_rbf() != 53877) {
1001610027
return InitializationResult.apiChecksumMismatch
1001710028
}
10029+
if (uniffi_ldk_node_checksum_method_onchainpayment_calculate_cpfp_fee_rate() != 32879) {
10030+
return InitializationResult.apiChecksumMismatch
10031+
}
1001810032
if (uniffi_ldk_node_checksum_method_onchainpayment_list_spendable_outputs() != 19144) {
1001910033
return InitializationResult.apiChecksumMismatch
1002010034
}

0 commit comments

Comments
 (0)