Skip to content

Commit 857056a

Browse files
committed
feat: update address types dynamically
1 parent 83015a3 commit 857056a

30 files changed

Lines changed: 1501 additions & 72 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# 0.7.0-rc.22 (Synonym Fork)
1+
# 0.7.0-rc.23 (Synonym Fork)
22

33
## Bug Fixes
44

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ exclude = ["bindings/uniffi-bindgen"]
44

55
[package]
66
name = "ldk-node"
7-
version = "0.7.0-rc.22"
7+
version = "0.7.0-rc.23"
88
authors = ["Elias Rohrer <dev@tnull.de>"]
99
homepage = "https://lightningdevkit.org/"
1010
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.7.0-rc.22"
7-
let checksum = "3ec3b86365ecfb925cf00c5268bf92176188f06db04a4775c76f249e2cffabfd"
6+
let tag = "v0.7.0-rc.23"
7+
let checksum = "0758d151182547c1afc75731b736edd0040cbf70806e3db76cf0a780a610009e"
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/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=0.7.0-rc.22
5+
libraryVersion=0.7.0-rc.23
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.android.kt

Lines changed: 157 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1497,6 +1497,16 @@ internal typealias UniffiVTableCallbackInterfaceVssHeaderProviderUniffiByValue =
14971497

14981498

14991499

1500+
1501+
1502+
1503+
1504+
1505+
1506+
1507+
1508+
1509+
15001510

15011511

15021512

