Skip to content

Commit 46e093d

Browse files
committed
chore: update ios and android bindings
1 parent d326a99 commit 46e093d

File tree

5 files changed

+173
-6
lines changed

5 files changed

+173
-6
lines changed

Package.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import PackageDescription
55

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

1010
let package = Package(
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: 172 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1002,6 +1002,10 @@ internal open class UniffiVTableCallbackInterfaceVssHeaderProvider(
10021002

10031003

10041004

1005+
1006+
1007+
1008+
10051009

10061010

10071011

@@ -1289,11 +1293,15 @@ internal interface UniffiLib : Library {
12891293
): RustBuffer.ByValue
12901294
fun uniffi_ldk_node_fn_method_onchainpayment_bump_fee_by_rbf(`ptr`: Pointer,`txid`: RustBuffer.ByValue,`feeRate`: Pointer,uniffi_out_err: UniffiRustCallStatus,
12911295
): RustBuffer.ByValue
1296+
fun uniffi_ldk_node_fn_method_onchainpayment_list_spendable_outputs(`ptr`: Pointer,uniffi_out_err: UniffiRustCallStatus,
1297+
): RustBuffer.ByValue
12921298
fun uniffi_ldk_node_fn_method_onchainpayment_new_address(`ptr`: Pointer,uniffi_out_err: UniffiRustCallStatus,
12931299
): RustBuffer.ByValue
1300+
fun uniffi_ldk_node_fn_method_onchainpayment_select_utxos_with_algorithm(`ptr`: Pointer,`targetAmountSats`: Long,`feeRate`: RustBuffer.ByValue,`algorithm`: RustBuffer.ByValue,`utxos`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
1301+
): RustBuffer.ByValue
12941302
fun uniffi_ldk_node_fn_method_onchainpayment_send_all_to_address(`ptr`: Pointer,`address`: RustBuffer.ByValue,`retainReserve`: Byte,`feeRate`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
12951303
): RustBuffer.ByValue
1296-
fun uniffi_ldk_node_fn_method_onchainpayment_send_to_address(`ptr`: Pointer,`address`: RustBuffer.ByValue,`amountSats`: Long,`feeRate`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
1304+
fun uniffi_ldk_node_fn_method_onchainpayment_send_to_address(`ptr`: Pointer,`address`: RustBuffer.ByValue,`amountSats`: Long,`feeRate`: RustBuffer.ByValue,`utxosToSpend`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
12971305
): RustBuffer.ByValue
12981306
fun uniffi_ldk_node_fn_clone_spontaneouspayment(`ptr`: Pointer,uniffi_out_err: UniffiRustCallStatus,
12991307
): Pointer
@@ -1649,8 +1657,12 @@ internal interface UniffiLib : Library {
16491657
): Short
16501658
fun uniffi_ldk_node_checksum_method_onchainpayment_bump_fee_by_rbf(
16511659
): Short
1660+
fun uniffi_ldk_node_checksum_method_onchainpayment_list_spendable_outputs(
1661+
): Short
16521662
fun uniffi_ldk_node_checksum_method_onchainpayment_new_address(
16531663
): Short
1664+
fun uniffi_ldk_node_checksum_method_onchainpayment_select_utxos_with_algorithm(
1665+
): Short
16541666
fun uniffi_ldk_node_checksum_method_onchainpayment_send_all_to_address(
16551667
): Short
16561668
fun uniffi_ldk_node_checksum_method_onchainpayment_send_to_address(
@@ -2015,13 +2027,19 @@ private fun uniffiCheckApiChecksums(lib: UniffiLib) {
20152027
if (lib.uniffi_ldk_node_checksum_method_onchainpayment_bump_fee_by_rbf() != 53877.toShort()) {
20162028
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
20172029
}
2030+
if (lib.uniffi_ldk_node_checksum_method_onchainpayment_list_spendable_outputs() != 19144.toShort()) {
2031+
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
2032+
}
20182033
if (lib.uniffi_ldk_node_checksum_method_onchainpayment_new_address() != 37251.toShort()) {
20192034
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
20202035
}
2036+
if (lib.uniffi_ldk_node_checksum_method_onchainpayment_select_utxos_with_algorithm() != 14084.toShort()) {
2037+
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
2038+
}
20212039
if (lib.uniffi_ldk_node_checksum_method_onchainpayment_send_all_to_address() != 37748.toShort()) {
20222040
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
20232041
}
2024-
if (lib.uniffi_ldk_node_checksum_method_onchainpayment_send_to_address() != 55646.toShort()) {
2042+
if (lib.uniffi_ldk_node_checksum_method_onchainpayment_send_to_address() != 28826.toShort()) {
20252043
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
20262044
}
20272045
if (lib.uniffi_ldk_node_checksum_method_spontaneouspayment_send() != 48210.toShort()) {
@@ -6006,11 +6024,15 @@ public interface OnchainPaymentInterface {
60066024

60076025
fun `bumpFeeByRbf`(`txid`: Txid, `feeRate`: FeeRate): Txid
60086026

6027+
fun `listSpendableOutputs`(): List<SpendableUtxo>
6028+
60096029
fun `newAddress`(): Address
60106030

6031+
fun `selectUtxosWithAlgorithm`(`targetAmountSats`: kotlin.ULong, `feeRate`: FeeRate?, `algorithm`: CoinSelectionAlgorithm, `utxos`: List<SpendableUtxo>?): List<SpendableUtxo>
6032+
60116033
fun `sendAllToAddress`(`address`: Address, `retainReserve`: kotlin.Boolean, `feeRate`: FeeRate?): Txid
60126034

6013-
fun `sendToAddress`(`address`: Address, `amountSats`: kotlin.ULong, `feeRate`: FeeRate?): Txid
6035+
fun `sendToAddress`(`address`: Address, `amountSats`: kotlin.ULong, `feeRate`: FeeRate?, `utxosToSpend`: List<SpendableUtxo>?): Txid
60146036

60156037
companion object
60166038
}
@@ -6123,6 +6145,19 @@ open class OnchainPayment: Disposable, AutoCloseable, OnchainPaymentInterface {
61236145

61246146

61256147

6148+
@Throws(NodeException::class)override fun `listSpendableOutputs`(): List<SpendableUtxo> {
6149+
return FfiConverterSequenceTypeSpendableUtxo.lift(
6150+
callWithPointer {
6151+
uniffiRustCallWithError(NodeException) { _status ->
6152+
UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_onchainpayment_list_spendable_outputs(
6153+
it, _status)
6154+
}
6155+
}
6156+
)
6157+
}
6158+
6159+
6160+
61266161
@Throws(NodeException::class)override fun `newAddress`(): Address {
61276162
return FfiConverterTypeAddress.lift(
61286163
callWithPointer {
@@ -6136,6 +6171,19 @@ open class OnchainPayment: Disposable, AutoCloseable, OnchainPaymentInterface {
61366171

61376172

61386173

6174+
@Throws(NodeException::class)override fun `selectUtxosWithAlgorithm`(`targetAmountSats`: kotlin.ULong, `feeRate`: FeeRate?, `algorithm`: CoinSelectionAlgorithm, `utxos`: List<SpendableUtxo>?): List<SpendableUtxo> {
6175+
return FfiConverterSequenceTypeSpendableUtxo.lift(
6176+
callWithPointer {
6177+
uniffiRustCallWithError(NodeException) { _status ->
6178+
UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_onchainpayment_select_utxos_with_algorithm(
6179+
it, FfiConverterULong.lower(`targetAmountSats`),FfiConverterOptionalTypeFeeRate.lower(`feeRate`),FfiConverterTypeCoinSelectionAlgorithm.lower(`algorithm`),FfiConverterOptionalSequenceTypeSpendableUtxo.lower(`utxos`),_status)
6180+
}
6181+
}
6182+
)
6183+
}
6184+
6185+
6186+
61396187
@Throws(NodeException::class)override fun `sendAllToAddress`(`address`: Address, `retainReserve`: kotlin.Boolean, `feeRate`: FeeRate?): Txid {
61406188
return FfiConverterTypeTxid.lift(
61416189
callWithPointer {
@@ -6149,12 +6197,12 @@ open class OnchainPayment: Disposable, AutoCloseable, OnchainPaymentInterface {
61496197

61506198

61516199

6152-
@Throws(NodeException::class)override fun `sendToAddress`(`address`: Address, `amountSats`: kotlin.ULong, `feeRate`: FeeRate?): Txid {
6200+
@Throws(NodeException::class)override fun `sendToAddress`(`address`: Address, `amountSats`: kotlin.ULong, `feeRate`: FeeRate?, `utxosToSpend`: List<SpendableUtxo>?): Txid {
61536201
return FfiConverterTypeTxid.lift(
61546202
callWithPointer {
61556203
uniffiRustCallWithError(NodeException) { _status ->
61566204
UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_onchainpayment_send_to_address(
6157-
it, FfiConverterTypeAddress.lower(`address`),FfiConverterULong.lower(`amountSats`),FfiConverterOptionalTypeFeeRate.lower(`feeRate`),_status)
6205+
it, FfiConverterTypeAddress.lower(`address`),FfiConverterULong.lower(`amountSats`),FfiConverterOptionalTypeFeeRate.lower(`feeRate`),FfiConverterOptionalSequenceTypeSpendableUtxo.lower(`utxosToSpend`),_status)
61586206
}
61596207
}
61606208
)
@@ -8248,6 +8296,35 @@ public object FfiConverterTypeSendingParameters: FfiConverterRustBuffer<SendingP
82488296

82498297

82508298

8299+
data class SpendableUtxo (
8300+
var `outpoint`: OutPoint,
8301+
var `valueSats`: kotlin.ULong
8302+
) {
8303+
8304+
companion object
8305+
}
8306+
8307+
public object FfiConverterTypeSpendableUtxo: FfiConverterRustBuffer<SpendableUtxo> {
8308+
override fun read(buf: ByteBuffer): SpendableUtxo {
8309+
return SpendableUtxo(
8310+
FfiConverterTypeOutPoint.read(buf),
8311+
FfiConverterULong.read(buf),
8312+
)
8313+
}
8314+
8315+
override fun allocationSize(value: SpendableUtxo) = (
8316+
FfiConverterTypeOutPoint.allocationSize(value.`outpoint`) +
8317+
FfiConverterULong.allocationSize(value.`valueSats`)
8318+
)
8319+
8320+
override fun write(value: SpendableUtxo, buf: ByteBuffer) {
8321+
FfiConverterTypeOutPoint.write(value.`outpoint`, buf)
8322+
FfiConverterULong.write(value.`valueSats`, buf)
8323+
}
8324+
}
8325+
8326+
8327+
82518328

82528329
enum class BalanceSource {
82538330

@@ -8725,6 +8802,35 @@ public object FfiConverterTypeClosureReason : FfiConverterRustBuffer<ClosureReas
87258802

87268803

87278804

8805+
8806+
enum class CoinSelectionAlgorithm {
8807+
8808+
BRANCH_AND_BOUND,
8809+
LARGEST_FIRST,
8810+
OLDEST_FIRST,
8811+
SINGLE_RANDOM_DRAW;
8812+
companion object
8813+
}
8814+
8815+
8816+
public object FfiConverterTypeCoinSelectionAlgorithm: FfiConverterRustBuffer<CoinSelectionAlgorithm> {
8817+
override fun read(buf: ByteBuffer) = try {
8818+
CoinSelectionAlgorithm.values()[buf.getInt() - 1]
8819+
} catch (e: IndexOutOfBoundsException) {
8820+
throw RuntimeException("invalid enum value, something is very wrong!!", e)
8821+
}
8822+
8823+
override fun allocationSize(value: CoinSelectionAlgorithm) = 4UL
8824+
8825+
override fun write(value: CoinSelectionAlgorithm, buf: ByteBuffer) {
8826+
buf.putInt(value.ordinal + 1)
8827+
}
8828+
}
8829+
8830+
8831+
8832+
8833+
87288834
sealed class ConfirmationStatus {
87298835

87308836
data class Confirmed(
@@ -9690,6 +9796,8 @@ sealed class NodeException(message: String): Exception(message) {
96909796

96919797
class NoSpendableOutputs(message: String) : NodeException(message)
96929798

9799+
class CoinSelectionFailed(message: String) : NodeException(message)
9800+
96939801

96949802
companion object ErrorHandler : UniffiRustCallStatusErrorHandler<NodeException> {
96959803
override fun lift(error_buf: RustBuffer.ByValue): NodeException = FfiConverterTypeNodeError.lift(error_buf)
@@ -9756,6 +9864,7 @@ public object FfiConverterTypeNodeError : FfiConverterRustBuffer<NodeException>
97569864
54 -> NodeException.TransactionNotFound(FfiConverterString.read(buf))
97579865
55 -> NodeException.TransactionAlreadyConfirmed(FfiConverterString.read(buf))
97589866
56 -> NodeException.NoSpendableOutputs(FfiConverterString.read(buf))
9867+
57 -> NodeException.CoinSelectionFailed(FfiConverterString.read(buf))
97599868
else -> throw RuntimeException("invalid error enum value, something is very wrong!!")
97609869
}
97619870

@@ -9991,6 +10100,10 @@ public object FfiConverterTypeNodeError : FfiConverterRustBuffer<NodeException>
999110100
buf.putInt(56)
999210101
Unit
999310102
}
10103+
is NodeException.CoinSelectionFailed -> {
10104+
buf.putInt(57)
10105+
Unit
10106+
}
999410107
}.let { /* this makes the `when` an expression, which ensures it is exhaustive */ }
999510108
}
999610109

@@ -11381,6 +11494,35 @@ public object FfiConverterOptionalTypePaymentFailureReason: FfiConverterRustBuff
1138111494

1138211495

1138311496

11497+
public object FfiConverterOptionalSequenceTypeSpendableUtxo: FfiConverterRustBuffer<List<SpendableUtxo>?> {
11498+
override fun read(buf: ByteBuffer): List<SpendableUtxo>? {
11499+
if (buf.get().toInt() == 0) {
11500+
return null
11501+
}
11502+
return FfiConverterSequenceTypeSpendableUtxo.read(buf)
11503+
}
11504+
11505+
override fun allocationSize(value: List<SpendableUtxo>?): ULong {
11506+
if (value == null) {
11507+
return 1UL
11508+
} else {
11509+
return 1UL + FfiConverterSequenceTypeSpendableUtxo.allocationSize(value)
11510+
}
11511+
}
11512+
11513+
override fun write(value: List<SpendableUtxo>?, buf: ByteBuffer) {
11514+
if (value == null) {
11515+
buf.put(0)
11516+
} else {
11517+
buf.put(1)
11518+
FfiConverterSequenceTypeSpendableUtxo.write(value, buf)
11519+
}
11520+
}
11521+
}
11522+
11523+
11524+
11525+
1138411526
public object FfiConverterOptionalSequenceTypeSocketAddress: FfiConverterRustBuffer<List<SocketAddress>?> {
1138511527
override fun read(buf: ByteBuffer): List<SocketAddress>? {
1138611528
if (buf.get().toInt() == 0) {
@@ -11875,6 +12017,31 @@ public object FfiConverterSequenceTypeRouteHintHop: FfiConverterRustBuffer<List<
1187512017

1187612018

1187712019

12020+
public object FfiConverterSequenceTypeSpendableUtxo: FfiConverterRustBuffer<List<SpendableUtxo>> {
12021+
override fun read(buf: ByteBuffer): List<SpendableUtxo> {
12022+
val len = buf.getInt()
12023+
return List<SpendableUtxo>(len) {
12024+
FfiConverterTypeSpendableUtxo.read(buf)
12025+
}
12026+
}
12027+
12028+
override fun allocationSize(value: List<SpendableUtxo>): ULong {
12029+
val sizeForLength = 4UL
12030+
val sizeForItems = value.map { FfiConverterTypeSpendableUtxo.allocationSize(it) }.sum()
12031+
return sizeForLength + sizeForItems
12032+
}
12033+
12034+
override fun write(value: List<SpendableUtxo>, buf: ByteBuffer) {
12035+
buf.putInt(value.size)
12036+
value.iterator().forEach {
12037+
FfiConverterTypeSpendableUtxo.write(it, buf)
12038+
}
12039+
}
12040+
}
12041+
12042+
12043+
12044+
1187812045
public object FfiConverterSequenceTypeLightningBalance: FfiConverterRustBuffer<List<LightningBalance>> {
1187912046
override fun read(buf: ByteBuffer): List<LightningBalance> {
1188012047
val len = buf.getInt()

0 commit comments

Comments
 (0)