@@ -2192,6 +2202,19 @@ internal interface UniffiLib : Library {
21922202
`ptr`: Pointer?,
21932203
uniffiCallStatus: UniffiRustCallStatus,
21942204
): Unit
2205+
fun uniffi_ldk_node_fn_method_node_add_address_type_to_monitor(
2206+
`ptr`: Pointer?,
2207+
`addressType`: RustBufferByValue,
2208+
`seedBytes`: RustBufferByValue,
2209+
uniffiCallStatus: UniffiRustCallStatus,
2210+
): Unit
2211+
fun uniffi_ldk_node_fn_method_node_add_address_type_to_monitor_with_mnemonic(
2212+
`ptr`: Pointer?,
2213+
`addressType`: RustBufferByValue,
2214+
`mnemonic`: RustBufferByValue,
2215+
`passphrase`: RustBufferByValue,
2216+
uniffiCallStatus: UniffiRustCallStatus,
2217+
): Unit
21952218
fun uniffi_ldk_node_fn_method_node_announcement_addresses(
21962219
`ptr`: Pointer?,
21972220
uniffiCallStatus: UniffiRustCallStatus,
@@ -2334,11 +2357,29 @@ internal interface UniffiLib : Library {
23342357
`paymentId`: RustBufferByValue,
23352358
uniffiCallStatus: UniffiRustCallStatus,
23362359
): RustBufferByValue
2360+
fun uniffi_ldk_node_fn_method_node_remove_address_type_from_monitor(
2361+
`ptr`: Pointer?,
2362+
`addressType`: RustBufferByValue,
2363+
uniffiCallStatus: UniffiRustCallStatus,
2364+
): Unit
23372365
fun uniffi_ldk_node_fn_method_node_remove_payment(
23382366
`ptr`: Pointer?,
23392367
`paymentId`: RustBufferByValue,
23402368
uniffiCallStatus: UniffiRustCallStatus,
23412369
): Unit
2370+
fun uniffi_ldk_node_fn_method_node_set_primary_address_type(
2371+
`ptr`: Pointer?,
2372+
`addressType`: RustBufferByValue,
2373+
`seedBytes`: RustBufferByValue,
2374+
uniffiCallStatus: UniffiRustCallStatus,
2375+
): Unit
2376+
fun uniffi_ldk_node_fn_method_node_set_primary_address_type_with_mnemonic(
2377+
`ptr`: Pointer?,
2378+
`addressType`: RustBufferByValue,
2379+
`mnemonic`: RustBufferByValue,
2380+
`passphrase`: RustBufferByValue,
2381+
uniffiCallStatus: UniffiRustCallStatus,
2382+
): Unit
23422383
fun uniffi_ldk_node_fn_method_node_sign_message(
23432384
`ptr`: Pointer?,
23442385
`msg`: RustBufferByValue,
@@ -3141,6 +3182,10 @@ internal interface UniffiLib : Library {
31413182
): Short
31423183
fun uniffi_ldk_node_checksum_method_networkgraph_node(
31433184
): Short
3185+
fun uniffi_ldk_node_checksum_method_node_add_address_type_to_monitor(
3186+
): Short
3187+
fun uniffi_ldk_node_checksum_method_node_add_address_type_to_monitor_with_mnemonic(
3188+
): Short
31443189
fun uniffi_ldk_node_checksum_method_node_announcement_addresses(
31453190
): Short
31463191
fun uniffi_ldk_node_checksum_method_node_bolt11_payment(
@@ -3201,8 +3246,14 @@ internal interface UniffiLib : Library {
32013246
): Short
32023247
fun uniffi_ldk_node_checksum_method_node_payment(
32033248
): Short
3249+
fun uniffi_ldk_node_checksum_method_node_remove_address_type_from_monitor(
3250+
): Short
32043251
fun uniffi_ldk_node_checksum_method_node_remove_payment(
32053252
): Short
3253+
fun uniffi_ldk_node_checksum_method_node_set_primary_address_type(
3254+
): Short
3255+
fun uniffi_ldk_node_checksum_method_node_set_primary_address_type_with_mnemonic(
3256+
): Short
32063257
fun uniffi_ldk_node_checksum_method_node_sign_message(
32073258
): Short
32083259
fun uniffi_ldk_node_checksum_method_node_splice_in(
@@ -3654,6 +3705,12 @@ private fun uniffiCheckApiChecksums(lib: UniffiLib) {
36543705
if (lib.uniffi_ldk_node_checksum_method_networkgraph_node() != 48925.toShort()) {
36553706
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
36563707
}
3708+
if (lib.uniffi_ldk_node_checksum_method_node_add_address_type_to_monitor() != 14706.toShort()) {
3709+
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
3710+
}
3711+
if (lib.uniffi_ldk_node_checksum_method_node_add_address_type_to_monitor_with_mnemonic() != 4517.toShort()) {
3712+
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
3713+
}
36573714
if (lib.uniffi_ldk_node_checksum_method_node_announcement_addresses() != 61426.toShort()) {
36583715
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
36593716
}
@@ -3744,9 +3801,18 @@ private fun uniffiCheckApiChecksums(lib: UniffiLib) {
37443801
if (lib.uniffi_ldk_node_checksum_method_node_payment() != 60296.toShort()) {
37453802
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
37463803
}
3804+
if (lib.uniffi_ldk_node_checksum_method_node_remove_address_type_from_monitor() != 37081.toShort()) {
3805+
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
3806+
}
37473807
if (lib.uniffi_ldk_node_checksum_method_node_remove_payment() != 47952.toShort()) {
37483808
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
37493809
}
3810+
if (lib.uniffi_ldk_node_checksum_method_node_set_primary_address_type() != 11005.toShort()) {
3811+
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
3812+
}
3813+
if (lib.uniffi_ldk_node_checksum_method_node_set_primary_address_type_with_mnemonic() != 50783.toShort()) {
3814+
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
3815+
}
37503816
if (lib.uniffi_ldk_node_checksum_method_node_sign_message() != 49319.toShort()) {
37513817
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
37523818
}
@@ -6887,6 +6953,35 @@ open class Node: Disposable, NodeInterface {
68876953
}
68886954

68896955

6956+
@Throws(NodeException::class)
6957+
override fun `addAddressTypeToMonitor`(`addressType`: AddressType, `seedBytes`: List<kotlin.UByte>) {
6958+
callWithPointer {
6959+
uniffiRustCallWithError(NodeExceptionErrorHandler) { uniffiRustCallStatus ->
6960+
UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_node_add_address_type_to_monitor(
6961+
it,
6962+
FfiConverterTypeAddressType.lower(`addressType`),
6963+
FfiConverterSequenceUByte.lower(`seedBytes`),
6964+
uniffiRustCallStatus,
6965+
)
6966+
}
6967+
}
6968+
}
6969+
6970+
@Throws(NodeException::class)
6971+
override fun `addAddressTypeToMonitorWithMnemonic`(`addressType`: AddressType, `mnemonic`: Mnemonic, `passphrase`: kotlin.String?) {
6972+
callWithPointer {
6973+
uniffiRustCallWithError(NodeExceptionErrorHandler) { uniffiRustCallStatus ->
6974+
UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_node_add_address_type_to_monitor_with_mnemonic(
6975+
it,
6976+
FfiConverterTypeAddressType.lower(`addressType`),
6977+
FfiConverterTypeMnemonic.lower(`mnemonic`),
6978+
FfiConverterOptionalString.lower(`passphrase`),
6979+
uniffiRustCallStatus,
6980+
)
6981+
}
6982+
}
6983+
}
6984+
68906985
override fun `announcementAddresses`(): List<SocketAddress>? {
68916986
return FfiConverterOptionalSequenceTypeSocketAddress.lift(callWithPointer {
68926987
uniffiRustCall { uniffiRustCallStatus ->
@@ -7257,6 +7352,19 @@ open class Node: Disposable, NodeInterface {
72577352
})
72587353
}
72597354

7355+
@Throws(NodeException::class)
7356+
override fun `removeAddressTypeFromMonitor`(`addressType`: AddressType) {
7357+
callWithPointer {
7358+
uniffiRustCallWithError(NodeExceptionErrorHandler) { uniffiRustCallStatus ->
7359+
UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_node_remove_address_type_from_monitor(
7360+
it,
7361+
FfiConverterTypeAddressType.lower(`addressType`),
7362+
uniffiRustCallStatus,
7363+
)
7364+
}
7365+
}
7366+
}
7367+
72607368
@Throws(NodeException::class)
72617369
override fun `removePayment`(`paymentId`: PaymentId) {
72627370
callWithPointer {
@@ -7270,6 +7378,35 @@ open class Node: Disposable, NodeInterface {
72707378
}
72717379
}
72727380

7381+
@Throws(NodeException::class)
7382+
override fun `setPrimaryAddressType`(`addressType`: AddressType, `seedBytes`: List<kotlin.UByte>) {
7383+
callWithPointer {
7384+
uniffiRustCallWithError(NodeExceptionErrorHandler) { uniffiRustCallStatus ->
7385+
UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_node_set_primary_address_type(
7386+
it,
7387+
FfiConverterTypeAddressType.lower(`addressType`),
7388+
FfiConverterSequenceUByte.lower(`seedBytes`),
7389+
uniffiRustCallStatus,
7390+
)
7391+
}
7392+
}
7393+
}
7394+
7395+
@Throws(NodeException::class)
7396+
override fun `setPrimaryAddressTypeWithMnemonic`(`addressType`: AddressType, `mnemonic`: Mnemonic, `passphrase`: kotlin.String?) {
7397+
callWithPointer {
7398+
uniffiRustCallWithError(NodeExceptionErrorHandler) { uniffiRustCallStatus ->
7399+
UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_node_set_primary_address_type_with_mnemonic(
7400+
it,
7401+
FfiConverterTypeAddressType.lower(`addressType`),
7402+
FfiConverterTypeMnemonic.lower(`mnemonic`),
7403+
FfiConverterOptionalString.lower(`passphrase`),
7404+
uniffiRustCallStatus,
7405+
)
7406+
}
7407+
}
7408+
}
7409+
72737410
override fun `signMessage`(`msg`: List<kotlin.UByte>): kotlin.String {
72747411
return FfiConverterString.lift(callWithPointer {
72757412
uniffiRustCall { uniffiRustCallStatus ->
@@ -11319,6 +11456,10 @@ object FfiConverterTypeNodeError : FfiConverterRustBuffer<NodeException> {
1131911456
61 -> NodeException.CoinSelectionFailed(FfiConverterString.read(buf))
1132011457
62 -> NodeException.InvalidMnemonic(FfiConverterString.read(buf))
1132111458
63 -> NodeException.BackgroundSyncNotEnabled(FfiConverterString.read(buf))
11459+
64 -> NodeException.AddressTypeAlreadyMonitored(FfiConverterString.read(buf))
11460+
65 -> NodeException.AddressTypeIsPrimary(FfiConverterString.read(buf))
11461+
66 -> NodeException.AddressTypeNotMonitored(FfiConverterString.read(buf))
11462+
67 -> NodeException.InvalidSeedBytes(FfiConverterString.read(buf))
1132211463
else -> throw RuntimeException("invalid error enum value, something is very wrong!!")
1132311464
}
1132411465
}
@@ -11581,6 +11722,22 @@ object FfiConverterTypeNodeError : FfiConverterRustBuffer<NodeException> {
1158111722
buf.putInt(63)
1158211723
Unit
1158311724
}
11725+
is NodeException.AddressTypeAlreadyMonitored -> {
11726+
buf.putInt(64)
11727+
Unit
11728+
}
11729+
is NodeException.AddressTypeIsPrimary -> {
11730+
buf.putInt(65)
11731+
Unit
11732+
}
11733+
is NodeException.AddressTypeNotMonitored -> {
11734+
buf.putInt(66)
11735+
Unit
11736+
}
11737+
is NodeException.InvalidSeedBytes -> {
11738+
buf.putInt(67)
11739+
Unit
11740+
}
1158411741
}.let { /* this makes the `when` an expression, which ensures it is exhaustive */ }
1158511742
}
1158611743
}

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

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -414,6 +414,12 @@ interface NetworkGraphInterface {
414414

415415
interface NodeInterface {
416416

417+
@Throws(NodeException::class)
418+
fun `addAddressTypeToMonitor`(`addressType`: AddressType, `seedBytes`: List<kotlin.UByte>)
419+
420+
@Throws(NodeException::class)
421+
fun `addAddressTypeToMonitorWithMnemonic`(`addressType`: AddressType, `mnemonic`: Mnemonic, `passphrase`: kotlin.String?)
422+
417423
fun `announcementAddresses`(): List<SocketAddress>?
418424

419425
fun `bolt11Payment`(): Bolt11Payment
@@ -484,9 +490,18 @@ interface NodeInterface {
484490

485491
fun `payment`(`paymentId`: PaymentId): PaymentDetails?
486492

493+
@Throws(NodeException::class)
494+
fun `removeAddressTypeFromMonitor`(`addressType`: AddressType)
495+
487496
@Throws(NodeException::class)
488497
fun `removePayment`(`paymentId`: PaymentId)
489498

499+
@Throws(NodeException::class)
500+
fun `setPrimaryAddressType`(`addressType`: AddressType, `seedBytes`: List<kotlin.UByte>)
501+
502+
@Throws(NodeException::class)
503+
fun `setPrimaryAddressTypeWithMnemonic`(`addressType`: AddressType, `mnemonic`: Mnemonic, `passphrase`: kotlin.String?)
504+
490505
fun `signMessage`(`msg`: List<kotlin.UByte>): kotlin.String
491506

492507
@Throws(NodeException::class)
@@ -1842,6 +1857,14 @@ sealed class NodeException(message: String): kotlin.Exception(message) {
18421857

18431858
class BackgroundSyncNotEnabled(message: String) : NodeException(message)
18441859

1860+
class AddressTypeAlreadyMonitored(message: String) : NodeException(message)
1861+
1862+
class AddressTypeIsPrimary(message: String) : NodeException(message)
1863+
1864+
class AddressTypeNotMonitored(message: String) : NodeException(message)
1865+
1866+
class InvalidSeedBytes(message: String) : NodeException(message)
1867+
18451868
}
18461869

18471870

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
org.gradle.jvmargs=-Xmx1536m
22
kotlin.code.style=official
3-
libraryVersion=0.7.0-rc.22
3+
libraryVersion=0.7.0-rc.23

0 commit comments

Comments
 (0)