diff --git a/Cargo.toml b/Cargo.toml index 0e32a2f19..688e88333 100755 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "ldk-node" -version = "0.6.2-rc.1" +version = "0.6.2-rc.3" authors = ["Elias Rohrer "] homepage = "https://lightningdevkit.org/" license = "MIT OR Apache-2.0" diff --git a/Package.swift b/Package.swift index 76f885290..2534d4bda 100644 --- a/Package.swift +++ b/Package.swift @@ -3,8 +3,8 @@ import PackageDescription -let tag = "v0.6.2-rc.1" -let checksum = "9aeeb548ddf2b3699fcb07b3bbb99d691d4361a45f53a2eee473fcaacc7f1db9" +let tag = "v0.6.2-rc.3" +let checksum = "ee0ccf65c286d652afc72cc613f7477f1c2c65faaf1774c5a8e21141b64b226b" let url = "https://github.com/synonymdev/ldk-node/releases/download/\(tag)/LDKNodeFFI.xcframework.zip" let package = Package( diff --git a/bindings/kotlin/ldk-node-android/lib/src/main/jniLibs/arm64-v8a/libldk_node.so b/bindings/kotlin/ldk-node-android/lib/src/main/jniLibs/arm64-v8a/libldk_node.so index 581cfd036..1da09b020 100755 Binary files a/bindings/kotlin/ldk-node-android/lib/src/main/jniLibs/arm64-v8a/libldk_node.so and b/bindings/kotlin/ldk-node-android/lib/src/main/jniLibs/arm64-v8a/libldk_node.so differ diff --git a/bindings/kotlin/ldk-node-android/lib/src/main/jniLibs/armeabi-v7a/libldk_node.so b/bindings/kotlin/ldk-node-android/lib/src/main/jniLibs/armeabi-v7a/libldk_node.so index 44c9a5582..2eb8c5398 100755 Binary files a/bindings/kotlin/ldk-node-android/lib/src/main/jniLibs/armeabi-v7a/libldk_node.so and b/bindings/kotlin/ldk-node-android/lib/src/main/jniLibs/armeabi-v7a/libldk_node.so differ diff --git a/bindings/kotlin/ldk-node-android/lib/src/main/jniLibs/x86_64/libldk_node.so b/bindings/kotlin/ldk-node-android/lib/src/main/jniLibs/x86_64/libldk_node.so index db5de959b..e6e3e944e 100755 Binary files a/bindings/kotlin/ldk-node-android/lib/src/main/jniLibs/x86_64/libldk_node.so and b/bindings/kotlin/ldk-node-android/lib/src/main/jniLibs/x86_64/libldk_node.so differ diff --git a/bindings/kotlin/ldk-node-android/lib/src/main/kotlin/org/lightningdevkit/ldknode/ldk_node.kt b/bindings/kotlin/ldk-node-android/lib/src/main/kotlin/org/lightningdevkit/ldknode/ldk_node.kt index f199708d9..64d078e86 100644 --- a/bindings/kotlin/ldk-node-android/lib/src/main/kotlin/org/lightningdevkit/ldknode/ldk_node.kt +++ b/bindings/kotlin/ldk-node-android/lib/src/main/kotlin/org/lightningdevkit/ldknode/ldk_node.kt @@ -3,7 +3,7 @@ @file:Suppress("NAME_SHADOWING") -package org.lightningdevkit.ldknode +package org.lightningdevkit.ldknode; // Common helper code. // @@ -17,29 +17,29 @@ package org.lightningdevkit.ldknode // compile the Rust component. The easiest way to ensure this is to bundle the Kotlin // helpers directly inline like we're doing here. -import android.os.Build -import androidx.annotation.RequiresApi -import com.sun.jna.Callback -import com.sun.jna.IntegerType import com.sun.jna.Library +import com.sun.jna.IntegerType import com.sun.jna.Native import com.sun.jna.Pointer import com.sun.jna.Structure +import com.sun.jna.Callback import com.sun.jna.ptr.* -import kotlinx.coroutines.CancellableContinuation -import kotlinx.coroutines.DelicateCoroutinesApi -import kotlinx.coroutines.GlobalScope -import kotlinx.coroutines.Job -import kotlinx.coroutines.launch -import kotlinx.coroutines.suspendCancellableCoroutine import java.nio.ByteBuffer import java.nio.ByteOrder import java.nio.CharBuffer import java.nio.charset.CodingErrorAction +import java.util.concurrent.atomic.AtomicLong import java.util.concurrent.ConcurrentHashMap +import android.os.Build +import androidx.annotation.RequiresApi import java.util.concurrent.atomic.AtomicBoolean -import java.util.concurrent.atomic.AtomicLong import kotlin.coroutines.resume +import kotlinx.coroutines.CancellableContinuation +import kotlinx.coroutines.DelicateCoroutinesApi +import kotlinx.coroutines.GlobalScope +import kotlinx.coroutines.Job +import kotlinx.coroutines.launch +import kotlinx.coroutines.suspendCancellableCoroutine // This is a helper for safely working with byte buffers returned from the Rust code. // A rust-owned buffer is represented by its capacity, its current length, and a @@ -50,41 +50,29 @@ open class RustBuffer : Structure() { // Note: `capacity` and `len` are actually `ULong` values, but JVM only supports signed values. // When dealing with these fields, make sure to call `toULong()`. @JvmField var capacity: Long = 0 - @JvmField var len: Long = 0 - @JvmField var data: Pointer? = null - class ByValue : - RustBuffer(), - Structure.ByValue + class ByValue: RustBuffer(), Structure.ByValue + class ByReference: RustBuffer(), Structure.ByReference - class ByReference : - RustBuffer(), - Structure.ByReference - - internal fun setValue(other: RustBuffer) { + internal fun setValue(other: RustBuffer) { capacity = other.capacity len = other.len data = other.data } companion object { - internal fun alloc(size: ULong = 0UL) = - uniffiRustCall { status -> - // Note: need to convert the size to a `Long` value to make this work with JVM. - UniffiLib.INSTANCE.ffi_ldk_node_rustbuffer_alloc(size.toLong(), status) - }.also { - if (it.data == null) { - throw RuntimeException("RustBuffer.alloc() returned null data pointer (size=$size)") - } - } + internal fun alloc(size: ULong = 0UL) = uniffiRustCall() { status -> + // Note: need to convert the size to a `Long` value to make this work with JVM. + UniffiLib.INSTANCE.ffi_ldk_node_rustbuffer_alloc(size.toLong(), status) + }.also { + if(it.data == null) { + throw RuntimeException("RustBuffer.alloc() returned null data pointer (size=${size})") + } + } - internal fun create( - capacity: ULong, - len: ULong, - data: Pointer?, - ): RustBuffer.ByValue { + internal fun create(capacity: ULong, len: ULong, data: Pointer?): RustBuffer.ByValue { var buf = RustBuffer.ByValue() buf.capacity = capacity.toLong() buf.len = len.toLong() @@ -92,10 +80,9 @@ open class RustBuffer : Structure() { return buf } - internal fun free(buf: RustBuffer.ByValue) = - uniffiRustCall { status -> - UniffiLib.INSTANCE.ffi_ldk_node_rustbuffer_free(buf, status) - } + internal fun free(buf: RustBuffer.ByValue) = uniffiRustCall() { status -> + UniffiLib.INSTANCE.ffi_ldk_node_rustbuffer_free(buf, status) + } } @Suppress("TooGenericExceptionThrown") @@ -146,14 +133,10 @@ class RustBufferByReference : ByReference(16) { @Structure.FieldOrder("len", "data") open class ForeignBytes : Structure() { @JvmField var len: Int = 0 - @JvmField var data: Pointer? = null - class ByValue : - ForeignBytes(), - Structure.ByValue + class ByValue : ForeignBytes(), Structure.ByValue } - // The FfiConverter interface handles converter types to and from the FFI // // All implementing objects should be public to support external types. When a @@ -179,10 +162,7 @@ public interface FfiConverter { fun allocationSize(value: KotlinType): ULong // Write a Kotlin type to a `ByteBuffer` - fun write( - value: KotlinType, - buf: ByteBuffer, - ) + fun write(value: KotlinType, buf: ByteBuffer) // Lower a value into a `RustBuffer` // @@ -193,10 +173,9 @@ public interface FfiConverter { fun lowerIntoRustBuffer(value: KotlinType): RustBuffer.ByValue { val rbuf = RustBuffer.alloc(allocationSize(value)) try { - val bbuf = - rbuf.data!!.getByteBuffer(0, rbuf.capacity).also { - it.order(ByteOrder.BIG_ENDIAN) - } + val bbuf = rbuf.data!!.getByteBuffer(0, rbuf.capacity).also { + it.order(ByteOrder.BIG_ENDIAN) + } write(value, bbuf) rbuf.writeField("len", bbuf.position().toLong()) return rbuf @@ -213,11 +192,11 @@ public interface FfiConverter { fun liftFromRustBuffer(rbuf: RustBuffer.ByValue): KotlinType { val byteBuf = rbuf.asByteBuffer()!! try { - val item = read(byteBuf) - if (byteBuf.hasRemaining()) { - throw RuntimeException("junk remaining in buffer after lifting, something is very wrong!!") - } - return item + val item = read(byteBuf) + if (byteBuf.hasRemaining()) { + throw RuntimeException("junk remaining in buffer after lifting, something is very wrong!!") + } + return item } finally { RustBuffer.free(rbuf) } @@ -225,9 +204,8 @@ public interface FfiConverter { } // FfiConverter that uses `RustBuffer` as the FfiType -public interface FfiConverterRustBuffer : FfiConverter { +public interface FfiConverterRustBuffer: FfiConverter { override fun lift(value: RustBuffer.ByValue) = liftFromRustBuffer(value) - override fun lower(value: KotlinType) = lowerIntoRustBuffer(value) } // A handful of classes and functions to support the generated data structures. @@ -240,24 +218,24 @@ internal const val UNIFFI_CALL_UNEXPECTED_ERROR = 2.toByte() @Structure.FieldOrder("code", "error_buf") internal open class UniffiRustCallStatus : Structure() { @JvmField var code: Byte = 0 - @JvmField var error_buf: RustBuffer.ByValue = RustBuffer.ByValue() - class ByValue : - UniffiRustCallStatus(), - Structure.ByValue + class ByValue: UniffiRustCallStatus(), Structure.ByValue - fun isSuccess(): Boolean = code == UNIFFI_CALL_SUCCESS + fun isSuccess(): Boolean { + return code == UNIFFI_CALL_SUCCESS + } - fun isError(): Boolean = code == UNIFFI_CALL_ERROR + fun isError(): Boolean { + return code == UNIFFI_CALL_ERROR + } - fun isPanic(): Boolean = code == UNIFFI_CALL_UNEXPECTED_ERROR + fun isPanic(): Boolean { + return code == UNIFFI_CALL_UNEXPECTED_ERROR + } companion object { - fun create( - code: Byte, - errorBuf: RustBuffer.ByValue, - ): UniffiRustCallStatus.ByValue { + fun create(code: Byte, errorBuf: RustBuffer.ByValue): UniffiRustCallStatus.ByValue { val callStatus = UniffiRustCallStatus.ByValue() callStatus.code = code callStatus.error_buf = errorBuf @@ -266,13 +244,11 @@ internal open class UniffiRustCallStatus : Structure() { } } -class InternalException( - message: String, -) : Exception(message) +class InternalException(message: String) : Exception(message) // Each top-level error class has a companion object that can lift the error from the call status's rust buffer interface UniffiRustCallStatusErrorHandler { - fun lift(error_buf: RustBuffer.ByValue): E + fun lift(error_buf: RustBuffer.ByValue): E; } // Helpers for calling Rust @@ -280,21 +256,15 @@ interface UniffiRustCallStatusErrorHandler { // synchronize itself // Call a rust function that returns a Result<>. Pass in the Error class companion that corresponds to the Err -private inline fun uniffiRustCallWithError( - errorHandler: UniffiRustCallStatusErrorHandler, - callback: (UniffiRustCallStatus) -> U, -): U { - var status = UniffiRustCallStatus() +private inline fun uniffiRustCallWithError(errorHandler: UniffiRustCallStatusErrorHandler, callback: (UniffiRustCallStatus) -> U): U { + var status = UniffiRustCallStatus(); val return_value = callback(status) uniffiCheckCallStatus(errorHandler, status) return return_value } // Check UniffiRustCallStatus and throw an error if the call wasn't successful -private fun uniffiCheckCallStatus( - errorHandler: UniffiRustCallStatusErrorHandler, - status: UniffiRustCallStatus, -) { +private fun uniffiCheckCallStatus(errorHandler: UniffiRustCallStatusErrorHandler, status: UniffiRustCallStatus) { if (status.isSuccess()) { return } else if (status.isError()) { @@ -314,7 +284,7 @@ private fun uniffiCheckCallStatus( } // UniffiRustCallStatusErrorHandler implementation for times when we don't expect a CALL_ERROR -object UniffiNullRustCallStatusErrorHandler : UniffiRustCallStatusErrorHandler { +object UniffiNullRustCallStatusErrorHandler: UniffiRustCallStatusErrorHandler { override fun lift(error_buf: RustBuffer.ByValue): InternalException { RustBuffer.free(error_buf) return InternalException("Unexpected CALL_ERROR") @@ -322,31 +292,32 @@ object UniffiNullRustCallStatusErrorHandler : UniffiRustCallStatusErrorHandler uniffiRustCall(callback: (UniffiRustCallStatus) -> U): U = - uniffiRustCallWithError(UniffiNullRustCallStatusErrorHandler, callback) +private inline fun uniffiRustCall(callback: (UniffiRustCallStatus) -> U): U { + return uniffiRustCallWithError(UniffiNullRustCallStatusErrorHandler, callback); +} -internal inline fun uniffiTraitInterfaceCall( +internal inline fun uniffiTraitInterfaceCall( callStatus: UniffiRustCallStatus, makeCall: () -> T, writeReturn: (T) -> Unit, ) { try { writeReturn(makeCall()) - } catch (e: Exception) { + } catch(e: Exception) { callStatus.code = UNIFFI_CALL_UNEXPECTED_ERROR callStatus.error_buf = FfiConverterString.lower(e.toString()) } } -internal inline fun uniffiTraitInterfaceCallWithError( +internal inline fun uniffiTraitInterfaceCallWithError( callStatus: UniffiRustCallStatus, makeCall: () -> T, writeReturn: (T) -> Unit, - lowerError: (E) -> RustBuffer.ByValue, + lowerError: (E) -> RustBuffer.ByValue ) { try { writeReturn(makeCall()) - } catch (e: Exception) { + } catch(e: Exception) { if (e is E) { callStatus.code = UNIFFI_CALL_ERROR callStatus.error_buf = lowerError(e) @@ -356,15 +327,12 @@ internal inline fun uniffiTraitInterfaceCallWithError } } } - // Map handles to objects // // This is used pass an opaque 64-bit handle representing a foreign object to the Rust code. -internal class UniffiHandleMap { +internal class UniffiHandleMap { private val map = ConcurrentHashMap() - private val counter = - java.util.concurrent.atomic - .AtomicLong(0) + private val counter = java.util.concurrent.atomic.AtomicLong(0) val size: Int get() = map.size @@ -377,10 +345,14 @@ internal class UniffiHandleMap { } // Get an object from the handle map - fun get(handle: Long): T = map.get(handle) ?: throw InternalException("UniffiHandleMap.get: Invalid handle") + fun get(handle: Long): T { + return map.get(handle) ?: throw InternalException("UniffiHandleMap.get: Invalid handle") + } // Remove an entry from the handlemap and get the Kotlin object back - fun remove(handle: Long): T = map.remove(handle) ?: throw InternalException("UniffiHandleMap: Invalid handle") + fun remove(handle: Long): T { + return map.remove(handle) ?: throw InternalException("UniffiHandleMap: Invalid handle") + } } // Contains loading, initialization code, @@ -394,25 +366,22 @@ private fun findLibraryName(componentName: String): String { return "ldk_node" } -private inline fun loadIndirect(componentName: String): Lib = - Native.load(findLibraryName(componentName), Lib::class.java) +private inline fun loadIndirect( + componentName: String +): Lib { + return Native.load(findLibraryName(componentName), Lib::class.java) +} // Define FFI callback types internal interface UniffiRustFutureContinuationCallback : com.sun.jna.Callback { - fun callback( - `data`: Long, - `pollResult`: Byte, - ) + fun callback(`data`: Long,`pollResult`: Byte,) } - internal interface UniffiForeignFutureFree : com.sun.jna.Callback { - fun callback(`handle`: Long) + fun callback(`handle`: Long,) } - internal interface UniffiCallbackInterfaceFree : com.sun.jna.Callback { - fun callback(`handle`: Long) + fun callback(`handle`: Long,) } - @Structure.FieldOrder("handle", "free") internal open class UniffiForeignFuture( @JvmField internal var `handle`: Long = 0.toLong(), @@ -421,15 +390,14 @@ internal open class UniffiForeignFuture( class UniffiByValue( `handle`: Long = 0.toLong(), `free`: UniffiForeignFutureFree? = null, - ) : UniffiForeignFuture(`handle`, `free`), - Structure.ByValue + ): UniffiForeignFuture(`handle`,`free`,), Structure.ByValue - internal fun uniffiSetValue(other: UniffiForeignFuture) { + internal fun uniffiSetValue(other: UniffiForeignFuture) { `handle` = other.`handle` `free` = other.`free` } -} +} @Structure.FieldOrder("returnValue", "callStatus") internal open class UniffiForeignFutureStructU8( @JvmField internal var `returnValue`: Byte = 0.toByte(), @@ -438,22 +406,17 @@ internal open class UniffiForeignFutureStructU8( class UniffiByValue( `returnValue`: Byte = 0.toByte(), `callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(), - ) : UniffiForeignFutureStructU8(`returnValue`, `callStatus`), - Structure.ByValue + ): UniffiForeignFutureStructU8(`returnValue`,`callStatus`,), Structure.ByValue - internal fun uniffiSetValue(other: UniffiForeignFutureStructU8) { + internal fun uniffiSetValue(other: UniffiForeignFutureStructU8) { `returnValue` = other.`returnValue` `callStatus` = other.`callStatus` } -} +} internal interface UniffiForeignFutureCompleteU8 : com.sun.jna.Callback { - fun callback( - `callbackData`: Long, - `result`: UniffiForeignFutureStructU8.UniffiByValue, - ) + fun callback(`callbackData`: Long,`result`: UniffiForeignFutureStructU8.UniffiByValue,) } - @Structure.FieldOrder("returnValue", "callStatus") internal open class UniffiForeignFutureStructI8( @JvmField internal var `returnValue`: Byte = 0.toByte(), @@ -462,22 +425,17 @@ internal open class UniffiForeignFutureStructI8( class UniffiByValue( `returnValue`: Byte = 0.toByte(), `callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(), - ) : UniffiForeignFutureStructI8(`returnValue`, `callStatus`), - Structure.ByValue + ): UniffiForeignFutureStructI8(`returnValue`,`callStatus`,), Structure.ByValue - internal fun uniffiSetValue(other: UniffiForeignFutureStructI8) { + internal fun uniffiSetValue(other: UniffiForeignFutureStructI8) { `returnValue` = other.`returnValue` `callStatus` = other.`callStatus` } -} +} internal interface UniffiForeignFutureCompleteI8 : com.sun.jna.Callback { - fun callback( - `callbackData`: Long, - `result`: UniffiForeignFutureStructI8.UniffiByValue, - ) + fun callback(`callbackData`: Long,`result`: UniffiForeignFutureStructI8.UniffiByValue,) } - @Structure.FieldOrder("returnValue", "callStatus") internal open class UniffiForeignFutureStructU16( @JvmField internal var `returnValue`: Short = 0.toShort(), @@ -486,22 +444,17 @@ internal open class UniffiForeignFutureStructU16( class UniffiByValue( `returnValue`: Short = 0.toShort(), `callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(), - ) : UniffiForeignFutureStructU16(`returnValue`, `callStatus`), - Structure.ByValue + ): UniffiForeignFutureStructU16(`returnValue`,`callStatus`,), Structure.ByValue - internal fun uniffiSetValue(other: UniffiForeignFutureStructU16) { + internal fun uniffiSetValue(other: UniffiForeignFutureStructU16) { `returnValue` = other.`returnValue` `callStatus` = other.`callStatus` } -} +} internal interface UniffiForeignFutureCompleteU16 : com.sun.jna.Callback { - fun callback( - `callbackData`: Long, - `result`: UniffiForeignFutureStructU16.UniffiByValue, - ) + fun callback(`callbackData`: Long,`result`: UniffiForeignFutureStructU16.UniffiByValue,) } - @Structure.FieldOrder("returnValue", "callStatus") internal open class UniffiForeignFutureStructI16( @JvmField internal var `returnValue`: Short = 0.toShort(), @@ -510,22 +463,17 @@ internal open class UniffiForeignFutureStructI16( class UniffiByValue( `returnValue`: Short = 0.toShort(), `callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(), - ) : UniffiForeignFutureStructI16(`returnValue`, `callStatus`), - Structure.ByValue + ): UniffiForeignFutureStructI16(`returnValue`,`callStatus`,), Structure.ByValue - internal fun uniffiSetValue(other: UniffiForeignFutureStructI16) { + internal fun uniffiSetValue(other: UniffiForeignFutureStructI16) { `returnValue` = other.`returnValue` `callStatus` = other.`callStatus` } -} +} internal interface UniffiForeignFutureCompleteI16 : com.sun.jna.Callback { - fun callback( - `callbackData`: Long, - `result`: UniffiForeignFutureStructI16.UniffiByValue, - ) + fun callback(`callbackData`: Long,`result`: UniffiForeignFutureStructI16.UniffiByValue,) } - @Structure.FieldOrder("returnValue", "callStatus") internal open class UniffiForeignFutureStructU32( @JvmField internal var `returnValue`: Int = 0, @@ -534,22 +482,17 @@ internal open class UniffiForeignFutureStructU32( class UniffiByValue( `returnValue`: Int = 0, `callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(), - ) : UniffiForeignFutureStructU32(`returnValue`, `callStatus`), - Structure.ByValue + ): UniffiForeignFutureStructU32(`returnValue`,`callStatus`,), Structure.ByValue - internal fun uniffiSetValue(other: UniffiForeignFutureStructU32) { + internal fun uniffiSetValue(other: UniffiForeignFutureStructU32) { `returnValue` = other.`returnValue` `callStatus` = other.`callStatus` } -} +} internal interface UniffiForeignFutureCompleteU32 : com.sun.jna.Callback { - fun callback( - `callbackData`: Long, - `result`: UniffiForeignFutureStructU32.UniffiByValue, - ) + fun callback(`callbackData`: Long,`result`: UniffiForeignFutureStructU32.UniffiByValue,) } - @Structure.FieldOrder("returnValue", "callStatus") internal open class UniffiForeignFutureStructI32( @JvmField internal var `returnValue`: Int = 0, @@ -558,22 +501,17 @@ internal open class UniffiForeignFutureStructI32( class UniffiByValue( `returnValue`: Int = 0, `callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(), - ) : UniffiForeignFutureStructI32(`returnValue`, `callStatus`), - Structure.ByValue + ): UniffiForeignFutureStructI32(`returnValue`,`callStatus`,), Structure.ByValue - internal fun uniffiSetValue(other: UniffiForeignFutureStructI32) { + internal fun uniffiSetValue(other: UniffiForeignFutureStructI32) { `returnValue` = other.`returnValue` `callStatus` = other.`callStatus` } -} +} internal interface UniffiForeignFutureCompleteI32 : com.sun.jna.Callback { - fun callback( - `callbackData`: Long, - `result`: UniffiForeignFutureStructI32.UniffiByValue, - ) + fun callback(`callbackData`: Long,`result`: UniffiForeignFutureStructI32.UniffiByValue,) } - @Structure.FieldOrder("returnValue", "callStatus") internal open class UniffiForeignFutureStructU64( @JvmField internal var `returnValue`: Long = 0.toLong(), @@ -582,22 +520,17 @@ internal open class UniffiForeignFutureStructU64( class UniffiByValue( `returnValue`: Long = 0.toLong(), `callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(), - ) : UniffiForeignFutureStructU64(`returnValue`, `callStatus`), - Structure.ByValue + ): UniffiForeignFutureStructU64(`returnValue`,`callStatus`,), Structure.ByValue - internal fun uniffiSetValue(other: UniffiForeignFutureStructU64) { + internal fun uniffiSetValue(other: UniffiForeignFutureStructU64) { `returnValue` = other.`returnValue` `callStatus` = other.`callStatus` } -} +} internal interface UniffiForeignFutureCompleteU64 : com.sun.jna.Callback { - fun callback( - `callbackData`: Long, - `result`: UniffiForeignFutureStructU64.UniffiByValue, - ) + fun callback(`callbackData`: Long,`result`: UniffiForeignFutureStructU64.UniffiByValue,) } - @Structure.FieldOrder("returnValue", "callStatus") internal open class UniffiForeignFutureStructI64( @JvmField internal var `returnValue`: Long = 0.toLong(), @@ -606,22 +539,17 @@ internal open class UniffiForeignFutureStructI64( class UniffiByValue( `returnValue`: Long = 0.toLong(), `callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(), - ) : UniffiForeignFutureStructI64(`returnValue`, `callStatus`), - Structure.ByValue + ): UniffiForeignFutureStructI64(`returnValue`,`callStatus`,), Structure.ByValue - internal fun uniffiSetValue(other: UniffiForeignFutureStructI64) { + internal fun uniffiSetValue(other: UniffiForeignFutureStructI64) { `returnValue` = other.`returnValue` `callStatus` = other.`callStatus` } -} +} internal interface UniffiForeignFutureCompleteI64 : com.sun.jna.Callback { - fun callback( - `callbackData`: Long, - `result`: UniffiForeignFutureStructI64.UniffiByValue, - ) + fun callback(`callbackData`: Long,`result`: UniffiForeignFutureStructI64.UniffiByValue,) } - @Structure.FieldOrder("returnValue", "callStatus") internal open class UniffiForeignFutureStructF32( @JvmField internal var `returnValue`: Float = 0.0f, @@ -630,22 +558,17 @@ internal open class UniffiForeignFutureStructF32( class UniffiByValue( `returnValue`: Float = 0.0f, `callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(), - ) : UniffiForeignFutureStructF32(`returnValue`, `callStatus`), - Structure.ByValue + ): UniffiForeignFutureStructF32(`returnValue`,`callStatus`,), Structure.ByValue - internal fun uniffiSetValue(other: UniffiForeignFutureStructF32) { + internal fun uniffiSetValue(other: UniffiForeignFutureStructF32) { `returnValue` = other.`returnValue` `callStatus` = other.`callStatus` } -} +} internal interface UniffiForeignFutureCompleteF32 : com.sun.jna.Callback { - fun callback( - `callbackData`: Long, - `result`: UniffiForeignFutureStructF32.UniffiByValue, - ) + fun callback(`callbackData`: Long,`result`: UniffiForeignFutureStructF32.UniffiByValue,) } - @Structure.FieldOrder("returnValue", "callStatus") internal open class UniffiForeignFutureStructF64( @JvmField internal var `returnValue`: Double = 0.0, @@ -654,22 +577,17 @@ internal open class UniffiForeignFutureStructF64( class UniffiByValue( `returnValue`: Double = 0.0, `callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(), - ) : UniffiForeignFutureStructF64(`returnValue`, `callStatus`), - Structure.ByValue + ): UniffiForeignFutureStructF64(`returnValue`,`callStatus`,), Structure.ByValue - internal fun uniffiSetValue(other: UniffiForeignFutureStructF64) { + internal fun uniffiSetValue(other: UniffiForeignFutureStructF64) { `returnValue` = other.`returnValue` `callStatus` = other.`callStatus` } -} +} internal interface UniffiForeignFutureCompleteF64 : com.sun.jna.Callback { - fun callback( - `callbackData`: Long, - `result`: UniffiForeignFutureStructF64.UniffiByValue, - ) + fun callback(`callbackData`: Long,`result`: UniffiForeignFutureStructF64.UniffiByValue,) } - @Structure.FieldOrder("returnValue", "callStatus") internal open class UniffiForeignFutureStructPointer( @JvmField internal var `returnValue`: Pointer = Pointer.NULL, @@ -678,22 +596,17 @@ internal open class UniffiForeignFutureStructPointer( class UniffiByValue( `returnValue`: Pointer = Pointer.NULL, `callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(), - ) : UniffiForeignFutureStructPointer(`returnValue`, `callStatus`), - Structure.ByValue + ): UniffiForeignFutureStructPointer(`returnValue`,`callStatus`,), Structure.ByValue - internal fun uniffiSetValue(other: UniffiForeignFutureStructPointer) { + internal fun uniffiSetValue(other: UniffiForeignFutureStructPointer) { `returnValue` = other.`returnValue` `callStatus` = other.`callStatus` } -} +} internal interface UniffiForeignFutureCompletePointer : com.sun.jna.Callback { - fun callback( - `callbackData`: Long, - `result`: UniffiForeignFutureStructPointer.UniffiByValue, - ) + fun callback(`callbackData`: Long,`result`: UniffiForeignFutureStructPointer.UniffiByValue,) } - @Structure.FieldOrder("returnValue", "callStatus") internal open class UniffiForeignFutureStructRustBuffer( @JvmField internal var `returnValue`: RustBuffer.ByValue = RustBuffer.ByValue(), @@ -702,62 +615,39 @@ internal open class UniffiForeignFutureStructRustBuffer( class UniffiByValue( `returnValue`: RustBuffer.ByValue = RustBuffer.ByValue(), `callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(), - ) : UniffiForeignFutureStructRustBuffer(`returnValue`, `callStatus`), - Structure.ByValue + ): UniffiForeignFutureStructRustBuffer(`returnValue`,`callStatus`,), Structure.ByValue - internal fun uniffiSetValue(other: UniffiForeignFutureStructRustBuffer) { + internal fun uniffiSetValue(other: UniffiForeignFutureStructRustBuffer) { `returnValue` = other.`returnValue` `callStatus` = other.`callStatus` } -} +} internal interface UniffiForeignFutureCompleteRustBuffer : com.sun.jna.Callback { - fun callback( - `callbackData`: Long, - `result`: UniffiForeignFutureStructRustBuffer.UniffiByValue, - ) + fun callback(`callbackData`: Long,`result`: UniffiForeignFutureStructRustBuffer.UniffiByValue,) } - @Structure.FieldOrder("callStatus") internal open class UniffiForeignFutureStructVoid( @JvmField internal var `callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(), ) : Structure() { class UniffiByValue( `callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(), - ) : UniffiForeignFutureStructVoid(`callStatus`), - Structure.ByValue + ): UniffiForeignFutureStructVoid(`callStatus`,), Structure.ByValue - internal fun uniffiSetValue(other: UniffiForeignFutureStructVoid) { + internal fun uniffiSetValue(other: UniffiForeignFutureStructVoid) { `callStatus` = other.`callStatus` } -} +} internal interface UniffiForeignFutureCompleteVoid : com.sun.jna.Callback { - fun callback( - `callbackData`: Long, - `result`: UniffiForeignFutureStructVoid.UniffiByValue, - ) + fun callback(`callbackData`: Long,`result`: UniffiForeignFutureStructVoid.UniffiByValue,) } - internal interface UniffiCallbackInterfaceLogWriterMethod0 : com.sun.jna.Callback { - fun callback( - `uniffiHandle`: Long, - `record`: RustBuffer.ByValue, - `uniffiOutReturn`: Pointer, - uniffiCallStatus: UniffiRustCallStatus, - ) + fun callback(`uniffiHandle`: Long,`record`: RustBuffer.ByValue,`uniffiOutReturn`: Pointer,uniffiCallStatus: UniffiRustCallStatus,) } - internal interface UniffiCallbackInterfaceVssHeaderProviderMethod0 : com.sun.jna.Callback { - fun callback( - `uniffiHandle`: Long, - `request`: RustBuffer.ByValue, - `uniffiFutureCallback`: UniffiForeignFutureCompleteRustBuffer, - `uniffiCallbackData`: Long, - `uniffiOutReturn`: UniffiForeignFuture, - ) + fun callback(`uniffiHandle`: Long,`request`: RustBuffer.ByValue,`uniffiFutureCallback`: UniffiForeignFutureCompleteRustBuffer,`uniffiCallbackData`: Long,`uniffiOutReturn`: UniffiForeignFuture,) } - @Structure.FieldOrder("log", "uniffiFree") internal open class UniffiVTableCallbackInterfaceLogWriter( @JvmField internal var `log`: UniffiCallbackInterfaceLogWriterMethod0? = null, @@ -766,15 +656,14 @@ internal open class UniffiVTableCallbackInterfaceLogWriter( class UniffiByValue( `log`: UniffiCallbackInterfaceLogWriterMethod0? = null, `uniffiFree`: UniffiCallbackInterfaceFree? = null, - ) : UniffiVTableCallbackInterfaceLogWriter(`log`, `uniffiFree`), - Structure.ByValue + ): UniffiVTableCallbackInterfaceLogWriter(`log`,`uniffiFree`,), Structure.ByValue - internal fun uniffiSetValue(other: UniffiVTableCallbackInterfaceLogWriter) { + internal fun uniffiSetValue(other: UniffiVTableCallbackInterfaceLogWriter) { `log` = other.`log` `uniffiFree` = other.`uniffiFree` } -} +} @Structure.FieldOrder("getHeaders", "uniffiFree") internal open class UniffiVTableCallbackInterfaceVssHeaderProvider( @JvmField internal var `getHeaders`: UniffiCallbackInterfaceVssHeaderProviderMethod0? = null, @@ -783,1427 +672,1062 @@ internal open class UniffiVTableCallbackInterfaceVssHeaderProvider( class UniffiByValue( `getHeaders`: UniffiCallbackInterfaceVssHeaderProviderMethod0? = null, `uniffiFree`: UniffiCallbackInterfaceFree? = null, - ) : UniffiVTableCallbackInterfaceVssHeaderProvider(`getHeaders`, `uniffiFree`), - Structure.ByValue + ): UniffiVTableCallbackInterfaceVssHeaderProvider(`getHeaders`,`uniffiFree`,), Structure.ByValue - internal fun uniffiSetValue(other: UniffiVTableCallbackInterfaceVssHeaderProvider) { + internal fun uniffiSetValue(other: UniffiVTableCallbackInterfaceVssHeaderProvider) { `getHeaders` = other.`getHeaders` `uniffiFree` = other.`uniffiFree` } + } -// A JNA Library to expose the extern-C FFI definitions. -// This is an implementation detail which will be called internally by the public API. -internal interface UniffiLib : Library { - companion object { - internal val INSTANCE: UniffiLib by lazy { - loadIndirect(componentName = "ldk_node") - .also { lib: UniffiLib -> - uniffiCheckContractApiVersion(lib) - uniffiCheckApiChecksums(lib) - uniffiCallbackInterfaceLogWriter.register(lib) - } - } - // The Cleaner for the whole library - internal val CLEANER: UniffiCleaner by lazy { - UniffiCleaner.create() - } - } - fun uniffi_ldk_node_fn_clone_bolt11invoice( - `ptr`: Pointer, - uniffi_out_err: UniffiRustCallStatus, - ): Pointer - fun uniffi_ldk_node_fn_free_bolt11invoice( - `ptr`: Pointer, - uniffi_out_err: UniffiRustCallStatus, - ): Unit - fun uniffi_ldk_node_fn_constructor_bolt11invoice_from_str( - `invoiceStr`: RustBuffer.ByValue, - uniffi_out_err: UniffiRustCallStatus, - ): Pointer - fun uniffi_ldk_node_fn_method_bolt11invoice_amount_milli_satoshis( - `ptr`: Pointer, - uniffi_out_err: UniffiRustCallStatus, - ): RustBuffer.ByValue - fun uniffi_ldk_node_fn_method_bolt11invoice_currency( - `ptr`: Pointer, - uniffi_out_err: UniffiRustCallStatus, - ): RustBuffer.ByValue - fun uniffi_ldk_node_fn_method_bolt11invoice_expiry_time_seconds( - `ptr`: Pointer, - uniffi_out_err: UniffiRustCallStatus, - ): Long - fun uniffi_ldk_node_fn_method_bolt11invoice_fallback_addresses( - `ptr`: Pointer, - uniffi_out_err: UniffiRustCallStatus, - ): RustBuffer.ByValue - fun uniffi_ldk_node_fn_method_bolt11invoice_invoice_description( - `ptr`: Pointer, - uniffi_out_err: UniffiRustCallStatus, - ): RustBuffer.ByValue - fun uniffi_ldk_node_fn_method_bolt11invoice_is_expired( - `ptr`: Pointer, - uniffi_out_err: UniffiRustCallStatus, - ): Byte - fun uniffi_ldk_node_fn_method_bolt11invoice_min_final_cltv_expiry_delta( - `ptr`: Pointer, - uniffi_out_err: UniffiRustCallStatus, - ): Long - fun uniffi_ldk_node_fn_method_bolt11invoice_network( - `ptr`: Pointer, - uniffi_out_err: UniffiRustCallStatus, - ): RustBuffer.ByValue - fun uniffi_ldk_node_fn_method_bolt11invoice_payment_hash( - `ptr`: Pointer, - uniffi_out_err: UniffiRustCallStatus, - ): RustBuffer.ByValue - fun uniffi_ldk_node_fn_method_bolt11invoice_payment_secret( - `ptr`: Pointer, - uniffi_out_err: UniffiRustCallStatus, - ): RustBuffer.ByValue - fun uniffi_ldk_node_fn_method_bolt11invoice_recover_payee_pub_key( - `ptr`: Pointer, - uniffi_out_err: UniffiRustCallStatus, - ): RustBuffer.ByValue - fun uniffi_ldk_node_fn_method_bolt11invoice_route_hints( - `ptr`: Pointer, - uniffi_out_err: UniffiRustCallStatus, - ): RustBuffer.ByValue - fun uniffi_ldk_node_fn_method_bolt11invoice_seconds_since_epoch( - `ptr`: Pointer, - uniffi_out_err: UniffiRustCallStatus, - ): Long - fun uniffi_ldk_node_fn_method_bolt11invoice_seconds_until_expiry( - `ptr`: Pointer, - uniffi_out_err: UniffiRustCallStatus, - ): Long - fun uniffi_ldk_node_fn_method_bolt11invoice_signable_hash( - `ptr`: Pointer, - uniffi_out_err: UniffiRustCallStatus, - ): RustBuffer.ByValue - fun uniffi_ldk_node_fn_method_bolt11invoice_would_expire( - `ptr`: Pointer, - `atTimeSeconds`: Long, - uniffi_out_err: UniffiRustCallStatus, - ): Byte - fun uniffi_ldk_node_fn_method_bolt11invoice_uniffi_trait_debug( - `ptr`: Pointer, - uniffi_out_err: UniffiRustCallStatus, - ): RustBuffer.ByValue - fun uniffi_ldk_node_fn_method_bolt11invoice_uniffi_trait_display( - `ptr`: Pointer, - uniffi_out_err: UniffiRustCallStatus, - ): RustBuffer.ByValue - fun uniffi_ldk_node_fn_method_bolt11invoice_uniffi_trait_eq_eq( - `ptr`: Pointer, - `other`: Pointer, - uniffi_out_err: UniffiRustCallStatus, - ): Byte - fun uniffi_ldk_node_fn_method_bolt11invoice_uniffi_trait_eq_ne( - `ptr`: Pointer, - `other`: Pointer, - uniffi_out_err: UniffiRustCallStatus, - ): Byte - fun uniffi_ldk_node_fn_clone_bolt11payment( - `ptr`: Pointer, - uniffi_out_err: UniffiRustCallStatus, - ): Pointer - fun uniffi_ldk_node_fn_free_bolt11payment( - `ptr`: Pointer, - uniffi_out_err: UniffiRustCallStatus, - ): Unit - fun uniffi_ldk_node_fn_method_bolt11payment_claim_for_hash( - `ptr`: Pointer, - `paymentHash`: RustBuffer.ByValue, - `claimableAmountMsat`: Long, - `preimage`: RustBuffer.ByValue, - uniffi_out_err: UniffiRustCallStatus, - ): Unit - fun uniffi_ldk_node_fn_method_bolt11payment_fail_for_hash( - `ptr`: Pointer, - `paymentHash`: RustBuffer.ByValue, - uniffi_out_err: UniffiRustCallStatus, - ): Unit - fun uniffi_ldk_node_fn_method_bolt11payment_receive( - `ptr`: Pointer, - `amountMsat`: Long, - `description`: RustBuffer.ByValue, - `expirySecs`: Int, - uniffi_out_err: UniffiRustCallStatus, - ): Pointer - fun uniffi_ldk_node_fn_method_bolt11payment_receive_for_hash( - `ptr`: Pointer, - `amountMsat`: Long, - `description`: RustBuffer.ByValue, - `expirySecs`: Int, - `paymentHash`: RustBuffer.ByValue, - uniffi_out_err: UniffiRustCallStatus, - ): Pointer - fun uniffi_ldk_node_fn_method_bolt11payment_receive_variable_amount( - `ptr`: Pointer, - `description`: RustBuffer.ByValue, - `expirySecs`: Int, - uniffi_out_err: UniffiRustCallStatus, - ): Pointer - fun uniffi_ldk_node_fn_method_bolt11payment_receive_variable_amount_for_hash( - `ptr`: Pointer, - `description`: RustBuffer.ByValue, - `expirySecs`: Int, - `paymentHash`: RustBuffer.ByValue, - uniffi_out_err: UniffiRustCallStatus, - ): Pointer - fun uniffi_ldk_node_fn_method_bolt11payment_receive_variable_amount_via_jit_channel( - `ptr`: Pointer, - `description`: RustBuffer.ByValue, - `expirySecs`: Int, - `maxProportionalLspFeeLimitPpmMsat`: RustBuffer.ByValue, - uniffi_out_err: UniffiRustCallStatus, - ): Pointer - fun uniffi_ldk_node_fn_method_bolt11payment_receive_via_jit_channel( - `ptr`: Pointer, - `amountMsat`: Long, - `description`: RustBuffer.ByValue, - `expirySecs`: Int, - `maxLspFeeLimitMsat`: RustBuffer.ByValue, - uniffi_out_err: UniffiRustCallStatus, - ): Pointer - fun uniffi_ldk_node_fn_method_bolt11payment_send( - `ptr`: Pointer, - `invoice`: Pointer, - `sendingParameters`: RustBuffer.ByValue, - uniffi_out_err: UniffiRustCallStatus, - ): RustBuffer.ByValue - fun uniffi_ldk_node_fn_method_bolt11payment_send_probes( - `ptr`: Pointer, - `invoice`: Pointer, - uniffi_out_err: UniffiRustCallStatus, - ): Unit - fun uniffi_ldk_node_fn_method_bolt11payment_send_probes_using_amount( - `ptr`: Pointer, - `invoice`: Pointer, - `amountMsat`: Long, - uniffi_out_err: UniffiRustCallStatus, - ): Unit - fun uniffi_ldk_node_fn_method_bolt11payment_send_using_amount( - `ptr`: Pointer, - `invoice`: Pointer, - `amountMsat`: Long, - `sendingParameters`: RustBuffer.ByValue, - uniffi_out_err: UniffiRustCallStatus, - ): RustBuffer.ByValue - fun uniffi_ldk_node_fn_clone_bolt12payment( - `ptr`: Pointer, - uniffi_out_err: UniffiRustCallStatus, - ): Pointer - fun uniffi_ldk_node_fn_free_bolt12payment( - `ptr`: Pointer, - uniffi_out_err: UniffiRustCallStatus, - ): Unit - fun uniffi_ldk_node_fn_method_bolt12payment_initiate_refund( - `ptr`: Pointer, - `amountMsat`: Long, - `expirySecs`: Int, - `quantity`: RustBuffer.ByValue, - `payerNote`: RustBuffer.ByValue, - uniffi_out_err: UniffiRustCallStatus, - ): RustBuffer.ByValue - fun uniffi_ldk_node_fn_method_bolt12payment_receive( - `ptr`: Pointer, - `amountMsat`: Long, - `description`: RustBuffer.ByValue, - `expirySecs`: RustBuffer.ByValue, - `quantity`: RustBuffer.ByValue, - uniffi_out_err: UniffiRustCallStatus, - ): RustBuffer.ByValue - fun uniffi_ldk_node_fn_method_bolt12payment_receive_variable_amount( - `ptr`: Pointer, - `description`: RustBuffer.ByValue, - `expirySecs`: RustBuffer.ByValue, - uniffi_out_err: UniffiRustCallStatus, - ): RustBuffer.ByValue - fun uniffi_ldk_node_fn_method_bolt12payment_request_refund_payment( - `ptr`: Pointer, - `refund`: RustBuffer.ByValue, - uniffi_out_err: UniffiRustCallStatus, - ): RustBuffer.ByValue - fun uniffi_ldk_node_fn_method_bolt12payment_send( - `ptr`: Pointer, - `offer`: RustBuffer.ByValue, - `quantity`: RustBuffer.ByValue, - `payerNote`: RustBuffer.ByValue, - uniffi_out_err: UniffiRustCallStatus, - ): RustBuffer.ByValue - fun uniffi_ldk_node_fn_method_bolt12payment_send_using_amount( - `ptr`: Pointer, - `offer`: RustBuffer.ByValue, - `amountMsat`: Long, - `quantity`: RustBuffer.ByValue, - `payerNote`: RustBuffer.ByValue, - uniffi_out_err: UniffiRustCallStatus, - ): RustBuffer.ByValue - fun uniffi_ldk_node_fn_clone_builder( - `ptr`: Pointer, - uniffi_out_err: UniffiRustCallStatus, - ): Pointer - fun uniffi_ldk_node_fn_free_builder( - `ptr`: Pointer, - uniffi_out_err: UniffiRustCallStatus, - ): Unit - fun uniffi_ldk_node_fn_constructor_builder_from_config( - `config`: RustBuffer.ByValue, - uniffi_out_err: UniffiRustCallStatus, - ): Pointer - fun uniffi_ldk_node_fn_constructor_builder_new(uniffi_out_err: UniffiRustCallStatus): Pointer - fun uniffi_ldk_node_fn_method_builder_build( - `ptr`: Pointer, - uniffi_out_err: UniffiRustCallStatus, - ): Pointer - fun uniffi_ldk_node_fn_method_builder_build_with_fs_store( - `ptr`: Pointer, - uniffi_out_err: UniffiRustCallStatus, - ): Pointer - fun uniffi_ldk_node_fn_method_builder_build_with_vss_store( - `ptr`: Pointer, - `vssUrl`: RustBuffer.ByValue, - `storeId`: RustBuffer.ByValue, - `lnurlAuthServerUrl`: RustBuffer.ByValue, - `fixedHeaders`: RustBuffer.ByValue, - uniffi_out_err: UniffiRustCallStatus, - ): Pointer - fun uniffi_ldk_node_fn_method_builder_build_with_vss_store_and_fixed_headers( - `ptr`: Pointer, - `vssUrl`: RustBuffer.ByValue, - `storeId`: RustBuffer.ByValue, - `fixedHeaders`: RustBuffer.ByValue, - uniffi_out_err: UniffiRustCallStatus, - ): Pointer - fun uniffi_ldk_node_fn_method_builder_build_with_vss_store_and_header_provider( - `ptr`: Pointer, - `vssUrl`: RustBuffer.ByValue, - `storeId`: RustBuffer.ByValue, - `headerProvider`: Pointer, - uniffi_out_err: UniffiRustCallStatus, - ): Pointer - fun uniffi_ldk_node_fn_method_builder_set_announcement_addresses( - `ptr`: Pointer, - `announcementAddresses`: RustBuffer.ByValue, - uniffi_out_err: UniffiRustCallStatus, - ): Unit - fun uniffi_ldk_node_fn_method_builder_set_chain_source_bitcoind_rpc( - `ptr`: Pointer, - `rpcHost`: RustBuffer.ByValue, - `rpcPort`: Short, - `rpcUser`: RustBuffer.ByValue, - `rpcPassword`: RustBuffer.ByValue, - uniffi_out_err: UniffiRustCallStatus, - ): Unit - fun uniffi_ldk_node_fn_method_builder_set_chain_source_electrum( - `ptr`: Pointer, - `serverUrl`: RustBuffer.ByValue, - `config`: RustBuffer.ByValue, - uniffi_out_err: UniffiRustCallStatus, - ): Unit - fun uniffi_ldk_node_fn_method_builder_set_chain_source_esplora( - `ptr`: Pointer, - `serverUrl`: RustBuffer.ByValue, - `config`: RustBuffer.ByValue, - uniffi_out_err: UniffiRustCallStatus, - ): Unit - fun uniffi_ldk_node_fn_method_builder_set_custom_logger( - `ptr`: Pointer, - `logWriter`: Pointer, - uniffi_out_err: UniffiRustCallStatus, - ): Unit - fun uniffi_ldk_node_fn_method_builder_set_entropy_bip39_mnemonic( - `ptr`: Pointer, - `mnemonic`: RustBuffer.ByValue, - `passphrase`: RustBuffer.ByValue, - uniffi_out_err: UniffiRustCallStatus, - ): Unit - fun uniffi_ldk_node_fn_method_builder_set_entropy_seed_bytes( - `ptr`: Pointer, - `seedBytes`: RustBuffer.ByValue, - uniffi_out_err: UniffiRustCallStatus, - ): Unit - fun uniffi_ldk_node_fn_method_builder_set_entropy_seed_path( - `ptr`: Pointer, - `seedPath`: RustBuffer.ByValue, - uniffi_out_err: UniffiRustCallStatus, - ): Unit - fun uniffi_ldk_node_fn_method_builder_set_filesystem_logger( - `ptr`: Pointer, - `logFilePath`: RustBuffer.ByValue, - `maxLogLevel`: RustBuffer.ByValue, - uniffi_out_err: UniffiRustCallStatus, - ): Unit - fun uniffi_ldk_node_fn_method_builder_set_gossip_source_p2p( - `ptr`: Pointer, - uniffi_out_err: UniffiRustCallStatus, - ): Unit - fun uniffi_ldk_node_fn_method_builder_set_gossip_source_rgs( - `ptr`: Pointer, - `rgsServerUrl`: RustBuffer.ByValue, - uniffi_out_err: UniffiRustCallStatus, - ): Unit - fun uniffi_ldk_node_fn_method_builder_set_liquidity_source_lsps1( - `ptr`: Pointer, - `nodeId`: RustBuffer.ByValue, - `address`: RustBuffer.ByValue, - `token`: RustBuffer.ByValue, - uniffi_out_err: UniffiRustCallStatus, - ): Unit - fun uniffi_ldk_node_fn_method_builder_set_liquidity_source_lsps2( - `ptr`: Pointer, - `nodeId`: RustBuffer.ByValue, - `address`: RustBuffer.ByValue, - `token`: RustBuffer.ByValue, - uniffi_out_err: UniffiRustCallStatus, - ): Unit - fun uniffi_ldk_node_fn_method_builder_set_listening_addresses( - `ptr`: Pointer, - `listeningAddresses`: RustBuffer.ByValue, - uniffi_out_err: UniffiRustCallStatus, - ): Unit - fun uniffi_ldk_node_fn_method_builder_set_log_facade_logger( - `ptr`: Pointer, - uniffi_out_err: UniffiRustCallStatus, - ): Unit - fun uniffi_ldk_node_fn_method_builder_set_network( - `ptr`: Pointer, - `network`: RustBuffer.ByValue, - uniffi_out_err: UniffiRustCallStatus, - ): Unit - fun uniffi_ldk_node_fn_method_builder_set_node_alias( - `ptr`: Pointer, - `nodeAlias`: RustBuffer.ByValue, - uniffi_out_err: UniffiRustCallStatus, - ): Unit - fun uniffi_ldk_node_fn_method_builder_set_storage_dir_path( - `ptr`: Pointer, - `storageDirPath`: RustBuffer.ByValue, - uniffi_out_err: UniffiRustCallStatus, - ): Unit - fun uniffi_ldk_node_fn_clone_feerate( - `ptr`: Pointer, - uniffi_out_err: UniffiRustCallStatus, - ): Pointer - fun uniffi_ldk_node_fn_free_feerate( - `ptr`: Pointer, - uniffi_out_err: UniffiRustCallStatus, - ): Unit - fun uniffi_ldk_node_fn_constructor_feerate_from_sat_per_kwu( - `satKwu`: Long, - uniffi_out_err: UniffiRustCallStatus, - ): Pointer - fun uniffi_ldk_node_fn_constructor_feerate_from_sat_per_vb_unchecked( - `satVb`: Long, - uniffi_out_err: UniffiRustCallStatus, - ): Pointer - fun uniffi_ldk_node_fn_method_feerate_to_sat_per_kwu( - `ptr`: Pointer, - uniffi_out_err: UniffiRustCallStatus, - ): Long - fun uniffi_ldk_node_fn_method_feerate_to_sat_per_vb_ceil( - `ptr`: Pointer, - uniffi_out_err: UniffiRustCallStatus, - ): Long - fun uniffi_ldk_node_fn_method_feerate_to_sat_per_vb_floor( - `ptr`: Pointer, - uniffi_out_err: UniffiRustCallStatus, - ): Long - fun uniffi_ldk_node_fn_clone_lsps1liquidity( - `ptr`: Pointer, - uniffi_out_err: UniffiRustCallStatus, - ): Pointer - fun uniffi_ldk_node_fn_free_lsps1liquidity( - `ptr`: Pointer, - uniffi_out_err: UniffiRustCallStatus, - ): Unit - fun uniffi_ldk_node_fn_method_lsps1liquidity_check_order_status( - `ptr`: Pointer, - `orderId`: RustBuffer.ByValue, - uniffi_out_err: UniffiRustCallStatus, - ): RustBuffer.ByValue - fun uniffi_ldk_node_fn_method_lsps1liquidity_request_channel( - `ptr`: Pointer, - `lspBalanceSat`: Long, - `clientBalanceSat`: Long, - `channelExpiryBlocks`: Int, - `announceChannel`: Byte, - uniffi_out_err: UniffiRustCallStatus, - ): RustBuffer.ByValue - fun uniffi_ldk_node_fn_clone_logwriter( - `ptr`: Pointer, - uniffi_out_err: UniffiRustCallStatus, - ): Pointer - fun uniffi_ldk_node_fn_free_logwriter( - `ptr`: Pointer, - uniffi_out_err: UniffiRustCallStatus, - ): Unit - fun uniffi_ldk_node_fn_init_callback_vtable_logwriter(`vtable`: UniffiVTableCallbackInterfaceLogWriter): Unit - fun uniffi_ldk_node_fn_method_logwriter_log( - `ptr`: Pointer, - `record`: RustBuffer.ByValue, - uniffi_out_err: UniffiRustCallStatus, - ): Unit - fun uniffi_ldk_node_fn_clone_networkgraph( - `ptr`: Pointer, - uniffi_out_err: UniffiRustCallStatus, - ): Pointer - fun uniffi_ldk_node_fn_free_networkgraph( - `ptr`: Pointer, - uniffi_out_err: UniffiRustCallStatus, - ): Unit - fun uniffi_ldk_node_fn_method_networkgraph_channel( - `ptr`: Pointer, - `shortChannelId`: Long, - uniffi_out_err: UniffiRustCallStatus, - ): RustBuffer.ByValue - fun uniffi_ldk_node_fn_method_networkgraph_list_channels( - `ptr`: Pointer, - uniffi_out_err: UniffiRustCallStatus, - ): RustBuffer.ByValue - fun uniffi_ldk_node_fn_method_networkgraph_list_nodes( - `ptr`: Pointer, - uniffi_out_err: UniffiRustCallStatus, - ): RustBuffer.ByValue - fun uniffi_ldk_node_fn_method_networkgraph_node( - `ptr`: Pointer, - `nodeId`: RustBuffer.ByValue, - uniffi_out_err: UniffiRustCallStatus, - ): RustBuffer.ByValue - fun uniffi_ldk_node_fn_clone_node( - `ptr`: Pointer, - uniffi_out_err: UniffiRustCallStatus, - ): Pointer - fun uniffi_ldk_node_fn_free_node( - `ptr`: Pointer, - uniffi_out_err: UniffiRustCallStatus, - ): Unit - fun uniffi_ldk_node_fn_method_node_announcement_addresses( - `ptr`: Pointer, - uniffi_out_err: UniffiRustCallStatus, - ): RustBuffer.ByValue - fun uniffi_ldk_node_fn_method_node_bolt11_payment( - `ptr`: Pointer, - uniffi_out_err: UniffiRustCallStatus, - ): Pointer - fun uniffi_ldk_node_fn_method_node_bolt12_payment( - `ptr`: Pointer, - uniffi_out_err: UniffiRustCallStatus, - ): Pointer - fun uniffi_ldk_node_fn_method_node_close_channel( - `ptr`: Pointer, - `userChannelId`: RustBuffer.ByValue, - `counterpartyNodeId`: RustBuffer.ByValue, - uniffi_out_err: UniffiRustCallStatus, - ): Unit - fun uniffi_ldk_node_fn_method_node_config( - `ptr`: Pointer, - uniffi_out_err: UniffiRustCallStatus, - ): RustBuffer.ByValue - fun uniffi_ldk_node_fn_method_node_connect( - `ptr`: Pointer, - `nodeId`: RustBuffer.ByValue, - `address`: RustBuffer.ByValue, - `persist`: Byte, - uniffi_out_err: UniffiRustCallStatus, - ): Unit - fun uniffi_ldk_node_fn_method_node_disconnect( - `ptr`: Pointer, - `nodeId`: RustBuffer.ByValue, - uniffi_out_err: UniffiRustCallStatus, - ): Unit - fun uniffi_ldk_node_fn_method_node_event_handled( - `ptr`: Pointer, - uniffi_out_err: UniffiRustCallStatus, - ): Unit - fun uniffi_ldk_node_fn_method_node_export_pathfinding_scores( - `ptr`: Pointer, - uniffi_out_err: UniffiRustCallStatus, - ): RustBuffer.ByValue - fun uniffi_ldk_node_fn_method_node_force_close_channel( - `ptr`: Pointer, - `userChannelId`: RustBuffer.ByValue, - `counterpartyNodeId`: RustBuffer.ByValue, - `reason`: RustBuffer.ByValue, - uniffi_out_err: UniffiRustCallStatus, - ): Unit - fun uniffi_ldk_node_fn_method_node_list_balances( - `ptr`: Pointer, - uniffi_out_err: UniffiRustCallStatus, - ): RustBuffer.ByValue - fun uniffi_ldk_node_fn_method_node_list_channels( - `ptr`: Pointer, - uniffi_out_err: UniffiRustCallStatus, - ): RustBuffer.ByValue - fun uniffi_ldk_node_fn_method_node_list_payments( - `ptr`: Pointer, - uniffi_out_err: UniffiRustCallStatus, - ): RustBuffer.ByValue - fun uniffi_ldk_node_fn_method_node_list_peers( - `ptr`: Pointer, - uniffi_out_err: UniffiRustCallStatus, - ): RustBuffer.ByValue - fun uniffi_ldk_node_fn_method_node_listening_addresses( - `ptr`: Pointer, - uniffi_out_err: UniffiRustCallStatus, - ): RustBuffer.ByValue - fun uniffi_ldk_node_fn_method_node_lsps1_liquidity( - `ptr`: Pointer, - uniffi_out_err: UniffiRustCallStatus, - ): Pointer - fun uniffi_ldk_node_fn_method_node_network_graph( - `ptr`: Pointer, - uniffi_out_err: UniffiRustCallStatus, - ): Pointer - fun uniffi_ldk_node_fn_method_node_next_event( - `ptr`: Pointer, - uniffi_out_err: UniffiRustCallStatus, - ): RustBuffer.ByValue - fun uniffi_ldk_node_fn_method_node_next_event_async(`ptr`: Pointer): Long - fun uniffi_ldk_node_fn_method_node_node_alias( - `ptr`: Pointer, - uniffi_out_err: UniffiRustCallStatus, - ): RustBuffer.ByValue - fun uniffi_ldk_node_fn_method_node_node_id( - `ptr`: Pointer, - uniffi_out_err: UniffiRustCallStatus, - ): RustBuffer.ByValue - fun uniffi_ldk_node_fn_method_node_onchain_payment( - `ptr`: Pointer, - uniffi_out_err: UniffiRustCallStatus, - ): Pointer - fun uniffi_ldk_node_fn_method_node_open_announced_channel( - `ptr`: Pointer, - `nodeId`: RustBuffer.ByValue, - `address`: RustBuffer.ByValue, - `channelAmountSats`: Long, - `pushToCounterpartyMsat`: RustBuffer.ByValue, - `channelConfig`: RustBuffer.ByValue, - uniffi_out_err: UniffiRustCallStatus, - ): RustBuffer.ByValue - fun uniffi_ldk_node_fn_method_node_open_channel( - `ptr`: Pointer, - `nodeId`: RustBuffer.ByValue, - `address`: RustBuffer.ByValue, - `channelAmountSats`: Long, - `pushToCounterpartyMsat`: RustBuffer.ByValue, - `channelConfig`: RustBuffer.ByValue, - uniffi_out_err: UniffiRustCallStatus, - ): RustBuffer.ByValue - fun uniffi_ldk_node_fn_method_node_payment( - `ptr`: Pointer, - `paymentId`: RustBuffer.ByValue, - uniffi_out_err: UniffiRustCallStatus, - ): RustBuffer.ByValue - fun uniffi_ldk_node_fn_method_node_remove_payment( - `ptr`: Pointer, - `paymentId`: RustBuffer.ByValue, - uniffi_out_err: UniffiRustCallStatus, - ): Unit - fun uniffi_ldk_node_fn_method_node_sign_message( - `ptr`: Pointer, - `msg`: RustBuffer.ByValue, - uniffi_out_err: UniffiRustCallStatus, - ): RustBuffer.ByValue - fun uniffi_ldk_node_fn_method_node_spontaneous_payment( - `ptr`: Pointer, - uniffi_out_err: UniffiRustCallStatus, - ): Pointer - fun uniffi_ldk_node_fn_method_node_start( - `ptr`: Pointer, - uniffi_out_err: UniffiRustCallStatus, - ): Unit - fun uniffi_ldk_node_fn_method_node_status( - `ptr`: Pointer, - uniffi_out_err: UniffiRustCallStatus, - ): RustBuffer.ByValue - fun uniffi_ldk_node_fn_method_node_stop( - `ptr`: Pointer, - uniffi_out_err: UniffiRustCallStatus, - ): Unit - fun uniffi_ldk_node_fn_method_node_sync_wallets( - `ptr`: Pointer, - uniffi_out_err: UniffiRustCallStatus, - ): Unit - fun uniffi_ldk_node_fn_method_node_unified_qr_payment( - `ptr`: Pointer, - uniffi_out_err: UniffiRustCallStatus, - ): Pointer - fun uniffi_ldk_node_fn_method_node_update_channel_config( - `ptr`: Pointer, - `userChannelId`: RustBuffer.ByValue, - `counterpartyNodeId`: RustBuffer.ByValue, - `channelConfig`: RustBuffer.ByValue, - uniffi_out_err: UniffiRustCallStatus, - ): Unit - fun uniffi_ldk_node_fn_method_node_verify_signature( - `ptr`: Pointer, - `msg`: RustBuffer.ByValue, - `sig`: RustBuffer.ByValue, - `pkey`: RustBuffer.ByValue, - uniffi_out_err: UniffiRustCallStatus, - ): Byte - fun uniffi_ldk_node_fn_method_node_wait_next_event( - `ptr`: Pointer, - uniffi_out_err: UniffiRustCallStatus, - ): RustBuffer.ByValue - fun uniffi_ldk_node_fn_clone_onchainpayment( - `ptr`: Pointer, - uniffi_out_err: UniffiRustCallStatus, - ): Pointer - fun uniffi_ldk_node_fn_free_onchainpayment( - `ptr`: Pointer, - uniffi_out_err: UniffiRustCallStatus, - ): Unit - fun uniffi_ldk_node_fn_method_onchainpayment_accelerate_by_cpfp( - `ptr`: Pointer, - `txid`: RustBuffer.ByValue, - `feeRate`: RustBuffer.ByValue, - `destinationAddress`: RustBuffer.ByValue, - uniffi_out_err: UniffiRustCallStatus, - ): RustBuffer.ByValue - fun uniffi_ldk_node_fn_method_onchainpayment_bump_fee_by_rbf( - `ptr`: Pointer, - `txid`: RustBuffer.ByValue, - `feeRate`: Pointer, - uniffi_out_err: UniffiRustCallStatus, - ): RustBuffer.ByValue - fun uniffi_ldk_node_fn_method_onchainpayment_calculate_cpfp_fee_rate( - `ptr`: Pointer, - `parentTxid`: RustBuffer.ByValue, - `urgent`: Byte, - uniffi_out_err: UniffiRustCallStatus, - ): Pointer - fun uniffi_ldk_node_fn_method_onchainpayment_calculate_total_fee( - `ptr`: Pointer, - `address`: RustBuffer.ByValue, - `amountSats`: Long, - `feeRate`: RustBuffer.ByValue, - `utxosToSpend`: RustBuffer.ByValue, - uniffi_out_err: UniffiRustCallStatus, - ): Long - fun uniffi_ldk_node_fn_method_onchainpayment_list_spendable_outputs( - `ptr`: Pointer, - uniffi_out_err: UniffiRustCallStatus, - ): RustBuffer.ByValue - fun uniffi_ldk_node_fn_method_onchainpayment_new_address( - `ptr`: Pointer, - uniffi_out_err: UniffiRustCallStatus, - ): RustBuffer.ByValue - 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, - ): RustBuffer.ByValue - 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, - ): RustBuffer.ByValue - 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, - ): RustBuffer.ByValue - fun uniffi_ldk_node_fn_clone_spontaneouspayment( - `ptr`: Pointer, - uniffi_out_err: UniffiRustCallStatus, - ): Pointer - fun uniffi_ldk_node_fn_free_spontaneouspayment( - `ptr`: Pointer, - uniffi_out_err: UniffiRustCallStatus, - ): Unit - fun uniffi_ldk_node_fn_method_spontaneouspayment_send( - `ptr`: Pointer, - `amountMsat`: Long, - `nodeId`: RustBuffer.ByValue, - `sendingParameters`: RustBuffer.ByValue, - uniffi_out_err: UniffiRustCallStatus, - ): RustBuffer.ByValue - fun uniffi_ldk_node_fn_method_spontaneouspayment_send_probes( - `ptr`: Pointer, - `amountMsat`: Long, - `nodeId`: RustBuffer.ByValue, - uniffi_out_err: UniffiRustCallStatus, - ): Unit - fun uniffi_ldk_node_fn_method_spontaneouspayment_send_with_custom_tlvs( - `ptr`: Pointer, - `amountMsat`: Long, - `nodeId`: RustBuffer.ByValue, - `sendingParameters`: RustBuffer.ByValue, - `customTlvs`: RustBuffer.ByValue, - uniffi_out_err: UniffiRustCallStatus, - ): RustBuffer.ByValue - fun uniffi_ldk_node_fn_clone_unifiedqrpayment( - `ptr`: Pointer, - uniffi_out_err: UniffiRustCallStatus, - ): Pointer - fun uniffi_ldk_node_fn_free_unifiedqrpayment( - `ptr`: Pointer, - uniffi_out_err: UniffiRustCallStatus, - ): Unit - fun uniffi_ldk_node_fn_method_unifiedqrpayment_receive( - `ptr`: Pointer, - `amountSats`: Long, - `message`: RustBuffer.ByValue, - `expirySec`: Int, - uniffi_out_err: UniffiRustCallStatus, - ): RustBuffer.ByValue - fun uniffi_ldk_node_fn_method_unifiedqrpayment_send( - `ptr`: Pointer, - `uriStr`: RustBuffer.ByValue, - uniffi_out_err: UniffiRustCallStatus, - ): RustBuffer.ByValue - fun uniffi_ldk_node_fn_clone_vssheaderprovider( - `ptr`: Pointer, - uniffi_out_err: UniffiRustCallStatus, - ): Pointer - fun uniffi_ldk_node_fn_free_vssheaderprovider( - `ptr`: Pointer, - uniffi_out_err: UniffiRustCallStatus, - ): Unit - fun uniffi_ldk_node_fn_method_vssheaderprovider_get_headers( - `ptr`: Pointer, - `request`: RustBuffer.ByValue, - ): Long - fun uniffi_ldk_node_fn_func_default_config(uniffi_out_err: UniffiRustCallStatus): RustBuffer.ByValue - fun uniffi_ldk_node_fn_func_generate_entropy_mnemonic(uniffi_out_err: UniffiRustCallStatus): RustBuffer.ByValue - fun ffi_ldk_node_rustbuffer_alloc( - `size`: Long, - uniffi_out_err: UniffiRustCallStatus, - ): RustBuffer.ByValue - fun ffi_ldk_node_rustbuffer_from_bytes( - `bytes`: ForeignBytes.ByValue, - uniffi_out_err: UniffiRustCallStatus, - ): RustBuffer.ByValue - fun ffi_ldk_node_rustbuffer_free( - `buf`: RustBuffer.ByValue, - uniffi_out_err: UniffiRustCallStatus, - ): Unit - fun ffi_ldk_node_rustbuffer_reserve( - `buf`: RustBuffer.ByValue, - `additional`: Long, - uniffi_out_err: UniffiRustCallStatus, - ): RustBuffer.ByValue - fun ffi_ldk_node_rust_future_poll_u8( - `handle`: Long, - `callback`: UniffiRustFutureContinuationCallback, - `callbackData`: Long, - ): Unit - fun ffi_ldk_node_rust_future_cancel_u8(`handle`: Long): Unit - fun ffi_ldk_node_rust_future_free_u8(`handle`: Long): Unit - fun ffi_ldk_node_rust_future_complete_u8( - `handle`: Long, - uniffi_out_err: UniffiRustCallStatus, - ): Byte - fun ffi_ldk_node_rust_future_poll_i8( - `handle`: Long, - `callback`: UniffiRustFutureContinuationCallback, - `callbackData`: Long, - ): Unit - fun ffi_ldk_node_rust_future_cancel_i8(`handle`: Long): Unit - fun ffi_ldk_node_rust_future_free_i8(`handle`: Long): Unit - fun ffi_ldk_node_rust_future_complete_i8( - `handle`: Long, - uniffi_out_err: UniffiRustCallStatus, - ): Byte - fun ffi_ldk_node_rust_future_poll_u16( - `handle`: Long, - `callback`: UniffiRustFutureContinuationCallback, - `callbackData`: Long, - ): Unit - fun ffi_ldk_node_rust_future_cancel_u16(`handle`: Long): Unit - fun ffi_ldk_node_rust_future_free_u16(`handle`: Long): Unit - fun ffi_ldk_node_rust_future_complete_u16( - `handle`: Long, - uniffi_out_err: UniffiRustCallStatus, - ): Short - fun ffi_ldk_node_rust_future_poll_i16( - `handle`: Long, - `callback`: UniffiRustFutureContinuationCallback, - `callbackData`: Long, - ): Unit - fun ffi_ldk_node_rust_future_cancel_i16(`handle`: Long): Unit - fun ffi_ldk_node_rust_future_free_i16(`handle`: Long): Unit - fun ffi_ldk_node_rust_future_complete_i16( - `handle`: Long, - uniffi_out_err: UniffiRustCallStatus, - ): Short - fun ffi_ldk_node_rust_future_poll_u32( - `handle`: Long, - `callback`: UniffiRustFutureContinuationCallback, - `callbackData`: Long, - ): Unit - fun ffi_ldk_node_rust_future_cancel_u32(`handle`: Long): Unit - fun ffi_ldk_node_rust_future_free_u32(`handle`: Long): Unit - fun ffi_ldk_node_rust_future_complete_u32( - `handle`: Long, - uniffi_out_err: UniffiRustCallStatus, - ): Int - fun ffi_ldk_node_rust_future_poll_i32( - `handle`: Long, - `callback`: UniffiRustFutureContinuationCallback, - `callbackData`: Long, - ): Unit - fun ffi_ldk_node_rust_future_cancel_i32(`handle`: Long): Unit - fun ffi_ldk_node_rust_future_free_i32(`handle`: Long): Unit - fun ffi_ldk_node_rust_future_complete_i32( - `handle`: Long, - uniffi_out_err: UniffiRustCallStatus, - ): Int - fun ffi_ldk_node_rust_future_poll_u64( - `handle`: Long, - `callback`: UniffiRustFutureContinuationCallback, - `callbackData`: Long, - ): Unit - fun ffi_ldk_node_rust_future_cancel_u64(`handle`: Long): Unit - fun ffi_ldk_node_rust_future_free_u64(`handle`: Long): Unit - fun ffi_ldk_node_rust_future_complete_u64( - `handle`: Long, - uniffi_out_err: UniffiRustCallStatus, - ): Long - fun ffi_ldk_node_rust_future_poll_i64( - `handle`: Long, - `callback`: UniffiRustFutureContinuationCallback, - `callbackData`: Long, - ): Unit - fun ffi_ldk_node_rust_future_cancel_i64(`handle`: Long): Unit - fun ffi_ldk_node_rust_future_free_i64(`handle`: Long): Unit - fun ffi_ldk_node_rust_future_complete_i64( - `handle`: Long, - uniffi_out_err: UniffiRustCallStatus, - ): Long - fun ffi_ldk_node_rust_future_poll_f32( - `handle`: Long, - `callback`: UniffiRustFutureContinuationCallback, - `callbackData`: Long, - ): Unit - fun ffi_ldk_node_rust_future_cancel_f32(`handle`: Long): Unit - fun ffi_ldk_node_rust_future_free_f32(`handle`: Long): Unit - fun ffi_ldk_node_rust_future_complete_f32( - `handle`: Long, - uniffi_out_err: UniffiRustCallStatus, - ): Float - fun ffi_ldk_node_rust_future_poll_f64( - `handle`: Long, - `callback`: UniffiRustFutureContinuationCallback, - `callbackData`: Long, - ): Unit - fun ffi_ldk_node_rust_future_cancel_f64(`handle`: Long): Unit - fun ffi_ldk_node_rust_future_free_f64(`handle`: Long): Unit - fun ffi_ldk_node_rust_future_complete_f64( - `handle`: Long, - uniffi_out_err: UniffiRustCallStatus, - ): Double - fun ffi_ldk_node_rust_future_poll_pointer( - `handle`: Long, - `callback`: UniffiRustFutureContinuationCallback, - `callbackData`: Long, - ): Unit - fun ffi_ldk_node_rust_future_cancel_pointer(`handle`: Long): Unit - fun ffi_ldk_node_rust_future_free_pointer(`handle`: Long): Unit - fun ffi_ldk_node_rust_future_complete_pointer( - `handle`: Long, - uniffi_out_err: UniffiRustCallStatus, - ): Pointer - fun ffi_ldk_node_rust_future_poll_rust_buffer( - `handle`: Long, - `callback`: UniffiRustFutureContinuationCallback, - `callbackData`: Long, - ): Unit - fun ffi_ldk_node_rust_future_cancel_rust_buffer(`handle`: Long): Unit - fun ffi_ldk_node_rust_future_free_rust_buffer(`handle`: Long): Unit - fun ffi_ldk_node_rust_future_complete_rust_buffer( - `handle`: Long, - uniffi_out_err: UniffiRustCallStatus, - ): RustBuffer.ByValue - fun ffi_ldk_node_rust_future_poll_void( - `handle`: Long, - `callback`: UniffiRustFutureContinuationCallback, - `callbackData`: Long, - ): Unit - fun ffi_ldk_node_rust_future_cancel_void(`handle`: Long): Unit - fun ffi_ldk_node_rust_future_free_void(`handle`: Long): Unit - fun ffi_ldk_node_rust_future_complete_void( - `handle`: Long, - uniffi_out_err: UniffiRustCallStatus, - ): Unit - fun uniffi_ldk_node_checksum_func_default_config(): Short - fun uniffi_ldk_node_checksum_func_generate_entropy_mnemonic(): Short - fun uniffi_ldk_node_checksum_method_bolt11invoice_amount_milli_satoshis(): Short - fun uniffi_ldk_node_checksum_method_bolt11invoice_currency(): Short - fun uniffi_ldk_node_checksum_method_bolt11invoice_expiry_time_seconds(): Short - fun uniffi_ldk_node_checksum_method_bolt11invoice_fallback_addresses(): Short - fun uniffi_ldk_node_checksum_method_bolt11invoice_invoice_description(): Short - fun uniffi_ldk_node_checksum_method_bolt11invoice_is_expired(): Short - fun uniffi_ldk_node_checksum_method_bolt11invoice_min_final_cltv_expiry_delta(): Short - fun uniffi_ldk_node_checksum_method_bolt11invoice_network(): Short - fun uniffi_ldk_node_checksum_method_bolt11invoice_payment_hash(): Short - fun uniffi_ldk_node_checksum_method_bolt11invoice_payment_secret(): Short - fun uniffi_ldk_node_checksum_method_bolt11invoice_recover_payee_pub_key(): Short - fun uniffi_ldk_node_checksum_method_bolt11invoice_route_hints(): Short - fun uniffi_ldk_node_checksum_method_bolt11invoice_seconds_since_epoch(): Short - fun uniffi_ldk_node_checksum_method_bolt11invoice_seconds_until_expiry(): Short - fun uniffi_ldk_node_checksum_method_bolt11invoice_signable_hash(): Short - fun uniffi_ldk_node_checksum_method_bolt11invoice_would_expire(): Short - fun uniffi_ldk_node_checksum_method_bolt11payment_claim_for_hash(): Short - fun uniffi_ldk_node_checksum_method_bolt11payment_fail_for_hash(): Short - fun uniffi_ldk_node_checksum_method_bolt11payment_receive(): Short - fun uniffi_ldk_node_checksum_method_bolt11payment_receive_for_hash(): Short - fun uniffi_ldk_node_checksum_method_bolt11payment_receive_variable_amount(): Short - fun uniffi_ldk_node_checksum_method_bolt11payment_receive_variable_amount_for_hash(): Short - fun uniffi_ldk_node_checksum_method_bolt11payment_receive_variable_amount_via_jit_channel(): Short - fun uniffi_ldk_node_checksum_method_bolt11payment_receive_via_jit_channel(): Short - fun uniffi_ldk_node_checksum_method_bolt11payment_send(): Short - fun uniffi_ldk_node_checksum_method_bolt11payment_send_probes(): Short - fun uniffi_ldk_node_checksum_method_bolt11payment_send_probes_using_amount(): Short - fun uniffi_ldk_node_checksum_method_bolt11payment_send_using_amount(): Short - fun uniffi_ldk_node_checksum_method_bolt12payment_initiate_refund(): Short - fun uniffi_ldk_node_checksum_method_bolt12payment_receive(): Short - fun uniffi_ldk_node_checksum_method_bolt12payment_receive_variable_amount(): Short - fun uniffi_ldk_node_checksum_method_bolt12payment_request_refund_payment(): Short - fun uniffi_ldk_node_checksum_method_bolt12payment_send(): Short - fun uniffi_ldk_node_checksum_method_bolt12payment_send_using_amount(): Short - fun uniffi_ldk_node_checksum_method_builder_build(): Short - fun uniffi_ldk_node_checksum_method_builder_build_with_fs_store(): Short - fun uniffi_ldk_node_checksum_method_builder_build_with_vss_store(): Short - fun uniffi_ldk_node_checksum_method_builder_build_with_vss_store_and_fixed_headers(): Short - fun uniffi_ldk_node_checksum_method_builder_build_with_vss_store_and_header_provider(): Short - fun uniffi_ldk_node_checksum_method_builder_set_announcement_addresses(): Short - fun uniffi_ldk_node_checksum_method_builder_set_chain_source_bitcoind_rpc(): Short - fun uniffi_ldk_node_checksum_method_builder_set_chain_source_electrum(): Short - fun uniffi_ldk_node_checksum_method_builder_set_chain_source_esplora(): Short - fun uniffi_ldk_node_checksum_method_builder_set_custom_logger(): Short - fun uniffi_ldk_node_checksum_method_builder_set_entropy_bip39_mnemonic(): Short - fun uniffi_ldk_node_checksum_method_builder_set_entropy_seed_bytes(): Short - fun uniffi_ldk_node_checksum_method_builder_set_entropy_seed_path(): Short - fun uniffi_ldk_node_checksum_method_builder_set_filesystem_logger(): Short - fun uniffi_ldk_node_checksum_method_builder_set_gossip_source_p2p(): Short - fun uniffi_ldk_node_checksum_method_builder_set_gossip_source_rgs(): Short - fun uniffi_ldk_node_checksum_method_builder_set_liquidity_source_lsps1(): Short - fun uniffi_ldk_node_checksum_method_builder_set_liquidity_source_lsps2(): Short - fun uniffi_ldk_node_checksum_method_builder_set_listening_addresses(): Short - fun uniffi_ldk_node_checksum_method_builder_set_log_facade_logger(): Short - fun uniffi_ldk_node_checksum_method_builder_set_network(): Short - fun uniffi_ldk_node_checksum_method_builder_set_node_alias(): Short - fun uniffi_ldk_node_checksum_method_builder_set_storage_dir_path(): Short - fun uniffi_ldk_node_checksum_method_feerate_to_sat_per_kwu(): Short - fun uniffi_ldk_node_checksum_method_feerate_to_sat_per_vb_ceil(): Short - fun uniffi_ldk_node_checksum_method_feerate_to_sat_per_vb_floor(): Short - fun uniffi_ldk_node_checksum_method_lsps1liquidity_check_order_status(): Short - fun uniffi_ldk_node_checksum_method_lsps1liquidity_request_channel(): Short - fun uniffi_ldk_node_checksum_method_logwriter_log(): Short - fun uniffi_ldk_node_checksum_method_networkgraph_channel(): Short - fun uniffi_ldk_node_checksum_method_networkgraph_list_channels(): Short - fun uniffi_ldk_node_checksum_method_networkgraph_list_nodes(): Short - fun uniffi_ldk_node_checksum_method_networkgraph_node(): Short - fun uniffi_ldk_node_checksum_method_node_announcement_addresses(): Short - fun uniffi_ldk_node_checksum_method_node_bolt11_payment(): Short - fun uniffi_ldk_node_checksum_method_node_bolt12_payment(): Short - fun uniffi_ldk_node_checksum_method_node_close_channel(): Short - fun uniffi_ldk_node_checksum_method_node_config(): Short - fun uniffi_ldk_node_checksum_method_node_connect(): Short - fun uniffi_ldk_node_checksum_method_node_disconnect(): Short - fun uniffi_ldk_node_checksum_method_node_event_handled(): Short - fun uniffi_ldk_node_checksum_method_node_export_pathfinding_scores(): Short - fun uniffi_ldk_node_checksum_method_node_force_close_channel(): Short - fun uniffi_ldk_node_checksum_method_node_list_balances(): Short - fun uniffi_ldk_node_checksum_method_node_list_channels(): Short - fun uniffi_ldk_node_checksum_method_node_list_payments(): Short - fun uniffi_ldk_node_checksum_method_node_list_peers(): Short - fun uniffi_ldk_node_checksum_method_node_listening_addresses(): Short - fun uniffi_ldk_node_checksum_method_node_lsps1_liquidity(): Short - fun uniffi_ldk_node_checksum_method_node_network_graph(): Short - fun uniffi_ldk_node_checksum_method_node_next_event(): Short - fun uniffi_ldk_node_checksum_method_node_next_event_async(): Short - fun uniffi_ldk_node_checksum_method_node_node_alias(): Short - fun uniffi_ldk_node_checksum_method_node_node_id(): Short - fun uniffi_ldk_node_checksum_method_node_onchain_payment(): Short - fun uniffi_ldk_node_checksum_method_node_open_announced_channel(): Short - fun uniffi_ldk_node_checksum_method_node_open_channel(): Short - fun uniffi_ldk_node_checksum_method_node_payment(): Short - fun uniffi_ldk_node_checksum_method_node_remove_payment(): Short - fun uniffi_ldk_node_checksum_method_node_sign_message(): Short - fun uniffi_ldk_node_checksum_method_node_spontaneous_payment(): Short - fun uniffi_ldk_node_checksum_method_node_start(): Short - fun uniffi_ldk_node_checksum_method_node_status(): Short - fun uniffi_ldk_node_checksum_method_node_stop(): Short - fun uniffi_ldk_node_checksum_method_node_sync_wallets(): Short - fun uniffi_ldk_node_checksum_method_node_unified_qr_payment(): Short - fun uniffi_ldk_node_checksum_method_node_update_channel_config(): Short - fun uniffi_ldk_node_checksum_method_node_verify_signature(): Short - fun uniffi_ldk_node_checksum_method_node_wait_next_event(): Short - fun uniffi_ldk_node_checksum_method_onchainpayment_accelerate_by_cpfp(): Short - fun uniffi_ldk_node_checksum_method_onchainpayment_bump_fee_by_rbf(): Short - fun uniffi_ldk_node_checksum_method_onchainpayment_calculate_cpfp_fee_rate(): Short - fun uniffi_ldk_node_checksum_method_onchainpayment_calculate_total_fee(): Short - fun uniffi_ldk_node_checksum_method_onchainpayment_list_spendable_outputs(): Short - fun uniffi_ldk_node_checksum_method_onchainpayment_new_address(): Short - fun uniffi_ldk_node_checksum_method_onchainpayment_select_utxos_with_algorithm(): Short - fun uniffi_ldk_node_checksum_method_onchainpayment_send_all_to_address(): Short - fun uniffi_ldk_node_checksum_method_onchainpayment_send_to_address(): Short - fun uniffi_ldk_node_checksum_method_spontaneouspayment_send(): Short - fun uniffi_ldk_node_checksum_method_spontaneouspayment_send_probes(): Short - fun uniffi_ldk_node_checksum_method_spontaneouspayment_send_with_custom_tlvs(): Short - fun uniffi_ldk_node_checksum_method_unifiedqrpayment_receive(): Short - fun uniffi_ldk_node_checksum_method_unifiedqrpayment_send(): Short - fun uniffi_ldk_node_checksum_method_vssheaderprovider_get_headers(): Short - fun uniffi_ldk_node_checksum_constructor_bolt11invoice_from_str(): Short - fun uniffi_ldk_node_checksum_constructor_builder_from_config(): Short - fun uniffi_ldk_node_checksum_constructor_builder_new(): Short - fun uniffi_ldk_node_checksum_constructor_feerate_from_sat_per_kwu(): Short - fun uniffi_ldk_node_checksum_constructor_feerate_from_sat_per_vb_unchecked(): Short - fun ffi_ldk_node_uniffi_contract_version(): Int + + +// A JNA Library to expose the extern-C FFI definitions. +// This is an implementation detail which will be called internally by the public API. + +internal interface UniffiLib : Library { + companion object { + internal val INSTANCE: UniffiLib by lazy { + loadIndirect(componentName = "ldk_node") + .also { lib: UniffiLib -> + uniffiCheckContractApiVersion(lib) + uniffiCheckApiChecksums(lib) + uniffiCallbackInterfaceLogWriter.register(lib) + } + } + + // The Cleaner for the whole library + internal val CLEANER: UniffiCleaner by lazy { + UniffiCleaner.create() + } + } + + fun uniffi_ldk_node_fn_clone_bolt11invoice(`ptr`: Pointer,uniffi_out_err: UniffiRustCallStatus, + ): Pointer + fun uniffi_ldk_node_fn_free_bolt11invoice(`ptr`: Pointer,uniffi_out_err: UniffiRustCallStatus, + ): Unit + fun uniffi_ldk_node_fn_constructor_bolt11invoice_from_str(`invoiceStr`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, + ): Pointer + fun uniffi_ldk_node_fn_method_bolt11invoice_amount_milli_satoshis(`ptr`: Pointer,uniffi_out_err: UniffiRustCallStatus, + ): RustBuffer.ByValue + fun uniffi_ldk_node_fn_method_bolt11invoice_currency(`ptr`: Pointer,uniffi_out_err: UniffiRustCallStatus, + ): RustBuffer.ByValue + fun uniffi_ldk_node_fn_method_bolt11invoice_expiry_time_seconds(`ptr`: Pointer,uniffi_out_err: UniffiRustCallStatus, + ): Long + fun uniffi_ldk_node_fn_method_bolt11invoice_fallback_addresses(`ptr`: Pointer,uniffi_out_err: UniffiRustCallStatus, + ): RustBuffer.ByValue + fun uniffi_ldk_node_fn_method_bolt11invoice_invoice_description(`ptr`: Pointer,uniffi_out_err: UniffiRustCallStatus, + ): RustBuffer.ByValue + fun uniffi_ldk_node_fn_method_bolt11invoice_is_expired(`ptr`: Pointer,uniffi_out_err: UniffiRustCallStatus, + ): Byte + fun uniffi_ldk_node_fn_method_bolt11invoice_min_final_cltv_expiry_delta(`ptr`: Pointer,uniffi_out_err: UniffiRustCallStatus, + ): Long + fun uniffi_ldk_node_fn_method_bolt11invoice_network(`ptr`: Pointer,uniffi_out_err: UniffiRustCallStatus, + ): RustBuffer.ByValue + fun uniffi_ldk_node_fn_method_bolt11invoice_payment_hash(`ptr`: Pointer,uniffi_out_err: UniffiRustCallStatus, + ): RustBuffer.ByValue + fun uniffi_ldk_node_fn_method_bolt11invoice_payment_secret(`ptr`: Pointer,uniffi_out_err: UniffiRustCallStatus, + ): RustBuffer.ByValue + fun uniffi_ldk_node_fn_method_bolt11invoice_recover_payee_pub_key(`ptr`: Pointer,uniffi_out_err: UniffiRustCallStatus, + ): RustBuffer.ByValue + fun uniffi_ldk_node_fn_method_bolt11invoice_route_hints(`ptr`: Pointer,uniffi_out_err: UniffiRustCallStatus, + ): RustBuffer.ByValue + fun uniffi_ldk_node_fn_method_bolt11invoice_seconds_since_epoch(`ptr`: Pointer,uniffi_out_err: UniffiRustCallStatus, + ): Long + fun uniffi_ldk_node_fn_method_bolt11invoice_seconds_until_expiry(`ptr`: Pointer,uniffi_out_err: UniffiRustCallStatus, + ): Long + fun uniffi_ldk_node_fn_method_bolt11invoice_signable_hash(`ptr`: Pointer,uniffi_out_err: UniffiRustCallStatus, + ): RustBuffer.ByValue + fun uniffi_ldk_node_fn_method_bolt11invoice_would_expire(`ptr`: Pointer,`atTimeSeconds`: Long,uniffi_out_err: UniffiRustCallStatus, + ): Byte + fun uniffi_ldk_node_fn_method_bolt11invoice_uniffi_trait_debug(`ptr`: Pointer,uniffi_out_err: UniffiRustCallStatus, + ): RustBuffer.ByValue + fun uniffi_ldk_node_fn_method_bolt11invoice_uniffi_trait_display(`ptr`: Pointer,uniffi_out_err: UniffiRustCallStatus, + ): RustBuffer.ByValue + fun uniffi_ldk_node_fn_method_bolt11invoice_uniffi_trait_eq_eq(`ptr`: Pointer,`other`: Pointer,uniffi_out_err: UniffiRustCallStatus, + ): Byte + fun uniffi_ldk_node_fn_method_bolt11invoice_uniffi_trait_eq_ne(`ptr`: Pointer,`other`: Pointer,uniffi_out_err: UniffiRustCallStatus, + ): Byte + fun uniffi_ldk_node_fn_clone_bolt11payment(`ptr`: Pointer,uniffi_out_err: UniffiRustCallStatus, + ): Pointer + fun uniffi_ldk_node_fn_free_bolt11payment(`ptr`: Pointer,uniffi_out_err: UniffiRustCallStatus, + ): Unit + fun uniffi_ldk_node_fn_method_bolt11payment_claim_for_hash(`ptr`: Pointer,`paymentHash`: RustBuffer.ByValue,`claimableAmountMsat`: Long,`preimage`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, + ): Unit + fun uniffi_ldk_node_fn_method_bolt11payment_estimate_routing_fees(`ptr`: Pointer,`invoice`: Pointer,uniffi_out_err: UniffiRustCallStatus, + ): Long + fun uniffi_ldk_node_fn_method_bolt11payment_estimate_routing_fees_using_amount(`ptr`: Pointer,`invoice`: Pointer,`amountMsat`: Long,uniffi_out_err: UniffiRustCallStatus, + ): Long + fun uniffi_ldk_node_fn_method_bolt11payment_fail_for_hash(`ptr`: Pointer,`paymentHash`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, + ): Unit + fun uniffi_ldk_node_fn_method_bolt11payment_receive(`ptr`: Pointer,`amountMsat`: Long,`description`: RustBuffer.ByValue,`expirySecs`: Int,uniffi_out_err: UniffiRustCallStatus, + ): Pointer + fun uniffi_ldk_node_fn_method_bolt11payment_receive_for_hash(`ptr`: Pointer,`amountMsat`: Long,`description`: RustBuffer.ByValue,`expirySecs`: Int,`paymentHash`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, + ): Pointer + fun uniffi_ldk_node_fn_method_bolt11payment_receive_variable_amount(`ptr`: Pointer,`description`: RustBuffer.ByValue,`expirySecs`: Int,uniffi_out_err: UniffiRustCallStatus, + ): Pointer + fun uniffi_ldk_node_fn_method_bolt11payment_receive_variable_amount_for_hash(`ptr`: Pointer,`description`: RustBuffer.ByValue,`expirySecs`: Int,`paymentHash`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, + ): Pointer + fun uniffi_ldk_node_fn_method_bolt11payment_receive_variable_amount_via_jit_channel(`ptr`: Pointer,`description`: RustBuffer.ByValue,`expirySecs`: Int,`maxProportionalLspFeeLimitPpmMsat`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, + ): Pointer + fun uniffi_ldk_node_fn_method_bolt11payment_receive_via_jit_channel(`ptr`: Pointer,`amountMsat`: Long,`description`: RustBuffer.ByValue,`expirySecs`: Int,`maxLspFeeLimitMsat`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, + ): Pointer + fun uniffi_ldk_node_fn_method_bolt11payment_send(`ptr`: Pointer,`invoice`: Pointer,`sendingParameters`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, + ): RustBuffer.ByValue + fun uniffi_ldk_node_fn_method_bolt11payment_send_probes(`ptr`: Pointer,`invoice`: Pointer,uniffi_out_err: UniffiRustCallStatus, + ): Unit + fun uniffi_ldk_node_fn_method_bolt11payment_send_probes_using_amount(`ptr`: Pointer,`invoice`: Pointer,`amountMsat`: Long,uniffi_out_err: UniffiRustCallStatus, + ): Unit + fun uniffi_ldk_node_fn_method_bolt11payment_send_using_amount(`ptr`: Pointer,`invoice`: Pointer,`amountMsat`: Long,`sendingParameters`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, + ): RustBuffer.ByValue + fun uniffi_ldk_node_fn_clone_bolt12payment(`ptr`: Pointer,uniffi_out_err: UniffiRustCallStatus, + ): Pointer + fun uniffi_ldk_node_fn_free_bolt12payment(`ptr`: Pointer,uniffi_out_err: UniffiRustCallStatus, + ): Unit + fun uniffi_ldk_node_fn_method_bolt12payment_initiate_refund(`ptr`: Pointer,`amountMsat`: Long,`expirySecs`: Int,`quantity`: RustBuffer.ByValue,`payerNote`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, + ): RustBuffer.ByValue + fun uniffi_ldk_node_fn_method_bolt12payment_receive(`ptr`: Pointer,`amountMsat`: Long,`description`: RustBuffer.ByValue,`expirySecs`: RustBuffer.ByValue,`quantity`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, + ): RustBuffer.ByValue + fun uniffi_ldk_node_fn_method_bolt12payment_receive_variable_amount(`ptr`: Pointer,`description`: RustBuffer.ByValue,`expirySecs`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, + ): RustBuffer.ByValue + fun uniffi_ldk_node_fn_method_bolt12payment_request_refund_payment(`ptr`: Pointer,`refund`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, + ): RustBuffer.ByValue + fun uniffi_ldk_node_fn_method_bolt12payment_send(`ptr`: Pointer,`offer`: RustBuffer.ByValue,`quantity`: RustBuffer.ByValue,`payerNote`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, + ): RustBuffer.ByValue + fun uniffi_ldk_node_fn_method_bolt12payment_send_using_amount(`ptr`: Pointer,`offer`: RustBuffer.ByValue,`amountMsat`: Long,`quantity`: RustBuffer.ByValue,`payerNote`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, + ): RustBuffer.ByValue + fun uniffi_ldk_node_fn_clone_builder(`ptr`: Pointer,uniffi_out_err: UniffiRustCallStatus, + ): Pointer + fun uniffi_ldk_node_fn_free_builder(`ptr`: Pointer,uniffi_out_err: UniffiRustCallStatus, + ): Unit + fun uniffi_ldk_node_fn_constructor_builder_from_config(`config`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, + ): Pointer + fun uniffi_ldk_node_fn_constructor_builder_new(uniffi_out_err: UniffiRustCallStatus, + ): Pointer + fun uniffi_ldk_node_fn_method_builder_build(`ptr`: Pointer,uniffi_out_err: UniffiRustCallStatus, + ): Pointer + fun uniffi_ldk_node_fn_method_builder_build_with_fs_store(`ptr`: Pointer,uniffi_out_err: UniffiRustCallStatus, + ): Pointer + fun uniffi_ldk_node_fn_method_builder_build_with_vss_store(`ptr`: Pointer,`vssUrl`: RustBuffer.ByValue,`storeId`: RustBuffer.ByValue,`lnurlAuthServerUrl`: RustBuffer.ByValue,`fixedHeaders`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, + ): Pointer + fun uniffi_ldk_node_fn_method_builder_build_with_vss_store_and_fixed_headers(`ptr`: Pointer,`vssUrl`: RustBuffer.ByValue,`storeId`: RustBuffer.ByValue,`fixedHeaders`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, + ): Pointer + fun uniffi_ldk_node_fn_method_builder_build_with_vss_store_and_header_provider(`ptr`: Pointer,`vssUrl`: RustBuffer.ByValue,`storeId`: RustBuffer.ByValue,`headerProvider`: Pointer,uniffi_out_err: UniffiRustCallStatus, + ): Pointer + fun uniffi_ldk_node_fn_method_builder_set_announcement_addresses(`ptr`: Pointer,`announcementAddresses`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, + ): Unit + fun uniffi_ldk_node_fn_method_builder_set_chain_source_bitcoind_rpc(`ptr`: Pointer,`rpcHost`: RustBuffer.ByValue,`rpcPort`: Short,`rpcUser`: RustBuffer.ByValue,`rpcPassword`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, + ): Unit + fun uniffi_ldk_node_fn_method_builder_set_chain_source_electrum(`ptr`: Pointer,`serverUrl`: RustBuffer.ByValue,`config`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, + ): Unit + fun uniffi_ldk_node_fn_method_builder_set_chain_source_esplora(`ptr`: Pointer,`serverUrl`: RustBuffer.ByValue,`config`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, + ): Unit + fun uniffi_ldk_node_fn_method_builder_set_custom_logger(`ptr`: Pointer,`logWriter`: Pointer,uniffi_out_err: UniffiRustCallStatus, + ): Unit + fun uniffi_ldk_node_fn_method_builder_set_entropy_bip39_mnemonic(`ptr`: Pointer,`mnemonic`: RustBuffer.ByValue,`passphrase`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, + ): Unit + fun uniffi_ldk_node_fn_method_builder_set_entropy_seed_bytes(`ptr`: Pointer,`seedBytes`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, + ): Unit + fun uniffi_ldk_node_fn_method_builder_set_entropy_seed_path(`ptr`: Pointer,`seedPath`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, + ): Unit + fun uniffi_ldk_node_fn_method_builder_set_filesystem_logger(`ptr`: Pointer,`logFilePath`: RustBuffer.ByValue,`maxLogLevel`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, + ): Unit + fun uniffi_ldk_node_fn_method_builder_set_gossip_source_p2p(`ptr`: Pointer,uniffi_out_err: UniffiRustCallStatus, + ): Unit + fun uniffi_ldk_node_fn_method_builder_set_gossip_source_rgs(`ptr`: Pointer,`rgsServerUrl`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, + ): Unit + fun uniffi_ldk_node_fn_method_builder_set_liquidity_source_lsps1(`ptr`: Pointer,`nodeId`: RustBuffer.ByValue,`address`: RustBuffer.ByValue,`token`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, + ): Unit + fun uniffi_ldk_node_fn_method_builder_set_liquidity_source_lsps2(`ptr`: Pointer,`nodeId`: RustBuffer.ByValue,`address`: RustBuffer.ByValue,`token`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, + ): Unit + fun uniffi_ldk_node_fn_method_builder_set_listening_addresses(`ptr`: Pointer,`listeningAddresses`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, + ): Unit + fun uniffi_ldk_node_fn_method_builder_set_log_facade_logger(`ptr`: Pointer,uniffi_out_err: UniffiRustCallStatus, + ): Unit + fun uniffi_ldk_node_fn_method_builder_set_network(`ptr`: Pointer,`network`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, + ): Unit + fun uniffi_ldk_node_fn_method_builder_set_node_alias(`ptr`: Pointer,`nodeAlias`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, + ): Unit + fun uniffi_ldk_node_fn_method_builder_set_storage_dir_path(`ptr`: Pointer,`storageDirPath`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, + ): Unit + fun uniffi_ldk_node_fn_clone_feerate(`ptr`: Pointer,uniffi_out_err: UniffiRustCallStatus, + ): Pointer + fun uniffi_ldk_node_fn_free_feerate(`ptr`: Pointer,uniffi_out_err: UniffiRustCallStatus, + ): Unit + fun uniffi_ldk_node_fn_constructor_feerate_from_sat_per_kwu(`satKwu`: Long,uniffi_out_err: UniffiRustCallStatus, + ): Pointer + fun uniffi_ldk_node_fn_constructor_feerate_from_sat_per_vb_unchecked(`satVb`: Long,uniffi_out_err: UniffiRustCallStatus, + ): Pointer + fun uniffi_ldk_node_fn_method_feerate_to_sat_per_kwu(`ptr`: Pointer,uniffi_out_err: UniffiRustCallStatus, + ): Long + fun uniffi_ldk_node_fn_method_feerate_to_sat_per_vb_ceil(`ptr`: Pointer,uniffi_out_err: UniffiRustCallStatus, + ): Long + fun uniffi_ldk_node_fn_method_feerate_to_sat_per_vb_floor(`ptr`: Pointer,uniffi_out_err: UniffiRustCallStatus, + ): Long + fun uniffi_ldk_node_fn_clone_lsps1liquidity(`ptr`: Pointer,uniffi_out_err: UniffiRustCallStatus, + ): Pointer + fun uniffi_ldk_node_fn_free_lsps1liquidity(`ptr`: Pointer,uniffi_out_err: UniffiRustCallStatus, + ): Unit + fun uniffi_ldk_node_fn_method_lsps1liquidity_check_order_status(`ptr`: Pointer,`orderId`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, + ): RustBuffer.ByValue + fun uniffi_ldk_node_fn_method_lsps1liquidity_request_channel(`ptr`: Pointer,`lspBalanceSat`: Long,`clientBalanceSat`: Long,`channelExpiryBlocks`: Int,`announceChannel`: Byte,uniffi_out_err: UniffiRustCallStatus, + ): RustBuffer.ByValue + fun uniffi_ldk_node_fn_clone_logwriter(`ptr`: Pointer,uniffi_out_err: UniffiRustCallStatus, + ): Pointer + fun uniffi_ldk_node_fn_free_logwriter(`ptr`: Pointer,uniffi_out_err: UniffiRustCallStatus, + ): Unit + fun uniffi_ldk_node_fn_init_callback_vtable_logwriter(`vtable`: UniffiVTableCallbackInterfaceLogWriter, + ): Unit + fun uniffi_ldk_node_fn_method_logwriter_log(`ptr`: Pointer,`record`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, + ): Unit + fun uniffi_ldk_node_fn_clone_networkgraph(`ptr`: Pointer,uniffi_out_err: UniffiRustCallStatus, + ): Pointer + fun uniffi_ldk_node_fn_free_networkgraph(`ptr`: Pointer,uniffi_out_err: UniffiRustCallStatus, + ): Unit + fun uniffi_ldk_node_fn_method_networkgraph_channel(`ptr`: Pointer,`shortChannelId`: Long,uniffi_out_err: UniffiRustCallStatus, + ): RustBuffer.ByValue + fun uniffi_ldk_node_fn_method_networkgraph_list_channels(`ptr`: Pointer,uniffi_out_err: UniffiRustCallStatus, + ): RustBuffer.ByValue + fun uniffi_ldk_node_fn_method_networkgraph_list_nodes(`ptr`: Pointer,uniffi_out_err: UniffiRustCallStatus, + ): RustBuffer.ByValue + fun uniffi_ldk_node_fn_method_networkgraph_node(`ptr`: Pointer,`nodeId`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, + ): RustBuffer.ByValue + fun uniffi_ldk_node_fn_clone_node(`ptr`: Pointer,uniffi_out_err: UniffiRustCallStatus, + ): Pointer + fun uniffi_ldk_node_fn_free_node(`ptr`: Pointer,uniffi_out_err: UniffiRustCallStatus, + ): Unit + fun uniffi_ldk_node_fn_method_node_announcement_addresses(`ptr`: Pointer,uniffi_out_err: UniffiRustCallStatus, + ): RustBuffer.ByValue + fun uniffi_ldk_node_fn_method_node_bolt11_payment(`ptr`: Pointer,uniffi_out_err: UniffiRustCallStatus, + ): Pointer + fun uniffi_ldk_node_fn_method_node_bolt12_payment(`ptr`: Pointer,uniffi_out_err: UniffiRustCallStatus, + ): Pointer + fun uniffi_ldk_node_fn_method_node_close_channel(`ptr`: Pointer,`userChannelId`: RustBuffer.ByValue,`counterpartyNodeId`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, + ): Unit + fun uniffi_ldk_node_fn_method_node_config(`ptr`: Pointer,uniffi_out_err: UniffiRustCallStatus, + ): RustBuffer.ByValue + fun uniffi_ldk_node_fn_method_node_connect(`ptr`: Pointer,`nodeId`: RustBuffer.ByValue,`address`: RustBuffer.ByValue,`persist`: Byte,uniffi_out_err: UniffiRustCallStatus, + ): Unit + fun uniffi_ldk_node_fn_method_node_disconnect(`ptr`: Pointer,`nodeId`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, + ): Unit + fun uniffi_ldk_node_fn_method_node_event_handled(`ptr`: Pointer,uniffi_out_err: UniffiRustCallStatus, + ): Unit + fun uniffi_ldk_node_fn_method_node_export_pathfinding_scores(`ptr`: Pointer,uniffi_out_err: UniffiRustCallStatus, + ): RustBuffer.ByValue + fun uniffi_ldk_node_fn_method_node_force_close_channel(`ptr`: Pointer,`userChannelId`: RustBuffer.ByValue,`counterpartyNodeId`: RustBuffer.ByValue,`reason`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, + ): Unit + fun uniffi_ldk_node_fn_method_node_list_balances(`ptr`: Pointer,uniffi_out_err: UniffiRustCallStatus, + ): RustBuffer.ByValue + fun uniffi_ldk_node_fn_method_node_list_channels(`ptr`: Pointer,uniffi_out_err: UniffiRustCallStatus, + ): RustBuffer.ByValue + fun uniffi_ldk_node_fn_method_node_list_payments(`ptr`: Pointer,uniffi_out_err: UniffiRustCallStatus, + ): RustBuffer.ByValue + fun uniffi_ldk_node_fn_method_node_list_peers(`ptr`: Pointer,uniffi_out_err: UniffiRustCallStatus, + ): RustBuffer.ByValue + fun uniffi_ldk_node_fn_method_node_listening_addresses(`ptr`: Pointer,uniffi_out_err: UniffiRustCallStatus, + ): RustBuffer.ByValue + fun uniffi_ldk_node_fn_method_node_lsps1_liquidity(`ptr`: Pointer,uniffi_out_err: UniffiRustCallStatus, + ): Pointer + fun uniffi_ldk_node_fn_method_node_network_graph(`ptr`: Pointer,uniffi_out_err: UniffiRustCallStatus, + ): Pointer + fun uniffi_ldk_node_fn_method_node_next_event(`ptr`: Pointer,uniffi_out_err: UniffiRustCallStatus, + ): RustBuffer.ByValue + fun uniffi_ldk_node_fn_method_node_next_event_async(`ptr`: Pointer, + ): Long + fun uniffi_ldk_node_fn_method_node_node_alias(`ptr`: Pointer,uniffi_out_err: UniffiRustCallStatus, + ): RustBuffer.ByValue + fun uniffi_ldk_node_fn_method_node_node_id(`ptr`: Pointer,uniffi_out_err: UniffiRustCallStatus, + ): RustBuffer.ByValue + fun uniffi_ldk_node_fn_method_node_onchain_payment(`ptr`: Pointer,uniffi_out_err: UniffiRustCallStatus, + ): Pointer + fun uniffi_ldk_node_fn_method_node_open_announced_channel(`ptr`: Pointer,`nodeId`: RustBuffer.ByValue,`address`: RustBuffer.ByValue,`channelAmountSats`: Long,`pushToCounterpartyMsat`: RustBuffer.ByValue,`channelConfig`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, + ): RustBuffer.ByValue + fun uniffi_ldk_node_fn_method_node_open_channel(`ptr`: Pointer,`nodeId`: RustBuffer.ByValue,`address`: RustBuffer.ByValue,`channelAmountSats`: Long,`pushToCounterpartyMsat`: RustBuffer.ByValue,`channelConfig`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, + ): RustBuffer.ByValue + fun uniffi_ldk_node_fn_method_node_payment(`ptr`: Pointer,`paymentId`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, + ): RustBuffer.ByValue + fun uniffi_ldk_node_fn_method_node_remove_payment(`ptr`: Pointer,`paymentId`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, + ): Unit + fun uniffi_ldk_node_fn_method_node_sign_message(`ptr`: Pointer,`msg`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, + ): RustBuffer.ByValue + fun uniffi_ldk_node_fn_method_node_spontaneous_payment(`ptr`: Pointer,uniffi_out_err: UniffiRustCallStatus, + ): Pointer + fun uniffi_ldk_node_fn_method_node_start(`ptr`: Pointer,uniffi_out_err: UniffiRustCallStatus, + ): Unit + fun uniffi_ldk_node_fn_method_node_status(`ptr`: Pointer,uniffi_out_err: UniffiRustCallStatus, + ): RustBuffer.ByValue + fun uniffi_ldk_node_fn_method_node_stop(`ptr`: Pointer,uniffi_out_err: UniffiRustCallStatus, + ): Unit + fun uniffi_ldk_node_fn_method_node_sync_wallets(`ptr`: Pointer,uniffi_out_err: UniffiRustCallStatus, + ): Unit + fun uniffi_ldk_node_fn_method_node_unified_qr_payment(`ptr`: Pointer,uniffi_out_err: UniffiRustCallStatus, + ): Pointer + fun uniffi_ldk_node_fn_method_node_update_channel_config(`ptr`: Pointer,`userChannelId`: RustBuffer.ByValue,`counterpartyNodeId`: RustBuffer.ByValue,`channelConfig`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, + ): Unit + fun uniffi_ldk_node_fn_method_node_verify_signature(`ptr`: Pointer,`msg`: RustBuffer.ByValue,`sig`: RustBuffer.ByValue,`pkey`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, + ): Byte + fun uniffi_ldk_node_fn_method_node_wait_next_event(`ptr`: Pointer,uniffi_out_err: UniffiRustCallStatus, + ): RustBuffer.ByValue + fun uniffi_ldk_node_fn_clone_onchainpayment(`ptr`: Pointer,uniffi_out_err: UniffiRustCallStatus, + ): Pointer + fun uniffi_ldk_node_fn_free_onchainpayment(`ptr`: Pointer,uniffi_out_err: UniffiRustCallStatus, + ): Unit + fun uniffi_ldk_node_fn_method_onchainpayment_accelerate_by_cpfp(`ptr`: Pointer,`txid`: RustBuffer.ByValue,`feeRate`: RustBuffer.ByValue,`destinationAddress`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, + ): RustBuffer.ByValue + fun uniffi_ldk_node_fn_method_onchainpayment_bump_fee_by_rbf(`ptr`: Pointer,`txid`: RustBuffer.ByValue,`feeRate`: Pointer,uniffi_out_err: UniffiRustCallStatus, + ): RustBuffer.ByValue + fun uniffi_ldk_node_fn_method_onchainpayment_calculate_cpfp_fee_rate(`ptr`: Pointer,`parentTxid`: RustBuffer.ByValue,`urgent`: Byte,uniffi_out_err: UniffiRustCallStatus, + ): Pointer + fun uniffi_ldk_node_fn_method_onchainpayment_calculate_total_fee(`ptr`: Pointer,`address`: RustBuffer.ByValue,`amountSats`: Long,`feeRate`: RustBuffer.ByValue,`utxosToSpend`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, + ): Long + fun uniffi_ldk_node_fn_method_onchainpayment_list_spendable_outputs(`ptr`: Pointer,uniffi_out_err: UniffiRustCallStatus, + ): RustBuffer.ByValue + fun uniffi_ldk_node_fn_method_onchainpayment_new_address(`ptr`: Pointer,uniffi_out_err: UniffiRustCallStatus, + ): RustBuffer.ByValue + 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, + ): RustBuffer.ByValue + 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, + ): RustBuffer.ByValue + 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, + ): RustBuffer.ByValue + fun uniffi_ldk_node_fn_clone_spontaneouspayment(`ptr`: Pointer,uniffi_out_err: UniffiRustCallStatus, + ): Pointer + fun uniffi_ldk_node_fn_free_spontaneouspayment(`ptr`: Pointer,uniffi_out_err: UniffiRustCallStatus, + ): Unit + fun uniffi_ldk_node_fn_method_spontaneouspayment_send(`ptr`: Pointer,`amountMsat`: Long,`nodeId`: RustBuffer.ByValue,`sendingParameters`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, + ): RustBuffer.ByValue + fun uniffi_ldk_node_fn_method_spontaneouspayment_send_probes(`ptr`: Pointer,`amountMsat`: Long,`nodeId`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, + ): Unit + fun uniffi_ldk_node_fn_method_spontaneouspayment_send_with_custom_tlvs(`ptr`: Pointer,`amountMsat`: Long,`nodeId`: RustBuffer.ByValue,`sendingParameters`: RustBuffer.ByValue,`customTlvs`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, + ): RustBuffer.ByValue + fun uniffi_ldk_node_fn_clone_unifiedqrpayment(`ptr`: Pointer,uniffi_out_err: UniffiRustCallStatus, + ): Pointer + fun uniffi_ldk_node_fn_free_unifiedqrpayment(`ptr`: Pointer,uniffi_out_err: UniffiRustCallStatus, + ): Unit + fun uniffi_ldk_node_fn_method_unifiedqrpayment_receive(`ptr`: Pointer,`amountSats`: Long,`message`: RustBuffer.ByValue,`expirySec`: Int,uniffi_out_err: UniffiRustCallStatus, + ): RustBuffer.ByValue + fun uniffi_ldk_node_fn_method_unifiedqrpayment_send(`ptr`: Pointer,`uriStr`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, + ): RustBuffer.ByValue + fun uniffi_ldk_node_fn_clone_vssheaderprovider(`ptr`: Pointer,uniffi_out_err: UniffiRustCallStatus, + ): Pointer + fun uniffi_ldk_node_fn_free_vssheaderprovider(`ptr`: Pointer,uniffi_out_err: UniffiRustCallStatus, + ): Unit + fun uniffi_ldk_node_fn_method_vssheaderprovider_get_headers(`ptr`: Pointer,`request`: RustBuffer.ByValue, + ): Long + fun uniffi_ldk_node_fn_func_default_config(uniffi_out_err: UniffiRustCallStatus, + ): RustBuffer.ByValue + fun uniffi_ldk_node_fn_func_generate_entropy_mnemonic(uniffi_out_err: UniffiRustCallStatus, + ): RustBuffer.ByValue + fun ffi_ldk_node_rustbuffer_alloc(`size`: Long,uniffi_out_err: UniffiRustCallStatus, + ): RustBuffer.ByValue + fun ffi_ldk_node_rustbuffer_from_bytes(`bytes`: ForeignBytes.ByValue,uniffi_out_err: UniffiRustCallStatus, + ): RustBuffer.ByValue + fun ffi_ldk_node_rustbuffer_free(`buf`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, + ): Unit + fun ffi_ldk_node_rustbuffer_reserve(`buf`: RustBuffer.ByValue,`additional`: Long,uniffi_out_err: UniffiRustCallStatus, + ): RustBuffer.ByValue + fun ffi_ldk_node_rust_future_poll_u8(`handle`: Long,`callback`: UniffiRustFutureContinuationCallback,`callbackData`: Long, + ): Unit + fun ffi_ldk_node_rust_future_cancel_u8(`handle`: Long, + ): Unit + fun ffi_ldk_node_rust_future_free_u8(`handle`: Long, + ): Unit + fun ffi_ldk_node_rust_future_complete_u8(`handle`: Long,uniffi_out_err: UniffiRustCallStatus, + ): Byte + fun ffi_ldk_node_rust_future_poll_i8(`handle`: Long,`callback`: UniffiRustFutureContinuationCallback,`callbackData`: Long, + ): Unit + fun ffi_ldk_node_rust_future_cancel_i8(`handle`: Long, + ): Unit + fun ffi_ldk_node_rust_future_free_i8(`handle`: Long, + ): Unit + fun ffi_ldk_node_rust_future_complete_i8(`handle`: Long,uniffi_out_err: UniffiRustCallStatus, + ): Byte + fun ffi_ldk_node_rust_future_poll_u16(`handle`: Long,`callback`: UniffiRustFutureContinuationCallback,`callbackData`: Long, + ): Unit + fun ffi_ldk_node_rust_future_cancel_u16(`handle`: Long, + ): Unit + fun ffi_ldk_node_rust_future_free_u16(`handle`: Long, + ): Unit + fun ffi_ldk_node_rust_future_complete_u16(`handle`: Long,uniffi_out_err: UniffiRustCallStatus, + ): Short + fun ffi_ldk_node_rust_future_poll_i16(`handle`: Long,`callback`: UniffiRustFutureContinuationCallback,`callbackData`: Long, + ): Unit + fun ffi_ldk_node_rust_future_cancel_i16(`handle`: Long, + ): Unit + fun ffi_ldk_node_rust_future_free_i16(`handle`: Long, + ): Unit + fun ffi_ldk_node_rust_future_complete_i16(`handle`: Long,uniffi_out_err: UniffiRustCallStatus, + ): Short + fun ffi_ldk_node_rust_future_poll_u32(`handle`: Long,`callback`: UniffiRustFutureContinuationCallback,`callbackData`: Long, + ): Unit + fun ffi_ldk_node_rust_future_cancel_u32(`handle`: Long, + ): Unit + fun ffi_ldk_node_rust_future_free_u32(`handle`: Long, + ): Unit + fun ffi_ldk_node_rust_future_complete_u32(`handle`: Long,uniffi_out_err: UniffiRustCallStatus, + ): Int + fun ffi_ldk_node_rust_future_poll_i32(`handle`: Long,`callback`: UniffiRustFutureContinuationCallback,`callbackData`: Long, + ): Unit + fun ffi_ldk_node_rust_future_cancel_i32(`handle`: Long, + ): Unit + fun ffi_ldk_node_rust_future_free_i32(`handle`: Long, + ): Unit + fun ffi_ldk_node_rust_future_complete_i32(`handle`: Long,uniffi_out_err: UniffiRustCallStatus, + ): Int + fun ffi_ldk_node_rust_future_poll_u64(`handle`: Long,`callback`: UniffiRustFutureContinuationCallback,`callbackData`: Long, + ): Unit + fun ffi_ldk_node_rust_future_cancel_u64(`handle`: Long, + ): Unit + fun ffi_ldk_node_rust_future_free_u64(`handle`: Long, + ): Unit + fun ffi_ldk_node_rust_future_complete_u64(`handle`: Long,uniffi_out_err: UniffiRustCallStatus, + ): Long + fun ffi_ldk_node_rust_future_poll_i64(`handle`: Long,`callback`: UniffiRustFutureContinuationCallback,`callbackData`: Long, + ): Unit + fun ffi_ldk_node_rust_future_cancel_i64(`handle`: Long, + ): Unit + fun ffi_ldk_node_rust_future_free_i64(`handle`: Long, + ): Unit + fun ffi_ldk_node_rust_future_complete_i64(`handle`: Long,uniffi_out_err: UniffiRustCallStatus, + ): Long + fun ffi_ldk_node_rust_future_poll_f32(`handle`: Long,`callback`: UniffiRustFutureContinuationCallback,`callbackData`: Long, + ): Unit + fun ffi_ldk_node_rust_future_cancel_f32(`handle`: Long, + ): Unit + fun ffi_ldk_node_rust_future_free_f32(`handle`: Long, + ): Unit + fun ffi_ldk_node_rust_future_complete_f32(`handle`: Long,uniffi_out_err: UniffiRustCallStatus, + ): Float + fun ffi_ldk_node_rust_future_poll_f64(`handle`: Long,`callback`: UniffiRustFutureContinuationCallback,`callbackData`: Long, + ): Unit + fun ffi_ldk_node_rust_future_cancel_f64(`handle`: Long, + ): Unit + fun ffi_ldk_node_rust_future_free_f64(`handle`: Long, + ): Unit + fun ffi_ldk_node_rust_future_complete_f64(`handle`: Long,uniffi_out_err: UniffiRustCallStatus, + ): Double + fun ffi_ldk_node_rust_future_poll_pointer(`handle`: Long,`callback`: UniffiRustFutureContinuationCallback,`callbackData`: Long, + ): Unit + fun ffi_ldk_node_rust_future_cancel_pointer(`handle`: Long, + ): Unit + fun ffi_ldk_node_rust_future_free_pointer(`handle`: Long, + ): Unit + fun ffi_ldk_node_rust_future_complete_pointer(`handle`: Long,uniffi_out_err: UniffiRustCallStatus, + ): Pointer + fun ffi_ldk_node_rust_future_poll_rust_buffer(`handle`: Long,`callback`: UniffiRustFutureContinuationCallback,`callbackData`: Long, + ): Unit + fun ffi_ldk_node_rust_future_cancel_rust_buffer(`handle`: Long, + ): Unit + fun ffi_ldk_node_rust_future_free_rust_buffer(`handle`: Long, + ): Unit + fun ffi_ldk_node_rust_future_complete_rust_buffer(`handle`: Long,uniffi_out_err: UniffiRustCallStatus, + ): RustBuffer.ByValue + fun ffi_ldk_node_rust_future_poll_void(`handle`: Long,`callback`: UniffiRustFutureContinuationCallback,`callbackData`: Long, + ): Unit + fun ffi_ldk_node_rust_future_cancel_void(`handle`: Long, + ): Unit + fun ffi_ldk_node_rust_future_free_void(`handle`: Long, + ): Unit + fun ffi_ldk_node_rust_future_complete_void(`handle`: Long,uniffi_out_err: UniffiRustCallStatus, + ): Unit + fun uniffi_ldk_node_checksum_func_default_config( + ): Short + fun uniffi_ldk_node_checksum_func_generate_entropy_mnemonic( + ): Short + fun uniffi_ldk_node_checksum_method_bolt11invoice_amount_milli_satoshis( + ): Short + fun uniffi_ldk_node_checksum_method_bolt11invoice_currency( + ): Short + fun uniffi_ldk_node_checksum_method_bolt11invoice_expiry_time_seconds( + ): Short + fun uniffi_ldk_node_checksum_method_bolt11invoice_fallback_addresses( + ): Short + fun uniffi_ldk_node_checksum_method_bolt11invoice_invoice_description( + ): Short + fun uniffi_ldk_node_checksum_method_bolt11invoice_is_expired( + ): Short + fun uniffi_ldk_node_checksum_method_bolt11invoice_min_final_cltv_expiry_delta( + ): Short + fun uniffi_ldk_node_checksum_method_bolt11invoice_network( + ): Short + fun uniffi_ldk_node_checksum_method_bolt11invoice_payment_hash( + ): Short + fun uniffi_ldk_node_checksum_method_bolt11invoice_payment_secret( + ): Short + fun uniffi_ldk_node_checksum_method_bolt11invoice_recover_payee_pub_key( + ): Short + fun uniffi_ldk_node_checksum_method_bolt11invoice_route_hints( + ): Short + fun uniffi_ldk_node_checksum_method_bolt11invoice_seconds_since_epoch( + ): Short + fun uniffi_ldk_node_checksum_method_bolt11invoice_seconds_until_expiry( + ): Short + fun uniffi_ldk_node_checksum_method_bolt11invoice_signable_hash( + ): Short + fun uniffi_ldk_node_checksum_method_bolt11invoice_would_expire( + ): Short + fun uniffi_ldk_node_checksum_method_bolt11payment_claim_for_hash( + ): Short + fun uniffi_ldk_node_checksum_method_bolt11payment_estimate_routing_fees( + ): Short + fun uniffi_ldk_node_checksum_method_bolt11payment_estimate_routing_fees_using_amount( + ): Short + fun uniffi_ldk_node_checksum_method_bolt11payment_fail_for_hash( + ): Short + fun uniffi_ldk_node_checksum_method_bolt11payment_receive( + ): Short + fun uniffi_ldk_node_checksum_method_bolt11payment_receive_for_hash( + ): Short + fun uniffi_ldk_node_checksum_method_bolt11payment_receive_variable_amount( + ): Short + fun uniffi_ldk_node_checksum_method_bolt11payment_receive_variable_amount_for_hash( + ): Short + fun uniffi_ldk_node_checksum_method_bolt11payment_receive_variable_amount_via_jit_channel( + ): Short + fun uniffi_ldk_node_checksum_method_bolt11payment_receive_via_jit_channel( + ): Short + fun uniffi_ldk_node_checksum_method_bolt11payment_send( + ): Short + fun uniffi_ldk_node_checksum_method_bolt11payment_send_probes( + ): Short + fun uniffi_ldk_node_checksum_method_bolt11payment_send_probes_using_amount( + ): Short + fun uniffi_ldk_node_checksum_method_bolt11payment_send_using_amount( + ): Short + fun uniffi_ldk_node_checksum_method_bolt12payment_initiate_refund( + ): Short + fun uniffi_ldk_node_checksum_method_bolt12payment_receive( + ): Short + fun uniffi_ldk_node_checksum_method_bolt12payment_receive_variable_amount( + ): Short + fun uniffi_ldk_node_checksum_method_bolt12payment_request_refund_payment( + ): Short + fun uniffi_ldk_node_checksum_method_bolt12payment_send( + ): Short + fun uniffi_ldk_node_checksum_method_bolt12payment_send_using_amount( + ): Short + fun uniffi_ldk_node_checksum_method_builder_build( + ): Short + fun uniffi_ldk_node_checksum_method_builder_build_with_fs_store( + ): Short + fun uniffi_ldk_node_checksum_method_builder_build_with_vss_store( + ): Short + fun uniffi_ldk_node_checksum_method_builder_build_with_vss_store_and_fixed_headers( + ): Short + fun uniffi_ldk_node_checksum_method_builder_build_with_vss_store_and_header_provider( + ): Short + fun uniffi_ldk_node_checksum_method_builder_set_announcement_addresses( + ): Short + fun uniffi_ldk_node_checksum_method_builder_set_chain_source_bitcoind_rpc( + ): Short + fun uniffi_ldk_node_checksum_method_builder_set_chain_source_electrum( + ): Short + fun uniffi_ldk_node_checksum_method_builder_set_chain_source_esplora( + ): Short + fun uniffi_ldk_node_checksum_method_builder_set_custom_logger( + ): Short + fun uniffi_ldk_node_checksum_method_builder_set_entropy_bip39_mnemonic( + ): Short + fun uniffi_ldk_node_checksum_method_builder_set_entropy_seed_bytes( + ): Short + fun uniffi_ldk_node_checksum_method_builder_set_entropy_seed_path( + ): Short + fun uniffi_ldk_node_checksum_method_builder_set_filesystem_logger( + ): Short + fun uniffi_ldk_node_checksum_method_builder_set_gossip_source_p2p( + ): Short + fun uniffi_ldk_node_checksum_method_builder_set_gossip_source_rgs( + ): Short + fun uniffi_ldk_node_checksum_method_builder_set_liquidity_source_lsps1( + ): Short + fun uniffi_ldk_node_checksum_method_builder_set_liquidity_source_lsps2( + ): Short + fun uniffi_ldk_node_checksum_method_builder_set_listening_addresses( + ): Short + fun uniffi_ldk_node_checksum_method_builder_set_log_facade_logger( + ): Short + fun uniffi_ldk_node_checksum_method_builder_set_network( + ): Short + fun uniffi_ldk_node_checksum_method_builder_set_node_alias( + ): Short + fun uniffi_ldk_node_checksum_method_builder_set_storage_dir_path( + ): Short + fun uniffi_ldk_node_checksum_method_feerate_to_sat_per_kwu( + ): Short + fun uniffi_ldk_node_checksum_method_feerate_to_sat_per_vb_ceil( + ): Short + fun uniffi_ldk_node_checksum_method_feerate_to_sat_per_vb_floor( + ): Short + fun uniffi_ldk_node_checksum_method_lsps1liquidity_check_order_status( + ): Short + fun uniffi_ldk_node_checksum_method_lsps1liquidity_request_channel( + ): Short + fun uniffi_ldk_node_checksum_method_logwriter_log( + ): Short + fun uniffi_ldk_node_checksum_method_networkgraph_channel( + ): Short + fun uniffi_ldk_node_checksum_method_networkgraph_list_channels( + ): Short + fun uniffi_ldk_node_checksum_method_networkgraph_list_nodes( + ): Short + fun uniffi_ldk_node_checksum_method_networkgraph_node( + ): Short + fun uniffi_ldk_node_checksum_method_node_announcement_addresses( + ): Short + fun uniffi_ldk_node_checksum_method_node_bolt11_payment( + ): Short + fun uniffi_ldk_node_checksum_method_node_bolt12_payment( + ): Short + fun uniffi_ldk_node_checksum_method_node_close_channel( + ): Short + fun uniffi_ldk_node_checksum_method_node_config( + ): Short + fun uniffi_ldk_node_checksum_method_node_connect( + ): Short + fun uniffi_ldk_node_checksum_method_node_disconnect( + ): Short + fun uniffi_ldk_node_checksum_method_node_event_handled( + ): Short + fun uniffi_ldk_node_checksum_method_node_export_pathfinding_scores( + ): Short + fun uniffi_ldk_node_checksum_method_node_force_close_channel( + ): Short + fun uniffi_ldk_node_checksum_method_node_list_balances( + ): Short + fun uniffi_ldk_node_checksum_method_node_list_channels( + ): Short + fun uniffi_ldk_node_checksum_method_node_list_payments( + ): Short + fun uniffi_ldk_node_checksum_method_node_list_peers( + ): Short + fun uniffi_ldk_node_checksum_method_node_listening_addresses( + ): Short + fun uniffi_ldk_node_checksum_method_node_lsps1_liquidity( + ): Short + fun uniffi_ldk_node_checksum_method_node_network_graph( + ): Short + fun uniffi_ldk_node_checksum_method_node_next_event( + ): Short + fun uniffi_ldk_node_checksum_method_node_next_event_async( + ): Short + fun uniffi_ldk_node_checksum_method_node_node_alias( + ): Short + fun uniffi_ldk_node_checksum_method_node_node_id( + ): Short + fun uniffi_ldk_node_checksum_method_node_onchain_payment( + ): Short + fun uniffi_ldk_node_checksum_method_node_open_announced_channel( + ): Short + fun uniffi_ldk_node_checksum_method_node_open_channel( + ): Short + fun uniffi_ldk_node_checksum_method_node_payment( + ): Short + fun uniffi_ldk_node_checksum_method_node_remove_payment( + ): Short + fun uniffi_ldk_node_checksum_method_node_sign_message( + ): Short + fun uniffi_ldk_node_checksum_method_node_spontaneous_payment( + ): Short + fun uniffi_ldk_node_checksum_method_node_start( + ): Short + fun uniffi_ldk_node_checksum_method_node_status( + ): Short + fun uniffi_ldk_node_checksum_method_node_stop( + ): Short + fun uniffi_ldk_node_checksum_method_node_sync_wallets( + ): Short + fun uniffi_ldk_node_checksum_method_node_unified_qr_payment( + ): Short + fun uniffi_ldk_node_checksum_method_node_update_channel_config( + ): Short + fun uniffi_ldk_node_checksum_method_node_verify_signature( + ): Short + fun uniffi_ldk_node_checksum_method_node_wait_next_event( + ): Short + fun uniffi_ldk_node_checksum_method_onchainpayment_accelerate_by_cpfp( + ): Short + fun uniffi_ldk_node_checksum_method_onchainpayment_bump_fee_by_rbf( + ): Short + fun uniffi_ldk_node_checksum_method_onchainpayment_calculate_cpfp_fee_rate( + ): Short + fun uniffi_ldk_node_checksum_method_onchainpayment_calculate_total_fee( + ): Short + fun uniffi_ldk_node_checksum_method_onchainpayment_list_spendable_outputs( + ): Short + fun uniffi_ldk_node_checksum_method_onchainpayment_new_address( + ): Short + fun uniffi_ldk_node_checksum_method_onchainpayment_select_utxos_with_algorithm( + ): Short + fun uniffi_ldk_node_checksum_method_onchainpayment_send_all_to_address( + ): Short + fun uniffi_ldk_node_checksum_method_onchainpayment_send_to_address( + ): Short + fun uniffi_ldk_node_checksum_method_spontaneouspayment_send( + ): Short + fun uniffi_ldk_node_checksum_method_spontaneouspayment_send_probes( + ): Short + fun uniffi_ldk_node_checksum_method_spontaneouspayment_send_with_custom_tlvs( + ): Short + fun uniffi_ldk_node_checksum_method_unifiedqrpayment_receive( + ): Short + fun uniffi_ldk_node_checksum_method_unifiedqrpayment_send( + ): Short + fun uniffi_ldk_node_checksum_method_vssheaderprovider_get_headers( + ): Short + fun uniffi_ldk_node_checksum_constructor_bolt11invoice_from_str( + ): Short + fun uniffi_ldk_node_checksum_constructor_builder_from_config( + ): Short + fun uniffi_ldk_node_checksum_constructor_builder_new( + ): Short + fun uniffi_ldk_node_checksum_constructor_feerate_from_sat_per_kwu( + ): Short + fun uniffi_ldk_node_checksum_constructor_feerate_from_sat_per_vb_unchecked( + ): Short + fun ffi_ldk_node_uniffi_contract_version( + ): Int + } private fun uniffiCheckContractApiVersion(lib: UniffiLib) { @@ -2275,6 +1799,12 @@ private fun uniffiCheckApiChecksums(lib: UniffiLib) { if (lib.uniffi_ldk_node_checksum_method_bolt11payment_claim_for_hash() != 52848.toShort()) { throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") } + if (lib.uniffi_ldk_node_checksum_method_bolt11payment_estimate_routing_fees() != 5123.toShort()) { + throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + } + if (lib.uniffi_ldk_node_checksum_method_bolt11payment_estimate_routing_fees_using_amount() != 46411.toShort()) { + throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + } if (lib.uniffi_ldk_node_checksum_method_bolt11payment_fail_for_hash() != 24516.toShort()) { throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") } @@ -2604,37 +2134,33 @@ internal const val UNIFFI_RUST_FUTURE_POLL_MAYBE_READY = 1.toByte() internal val uniffiContinuationHandleMap = UniffiHandleMap>() // FFI type for Rust future continuations -internal object uniffiRustFutureContinuationCallbackImpl : UniffiRustFutureContinuationCallback { - override fun callback( - data: Long, - pollResult: Byte, - ) { +internal object uniffiRustFutureContinuationCallbackImpl: UniffiRustFutureContinuationCallback { + override fun callback(data: Long, pollResult: Byte) { uniffiContinuationHandleMap.remove(data).resume(pollResult) } } -internal suspend fun uniffiRustCallAsync( +internal suspend fun uniffiRustCallAsync( rustFuture: Long, pollFunc: (Long, UniffiRustFutureContinuationCallback, Long) -> Unit, completeFunc: (Long, UniffiRustCallStatus) -> F, freeFunc: (Long) -> Unit, liftFunc: (F) -> T, - errorHandler: UniffiRustCallStatusErrorHandler, + errorHandler: UniffiRustCallStatusErrorHandler ): T { try { do { - val pollResult = - suspendCancellableCoroutine { continuation -> - pollFunc( - rustFuture, - uniffiRustFutureContinuationCallbackImpl, - uniffiContinuationHandleMap.insert(continuation), - ) - } - } while (pollResult != UNIFFI_RUST_FUTURE_POLL_READY) + val pollResult = suspendCancellableCoroutine { continuation -> + pollFunc( + rustFuture, + uniffiRustFutureContinuationCallbackImpl, + uniffiContinuationHandleMap.insert(continuation) + ) + } + } while (pollResult != UNIFFI_RUST_FUTURE_POLL_READY); return liftFunc( - uniffiRustCallWithError(errorHandler, { status -> completeFunc(rustFuture, status) }), + uniffiRustCallWithError(errorHandler, { status -> completeFunc(rustFuture, status) }) ) } finally { freeFunc(rustFuture) @@ -2643,6 +2169,7 @@ internal suspend fun uniffiRustCallAsync( // Public interface members begin here. + // Interface implemented by anything that can contain an object reference. // // Such types expose a `destroy()` method that must be called to cleanly @@ -2653,11 +2180,9 @@ internal suspend fun uniffiRustCallAsync( // helper method to execute a block and destroy the object at the end. interface Disposable { fun destroy() - companion object { fun destroy(vararg args: Any?) { - args - .filterIsInstance() + args.filterIsInstance() .forEach(Disposable::destroy) } } @@ -2678,92 +2203,107 @@ inline fun T.use(block: (T) -> R) = /** Used to instantiate an interface without an actual pointer, for fakes in tests, mostly. */ object NoPointer -public object FfiConverterUByte : FfiConverter { - override fun lift(value: Byte): UByte = value.toUByte() +public object FfiConverterUByte: FfiConverter { + override fun lift(value: Byte): UByte { + return value.toUByte() + } - override fun read(buf: ByteBuffer): UByte = lift(buf.get()) + override fun read(buf: ByteBuffer): UByte { + return lift(buf.get()) + } - override fun lower(value: UByte): Byte = value.toByte() + override fun lower(value: UByte): Byte { + return value.toByte() + } override fun allocationSize(value: UByte) = 1UL - override fun write( - value: UByte, - buf: ByteBuffer, - ) { + override fun write(value: UByte, buf: ByteBuffer) { buf.put(value.toByte()) } } -public object FfiConverterUShort : FfiConverter { - override fun lift(value: Short): UShort = value.toUShort() +public object FfiConverterUShort: FfiConverter { + override fun lift(value: Short): UShort { + return value.toUShort() + } - override fun read(buf: ByteBuffer): UShort = lift(buf.getShort()) + override fun read(buf: ByteBuffer): UShort { + return lift(buf.getShort()) + } - override fun lower(value: UShort): Short = value.toShort() + override fun lower(value: UShort): Short { + return value.toShort() + } override fun allocationSize(value: UShort) = 2UL - override fun write( - value: UShort, - buf: ByteBuffer, - ) { + override fun write(value: UShort, buf: ByteBuffer) { buf.putShort(value.toShort()) } } -public object FfiConverterUInt : FfiConverter { - override fun lift(value: Int): UInt = value.toUInt() +public object FfiConverterUInt: FfiConverter { + override fun lift(value: Int): UInt { + return value.toUInt() + } - override fun read(buf: ByteBuffer): UInt = lift(buf.getInt()) + override fun read(buf: ByteBuffer): UInt { + return lift(buf.getInt()) + } - override fun lower(value: UInt): Int = value.toInt() + override fun lower(value: UInt): Int { + return value.toInt() + } override fun allocationSize(value: UInt) = 4UL - override fun write( - value: UInt, - buf: ByteBuffer, - ) { + override fun write(value: UInt, buf: ByteBuffer) { buf.putInt(value.toInt()) } } -public object FfiConverterULong : FfiConverter { - override fun lift(value: Long): ULong = value.toULong() +public object FfiConverterULong: FfiConverter { + override fun lift(value: Long): ULong { + return value.toULong() + } - override fun read(buf: ByteBuffer): ULong = lift(buf.getLong()) + override fun read(buf: ByteBuffer): ULong { + return lift(buf.getLong()) + } - override fun lower(value: ULong): Long = value.toLong() + override fun lower(value: ULong): Long { + return value.toLong() + } override fun allocationSize(value: ULong) = 8UL - override fun write( - value: ULong, - buf: ByteBuffer, - ) { + override fun write(value: ULong, buf: ByteBuffer) { buf.putLong(value.toLong()) } } -public object FfiConverterBoolean : FfiConverter { - override fun lift(value: Byte): Boolean = value.toInt() != 0 +public object FfiConverterBoolean: FfiConverter { + override fun lift(value: Byte): Boolean { + return value.toInt() != 0 + } - override fun read(buf: ByteBuffer): Boolean = lift(buf.get()) + override fun read(buf: ByteBuffer): Boolean { + return lift(buf.get()) + } - override fun lower(value: Boolean): Byte = if (value) 1.toByte() else 0.toByte() + override fun lower(value: Boolean): Byte { + return if (value) 1.toByte() else 0.toByte() + } override fun allocationSize(value: Boolean) = 1UL - override fun write( - value: Boolean, - buf: ByteBuffer, - ) { + override fun write(value: Boolean, buf: ByteBuffer) { buf.put(lower(value)) } } -public object FfiConverterString : FfiConverter { +public object FfiConverterString: FfiConverter { // Note: we don't inherit from FfiConverterRustBuffer, because we use a // special encoding when lowering/lifting. We can use `RustBuffer.len` to // store our length and avoid writing it out to the buffer. @@ -2810,35 +2350,30 @@ public object FfiConverterString : FfiConverter { return sizeForLength + sizeForString } - override fun write( - value: String, - buf: ByteBuffer, - ) { + override fun write(value: String, buf: ByteBuffer) { val byteBuf = toUtf8(value) buf.putInt(byteBuf.limit()) buf.put(byteBuf) } } -public object FfiConverterByteArray : FfiConverterRustBuffer { +public object FfiConverterByteArray: FfiConverterRustBuffer { override fun read(buf: ByteBuffer): ByteArray { val len = buf.getInt() val byteArr = ByteArray(len) buf.get(byteArr) return byteArr } - - override fun allocationSize(value: ByteArray): ULong = 4UL + value.size.toULong() - - override fun write( - value: ByteArray, - buf: ByteBuffer, - ) { + override fun allocationSize(value: ByteArray): ULong { + return 4UL + value.size.toULong() + } + override fun write(value: ByteArray, buf: ByteBuffer) { buf.putInt(value.size) buf.put(value) } } + // This template implements a class for working with a Rust struct via a Pointer/Arc // to the live Rust struct on the other side of the FFI. // @@ -2936,6 +2471,7 @@ public object FfiConverterByteArray : FfiConverterRustBuffer { // [1] https://stackoverflow.com/questions/24376768/can-java-finalize-an-object-when-it-is-still-in-scope/24380219 // + // The cleaner interface for Object finalization code to run. // This is the entry point to any implementation that we're using. // @@ -2947,24 +2483,17 @@ interface UniffiCleaner { fun clean() } - fun register( - value: Any, - cleanUpTask: Runnable, - ): UniffiCleaner.Cleanable + fun register(value: Any, cleanUpTask: Runnable): UniffiCleaner.Cleanable companion object } // The fallback Jna cleaner, which is available for both Android, and the JVM. private class UniffiJnaCleaner : UniffiCleaner { - private val cleaner = - com.sun.jna.internal.Cleaner - .getCleaner() + private val cleaner = com.sun.jna.internal.Cleaner.getCleaner() - override fun register( - value: Any, - cleanUpTask: Runnable, - ): UniffiCleaner.Cleanable = UniffiJnaCleanable(cleaner.register(value, cleanUpTask)) + override fun register(value: Any, cleanUpTask: Runnable): UniffiCleaner.Cleanable = + UniffiJnaCleanable(cleaner.register(value, cleanUpTask)) } private class UniffiJnaCleanable( @@ -2978,6 +2507,7 @@ private class UniffiJnaCleanable( // There are further runtime checks to chose the correct implementation // of the cleaner. + private fun UniffiCleaner.Companion.create(): UniffiCleaner = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE) { AndroidSystemCleaner() @@ -2991,10 +2521,8 @@ private fun UniffiCleaner.Companion.create(): UniffiCleaner = private class AndroidSystemCleaner : UniffiCleaner { val cleaner = android.system.SystemCleaner.cleaner() - override fun register( - value: Any, - cleanUpTask: Runnable, - ): UniffiCleaner.Cleanable = AndroidSystemCleanable(cleaner.register(value, cleanUpTask)) + override fun register(value: Any, cleanUpTask: Runnable): UniffiCleaner.Cleanable = + AndroidSystemCleanable(cleaner.register(value, cleanUpTask)) } @RequiresApi(Build.VERSION_CODES.UPSIDE_DOWN_CAKE) @@ -3003,47 +2531,45 @@ private class AndroidSystemCleanable( ) : UniffiCleaner.Cleanable { override fun clean() = cleanable.clean() } - public interface Bolt11InvoiceInterface { + fun `amountMilliSatoshis`(): kotlin.ULong? - + fun `currency`(): Currency - + fun `expiryTimeSeconds`(): kotlin.ULong - + fun `fallbackAddresses`(): List
- + fun `invoiceDescription`(): Bolt11InvoiceDescription - + fun `isExpired`(): kotlin.Boolean - + fun `minFinalCltvExpiryDelta`(): kotlin.ULong - + fun `network`(): Network - + fun `paymentHash`(): PaymentHash - + fun `paymentSecret`(): PaymentSecret - + fun `recoverPayeePubKey`(): PublicKey - + fun `routeHints`(): List> - + fun `secondsSinceEpoch`(): kotlin.ULong - + fun `secondsUntilExpiry`(): kotlin.ULong - + fun `signableHash`(): List - + fun `wouldExpire`(`atTimeSeconds`: kotlin.ULong): kotlin.Boolean - + companion object } -open class Bolt11Invoice : - Disposable, - AutoCloseable, - Bolt11InvoiceInterface { +open class Bolt11Invoice: Disposable, AutoCloseable, Bolt11InvoiceInterface { + constructor(pointer: Pointer) { this.pointer = pointer this.cleanable = UniffiLib.CLEANER.register(this, UniffiCleanAction(pointer)) @@ -3093,7 +2619,7 @@ open class Bolt11Invoice : if (c == Long.MAX_VALUE) { throw IllegalStateException("${this.javaClass.simpleName} call counter would overflow") } - } while (!this.callCounter.compareAndSet(c, c + 1L)) + } while (! this.callCounter.compareAndSet(c, c + 1L)) // Now we can safely do the method call without the pointer being freed concurrently. try { return block(this.uniffiClonePointer()) @@ -3107,9 +2633,7 @@ open class Bolt11Invoice : // Use a static inner class instead of a closure so as not to accidentally // capture `this` as part of the cleanable's action. - private class UniffiCleanAction( - private val pointer: Pointer?, - ) : Runnable { + private class UniffiCleanAction(private val pointer: Pointer?) : Runnable { override fun run() { pointer?.let { ptr -> uniffiRustCall { status -> @@ -3119,202 +2643,258 @@ open class Bolt11Invoice : } } - fun uniffiClonePointer(): Pointer = - uniffiRustCall { status -> + fun uniffiClonePointer(): Pointer { + return uniffiRustCall() { status -> UniffiLib.INSTANCE.uniffi_ldk_node_fn_clone_bolt11invoice(pointer!!, status) } + } - override fun `amountMilliSatoshis`(): kotlin.ULong? = - FfiConverterOptionalULong.lift( - callWithPointer { - uniffiRustCall { _status -> - UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_bolt11invoice_amount_milli_satoshis(it, _status) - } - }, - ) - - override fun `currency`(): Currency = - FfiConverterTypeCurrency.lift( - callWithPointer { - uniffiRustCall { _status -> - UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_bolt11invoice_currency(it, _status) - } - }, - ) + override fun `amountMilliSatoshis`(): kotlin.ULong? { + return FfiConverterOptionalULong.lift( + callWithPointer { + uniffiRustCall() { _status -> + UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_bolt11invoice_amount_milli_satoshis( + it, _status) +} + } + ) + } + - override fun `expiryTimeSeconds`(): kotlin.ULong = - FfiConverterULong.lift( - callWithPointer { - uniffiRustCall { _status -> - UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_bolt11invoice_expiry_time_seconds(it, _status) - } - }, - ) + override fun `currency`(): Currency { + return FfiConverterTypeCurrency.lift( + callWithPointer { + uniffiRustCall() { _status -> + UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_bolt11invoice_currency( + it, _status) +} + } + ) + } + - override fun `fallbackAddresses`(): List
= - FfiConverterSequenceTypeAddress.lift( - callWithPointer { - uniffiRustCall { _status -> - UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_bolt11invoice_fallback_addresses(it, _status) - } - }, - ) + override fun `expiryTimeSeconds`(): kotlin.ULong { + return FfiConverterULong.lift( + callWithPointer { + uniffiRustCall() { _status -> + UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_bolt11invoice_expiry_time_seconds( + it, _status) +} + } + ) + } + - override fun `invoiceDescription`(): Bolt11InvoiceDescription = - FfiConverterTypeBolt11InvoiceDescription.lift( - callWithPointer { - uniffiRustCall { _status -> - UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_bolt11invoice_invoice_description(it, _status) - } - }, - ) + override fun `fallbackAddresses`(): List
{ + return FfiConverterSequenceTypeAddress.lift( + callWithPointer { + uniffiRustCall() { _status -> + UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_bolt11invoice_fallback_addresses( + it, _status) +} + } + ) + } + - override fun `isExpired`(): kotlin.Boolean = - FfiConverterBoolean.lift( - callWithPointer { - uniffiRustCall { _status -> - UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_bolt11invoice_is_expired(it, _status) - } - }, - ) + override fun `invoiceDescription`(): Bolt11InvoiceDescription { + return FfiConverterTypeBolt11InvoiceDescription.lift( + callWithPointer { + uniffiRustCall() { _status -> + UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_bolt11invoice_invoice_description( + it, _status) +} + } + ) + } + - override fun `minFinalCltvExpiryDelta`(): kotlin.ULong = - FfiConverterULong.lift( - callWithPointer { - uniffiRustCall { _status -> - UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_bolt11invoice_min_final_cltv_expiry_delta(it, _status) - } - }, - ) + override fun `isExpired`(): kotlin.Boolean { + return FfiConverterBoolean.lift( + callWithPointer { + uniffiRustCall() { _status -> + UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_bolt11invoice_is_expired( + it, _status) +} + } + ) + } + - override fun `network`(): Network = - FfiConverterTypeNetwork.lift( - callWithPointer { - uniffiRustCall { _status -> - UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_bolt11invoice_network(it, _status) - } - }, - ) + override fun `minFinalCltvExpiryDelta`(): kotlin.ULong { + return FfiConverterULong.lift( + callWithPointer { + uniffiRustCall() { _status -> + UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_bolt11invoice_min_final_cltv_expiry_delta( + it, _status) +} + } + ) + } + - override fun `paymentHash`(): PaymentHash = - FfiConverterTypePaymentHash.lift( - callWithPointer { - uniffiRustCall { _status -> - UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_bolt11invoice_payment_hash(it, _status) - } - }, - ) + override fun `network`(): Network { + return FfiConverterTypeNetwork.lift( + callWithPointer { + uniffiRustCall() { _status -> + UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_bolt11invoice_network( + it, _status) +} + } + ) + } + - override fun `paymentSecret`(): PaymentSecret = - FfiConverterTypePaymentSecret.lift( - callWithPointer { - uniffiRustCall { _status -> - UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_bolt11invoice_payment_secret(it, _status) - } - }, - ) + override fun `paymentHash`(): PaymentHash { + return FfiConverterTypePaymentHash.lift( + callWithPointer { + uniffiRustCall() { _status -> + UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_bolt11invoice_payment_hash( + it, _status) +} + } + ) + } + - override fun `recoverPayeePubKey`(): PublicKey = - FfiConverterTypePublicKey.lift( - callWithPointer { - uniffiRustCall { _status -> - UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_bolt11invoice_recover_payee_pub_key(it, _status) - } - }, - ) + override fun `paymentSecret`(): PaymentSecret { + return FfiConverterTypePaymentSecret.lift( + callWithPointer { + uniffiRustCall() { _status -> + UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_bolt11invoice_payment_secret( + it, _status) +} + } + ) + } + - override fun `routeHints`(): List> = - FfiConverterSequenceSequenceTypeRouteHintHop.lift( - callWithPointer { - uniffiRustCall { _status -> - UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_bolt11invoice_route_hints(it, _status) - } - }, - ) + override fun `recoverPayeePubKey`(): PublicKey { + return FfiConverterTypePublicKey.lift( + callWithPointer { + uniffiRustCall() { _status -> + UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_bolt11invoice_recover_payee_pub_key( + it, _status) +} + } + ) + } + - override fun `secondsSinceEpoch`(): kotlin.ULong = - FfiConverterULong.lift( - callWithPointer { - uniffiRustCall { _status -> - UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_bolt11invoice_seconds_since_epoch(it, _status) - } - }, - ) + override fun `routeHints`(): List> { + return FfiConverterSequenceSequenceTypeRouteHintHop.lift( + callWithPointer { + uniffiRustCall() { _status -> + UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_bolt11invoice_route_hints( + it, _status) +} + } + ) + } + - override fun `secondsUntilExpiry`(): kotlin.ULong = - FfiConverterULong.lift( - callWithPointer { - uniffiRustCall { _status -> - UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_bolt11invoice_seconds_until_expiry(it, _status) - } - }, - ) + override fun `secondsSinceEpoch`(): kotlin.ULong { + return FfiConverterULong.lift( + callWithPointer { + uniffiRustCall() { _status -> + UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_bolt11invoice_seconds_since_epoch( + it, _status) +} + } + ) + } + - override fun `signableHash`(): List = - FfiConverterSequenceUByte.lift( - callWithPointer { - uniffiRustCall { _status -> - UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_bolt11invoice_signable_hash(it, _status) - } - }, - ) + override fun `secondsUntilExpiry`(): kotlin.ULong { + return FfiConverterULong.lift( + callWithPointer { + uniffiRustCall() { _status -> + UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_bolt11invoice_seconds_until_expiry( + it, _status) +} + } + ) + } + - override fun `wouldExpire`(`atTimeSeconds`: kotlin.ULong): kotlin.Boolean = - FfiConverterBoolean.lift( - callWithPointer { - uniffiRustCall { _status -> - UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_bolt11invoice_would_expire( - it, - FfiConverterULong.lower(`atTimeSeconds`), - _status, - ) - } - }, - ) + override fun `signableHash`(): List { + return FfiConverterSequenceUByte.lift( + callWithPointer { + uniffiRustCall() { _status -> + UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_bolt11invoice_signable_hash( + it, _status) +} + } + ) + } + - override fun toString(): String = - FfiConverterString.lift( - callWithPointer { - uniffiRustCall { _status -> - UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_bolt11invoice_uniffi_trait_display(it, _status) - } - }, - ) + override fun `wouldExpire`(`atTimeSeconds`: kotlin.ULong): kotlin.Boolean { + return FfiConverterBoolean.lift( + callWithPointer { + uniffiRustCall() { _status -> + UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_bolt11invoice_would_expire( + it, FfiConverterULong.lower(`atTimeSeconds`),_status) +} + } + ) + } + + + override fun toString(): String { + return FfiConverterString.lift( + callWithPointer { + uniffiRustCall() { _status -> + UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_bolt11invoice_uniffi_trait_display( + it, _status) +} + } + ) + } + + override fun equals(other: Any?): Boolean { if (this === other) return true if (other !is Bolt11Invoice) return false return FfiConverterBoolean.lift( - callWithPointer { - uniffiRustCall { _status -> - UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_bolt11invoice_uniffi_trait_eq_eq( - it, - FfiConverterTypeBolt11Invoice.lower(`other`), - _status, - ) - } - }, - ) + callWithPointer { + uniffiRustCall() { _status -> + UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_bolt11invoice_uniffi_trait_eq_eq( + it, FfiConverterTypeBolt11Invoice.lower(`other`),_status) +} + } + ) } + + companion object { - @Throws(NodeException::class) - fun `fromStr`(`invoiceStr`: kotlin.String): Bolt11Invoice = - FfiConverterTypeBolt11Invoice.lift( - uniffiRustCallWithError(NodeException) { _status -> - UniffiLib.INSTANCE.uniffi_ldk_node_fn_constructor_bolt11invoice_from_str( - FfiConverterString.lower(`invoiceStr`), - _status, - ) - }, - ) + + @Throws(NodeException::class) fun `fromStr`(`invoiceStr`: kotlin.String): Bolt11Invoice { + return FfiConverterTypeBolt11Invoice.lift( + uniffiRustCallWithError(NodeException) { _status -> + UniffiLib.INSTANCE.uniffi_ldk_node_fn_constructor_bolt11invoice_from_str( + FfiConverterString.lower(`invoiceStr`),_status) +} + ) } + + + + } + } -public object FfiConverterTypeBolt11Invoice : FfiConverter { - override fun lower(value: Bolt11Invoice): Pointer = value.uniffiClonePointer() +public object FfiConverterTypeBolt11Invoice: FfiConverter { + + override fun lower(value: Bolt11Invoice): Pointer { + return value.uniffiClonePointer() + } - override fun lift(value: Pointer): Bolt11Invoice = Bolt11Invoice(value) + override fun lift(value: Pointer): Bolt11Invoice { + return Bolt11Invoice(value) + } override fun read(buf: ByteBuffer): Bolt11Invoice { // The Rust code always writes pointers as 8 bytes, and will @@ -3324,16 +2904,14 @@ public object FfiConverterTypeBolt11Invoice : FfiConverter // to the live Rust struct on the other side of the FFI. // @@ -3431,77 +3009,42 @@ public object FfiConverterTypeBolt11Invoice : FfiConverter uniffiRustCall { status -> @@ -3577,234 +3118,207 @@ open class Bolt11Payment : } } - fun uniffiClonePointer(): Pointer = - uniffiRustCall { status -> + fun uniffiClonePointer(): Pointer { + return uniffiRustCall() { status -> UniffiLib.INSTANCE.uniffi_ldk_node_fn_clone_bolt11payment(pointer!!, status) } + } - @Throws(NodeException::class) - override fun `claimForHash`( - `paymentHash`: PaymentHash, - `claimableAmountMsat`: kotlin.ULong, - `preimage`: PaymentPreimage, - ) = callWithPointer { - uniffiRustCallWithError(NodeException) { _status -> - UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_bolt11payment_claim_for_hash( - it, - FfiConverterTypePaymentHash.lower(`paymentHash`), - FfiConverterULong.lower(`claimableAmountMsat`), - FfiConverterTypePaymentPreimage.lower(`preimage`), - _status, - ) - } + + @Throws(NodeException::class)override fun `claimForHash`(`paymentHash`: PaymentHash, `claimableAmountMsat`: kotlin.ULong, `preimage`: PaymentPreimage) + = + callWithPointer { + uniffiRustCallWithError(NodeException) { _status -> + UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_bolt11payment_claim_for_hash( + it, FfiConverterTypePaymentHash.lower(`paymentHash`),FfiConverterULong.lower(`claimableAmountMsat`),FfiConverterTypePaymentPreimage.lower(`preimage`),_status) +} } + + - @Throws(NodeException::class) - override fun `failForHash`(`paymentHash`: PaymentHash) = - callWithPointer { - uniffiRustCallWithError(NodeException) { _status -> - UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_bolt11payment_fail_for_hash( - it, - FfiConverterTypePaymentHash.lower(`paymentHash`), - _status, - ) - } - } + + @Throws(NodeException::class)override fun `estimateRoutingFees`(`invoice`: Bolt11Invoice): kotlin.ULong { + return FfiConverterULong.lift( + callWithPointer { + uniffiRustCallWithError(NodeException) { _status -> + UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_bolt11payment_estimate_routing_fees( + it, FfiConverterTypeBolt11Invoice.lower(`invoice`),_status) +} + } + ) + } + - @Throws(NodeException::class) - override fun `receive`( - `amountMsat`: kotlin.ULong, - `description`: Bolt11InvoiceDescription, - `expirySecs`: kotlin.UInt, - ): Bolt11Invoice = - FfiConverterTypeBolt11Invoice.lift( - callWithPointer { - uniffiRustCallWithError(NodeException) { _status -> - UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_bolt11payment_receive( - it, - FfiConverterULong.lower(`amountMsat`), - FfiConverterTypeBolt11InvoiceDescription.lower(`description`), - FfiConverterUInt.lower(`expirySecs`), - _status, - ) - } - }, - ) + + @Throws(NodeException::class)override fun `estimateRoutingFeesUsingAmount`(`invoice`: Bolt11Invoice, `amountMsat`: kotlin.ULong): kotlin.ULong { + return FfiConverterULong.lift( + callWithPointer { + uniffiRustCallWithError(NodeException) { _status -> + UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_bolt11payment_estimate_routing_fees_using_amount( + it, FfiConverterTypeBolt11Invoice.lower(`invoice`),FfiConverterULong.lower(`amountMsat`),_status) +} + } + ) + } + - @Throws(NodeException::class) - override fun `receiveForHash`( - `amountMsat`: kotlin.ULong, - `description`: Bolt11InvoiceDescription, - `expirySecs`: kotlin.UInt, - `paymentHash`: PaymentHash, - ): Bolt11Invoice = - FfiConverterTypeBolt11Invoice.lift( - callWithPointer { - uniffiRustCallWithError(NodeException) { _status -> - UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_bolt11payment_receive_for_hash( - it, - FfiConverterULong.lower(`amountMsat`), - FfiConverterTypeBolt11InvoiceDescription.lower(`description`), - FfiConverterUInt.lower(`expirySecs`), - FfiConverterTypePaymentHash.lower(`paymentHash`), - _status, - ) - } - }, - ) + + @Throws(NodeException::class)override fun `failForHash`(`paymentHash`: PaymentHash) + = + callWithPointer { + uniffiRustCallWithError(NodeException) { _status -> + UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_bolt11payment_fail_for_hash( + it, FfiConverterTypePaymentHash.lower(`paymentHash`),_status) +} + } + + - @Throws(NodeException::class) - override fun `receiveVariableAmount`( - `description`: Bolt11InvoiceDescription, - `expirySecs`: kotlin.UInt, - ): Bolt11Invoice = - FfiConverterTypeBolt11Invoice.lift( - callWithPointer { - uniffiRustCallWithError(NodeException) { _status -> - UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_bolt11payment_receive_variable_amount( - it, - FfiConverterTypeBolt11InvoiceDescription.lower(`description`), - FfiConverterUInt.lower(`expirySecs`), - _status, - ) - } - }, - ) + + @Throws(NodeException::class)override fun `receive`(`amountMsat`: kotlin.ULong, `description`: Bolt11InvoiceDescription, `expirySecs`: kotlin.UInt): Bolt11Invoice { + return FfiConverterTypeBolt11Invoice.lift( + callWithPointer { + uniffiRustCallWithError(NodeException) { _status -> + UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_bolt11payment_receive( + it, FfiConverterULong.lower(`amountMsat`),FfiConverterTypeBolt11InvoiceDescription.lower(`description`),FfiConverterUInt.lower(`expirySecs`),_status) +} + } + ) + } + - @Throws(NodeException::class) - override fun `receiveVariableAmountForHash`( - `description`: Bolt11InvoiceDescription, - `expirySecs`: kotlin.UInt, - `paymentHash`: PaymentHash, - ): Bolt11Invoice = - FfiConverterTypeBolt11Invoice.lift( - callWithPointer { - uniffiRustCallWithError(NodeException) { _status -> - UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_bolt11payment_receive_variable_amount_for_hash( - it, - FfiConverterTypeBolt11InvoiceDescription.lower(`description`), - FfiConverterUInt.lower(`expirySecs`), - FfiConverterTypePaymentHash.lower(`paymentHash`), - _status, - ) - } - }, - ) + + @Throws(NodeException::class)override fun `receiveForHash`(`amountMsat`: kotlin.ULong, `description`: Bolt11InvoiceDescription, `expirySecs`: kotlin.UInt, `paymentHash`: PaymentHash): Bolt11Invoice { + return FfiConverterTypeBolt11Invoice.lift( + callWithPointer { + uniffiRustCallWithError(NodeException) { _status -> + UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_bolt11payment_receive_for_hash( + it, FfiConverterULong.lower(`amountMsat`),FfiConverterTypeBolt11InvoiceDescription.lower(`description`),FfiConverterUInt.lower(`expirySecs`),FfiConverterTypePaymentHash.lower(`paymentHash`),_status) +} + } + ) + } + - @Throws(NodeException::class) - override fun `receiveVariableAmountViaJitChannel`( - `description`: Bolt11InvoiceDescription, - `expirySecs`: kotlin.UInt, - `maxProportionalLspFeeLimitPpmMsat`: kotlin.ULong?, - ): Bolt11Invoice = - FfiConverterTypeBolt11Invoice.lift( - callWithPointer { - uniffiRustCallWithError(NodeException) { _status -> - UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_bolt11payment_receive_variable_amount_via_jit_channel( - it, - FfiConverterTypeBolt11InvoiceDescription.lower(`description`), - FfiConverterUInt.lower(`expirySecs`), - FfiConverterOptionalULong.lower(`maxProportionalLspFeeLimitPpmMsat`), - _status, - ) - } - }, - ) + + @Throws(NodeException::class)override fun `receiveVariableAmount`(`description`: Bolt11InvoiceDescription, `expirySecs`: kotlin.UInt): Bolt11Invoice { + return FfiConverterTypeBolt11Invoice.lift( + callWithPointer { + uniffiRustCallWithError(NodeException) { _status -> + UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_bolt11payment_receive_variable_amount( + it, FfiConverterTypeBolt11InvoiceDescription.lower(`description`),FfiConverterUInt.lower(`expirySecs`),_status) +} + } + ) + } + - @Throws(NodeException::class) - override fun `receiveViaJitChannel`( - `amountMsat`: kotlin.ULong, - `description`: Bolt11InvoiceDescription, - `expirySecs`: kotlin.UInt, - `maxLspFeeLimitMsat`: kotlin.ULong?, - ): Bolt11Invoice = - FfiConverterTypeBolt11Invoice.lift( - callWithPointer { - uniffiRustCallWithError(NodeException) { _status -> - UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_bolt11payment_receive_via_jit_channel( - it, - FfiConverterULong.lower(`amountMsat`), - FfiConverterTypeBolt11InvoiceDescription.lower(`description`), - FfiConverterUInt.lower(`expirySecs`), - FfiConverterOptionalULong.lower(`maxLspFeeLimitMsat`), - _status, - ) - } - }, - ) + + @Throws(NodeException::class)override fun `receiveVariableAmountForHash`(`description`: Bolt11InvoiceDescription, `expirySecs`: kotlin.UInt, `paymentHash`: PaymentHash): Bolt11Invoice { + return FfiConverterTypeBolt11Invoice.lift( + callWithPointer { + uniffiRustCallWithError(NodeException) { _status -> + UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_bolt11payment_receive_variable_amount_for_hash( + it, FfiConverterTypeBolt11InvoiceDescription.lower(`description`),FfiConverterUInt.lower(`expirySecs`),FfiConverterTypePaymentHash.lower(`paymentHash`),_status) +} + } + ) + } + - @Throws(NodeException::class) - override fun `send`( - `invoice`: Bolt11Invoice, - `sendingParameters`: SendingParameters?, - ): PaymentId = - FfiConverterTypePaymentId.lift( - callWithPointer { - uniffiRustCallWithError(NodeException) { _status -> - UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_bolt11payment_send( - it, - FfiConverterTypeBolt11Invoice.lower(`invoice`), - FfiConverterOptionalTypeSendingParameters.lower(`sendingParameters`), - _status, - ) - } - }, - ) + + @Throws(NodeException::class)override fun `receiveVariableAmountViaJitChannel`(`description`: Bolt11InvoiceDescription, `expirySecs`: kotlin.UInt, `maxProportionalLspFeeLimitPpmMsat`: kotlin.ULong?): Bolt11Invoice { + return FfiConverterTypeBolt11Invoice.lift( + callWithPointer { + uniffiRustCallWithError(NodeException) { _status -> + UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_bolt11payment_receive_variable_amount_via_jit_channel( + it, FfiConverterTypeBolt11InvoiceDescription.lower(`description`),FfiConverterUInt.lower(`expirySecs`),FfiConverterOptionalULong.lower(`maxProportionalLspFeeLimitPpmMsat`),_status) +} + } + ) + } + - @Throws(NodeException::class) - override fun `sendProbes`(`invoice`: Bolt11Invoice) = - callWithPointer { - uniffiRustCallWithError(NodeException) { _status -> - UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_bolt11payment_send_probes( - it, - FfiConverterTypeBolt11Invoice.lower(`invoice`), - _status, - ) - } - } + + @Throws(NodeException::class)override fun `receiveViaJitChannel`(`amountMsat`: kotlin.ULong, `description`: Bolt11InvoiceDescription, `expirySecs`: kotlin.UInt, `maxLspFeeLimitMsat`: kotlin.ULong?): Bolt11Invoice { + return FfiConverterTypeBolt11Invoice.lift( + callWithPointer { + uniffiRustCallWithError(NodeException) { _status -> + UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_bolt11payment_receive_via_jit_channel( + it, FfiConverterULong.lower(`amountMsat`),FfiConverterTypeBolt11InvoiceDescription.lower(`description`),FfiConverterUInt.lower(`expirySecs`),FfiConverterOptionalULong.lower(`maxLspFeeLimitMsat`),_status) +} + } + ) + } + - @Throws(NodeException::class) - override fun `sendProbesUsingAmount`( - `invoice`: Bolt11Invoice, - `amountMsat`: kotlin.ULong, - ) = callWithPointer { - uniffiRustCallWithError(NodeException) { _status -> - UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_bolt11payment_send_probes_using_amount( - it, - FfiConverterTypeBolt11Invoice.lower(`invoice`), - FfiConverterULong.lower(`amountMsat`), - _status, - ) - } + + @Throws(NodeException::class)override fun `send`(`invoice`: Bolt11Invoice, `sendingParameters`: SendingParameters?): PaymentId { + return FfiConverterTypePaymentId.lift( + callWithPointer { + uniffiRustCallWithError(NodeException) { _status -> + UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_bolt11payment_send( + it, FfiConverterTypeBolt11Invoice.lower(`invoice`),FfiConverterOptionalTypeSendingParameters.lower(`sendingParameters`),_status) +} + } + ) } + - @Throws(NodeException::class) - override fun `sendUsingAmount`( - `invoice`: Bolt11Invoice, - `amountMsat`: kotlin.ULong, - `sendingParameters`: SendingParameters?, - ): PaymentId = - FfiConverterTypePaymentId.lift( - callWithPointer { - uniffiRustCallWithError(NodeException) { _status -> - UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_bolt11payment_send_using_amount( - it, - FfiConverterTypeBolt11Invoice.lower(`invoice`), - FfiConverterULong.lower(`amountMsat`), - FfiConverterOptionalTypeSendingParameters.lower(`sendingParameters`), - _status, - ) - } - }, - ) + + @Throws(NodeException::class)override fun `sendProbes`(`invoice`: Bolt11Invoice) + = + callWithPointer { + uniffiRustCallWithError(NodeException) { _status -> + UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_bolt11payment_send_probes( + it, FfiConverterTypeBolt11Invoice.lower(`invoice`),_status) +} + } + + + + + @Throws(NodeException::class)override fun `sendProbesUsingAmount`(`invoice`: Bolt11Invoice, `amountMsat`: kotlin.ULong) + = + callWithPointer { + uniffiRustCallWithError(NodeException) { _status -> + UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_bolt11payment_send_probes_using_amount( + it, FfiConverterTypeBolt11Invoice.lower(`invoice`),FfiConverterULong.lower(`amountMsat`),_status) +} + } + + + + + @Throws(NodeException::class)override fun `sendUsingAmount`(`invoice`: Bolt11Invoice, `amountMsat`: kotlin.ULong, `sendingParameters`: SendingParameters?): PaymentId { + return FfiConverterTypePaymentId.lift( + callWithPointer { + uniffiRustCallWithError(NodeException) { _status -> + UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_bolt11payment_send_using_amount( + it, FfiConverterTypeBolt11Invoice.lower(`invoice`),FfiConverterULong.lower(`amountMsat`),FfiConverterOptionalTypeSendingParameters.lower(`sendingParameters`),_status) +} + } + ) + } + + + + + companion object + } -public object FfiConverterTypeBolt11Payment : FfiConverter { - override fun lower(value: Bolt11Payment): Pointer = value.uniffiClonePointer() +public object FfiConverterTypeBolt11Payment: FfiConverter { - override fun lift(value: Pointer): Bolt11Payment = Bolt11Payment(value) + override fun lower(value: Bolt11Payment): Pointer { + return value.uniffiClonePointer() + } + + override fun lift(value: Pointer): Bolt11Payment { + return Bolt11Payment(value) + } override fun read(buf: ByteBuffer): Bolt11Payment { // The Rust code always writes pointers as 8 bytes, and will @@ -3814,16 +3328,14 @@ public object FfiConverterTypeBolt11Payment : FfiConverter // to the live Rust struct on the other side of the FFI. // @@ -3921,48 +3433,26 @@ public object FfiConverterTypeBolt11Payment : FfiConverter uniffiRustCall { status -> @@ -4038,136 +3526,107 @@ open class Bolt12Payment : } } - fun uniffiClonePointer(): Pointer = - uniffiRustCall { status -> + fun uniffiClonePointer(): Pointer { + return uniffiRustCall() { status -> UniffiLib.INSTANCE.uniffi_ldk_node_fn_clone_bolt12payment(pointer!!, status) } + } - @Throws(NodeException::class) - override fun `initiateRefund`( - `amountMsat`: kotlin.ULong, - `expirySecs`: kotlin.UInt, - `quantity`: kotlin.ULong?, - `payerNote`: kotlin.String?, - ): Refund = - FfiConverterTypeRefund.lift( - callWithPointer { - uniffiRustCallWithError(NodeException) { _status -> - UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_bolt12payment_initiate_refund( - it, - FfiConverterULong.lower(`amountMsat`), - FfiConverterUInt.lower(`expirySecs`), - FfiConverterOptionalULong.lower(`quantity`), - FfiConverterOptionalString.lower(`payerNote`), - _status, - ) - } - }, - ) + + @Throws(NodeException::class)override fun `initiateRefund`(`amountMsat`: kotlin.ULong, `expirySecs`: kotlin.UInt, `quantity`: kotlin.ULong?, `payerNote`: kotlin.String?): Refund { + return FfiConverterTypeRefund.lift( + callWithPointer { + uniffiRustCallWithError(NodeException) { _status -> + UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_bolt12payment_initiate_refund( + it, FfiConverterULong.lower(`amountMsat`),FfiConverterUInt.lower(`expirySecs`),FfiConverterOptionalULong.lower(`quantity`),FfiConverterOptionalString.lower(`payerNote`),_status) +} + } + ) + } + - @Throws(NodeException::class) - override fun `receive`( - `amountMsat`: kotlin.ULong, - `description`: kotlin.String, - `expirySecs`: kotlin.UInt?, - `quantity`: kotlin.ULong?, - ): Offer = - FfiConverterTypeOffer.lift( - callWithPointer { - uniffiRustCallWithError(NodeException) { _status -> - UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_bolt12payment_receive( - it, - FfiConverterULong.lower(`amountMsat`), - FfiConverterString.lower(`description`), - FfiConverterOptionalUInt.lower(`expirySecs`), - FfiConverterOptionalULong.lower(`quantity`), - _status, - ) - } - }, - ) + + @Throws(NodeException::class)override fun `receive`(`amountMsat`: kotlin.ULong, `description`: kotlin.String, `expirySecs`: kotlin.UInt?, `quantity`: kotlin.ULong?): Offer { + return FfiConverterTypeOffer.lift( + callWithPointer { + uniffiRustCallWithError(NodeException) { _status -> + UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_bolt12payment_receive( + it, FfiConverterULong.lower(`amountMsat`),FfiConverterString.lower(`description`),FfiConverterOptionalUInt.lower(`expirySecs`),FfiConverterOptionalULong.lower(`quantity`),_status) +} + } + ) + } + - @Throws(NodeException::class) - override fun `receiveVariableAmount`( - `description`: kotlin.String, - `expirySecs`: kotlin.UInt?, - ): Offer = - FfiConverterTypeOffer.lift( - callWithPointer { - uniffiRustCallWithError(NodeException) { _status -> - UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_bolt12payment_receive_variable_amount( - it, - FfiConverterString.lower(`description`), - FfiConverterOptionalUInt.lower(`expirySecs`), - _status, - ) - } - }, - ) + + @Throws(NodeException::class)override fun `receiveVariableAmount`(`description`: kotlin.String, `expirySecs`: kotlin.UInt?): Offer { + return FfiConverterTypeOffer.lift( + callWithPointer { + uniffiRustCallWithError(NodeException) { _status -> + UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_bolt12payment_receive_variable_amount( + it, FfiConverterString.lower(`description`),FfiConverterOptionalUInt.lower(`expirySecs`),_status) +} + } + ) + } + - @Throws(NodeException::class) - override fun `requestRefundPayment`(`refund`: Refund): Bolt12Invoice = - FfiConverterTypeBolt12Invoice.lift( - callWithPointer { - uniffiRustCallWithError(NodeException) { _status -> - UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_bolt12payment_request_refund_payment( - it, - FfiConverterTypeRefund.lower(`refund`), - _status, - ) - } - }, - ) + + @Throws(NodeException::class)override fun `requestRefundPayment`(`refund`: Refund): Bolt12Invoice { + return FfiConverterTypeBolt12Invoice.lift( + callWithPointer { + uniffiRustCallWithError(NodeException) { _status -> + UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_bolt12payment_request_refund_payment( + it, FfiConverterTypeRefund.lower(`refund`),_status) +} + } + ) + } + - @Throws(NodeException::class) - override fun `send`( - `offer`: Offer, - `quantity`: kotlin.ULong?, - `payerNote`: kotlin.String?, - ): PaymentId = - FfiConverterTypePaymentId.lift( - callWithPointer { - uniffiRustCallWithError(NodeException) { _status -> - UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_bolt12payment_send( - it, - FfiConverterTypeOffer.lower(`offer`), - FfiConverterOptionalULong.lower(`quantity`), - FfiConverterOptionalString.lower(`payerNote`), - _status, - ) - } - }, - ) + + @Throws(NodeException::class)override fun `send`(`offer`: Offer, `quantity`: kotlin.ULong?, `payerNote`: kotlin.String?): PaymentId { + return FfiConverterTypePaymentId.lift( + callWithPointer { + uniffiRustCallWithError(NodeException) { _status -> + UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_bolt12payment_send( + it, FfiConverterTypeOffer.lower(`offer`),FfiConverterOptionalULong.lower(`quantity`),FfiConverterOptionalString.lower(`payerNote`),_status) +} + } + ) + } + - @Throws(NodeException::class) - override fun `sendUsingAmount`( - `offer`: Offer, - `amountMsat`: kotlin.ULong, - `quantity`: kotlin.ULong?, - `payerNote`: kotlin.String?, - ): PaymentId = - FfiConverterTypePaymentId.lift( - callWithPointer { - uniffiRustCallWithError(NodeException) { _status -> - UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_bolt12payment_send_using_amount( - it, - FfiConverterTypeOffer.lower(`offer`), - FfiConverterULong.lower(`amountMsat`), - FfiConverterOptionalULong.lower(`quantity`), - FfiConverterOptionalString.lower(`payerNote`), - _status, - ) - } - }, - ) + + @Throws(NodeException::class)override fun `sendUsingAmount`(`offer`: Offer, `amountMsat`: kotlin.ULong, `quantity`: kotlin.ULong?, `payerNote`: kotlin.String?): PaymentId { + return FfiConverterTypePaymentId.lift( + callWithPointer { + uniffiRustCallWithError(NodeException) { _status -> + UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_bolt12payment_send_using_amount( + it, FfiConverterTypeOffer.lower(`offer`),FfiConverterULong.lower(`amountMsat`),FfiConverterOptionalULong.lower(`quantity`),FfiConverterOptionalString.lower(`payerNote`),_status) +} + } + ) + } + + + + + companion object + } -public object FfiConverterTypeBolt12Payment : FfiConverter { - override fun lower(value: Bolt12Payment): Pointer = value.uniffiClonePointer() +public object FfiConverterTypeBolt12Payment: FfiConverter { - override fun lift(value: Pointer): Bolt12Payment = Bolt12Payment(value) + override fun lower(value: Bolt12Payment): Pointer { + return value.uniffiClonePointer() + } + + override fun lift(value: Pointer): Bolt12Payment { + return Bolt12Payment(value) + } override fun read(buf: ByteBuffer): Bolt12Payment { // The Rust code always writes pointers as 8 bytes, and will @@ -4177,16 +3636,14 @@ public object FfiConverterTypeBolt12Payment : FfiConverter // to the live Rust struct on the other side of the FFI. // @@ -4284,98 +3741,60 @@ public object FfiConverterTypeBolt12Payment : FfiConverter, - ): Node - - fun `buildWithVssStoreAndFixedHeaders`( - `vssUrl`: kotlin.String, - `storeId`: kotlin.String, - `fixedHeaders`: Map, - ): Node - - fun `buildWithVssStoreAndHeaderProvider`( - `vssUrl`: kotlin.String, - `storeId`: kotlin.String, - `headerProvider`: VssHeaderProvider, - ): Node - + + fun `buildWithVssStore`(`vssUrl`: kotlin.String, `storeId`: kotlin.String, `lnurlAuthServerUrl`: kotlin.String, `fixedHeaders`: Map): Node + + fun `buildWithVssStoreAndFixedHeaders`(`vssUrl`: kotlin.String, `storeId`: kotlin.String, `fixedHeaders`: Map): Node + + fun `buildWithVssStoreAndHeaderProvider`(`vssUrl`: kotlin.String, `storeId`: kotlin.String, `headerProvider`: VssHeaderProvider): Node + fun `setAnnouncementAddresses`(`announcementAddresses`: List) - - fun `setChainSourceBitcoindRpc`( - `rpcHost`: kotlin.String, - `rpcPort`: kotlin.UShort, - `rpcUser`: kotlin.String, - `rpcPassword`: kotlin.String, - ) - - fun `setChainSourceElectrum`( - `serverUrl`: kotlin.String, - `config`: ElectrumSyncConfig?, - ) - - fun `setChainSourceEsplora`( - `serverUrl`: kotlin.String, - `config`: EsploraSyncConfig?, - ) - + + fun `setChainSourceBitcoindRpc`(`rpcHost`: kotlin.String, `rpcPort`: kotlin.UShort, `rpcUser`: kotlin.String, `rpcPassword`: kotlin.String) + + fun `setChainSourceElectrum`(`serverUrl`: kotlin.String, `config`: ElectrumSyncConfig?) + + fun `setChainSourceEsplora`(`serverUrl`: kotlin.String, `config`: EsploraSyncConfig?) + fun `setCustomLogger`(`logWriter`: LogWriter) - - fun `setEntropyBip39Mnemonic`( - `mnemonic`: Mnemonic, - `passphrase`: kotlin.String?, - ) - + + fun `setEntropyBip39Mnemonic`(`mnemonic`: Mnemonic, `passphrase`: kotlin.String?) + fun `setEntropySeedBytes`(`seedBytes`: List) - + fun `setEntropySeedPath`(`seedPath`: kotlin.String) - - fun `setFilesystemLogger`( - `logFilePath`: kotlin.String?, - `maxLogLevel`: LogLevel?, - ) - + + fun `setFilesystemLogger`(`logFilePath`: kotlin.String?, `maxLogLevel`: LogLevel?) + fun `setGossipSourceP2p`() - + fun `setGossipSourceRgs`(`rgsServerUrl`: kotlin.String) - - fun `setLiquiditySourceLsps1`( - `nodeId`: PublicKey, - `address`: SocketAddress, - `token`: kotlin.String?, - ) - - fun `setLiquiditySourceLsps2`( - `nodeId`: PublicKey, - `address`: SocketAddress, - `token`: kotlin.String?, - ) - + + fun `setLiquiditySourceLsps1`(`nodeId`: PublicKey, `address`: SocketAddress, `token`: kotlin.String?) + + fun `setLiquiditySourceLsps2`(`nodeId`: PublicKey, `address`: SocketAddress, `token`: kotlin.String?) + fun `setListeningAddresses`(`listeningAddresses`: List) - + fun `setLogFacadeLogger`() - + fun `setNetwork`(`network`: Network) - + fun `setNodeAlias`(`nodeAlias`: kotlin.String) - + fun `setStorageDirPath`(`storageDirPath`: kotlin.String) - + companion object } -open class Builder : - Disposable, - AutoCloseable, - BuilderInterface { +open class Builder: Disposable, AutoCloseable, BuilderInterface { + constructor(pointer: Pointer) { this.pointer = pointer this.cleanable = UniffiLib.CLEANER.register(this, UniffiCleanAction(pointer)) @@ -4393,10 +3812,11 @@ open class Builder : } constructor() : this( - uniffiRustCall { _status -> - UniffiLib.INSTANCE.uniffi_ldk_node_fn_constructor_builder_new(_status) - }, - ) + uniffiRustCall() { _status -> + UniffiLib.INSTANCE.uniffi_ldk_node_fn_constructor_builder_new( + _status) +} + ) protected val pointer: Pointer? protected val cleanable: UniffiCleaner.Cleanable @@ -4431,7 +3851,7 @@ open class Builder : if (c == Long.MAX_VALUE) { throw IllegalStateException("${this.javaClass.simpleName} call counter would overflow") } - } while (!this.callCounter.compareAndSet(c, c + 1L)) + } while (! this.callCounter.compareAndSet(c, c + 1L)) // Now we can safely do the method call without the pointer being freed concurrently. try { return block(this.uniffiClonePointer()) @@ -4445,9 +3865,7 @@ open class Builder : // Use a static inner class instead of a closure so as not to accidentally // capture `this` as part of the cleanable's action. - private class UniffiCleanAction( - private val pointer: Pointer?, - ) : Runnable { + private class UniffiCleanAction(private val pointer: Pointer?) : Runnable { override fun run() { pointer?.let { ptr -> uniffiRustCall { status -> @@ -4457,322 +3875,307 @@ open class Builder : } } - fun uniffiClonePointer(): Pointer = - uniffiRustCall { status -> + fun uniffiClonePointer(): Pointer { + return uniffiRustCall() { status -> UniffiLib.INSTANCE.uniffi_ldk_node_fn_clone_builder(pointer!!, status) } + } - @Throws(BuildException::class) - override fun `build`(): Node = - FfiConverterTypeNode.lift( - callWithPointer { - uniffiRustCallWithError(BuildException) { _status -> - UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_builder_build(it, _status) - } - }, - ) + + @Throws(BuildException::class)override fun `build`(): Node { + return FfiConverterTypeNode.lift( + callWithPointer { + uniffiRustCallWithError(BuildException) { _status -> + UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_builder_build( + it, _status) +} + } + ) + } + - @Throws(BuildException::class) - override fun `buildWithFsStore`(): Node = - FfiConverterTypeNode.lift( - callWithPointer { - uniffiRustCallWithError(BuildException) { _status -> - UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_builder_build_with_fs_store(it, _status) - } - }, - ) + + @Throws(BuildException::class)override fun `buildWithFsStore`(): Node { + return FfiConverterTypeNode.lift( + callWithPointer { + uniffiRustCallWithError(BuildException) { _status -> + UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_builder_build_with_fs_store( + it, _status) +} + } + ) + } + - @Throws(BuildException::class) - override fun `buildWithVssStore`( - `vssUrl`: kotlin.String, - `storeId`: kotlin.String, - `lnurlAuthServerUrl`: kotlin.String, - `fixedHeaders`: Map, - ): Node = - FfiConverterTypeNode.lift( - callWithPointer { - uniffiRustCallWithError(BuildException) { _status -> - UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_builder_build_with_vss_store( - it, - FfiConverterString.lower(`vssUrl`), - FfiConverterString.lower(`storeId`), - FfiConverterString.lower(`lnurlAuthServerUrl`), - FfiConverterMapStringString.lower(`fixedHeaders`), - _status, - ) - } - }, - ) + + @Throws(BuildException::class)override fun `buildWithVssStore`(`vssUrl`: kotlin.String, `storeId`: kotlin.String, `lnurlAuthServerUrl`: kotlin.String, `fixedHeaders`: Map): Node { + return FfiConverterTypeNode.lift( + callWithPointer { + uniffiRustCallWithError(BuildException) { _status -> + UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_builder_build_with_vss_store( + it, FfiConverterString.lower(`vssUrl`),FfiConverterString.lower(`storeId`),FfiConverterString.lower(`lnurlAuthServerUrl`),FfiConverterMapStringString.lower(`fixedHeaders`),_status) +} + } + ) + } + - @Throws(BuildException::class) - override fun `buildWithVssStoreAndFixedHeaders`( - `vssUrl`: kotlin.String, - `storeId`: kotlin.String, - `fixedHeaders`: Map, - ): Node = - FfiConverterTypeNode.lift( - callWithPointer { - uniffiRustCallWithError(BuildException) { _status -> - UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_builder_build_with_vss_store_and_fixed_headers( - it, - FfiConverterString.lower(`vssUrl`), - FfiConverterString.lower(`storeId`), - FfiConverterMapStringString.lower(`fixedHeaders`), - _status, - ) - } - }, - ) + + @Throws(BuildException::class)override fun `buildWithVssStoreAndFixedHeaders`(`vssUrl`: kotlin.String, `storeId`: kotlin.String, `fixedHeaders`: Map): Node { + return FfiConverterTypeNode.lift( + callWithPointer { + uniffiRustCallWithError(BuildException) { _status -> + UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_builder_build_with_vss_store_and_fixed_headers( + it, FfiConverterString.lower(`vssUrl`),FfiConverterString.lower(`storeId`),FfiConverterMapStringString.lower(`fixedHeaders`),_status) +} + } + ) + } + - @Throws(BuildException::class) - override fun `buildWithVssStoreAndHeaderProvider`( - `vssUrl`: kotlin.String, - `storeId`: kotlin.String, - `headerProvider`: VssHeaderProvider, - ): Node = - FfiConverterTypeNode.lift( - callWithPointer { - uniffiRustCallWithError(BuildException) { _status -> - UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_builder_build_with_vss_store_and_header_provider( - it, - FfiConverterString.lower(`vssUrl`), - FfiConverterString.lower(`storeId`), - FfiConverterTypeVssHeaderProvider.lower(`headerProvider`), - _status, - ) - } - }, - ) + + @Throws(BuildException::class)override fun `buildWithVssStoreAndHeaderProvider`(`vssUrl`: kotlin.String, `storeId`: kotlin.String, `headerProvider`: VssHeaderProvider): Node { + return FfiConverterTypeNode.lift( + callWithPointer { + uniffiRustCallWithError(BuildException) { _status -> + UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_builder_build_with_vss_store_and_header_provider( + it, FfiConverterString.lower(`vssUrl`),FfiConverterString.lower(`storeId`),FfiConverterTypeVssHeaderProvider.lower(`headerProvider`),_status) +} + } + ) + } + - @Throws(BuildException::class) - override fun `setAnnouncementAddresses`(`announcementAddresses`: List) = - callWithPointer { - uniffiRustCallWithError(BuildException) { _status -> - UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_builder_set_announcement_addresses( - it, - FfiConverterSequenceTypeSocketAddress.lower(`announcementAddresses`), - _status, - ) - } - } + + @Throws(BuildException::class)override fun `setAnnouncementAddresses`(`announcementAddresses`: List) + = + callWithPointer { + uniffiRustCallWithError(BuildException) { _status -> + UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_builder_set_announcement_addresses( + it, FfiConverterSequenceTypeSocketAddress.lower(`announcementAddresses`),_status) +} + } + + - override fun `setChainSourceBitcoindRpc`( - `rpcHost`: kotlin.String, - `rpcPort`: kotlin.UShort, - `rpcUser`: kotlin.String, - `rpcPassword`: kotlin.String, - ) = callWithPointer { - uniffiRustCall { _status -> - UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_builder_set_chain_source_bitcoind_rpc( - it, - FfiConverterString.lower(`rpcHost`), - FfiConverterUShort.lower(`rpcPort`), - FfiConverterString.lower(`rpcUser`), - FfiConverterString.lower(`rpcPassword`), - _status, - ) - } + override fun `setChainSourceBitcoindRpc`(`rpcHost`: kotlin.String, `rpcPort`: kotlin.UShort, `rpcUser`: kotlin.String, `rpcPassword`: kotlin.String) + = + callWithPointer { + uniffiRustCall() { _status -> + UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_builder_set_chain_source_bitcoind_rpc( + it, FfiConverterString.lower(`rpcHost`),FfiConverterUShort.lower(`rpcPort`),FfiConverterString.lower(`rpcUser`),FfiConverterString.lower(`rpcPassword`),_status) +} } + + - override fun `setChainSourceElectrum`( - `serverUrl`: kotlin.String, - `config`: ElectrumSyncConfig?, - ) = callWithPointer { - uniffiRustCall { _status -> - UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_builder_set_chain_source_electrum( - it, - FfiConverterString.lower(`serverUrl`), - FfiConverterOptionalTypeElectrumSyncConfig.lower(`config`), - _status, - ) - } + override fun `setChainSourceElectrum`(`serverUrl`: kotlin.String, `config`: ElectrumSyncConfig?) + = + callWithPointer { + uniffiRustCall() { _status -> + UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_builder_set_chain_source_electrum( + it, FfiConverterString.lower(`serverUrl`),FfiConverterOptionalTypeElectrumSyncConfig.lower(`config`),_status) +} } + + - override fun `setChainSourceEsplora`( - `serverUrl`: kotlin.String, - `config`: EsploraSyncConfig?, - ) = callWithPointer { - uniffiRustCall { _status -> - UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_builder_set_chain_source_esplora( - it, - FfiConverterString.lower(`serverUrl`), - FfiConverterOptionalTypeEsploraSyncConfig.lower(`config`), - _status, - ) - } + override fun `setChainSourceEsplora`(`serverUrl`: kotlin.String, `config`: EsploraSyncConfig?) + = + callWithPointer { + uniffiRustCall() { _status -> + UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_builder_set_chain_source_esplora( + it, FfiConverterString.lower(`serverUrl`),FfiConverterOptionalTypeEsploraSyncConfig.lower(`config`),_status) +} + } + + + + override fun `setCustomLogger`(`logWriter`: LogWriter) + = + callWithPointer { + uniffiRustCall() { _status -> + UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_builder_set_custom_logger( + it, FfiConverterTypeLogWriter.lower(`logWriter`),_status) +} } + + - override fun `setCustomLogger`(`logWriter`: LogWriter) = - callWithPointer { - uniffiRustCall { _status -> - UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_builder_set_custom_logger( - it, - FfiConverterTypeLogWriter.lower(`logWriter`), - _status, - ) - } - } + override fun `setEntropyBip39Mnemonic`(`mnemonic`: Mnemonic, `passphrase`: kotlin.String?) + = + callWithPointer { + uniffiRustCall() { _status -> + UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_builder_set_entropy_bip39_mnemonic( + it, FfiConverterTypeMnemonic.lower(`mnemonic`),FfiConverterOptionalString.lower(`passphrase`),_status) +} + } + + - override fun `setEntropyBip39Mnemonic`( - `mnemonic`: Mnemonic, - `passphrase`: kotlin.String?, - ) = callWithPointer { - uniffiRustCall { _status -> - UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_builder_set_entropy_bip39_mnemonic( - it, - FfiConverterTypeMnemonic.lower(`mnemonic`), - FfiConverterOptionalString.lower(`passphrase`), - _status, - ) - } + + @Throws(BuildException::class)override fun `setEntropySeedBytes`(`seedBytes`: List) + = + callWithPointer { + uniffiRustCallWithError(BuildException) { _status -> + UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_builder_set_entropy_seed_bytes( + it, FfiConverterSequenceUByte.lower(`seedBytes`),_status) +} } + + - @Throws(BuildException::class) - override fun `setEntropySeedBytes`(`seedBytes`: List) = - callWithPointer { - uniffiRustCallWithError(BuildException) { _status -> - UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_builder_set_entropy_seed_bytes( - it, - FfiConverterSequenceUByte.lower(`seedBytes`), - _status, - ) - } - } + override fun `setEntropySeedPath`(`seedPath`: kotlin.String) + = + callWithPointer { + uniffiRustCall() { _status -> + UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_builder_set_entropy_seed_path( + it, FfiConverterString.lower(`seedPath`),_status) +} + } + + - override fun `setEntropySeedPath`(`seedPath`: kotlin.String) = - callWithPointer { - uniffiRustCall { _status -> - UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_builder_set_entropy_seed_path( - it, - FfiConverterString.lower(`seedPath`), - _status, - ) - } - } + override fun `setFilesystemLogger`(`logFilePath`: kotlin.String?, `maxLogLevel`: LogLevel?) + = + callWithPointer { + uniffiRustCall() { _status -> + UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_builder_set_filesystem_logger( + it, FfiConverterOptionalString.lower(`logFilePath`),FfiConverterOptionalTypeLogLevel.lower(`maxLogLevel`),_status) +} + } + + - override fun `setFilesystemLogger`( - `logFilePath`: kotlin.String?, - `maxLogLevel`: LogLevel?, - ) = callWithPointer { - uniffiRustCall { _status -> - UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_builder_set_filesystem_logger( - it, - FfiConverterOptionalString.lower(`logFilePath`), - FfiConverterOptionalTypeLogLevel.lower(`maxLogLevel`), - _status, - ) - } + override fun `setGossipSourceP2p`() + = + callWithPointer { + uniffiRustCall() { _status -> + UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_builder_set_gossip_source_p2p( + it, _status) +} } + + - override fun `setGossipSourceP2p`() = - callWithPointer { - uniffiRustCall { _status -> - UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_builder_set_gossip_source_p2p(it, _status) - } - } + override fun `setGossipSourceRgs`(`rgsServerUrl`: kotlin.String) + = + callWithPointer { + uniffiRustCall() { _status -> + UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_builder_set_gossip_source_rgs( + it, FfiConverterString.lower(`rgsServerUrl`),_status) +} + } + + - override fun `setGossipSourceRgs`(`rgsServerUrl`: kotlin.String) = - callWithPointer { - uniffiRustCall { _status -> - UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_builder_set_gossip_source_rgs( - it, - FfiConverterString.lower(`rgsServerUrl`), - _status, - ) - } - } + override fun `setLiquiditySourceLsps1`(`nodeId`: PublicKey, `address`: SocketAddress, `token`: kotlin.String?) + = + callWithPointer { + uniffiRustCall() { _status -> + UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_builder_set_liquidity_source_lsps1( + it, FfiConverterTypePublicKey.lower(`nodeId`),FfiConverterTypeSocketAddress.lower(`address`),FfiConverterOptionalString.lower(`token`),_status) +} + } + + - override fun `setLiquiditySourceLsps1`( - `nodeId`: PublicKey, - `address`: SocketAddress, - `token`: kotlin.String?, - ) = callWithPointer { - uniffiRustCall { _status -> - UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_builder_set_liquidity_source_lsps1( - it, - FfiConverterTypePublicKey.lower(`nodeId`), - FfiConverterTypeSocketAddress.lower(`address`), - FfiConverterOptionalString.lower(`token`), - _status, - ) - } + override fun `setLiquiditySourceLsps2`(`nodeId`: PublicKey, `address`: SocketAddress, `token`: kotlin.String?) + = + callWithPointer { + uniffiRustCall() { _status -> + UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_builder_set_liquidity_source_lsps2( + it, FfiConverterTypePublicKey.lower(`nodeId`),FfiConverterTypeSocketAddress.lower(`address`),FfiConverterOptionalString.lower(`token`),_status) +} } + + - override fun `setLiquiditySourceLsps2`( - `nodeId`: PublicKey, - `address`: SocketAddress, - `token`: kotlin.String?, - ) = callWithPointer { - uniffiRustCall { _status -> - UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_builder_set_liquidity_source_lsps2( - it, - FfiConverterTypePublicKey.lower(`nodeId`), - FfiConverterTypeSocketAddress.lower(`address`), - FfiConverterOptionalString.lower(`token`), - _status, - ) - } + + @Throws(BuildException::class)override fun `setListeningAddresses`(`listeningAddresses`: List) + = + callWithPointer { + uniffiRustCallWithError(BuildException) { _status -> + UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_builder_set_listening_addresses( + it, FfiConverterSequenceTypeSocketAddress.lower(`listeningAddresses`),_status) +} } + + - @Throws(BuildException::class) - override fun `setListeningAddresses`(`listeningAddresses`: List) = - callWithPointer { - uniffiRustCallWithError(BuildException) { _status -> - UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_builder_set_listening_addresses( - it, - FfiConverterSequenceTypeSocketAddress.lower(`listeningAddresses`), - _status, - ) - } - } + override fun `setLogFacadeLogger`() + = + callWithPointer { + uniffiRustCall() { _status -> + UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_builder_set_log_facade_logger( + it, _status) +} + } + + - override fun `setLogFacadeLogger`() = - callWithPointer { - uniffiRustCall { _status -> - UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_builder_set_log_facade_logger(it, _status) - } - } + override fun `setNetwork`(`network`: Network) + = + callWithPointer { + uniffiRustCall() { _status -> + UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_builder_set_network( + it, FfiConverterTypeNetwork.lower(`network`),_status) +} + } + + - override fun `setNetwork`(`network`: Network) = - callWithPointer { - uniffiRustCall { _status -> - UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_builder_set_network(it, FfiConverterTypeNetwork.lower(`network`), _status) - } - } + + @Throws(BuildException::class)override fun `setNodeAlias`(`nodeAlias`: kotlin.String) + = + callWithPointer { + uniffiRustCallWithError(BuildException) { _status -> + UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_builder_set_node_alias( + it, FfiConverterString.lower(`nodeAlias`),_status) +} + } + + - @Throws(BuildException::class) - override fun `setNodeAlias`(`nodeAlias`: kotlin.String) = - callWithPointer { - uniffiRustCallWithError(BuildException) { _status -> - UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_builder_set_node_alias(it, FfiConverterString.lower(`nodeAlias`), _status) - } - } + override fun `setStorageDirPath`(`storageDirPath`: kotlin.String) + = + callWithPointer { + uniffiRustCall() { _status -> + UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_builder_set_storage_dir_path( + it, FfiConverterString.lower(`storageDirPath`),_status) +} + } + + - override fun `setStorageDirPath`(`storageDirPath`: kotlin.String) = - callWithPointer { - uniffiRustCall { _status -> - UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_builder_set_storage_dir_path( - it, - FfiConverterString.lower(`storageDirPath`), - _status, - ) - } - } + + companion object { - fun `fromConfig`(`config`: Config): Builder = - FfiConverterTypeBuilder.lift( - uniffiRustCall { _status -> - UniffiLib.INSTANCE.uniffi_ldk_node_fn_constructor_builder_from_config(FfiConverterTypeConfig.lower(`config`), _status) - }, - ) + fun `fromConfig`(`config`: Config): Builder { + return FfiConverterTypeBuilder.lift( + uniffiRustCall() { _status -> + UniffiLib.INSTANCE.uniffi_ldk_node_fn_constructor_builder_from_config( + FfiConverterTypeConfig.lower(`config`),_status) +} + ) } + + + + } + } -public object FfiConverterTypeBuilder : FfiConverter { - override fun lower(value: Builder): Pointer = value.uniffiClonePointer() +public object FfiConverterTypeBuilder: FfiConverter { + + override fun lower(value: Builder): Pointer { + return value.uniffiClonePointer() + } - override fun lift(value: Pointer): Builder = Builder(value) + override fun lift(value: Pointer): Builder { + return Builder(value) + } override fun read(buf: ByteBuffer): Builder { // The Rust code always writes pointers as 8 bytes, and will @@ -4782,16 +4185,14 @@ public object FfiConverterTypeBuilder : FfiConverter { override fun allocationSize(value: Builder) = 8UL - override fun write( - value: Builder, - buf: ByteBuffer, - ) { + override fun write(value: Builder, buf: ByteBuffer) { // The Rust code always expects pointers written as 8 bytes, // and will fail to compile if they don't fit. buf.putLong(Pointer.nativeValue(lower(value))) } } + // This template implements a class for working with a Rust struct via a Pointer/Arc // to the live Rust struct on the other side of the FFI. // @@ -4889,20 +4290,20 @@ public object FfiConverterTypeBuilder : FfiConverter { // [1] https://stackoverflow.com/questions/24376768/can-java-finalize-an-object-when-it-is-still-in-scope/24380219 // + public interface FeeRateInterface { + fun `toSatPerKwu`(): kotlin.ULong - + fun `toSatPerVbCeil`(): kotlin.ULong - + fun `toSatPerVbFloor`(): kotlin.ULong - + companion object } -open class FeeRate : - Disposable, - AutoCloseable, - FeeRateInterface { +open class FeeRate: Disposable, AutoCloseable, FeeRateInterface { + constructor(pointer: Pointer) { this.pointer = pointer this.cleanable = UniffiLib.CLEANER.register(this, UniffiCleanAction(pointer)) @@ -4952,7 +4353,7 @@ open class FeeRate : if (c == Long.MAX_VALUE) { throw IllegalStateException("${this.javaClass.simpleName} call counter would overflow") } - } while (!this.callCounter.compareAndSet(c, c + 1L)) + } while (! this.callCounter.compareAndSet(c, c + 1L)) // Now we can safely do the method call without the pointer being freed concurrently. try { return block(this.uniffiClonePointer()) @@ -4966,9 +4367,7 @@ open class FeeRate : // Use a static inner class instead of a closure so as not to accidentally // capture `this` as part of the cleanable's action. - private class UniffiCleanAction( - private val pointer: Pointer?, - ) : Runnable { + private class UniffiCleanAction(private val pointer: Pointer?) : Runnable { override fun run() { pointer?.let { ptr -> uniffiRustCall { status -> @@ -4978,62 +4377,86 @@ open class FeeRate : } } - fun uniffiClonePointer(): Pointer = - uniffiRustCall { status -> + fun uniffiClonePointer(): Pointer { + return uniffiRustCall() { status -> UniffiLib.INSTANCE.uniffi_ldk_node_fn_clone_feerate(pointer!!, status) } + } - override fun `toSatPerKwu`(): kotlin.ULong = - FfiConverterULong.lift( - callWithPointer { - uniffiRustCall { _status -> - UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_feerate_to_sat_per_kwu(it, _status) - } - }, - ) + override fun `toSatPerKwu`(): kotlin.ULong { + return FfiConverterULong.lift( + callWithPointer { + uniffiRustCall() { _status -> + UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_feerate_to_sat_per_kwu( + it, _status) +} + } + ) + } + - override fun `toSatPerVbCeil`(): kotlin.ULong = - FfiConverterULong.lift( - callWithPointer { - uniffiRustCall { _status -> - UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_feerate_to_sat_per_vb_ceil(it, _status) - } - }, - ) + override fun `toSatPerVbCeil`(): kotlin.ULong { + return FfiConverterULong.lift( + callWithPointer { + uniffiRustCall() { _status -> + UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_feerate_to_sat_per_vb_ceil( + it, _status) +} + } + ) + } + - override fun `toSatPerVbFloor`(): kotlin.ULong = - FfiConverterULong.lift( - callWithPointer { - uniffiRustCall { _status -> - UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_feerate_to_sat_per_vb_floor(it, _status) - } - }, - ) + override fun `toSatPerVbFloor`(): kotlin.ULong { + return FfiConverterULong.lift( + callWithPointer { + uniffiRustCall() { _status -> + UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_feerate_to_sat_per_vb_floor( + it, _status) +} + } + ) + } + + + + companion object { - fun `fromSatPerKwu`(`satKwu`: kotlin.ULong): FeeRate = - FfiConverterTypeFeeRate.lift( - uniffiRustCall { _status -> - UniffiLib.INSTANCE.uniffi_ldk_node_fn_constructor_feerate_from_sat_per_kwu(FfiConverterULong.lower(`satKwu`), _status) - }, - ) + fun `fromSatPerKwu`(`satKwu`: kotlin.ULong): FeeRate { + return FfiConverterTypeFeeRate.lift( + uniffiRustCall() { _status -> + UniffiLib.INSTANCE.uniffi_ldk_node_fn_constructor_feerate_from_sat_per_kwu( + FfiConverterULong.lower(`satKwu`),_status) +} + ) + } + - fun `fromSatPerVbUnchecked`(`satVb`: kotlin.ULong): FeeRate = - FfiConverterTypeFeeRate.lift( - uniffiRustCall { _status -> - UniffiLib.INSTANCE.uniffi_ldk_node_fn_constructor_feerate_from_sat_per_vb_unchecked( - FfiConverterULong.lower(`satVb`), - _status, - ) - }, - ) + fun `fromSatPerVbUnchecked`(`satVb`: kotlin.ULong): FeeRate { + return FfiConverterTypeFeeRate.lift( + uniffiRustCall() { _status -> + UniffiLib.INSTANCE.uniffi_ldk_node_fn_constructor_feerate_from_sat_per_vb_unchecked( + FfiConverterULong.lower(`satVb`),_status) +} + ) + } + + + } + } -public object FfiConverterTypeFeeRate : FfiConverter { - override fun lower(value: FeeRate): Pointer = value.uniffiClonePointer() +public object FfiConverterTypeFeeRate: FfiConverter { - override fun lift(value: Pointer): FeeRate = FeeRate(value) + override fun lower(value: FeeRate): Pointer { + return value.uniffiClonePointer() + } + + override fun lift(value: Pointer): FeeRate { + return FeeRate(value) + } override fun read(buf: ByteBuffer): FeeRate { // The Rust code always writes pointers as 8 bytes, and will @@ -5043,16 +4466,14 @@ public object FfiConverterTypeFeeRate : FfiConverter { override fun allocationSize(value: FeeRate) = 8UL - override fun write( - value: FeeRate, - buf: ByteBuffer, - ) { + override fun write(value: FeeRate, buf: ByteBuffer) { // The Rust code always expects pointers written as 8 bytes, // and will fail to compile if they don't fit. buf.putLong(Pointer.nativeValue(lower(value))) } } + // This template implements a class for working with a Rust struct via a Pointer/Arc // to the live Rust struct on the other side of the FFI. // @@ -5150,23 +4571,18 @@ public object FfiConverterTypeFeeRate : FfiConverter { // [1] https://stackoverflow.com/questions/24376768/can-java-finalize-an-object-when-it-is-still-in-scope/24380219 // + public interface Lsps1LiquidityInterface { + fun `checkOrderStatus`(`orderId`: OrderId): Lsps1OrderStatus - - fun `requestChannel`( - `lspBalanceSat`: kotlin.ULong, - `clientBalanceSat`: kotlin.ULong, - `channelExpiryBlocks`: kotlin.UInt, - `announceChannel`: kotlin.Boolean, - ): Lsps1OrderStatus - + + fun `requestChannel`(`lspBalanceSat`: kotlin.ULong, `clientBalanceSat`: kotlin.ULong, `channelExpiryBlocks`: kotlin.UInt, `announceChannel`: kotlin.Boolean): Lsps1OrderStatus + companion object } -open class Lsps1Liquidity : - Disposable, - AutoCloseable, - Lsps1LiquidityInterface { +open class Lsps1Liquidity: Disposable, AutoCloseable, Lsps1LiquidityInterface { + constructor(pointer: Pointer) { this.pointer = pointer this.cleanable = UniffiLib.CLEANER.register(this, UniffiCleanAction(pointer)) @@ -5216,7 +4632,7 @@ open class Lsps1Liquidity : if (c == Long.MAX_VALUE) { throw IllegalStateException("${this.javaClass.simpleName} call counter would overflow") } - } while (!this.callCounter.compareAndSet(c, c + 1L)) + } while (! this.callCounter.compareAndSet(c, c + 1L)) // Now we can safely do the method call without the pointer being freed concurrently. try { return block(this.uniffiClonePointer()) @@ -5230,9 +4646,7 @@ open class Lsps1Liquidity : // Use a static inner class instead of a closure so as not to accidentally // capture `this` as part of the cleanable's action. - private class UniffiCleanAction( - private val pointer: Pointer?, - ) : Runnable { + private class UniffiCleanAction(private val pointer: Pointer?) : Runnable { override fun run() { pointer?.let { ptr -> uniffiRustCall { status -> @@ -5242,54 +4656,55 @@ open class Lsps1Liquidity : } } - fun uniffiClonePointer(): Pointer = - uniffiRustCall { status -> + fun uniffiClonePointer(): Pointer { + return uniffiRustCall() { status -> UniffiLib.INSTANCE.uniffi_ldk_node_fn_clone_lsps1liquidity(pointer!!, status) } + } - @Throws(NodeException::class) - override fun `checkOrderStatus`(`orderId`: OrderId): Lsps1OrderStatus = - FfiConverterTypeLSPS1OrderStatus.lift( - callWithPointer { - uniffiRustCallWithError(NodeException) { _status -> - UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_lsps1liquidity_check_order_status( - it, - FfiConverterTypeOrderId.lower(`orderId`), - _status, - ) - } - }, - ) + + @Throws(NodeException::class)override fun `checkOrderStatus`(`orderId`: OrderId): Lsps1OrderStatus { + return FfiConverterTypeLSPS1OrderStatus.lift( + callWithPointer { + uniffiRustCallWithError(NodeException) { _status -> + UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_lsps1liquidity_check_order_status( + it, FfiConverterTypeOrderId.lower(`orderId`),_status) +} + } + ) + } + - @Throws(NodeException::class) - override fun `requestChannel`( - `lspBalanceSat`: kotlin.ULong, - `clientBalanceSat`: kotlin.ULong, - `channelExpiryBlocks`: kotlin.UInt, - `announceChannel`: kotlin.Boolean, - ): Lsps1OrderStatus = - FfiConverterTypeLSPS1OrderStatus.lift( - callWithPointer { - uniffiRustCallWithError(NodeException) { _status -> - UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_lsps1liquidity_request_channel( - it, - FfiConverterULong.lower(`lspBalanceSat`), - FfiConverterULong.lower(`clientBalanceSat`), - FfiConverterUInt.lower(`channelExpiryBlocks`), - FfiConverterBoolean.lower(`announceChannel`), - _status, - ) - } - }, - ) + + @Throws(NodeException::class)override fun `requestChannel`(`lspBalanceSat`: kotlin.ULong, `clientBalanceSat`: kotlin.ULong, `channelExpiryBlocks`: kotlin.UInt, `announceChannel`: kotlin.Boolean): Lsps1OrderStatus { + return FfiConverterTypeLSPS1OrderStatus.lift( + callWithPointer { + uniffiRustCallWithError(NodeException) { _status -> + UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_lsps1liquidity_request_channel( + it, FfiConverterULong.lower(`lspBalanceSat`),FfiConverterULong.lower(`clientBalanceSat`),FfiConverterUInt.lower(`channelExpiryBlocks`),FfiConverterBoolean.lower(`announceChannel`),_status) +} + } + ) + } + + + + + companion object + } -public object FfiConverterTypeLSPS1Liquidity : FfiConverter { - override fun lower(value: Lsps1Liquidity): Pointer = value.uniffiClonePointer() +public object FfiConverterTypeLSPS1Liquidity: FfiConverter { + + override fun lower(value: Lsps1Liquidity): Pointer { + return value.uniffiClonePointer() + } - override fun lift(value: Pointer): Lsps1Liquidity = Lsps1Liquidity(value) + override fun lift(value: Pointer): Lsps1Liquidity { + return Lsps1Liquidity(value) + } override fun read(buf: ByteBuffer): Lsps1Liquidity { // The Rust code always writes pointers as 8 bytes, and will @@ -5299,16 +4714,14 @@ public object FfiConverterTypeLSPS1Liquidity : FfiConverter // to the live Rust struct on the other side of the FFI. // @@ -5406,16 +4819,16 @@ public object FfiConverterTypeLSPS1Liquidity : FfiConverter uniffiRustCall { status -> @@ -5491,38 +4902,48 @@ open class LogWriterImpl : } } - fun uniffiClonePointer(): Pointer = - uniffiRustCall { status -> + fun uniffiClonePointer(): Pointer { + return uniffiRustCall() { status -> UniffiLib.INSTANCE.uniffi_ldk_node_fn_clone_logwriter(pointer!!, status) } + } - override fun `log`(`record`: LogRecord) = - callWithPointer { - uniffiRustCall { _status -> - UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_logwriter_log(it, FfiConverterTypeLogRecord.lower(`record`), _status) - } - } + override fun `log`(`record`: LogRecord) + = + callWithPointer { + uniffiRustCall() { _status -> + UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_logwriter_log( + it, FfiConverterTypeLogRecord.lower(`record`),_status) +} + } + + + + + + companion object + } - // Magic number for the Rust proxy to call using the same mechanism as every other method, // to free the callback once it's dropped by Rust. internal const val IDX_CALLBACK_FREE = 0 - // Callback return codes internal const val UNIFFI_CALLBACK_SUCCESS = 0 internal const val UNIFFI_CALLBACK_ERROR = 1 internal const val UNIFFI_CALLBACK_UNEXPECTED_ERROR = 2 -public abstract class FfiConverterCallbackInterface : FfiConverter { +public abstract class FfiConverterCallbackInterface: FfiConverter { internal val handleMap = UniffiHandleMap() internal fun drop(handle: Long) { handleMap.remove(handle) } - override fun lift(value: Long): CallbackInterface = handleMap.get(value) + override fun lift(value: Long): CallbackInterface { + return handleMap.get(value) + } override fun read(buf: ByteBuffer) = lift(buf.getLong()) @@ -5530,44 +4951,36 @@ public abstract class FfiConverterCallbackInterface : F override fun allocationSize(value: CallbackInterface) = 8UL - override fun write( - value: CallbackInterface, - buf: ByteBuffer, - ) { + override fun write(value: CallbackInterface, buf: ByteBuffer) { buf.putLong(lower(value)) } } // Put the implementation in an object so we don't pollute the top-level namespace internal object uniffiCallbackInterfaceLogWriter { - internal object `log` : UniffiCallbackInterfaceLogWriterMethod0 { - override fun callback( - `uniffiHandle`: Long, - `record`: RustBuffer.ByValue, - `uniffiOutReturn`: Pointer, - uniffiCallStatus: UniffiRustCallStatus, - ) { + internal object `log`: UniffiCallbackInterfaceLogWriterMethod0 { + override fun callback(`uniffiHandle`: Long,`record`: RustBuffer.ByValue,`uniffiOutReturn`: Pointer,uniffiCallStatus: UniffiRustCallStatus,) { val uniffiObj = FfiConverterTypeLogWriter.handleMap.get(uniffiHandle) - val makeCall = { uniffiObj.`log`( - FfiConverterTypeLogRecord.lift(`record`), - ) + val makeCall = { -> + uniffiObj.`log`( + FfiConverterTypeLogRecord.lift(`record`), + ) } val writeReturn = { _: Unit -> Unit } uniffiTraitInterfaceCall(uniffiCallStatus, makeCall, writeReturn) } } - internal object uniffiFree : UniffiCallbackInterfaceFree { + internal object uniffiFree: UniffiCallbackInterfaceFree { override fun callback(handle: Long) { FfiConverterTypeLogWriter.handleMap.remove(handle) } } - internal var vtable = - UniffiVTableCallbackInterfaceLogWriter.UniffiByValue( - `log`, - uniffiFree, - ) + internal var vtable = UniffiVTableCallbackInterfaceLogWriter.UniffiByValue( + `log`, + uniffiFree, + ) // Registers the foreign callback with the Rust side. // This method is generated for each callback interface. @@ -5576,12 +4989,16 @@ internal object uniffiCallbackInterfaceLogWriter { } } -public object FfiConverterTypeLogWriter : FfiConverter { +public object FfiConverterTypeLogWriter: FfiConverter { internal val handleMap = UniffiHandleMap() - override fun lower(value: LogWriter): Pointer = Pointer(handleMap.insert(value)) + override fun lower(value: LogWriter): Pointer { + return Pointer(handleMap.insert(value)) + } - override fun lift(value: Pointer): LogWriter = LogWriterImpl(value) + override fun lift(value: Pointer): LogWriter { + return LogWriterImpl(value) + } override fun read(buf: ByteBuffer): LogWriter { // The Rust code always writes pointers as 8 bytes, and will @@ -5591,16 +5008,14 @@ public object FfiConverterTypeLogWriter : FfiConverter { override fun allocationSize(value: LogWriter) = 8UL - override fun write( - value: LogWriter, - buf: ByteBuffer, - ) { + override fun write(value: LogWriter, buf: ByteBuffer) { // The Rust code always expects pointers written as 8 bytes, // and will fail to compile if they don't fit. buf.putLong(Pointer.nativeValue(lower(value))) } } + // This template implements a class for working with a Rust struct via a Pointer/Arc // to the live Rust struct on the other side of the FFI. // @@ -5698,22 +5113,22 @@ public object FfiConverterTypeLogWriter : FfiConverter { // [1] https://stackoverflow.com/questions/24376768/can-java-finalize-an-object-when-it-is-still-in-scope/24380219 // + public interface NetworkGraphInterface { + fun `channel`(`shortChannelId`: kotlin.ULong): ChannelInfo? - + fun `listChannels`(): List - + fun `listNodes`(): List - + fun `node`(`nodeId`: NodeId): NodeInfo? - + companion object } -open class NetworkGraph : - Disposable, - AutoCloseable, - NetworkGraphInterface { +open class NetworkGraph: Disposable, AutoCloseable, NetworkGraphInterface { + constructor(pointer: Pointer) { this.pointer = pointer this.cleanable = UniffiLib.CLEANER.register(this, UniffiCleanAction(pointer)) @@ -5763,7 +5178,7 @@ open class NetworkGraph : if (c == Long.MAX_VALUE) { throw IllegalStateException("${this.javaClass.simpleName} call counter would overflow") } - } while (!this.callCounter.compareAndSet(c, c + 1L)) + } while (! this.callCounter.compareAndSet(c, c + 1L)) // Now we can safely do the method call without the pointer being freed concurrently. try { return block(this.uniffiClonePointer()) @@ -5777,9 +5192,7 @@ open class NetworkGraph : // Use a static inner class instead of a closure so as not to accidentally // capture `this` as part of the cleanable's action. - private class UniffiCleanAction( - private val pointer: Pointer?, - ) : Runnable { + private class UniffiCleanAction(private val pointer: Pointer?) : Runnable { override fun run() { pointer?.let { ptr -> uniffiRustCall { status -> @@ -5789,58 +5202,77 @@ open class NetworkGraph : } } - fun uniffiClonePointer(): Pointer = - uniffiRustCall { status -> + fun uniffiClonePointer(): Pointer { + return uniffiRustCall() { status -> UniffiLib.INSTANCE.uniffi_ldk_node_fn_clone_networkgraph(pointer!!, status) } + } - override fun `channel`(`shortChannelId`: kotlin.ULong): ChannelInfo? = - FfiConverterOptionalTypeChannelInfo.lift( - callWithPointer { - uniffiRustCall { _status -> - UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_networkgraph_channel( - it, - FfiConverterULong.lower(`shortChannelId`), - _status, - ) - } - }, - ) + override fun `channel`(`shortChannelId`: kotlin.ULong): ChannelInfo? { + return FfiConverterOptionalTypeChannelInfo.lift( + callWithPointer { + uniffiRustCall() { _status -> + UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_networkgraph_channel( + it, FfiConverterULong.lower(`shortChannelId`),_status) +} + } + ) + } + - override fun `listChannels`(): List = - FfiConverterSequenceULong.lift( - callWithPointer { - uniffiRustCall { _status -> - UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_networkgraph_list_channels(it, _status) - } - }, - ) + override fun `listChannels`(): List { + return FfiConverterSequenceULong.lift( + callWithPointer { + uniffiRustCall() { _status -> + UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_networkgraph_list_channels( + it, _status) +} + } + ) + } + - override fun `listNodes`(): List = - FfiConverterSequenceTypeNodeId.lift( - callWithPointer { - uniffiRustCall { _status -> - UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_networkgraph_list_nodes(it, _status) - } - }, - ) + override fun `listNodes`(): List { + return FfiConverterSequenceTypeNodeId.lift( + callWithPointer { + uniffiRustCall() { _status -> + UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_networkgraph_list_nodes( + it, _status) +} + } + ) + } + - override fun `node`(`nodeId`: NodeId): NodeInfo? = - FfiConverterOptionalTypeNodeInfo.lift( - callWithPointer { - uniffiRustCall { _status -> - UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_networkgraph_node(it, FfiConverterTypeNodeId.lower(`nodeId`), _status) - } - }, - ) + override fun `node`(`nodeId`: NodeId): NodeInfo? { + return FfiConverterOptionalTypeNodeInfo.lift( + callWithPointer { + uniffiRustCall() { _status -> + UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_networkgraph_node( + it, FfiConverterTypeNodeId.lower(`nodeId`),_status) +} + } + ) + } + + + + + companion object + } -public object FfiConverterTypeNetworkGraph : FfiConverter { - override fun lower(value: NetworkGraph): Pointer = value.uniffiClonePointer() +public object FfiConverterTypeNetworkGraph: FfiConverter { + + override fun lower(value: NetworkGraph): Pointer { + return value.uniffiClonePointer() + } - override fun lift(value: Pointer): NetworkGraph = NetworkGraph(value) + override fun lift(value: Pointer): NetworkGraph { + return NetworkGraph(value) + } override fun read(buf: ByteBuffer): NetworkGraph { // The Rust code always writes pointers as 8 bytes, and will @@ -5850,16 +5282,14 @@ public object FfiConverterTypeNetworkGraph : FfiConverter override fun allocationSize(value: NetworkGraph) = 8UL - override fun write( - value: NetworkGraph, - buf: ByteBuffer, - ) { + override fun write(value: NetworkGraph, buf: ByteBuffer) { // The Rust code always expects pointers written as 8 bytes, // and will fail to compile if they don't fit. buf.putLong(Pointer.nativeValue(lower(value))) } } + // This template implements a class for working with a Rust struct via a Pointer/Arc // to the live Rust struct on the other side of the FFI. // @@ -5957,117 +5387,86 @@ public object FfiConverterTypeNetworkGraph : FfiConverter // [1] https://stackoverflow.com/questions/24376768/can-java-finalize-an-object-when-it-is-still-in-scope/24380219 // + public interface NodeInterface { + fun `announcementAddresses`(): List? - + fun `bolt11Payment`(): Bolt11Payment - + fun `bolt12Payment`(): Bolt12Payment - - fun `closeChannel`( - `userChannelId`: UserChannelId, - `counterpartyNodeId`: PublicKey, - ) - + + fun `closeChannel`(`userChannelId`: UserChannelId, `counterpartyNodeId`: PublicKey) + fun `config`(): Config - - fun `connect`( - `nodeId`: PublicKey, - `address`: SocketAddress, - `persist`: kotlin.Boolean, - ) - + + fun `connect`(`nodeId`: PublicKey, `address`: SocketAddress, `persist`: kotlin.Boolean) + fun `disconnect`(`nodeId`: PublicKey) - + fun `eventHandled`() - + fun `exportPathfindingScores`(): kotlin.ByteArray - - fun `forceCloseChannel`( - `userChannelId`: UserChannelId, - `counterpartyNodeId`: PublicKey, - `reason`: kotlin.String?, - ) - + + fun `forceCloseChannel`(`userChannelId`: UserChannelId, `counterpartyNodeId`: PublicKey, `reason`: kotlin.String?) + fun `listBalances`(): BalanceDetails - + fun `listChannels`(): List - + fun `listPayments`(): List - + fun `listPeers`(): List - + fun `listeningAddresses`(): List? - + fun `lsps1Liquidity`(): Lsps1Liquidity - + fun `networkGraph`(): NetworkGraph - + fun `nextEvent`(): Event? - + suspend fun `nextEventAsync`(): Event - + fun `nodeAlias`(): NodeAlias? - + fun `nodeId`(): PublicKey - + fun `onchainPayment`(): OnchainPayment - - fun `openAnnouncedChannel`( - `nodeId`: PublicKey, - `address`: SocketAddress, - `channelAmountSats`: kotlin.ULong, - `pushToCounterpartyMsat`: kotlin.ULong?, - `channelConfig`: ChannelConfig?, - ): UserChannelId - - fun `openChannel`( - `nodeId`: PublicKey, - `address`: SocketAddress, - `channelAmountSats`: kotlin.ULong, - `pushToCounterpartyMsat`: kotlin.ULong?, - `channelConfig`: ChannelConfig?, - ): UserChannelId - + + fun `openAnnouncedChannel`(`nodeId`: PublicKey, `address`: SocketAddress, `channelAmountSats`: kotlin.ULong, `pushToCounterpartyMsat`: kotlin.ULong?, `channelConfig`: ChannelConfig?): UserChannelId + + fun `openChannel`(`nodeId`: PublicKey, `address`: SocketAddress, `channelAmountSats`: kotlin.ULong, `pushToCounterpartyMsat`: kotlin.ULong?, `channelConfig`: ChannelConfig?): UserChannelId + fun `payment`(`paymentId`: PaymentId): PaymentDetails? - + fun `removePayment`(`paymentId`: PaymentId) - + fun `signMessage`(`msg`: List): kotlin.String - + fun `spontaneousPayment`(): SpontaneousPayment - + fun `start`() - + fun `status`(): NodeStatus - + fun `stop`() - + fun `syncWallets`() - + fun `unifiedQrPayment`(): UnifiedQrPayment - - fun `updateChannelConfig`( - `userChannelId`: UserChannelId, - `counterpartyNodeId`: PublicKey, - `channelConfig`: ChannelConfig, - ) - - fun `verifySignature`( - `msg`: List, - `sig`: kotlin.String, - `pkey`: PublicKey, - ): kotlin.Boolean - + + fun `updateChannelConfig`(`userChannelId`: UserChannelId, `counterpartyNodeId`: PublicKey, `channelConfig`: ChannelConfig) + + fun `verifySignature`(`msg`: List, `sig`: kotlin.String, `pkey`: PublicKey): kotlin.Boolean + fun `waitNextEvent`(): Event - + companion object } -open class Node : - Disposable, - AutoCloseable, - NodeInterface { +open class Node: Disposable, AutoCloseable, NodeInterface { + constructor(pointer: Pointer) { this.pointer = pointer this.cleanable = UniffiLib.CLEANER.register(this, UniffiCleanAction(pointer)) @@ -6117,7 +5516,7 @@ open class Node : if (c == Long.MAX_VALUE) { throw IllegalStateException("${this.javaClass.simpleName} call counter would overflow") } - } while (!this.callCounter.compareAndSet(c, c + 1L)) + } while (! this.callCounter.compareAndSet(c, c + 1L)) // Now we can safely do the method call without the pointer being freed concurrently. try { return block(this.uniffiClonePointer()) @@ -6131,9 +5530,7 @@ open class Node : // Use a static inner class instead of a closure so as not to accidentally // capture `this` as part of the cleanable's action. - private class UniffiCleanAction( - private val pointer: Pointer?, - ) : Runnable { + private class UniffiCleanAction(private val pointer: Pointer?) : Runnable { override fun run() { pointer?.let { ptr -> uniffiRustCall { status -> @@ -6143,421 +5540,472 @@ open class Node : } } - fun uniffiClonePointer(): Pointer = - uniffiRustCall { status -> + fun uniffiClonePointer(): Pointer { + return uniffiRustCall() { status -> UniffiLib.INSTANCE.uniffi_ldk_node_fn_clone_node(pointer!!, status) } + } - override fun `announcementAddresses`(): List? = - FfiConverterOptionalSequenceTypeSocketAddress.lift( - callWithPointer { - uniffiRustCall { _status -> - UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_node_announcement_addresses(it, _status) - } - }, - ) + override fun `announcementAddresses`(): List? { + return FfiConverterOptionalSequenceTypeSocketAddress.lift( + callWithPointer { + uniffiRustCall() { _status -> + UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_node_announcement_addresses( + it, _status) +} + } + ) + } + - override fun `bolt11Payment`(): Bolt11Payment = - FfiConverterTypeBolt11Payment.lift( - callWithPointer { - uniffiRustCall { _status -> - UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_node_bolt11_payment(it, _status) - } - }, - ) + override fun `bolt11Payment`(): Bolt11Payment { + return FfiConverterTypeBolt11Payment.lift( + callWithPointer { + uniffiRustCall() { _status -> + UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_node_bolt11_payment( + it, _status) +} + } + ) + } + - override fun `bolt12Payment`(): Bolt12Payment = - FfiConverterTypeBolt12Payment.lift( - callWithPointer { - uniffiRustCall { _status -> - UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_node_bolt12_payment(it, _status) - } - }, - ) + override fun `bolt12Payment`(): Bolt12Payment { + return FfiConverterTypeBolt12Payment.lift( + callWithPointer { + uniffiRustCall() { _status -> + UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_node_bolt12_payment( + it, _status) +} + } + ) + } + - @Throws(NodeException::class) - override fun `closeChannel`( - `userChannelId`: UserChannelId, - `counterpartyNodeId`: PublicKey, - ) = callWithPointer { - uniffiRustCallWithError(NodeException) { _status -> - UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_node_close_channel( - it, - FfiConverterTypeUserChannelId.lower(`userChannelId`), - FfiConverterTypePublicKey.lower(`counterpartyNodeId`), - _status, - ) - } + + @Throws(NodeException::class)override fun `closeChannel`(`userChannelId`: UserChannelId, `counterpartyNodeId`: PublicKey) + = + callWithPointer { + uniffiRustCallWithError(NodeException) { _status -> + UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_node_close_channel( + it, FfiConverterTypeUserChannelId.lower(`userChannelId`),FfiConverterTypePublicKey.lower(`counterpartyNodeId`),_status) +} } + + - override fun `config`(): Config = - FfiConverterTypeConfig.lift( - callWithPointer { - uniffiRustCall { _status -> - UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_node_config(it, _status) - } - }, - ) + override fun `config`(): Config { + return FfiConverterTypeConfig.lift( + callWithPointer { + uniffiRustCall() { _status -> + UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_node_config( + it, _status) +} + } + ) + } + - @Throws(NodeException::class) - override fun `connect`( - `nodeId`: PublicKey, - `address`: SocketAddress, - `persist`: kotlin.Boolean, - ) = callWithPointer { - uniffiRustCallWithError(NodeException) { _status -> - UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_node_connect( - it, - FfiConverterTypePublicKey.lower(`nodeId`), - FfiConverterTypeSocketAddress.lower(`address`), - FfiConverterBoolean.lower(`persist`), - _status, - ) - } + + @Throws(NodeException::class)override fun `connect`(`nodeId`: PublicKey, `address`: SocketAddress, `persist`: kotlin.Boolean) + = + callWithPointer { + uniffiRustCallWithError(NodeException) { _status -> + UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_node_connect( + it, FfiConverterTypePublicKey.lower(`nodeId`),FfiConverterTypeSocketAddress.lower(`address`),FfiConverterBoolean.lower(`persist`),_status) +} + } + + + + + @Throws(NodeException::class)override fun `disconnect`(`nodeId`: PublicKey) + = + callWithPointer { + uniffiRustCallWithError(NodeException) { _status -> + UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_node_disconnect( + it, FfiConverterTypePublicKey.lower(`nodeId`),_status) +} } + + - @Throws(NodeException::class) - override fun `disconnect`(`nodeId`: PublicKey) = - callWithPointer { - uniffiRustCallWithError(NodeException) { _status -> - UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_node_disconnect(it, FfiConverterTypePublicKey.lower(`nodeId`), _status) - } - } - - @Throws(NodeException::class) - override fun `eventHandled`() = - callWithPointer { - uniffiRustCallWithError(NodeException) { _status -> - UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_node_event_handled(it, _status) - } - } + + @Throws(NodeException::class)override fun `eventHandled`() + = + callWithPointer { + uniffiRustCallWithError(NodeException) { _status -> + UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_node_event_handled( + it, _status) +} + } + + - @Throws(NodeException::class) - override fun `exportPathfindingScores`(): kotlin.ByteArray = - FfiConverterByteArray.lift( - callWithPointer { - uniffiRustCallWithError(NodeException) { _status -> - UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_node_export_pathfinding_scores(it, _status) - } - }, - ) + + @Throws(NodeException::class)override fun `exportPathfindingScores`(): kotlin.ByteArray { + return FfiConverterByteArray.lift( + callWithPointer { + uniffiRustCallWithError(NodeException) { _status -> + UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_node_export_pathfinding_scores( + it, _status) +} + } + ) + } + - @Throws(NodeException::class) - override fun `forceCloseChannel`( - `userChannelId`: UserChannelId, - `counterpartyNodeId`: PublicKey, - `reason`: kotlin.String?, - ) = callWithPointer { - uniffiRustCallWithError(NodeException) { _status -> - UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_node_force_close_channel( - it, - FfiConverterTypeUserChannelId.lower(`userChannelId`), - FfiConverterTypePublicKey.lower(`counterpartyNodeId`), - FfiConverterOptionalString.lower(`reason`), - _status, - ) - } + + @Throws(NodeException::class)override fun `forceCloseChannel`(`userChannelId`: UserChannelId, `counterpartyNodeId`: PublicKey, `reason`: kotlin.String?) + = + callWithPointer { + uniffiRustCallWithError(NodeException) { _status -> + UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_node_force_close_channel( + it, FfiConverterTypeUserChannelId.lower(`userChannelId`),FfiConverterTypePublicKey.lower(`counterpartyNodeId`),FfiConverterOptionalString.lower(`reason`),_status) +} } + + - override fun `listBalances`(): BalanceDetails = - FfiConverterTypeBalanceDetails.lift( - callWithPointer { - uniffiRustCall { _status -> - UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_node_list_balances(it, _status) - } - }, - ) + override fun `listBalances`(): BalanceDetails { + return FfiConverterTypeBalanceDetails.lift( + callWithPointer { + uniffiRustCall() { _status -> + UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_node_list_balances( + it, _status) +} + } + ) + } + - override fun `listChannels`(): List = - FfiConverterSequenceTypeChannelDetails.lift( - callWithPointer { - uniffiRustCall { _status -> - UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_node_list_channels(it, _status) - } - }, - ) + override fun `listChannels`(): List { + return FfiConverterSequenceTypeChannelDetails.lift( + callWithPointer { + uniffiRustCall() { _status -> + UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_node_list_channels( + it, _status) +} + } + ) + } + - override fun `listPayments`(): List = - FfiConverterSequenceTypePaymentDetails.lift( - callWithPointer { - uniffiRustCall { _status -> - UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_node_list_payments(it, _status) - } - }, - ) + override fun `listPayments`(): List { + return FfiConverterSequenceTypePaymentDetails.lift( + callWithPointer { + uniffiRustCall() { _status -> + UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_node_list_payments( + it, _status) +} + } + ) + } + - override fun `listPeers`(): List = - FfiConverterSequenceTypePeerDetails.lift( - callWithPointer { - uniffiRustCall { _status -> - UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_node_list_peers(it, _status) - } - }, - ) + override fun `listPeers`(): List { + return FfiConverterSequenceTypePeerDetails.lift( + callWithPointer { + uniffiRustCall() { _status -> + UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_node_list_peers( + it, _status) +} + } + ) + } + - override fun `listeningAddresses`(): List? = - FfiConverterOptionalSequenceTypeSocketAddress.lift( - callWithPointer { - uniffiRustCall { _status -> - UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_node_listening_addresses(it, _status) - } - }, - ) + override fun `listeningAddresses`(): List? { + return FfiConverterOptionalSequenceTypeSocketAddress.lift( + callWithPointer { + uniffiRustCall() { _status -> + UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_node_listening_addresses( + it, _status) +} + } + ) + } + - override fun `lsps1Liquidity`(): Lsps1Liquidity = - FfiConverterTypeLSPS1Liquidity.lift( - callWithPointer { - uniffiRustCall { _status -> - UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_node_lsps1_liquidity(it, _status) - } - }, - ) + override fun `lsps1Liquidity`(): Lsps1Liquidity { + return FfiConverterTypeLSPS1Liquidity.lift( + callWithPointer { + uniffiRustCall() { _status -> + UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_node_lsps1_liquidity( + it, _status) +} + } + ) + } + - override fun `networkGraph`(): NetworkGraph = - FfiConverterTypeNetworkGraph.lift( - callWithPointer { - uniffiRustCall { _status -> - UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_node_network_graph(it, _status) - } - }, - ) + override fun `networkGraph`(): NetworkGraph { + return FfiConverterTypeNetworkGraph.lift( + callWithPointer { + uniffiRustCall() { _status -> + UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_node_network_graph( + it, _status) +} + } + ) + } + - override fun `nextEvent`(): Event? = - FfiConverterOptionalTypeEvent.lift( - callWithPointer { - uniffiRustCall { _status -> - UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_node_next_event(it, _status) - } - }, - ) + override fun `nextEvent`(): Event? { + return FfiConverterOptionalTypeEvent.lift( + callWithPointer { + uniffiRustCall() { _status -> + UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_node_next_event( + it, _status) +} + } + ) + } + + @Suppress("ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE") - override suspend fun `nextEventAsync`(): Event = - uniffiRustCallAsync( - callWithPointer { thisPtr -> - UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_node_next_event_async( - thisPtr, - ) - }, - { - future, - callback, - continuation, - -> - UniffiLib.INSTANCE.ffi_ldk_node_rust_future_poll_rust_buffer(future, callback, continuation) - }, - { future, continuation -> UniffiLib.INSTANCE.ffi_ldk_node_rust_future_complete_rust_buffer(future, continuation) }, - { future -> UniffiLib.INSTANCE.ffi_ldk_node_rust_future_free_rust_buffer(future) }, - // lift function - { FfiConverterTypeEvent.lift(it) }, - // Error FFI converter - UniffiNullRustCallStatusErrorHandler, - ) + override suspend fun `nextEventAsync`() : Event { + return uniffiRustCallAsync( + callWithPointer { thisPtr -> + UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_node_next_event_async( + thisPtr, + + ) + }, + { future, callback, continuation -> UniffiLib.INSTANCE.ffi_ldk_node_rust_future_poll_rust_buffer(future, callback, continuation) }, + { future, continuation -> UniffiLib.INSTANCE.ffi_ldk_node_rust_future_complete_rust_buffer(future, continuation) }, + { future -> UniffiLib.INSTANCE.ffi_ldk_node_rust_future_free_rust_buffer(future) }, + // lift function + { FfiConverterTypeEvent.lift(it) }, + // Error FFI converter + UniffiNullRustCallStatusErrorHandler, + ) + } - override fun `nodeAlias`(): NodeAlias? = - FfiConverterOptionalTypeNodeAlias.lift( - callWithPointer { - uniffiRustCall { _status -> - UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_node_node_alias(it, _status) - } - }, - ) + override fun `nodeAlias`(): NodeAlias? { + return FfiConverterOptionalTypeNodeAlias.lift( + callWithPointer { + uniffiRustCall() { _status -> + UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_node_node_alias( + it, _status) +} + } + ) + } + - override fun `nodeId`(): PublicKey = - FfiConverterTypePublicKey.lift( - callWithPointer { - uniffiRustCall { _status -> - UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_node_node_id(it, _status) - } - }, - ) + override fun `nodeId`(): PublicKey { + return FfiConverterTypePublicKey.lift( + callWithPointer { + uniffiRustCall() { _status -> + UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_node_node_id( + it, _status) +} + } + ) + } + - override fun `onchainPayment`(): OnchainPayment = - FfiConverterTypeOnchainPayment.lift( - callWithPointer { - uniffiRustCall { _status -> - UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_node_onchain_payment(it, _status) - } - }, - ) + override fun `onchainPayment`(): OnchainPayment { + return FfiConverterTypeOnchainPayment.lift( + callWithPointer { + uniffiRustCall() { _status -> + UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_node_onchain_payment( + it, _status) +} + } + ) + } + - @Throws(NodeException::class) - override fun `openAnnouncedChannel`( - `nodeId`: PublicKey, - `address`: SocketAddress, - `channelAmountSats`: kotlin.ULong, - `pushToCounterpartyMsat`: kotlin.ULong?, - `channelConfig`: ChannelConfig?, - ): UserChannelId = - FfiConverterTypeUserChannelId.lift( - callWithPointer { - uniffiRustCallWithError(NodeException) { _status -> - UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_node_open_announced_channel( - it, - FfiConverterTypePublicKey.lower(`nodeId`), - FfiConverterTypeSocketAddress.lower(`address`), - FfiConverterULong.lower(`channelAmountSats`), - FfiConverterOptionalULong.lower(`pushToCounterpartyMsat`), - FfiConverterOptionalTypeChannelConfig.lower(`channelConfig`), - _status, - ) - } - }, - ) + + @Throws(NodeException::class)override fun `openAnnouncedChannel`(`nodeId`: PublicKey, `address`: SocketAddress, `channelAmountSats`: kotlin.ULong, `pushToCounterpartyMsat`: kotlin.ULong?, `channelConfig`: ChannelConfig?): UserChannelId { + return FfiConverterTypeUserChannelId.lift( + callWithPointer { + uniffiRustCallWithError(NodeException) { _status -> + UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_node_open_announced_channel( + it, FfiConverterTypePublicKey.lower(`nodeId`),FfiConverterTypeSocketAddress.lower(`address`),FfiConverterULong.lower(`channelAmountSats`),FfiConverterOptionalULong.lower(`pushToCounterpartyMsat`),FfiConverterOptionalTypeChannelConfig.lower(`channelConfig`),_status) +} + } + ) + } + - @Throws(NodeException::class) - override fun `openChannel`( - `nodeId`: PublicKey, - `address`: SocketAddress, - `channelAmountSats`: kotlin.ULong, - `pushToCounterpartyMsat`: kotlin.ULong?, - `channelConfig`: ChannelConfig?, - ): UserChannelId = - FfiConverterTypeUserChannelId.lift( - callWithPointer { - uniffiRustCallWithError(NodeException) { _status -> - UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_node_open_channel( - it, - FfiConverterTypePublicKey.lower(`nodeId`), - FfiConverterTypeSocketAddress.lower(`address`), - FfiConverterULong.lower(`channelAmountSats`), - FfiConverterOptionalULong.lower(`pushToCounterpartyMsat`), - FfiConverterOptionalTypeChannelConfig.lower(`channelConfig`), - _status, - ) - } - }, - ) + + @Throws(NodeException::class)override fun `openChannel`(`nodeId`: PublicKey, `address`: SocketAddress, `channelAmountSats`: kotlin.ULong, `pushToCounterpartyMsat`: kotlin.ULong?, `channelConfig`: ChannelConfig?): UserChannelId { + return FfiConverterTypeUserChannelId.lift( + callWithPointer { + uniffiRustCallWithError(NodeException) { _status -> + UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_node_open_channel( + it, FfiConverterTypePublicKey.lower(`nodeId`),FfiConverterTypeSocketAddress.lower(`address`),FfiConverterULong.lower(`channelAmountSats`),FfiConverterOptionalULong.lower(`pushToCounterpartyMsat`),FfiConverterOptionalTypeChannelConfig.lower(`channelConfig`),_status) +} + } + ) + } + - override fun `payment`(`paymentId`: PaymentId): PaymentDetails? = - FfiConverterOptionalTypePaymentDetails.lift( - callWithPointer { - uniffiRustCall { _status -> - UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_node_payment(it, FfiConverterTypePaymentId.lower(`paymentId`), _status) - } - }, - ) + override fun `payment`(`paymentId`: PaymentId): PaymentDetails? { + return FfiConverterOptionalTypePaymentDetails.lift( + callWithPointer { + uniffiRustCall() { _status -> + UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_node_payment( + it, FfiConverterTypePaymentId.lower(`paymentId`),_status) +} + } + ) + } + - @Throws(NodeException::class) - override fun `removePayment`(`paymentId`: PaymentId) = - callWithPointer { - uniffiRustCallWithError(NodeException) { _status -> - UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_node_remove_payment(it, FfiConverterTypePaymentId.lower(`paymentId`), _status) - } - } + + @Throws(NodeException::class)override fun `removePayment`(`paymentId`: PaymentId) + = + callWithPointer { + uniffiRustCallWithError(NodeException) { _status -> + UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_node_remove_payment( + it, FfiConverterTypePaymentId.lower(`paymentId`),_status) +} + } + + - override fun `signMessage`(`msg`: List): kotlin.String = - FfiConverterString.lift( - callWithPointer { - uniffiRustCall { _status -> - UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_node_sign_message(it, FfiConverterSequenceUByte.lower(`msg`), _status) - } - }, - ) + override fun `signMessage`(`msg`: List): kotlin.String { + return FfiConverterString.lift( + callWithPointer { + uniffiRustCall() { _status -> + UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_node_sign_message( + it, FfiConverterSequenceUByte.lower(`msg`),_status) +} + } + ) + } + - override fun `spontaneousPayment`(): SpontaneousPayment = - FfiConverterTypeSpontaneousPayment.lift( - callWithPointer { - uniffiRustCall { _status -> - UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_node_spontaneous_payment(it, _status) - } - }, - ) + override fun `spontaneousPayment`(): SpontaneousPayment { + return FfiConverterTypeSpontaneousPayment.lift( + callWithPointer { + uniffiRustCall() { _status -> + UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_node_spontaneous_payment( + it, _status) +} + } + ) + } + - @Throws(NodeException::class) - override fun `start`() = - callWithPointer { - uniffiRustCallWithError(NodeException) { _status -> - UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_node_start(it, _status) - } - } + + @Throws(NodeException::class)override fun `start`() + = + callWithPointer { + uniffiRustCallWithError(NodeException) { _status -> + UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_node_start( + it, _status) +} + } + + - override fun `status`(): NodeStatus = - FfiConverterTypeNodeStatus.lift( - callWithPointer { - uniffiRustCall { _status -> - UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_node_status(it, _status) - } - }, - ) + override fun `status`(): NodeStatus { + return FfiConverterTypeNodeStatus.lift( + callWithPointer { + uniffiRustCall() { _status -> + UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_node_status( + it, _status) +} + } + ) + } + - @Throws(NodeException::class) - override fun `stop`() = - callWithPointer { - uniffiRustCallWithError(NodeException) { _status -> - UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_node_stop(it, _status) - } - } + + @Throws(NodeException::class)override fun `stop`() + = + callWithPointer { + uniffiRustCallWithError(NodeException) { _status -> + UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_node_stop( + it, _status) +} + } + + - @Throws(NodeException::class) - override fun `syncWallets`() = - callWithPointer { - uniffiRustCallWithError(NodeException) { _status -> - UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_node_sync_wallets(it, _status) - } - } + + @Throws(NodeException::class)override fun `syncWallets`() + = + callWithPointer { + uniffiRustCallWithError(NodeException) { _status -> + UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_node_sync_wallets( + it, _status) +} + } + + - override fun `unifiedQrPayment`(): UnifiedQrPayment = - FfiConverterTypeUnifiedQrPayment.lift( - callWithPointer { - uniffiRustCall { _status -> - UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_node_unified_qr_payment(it, _status) - } - }, - ) + override fun `unifiedQrPayment`(): UnifiedQrPayment { + return FfiConverterTypeUnifiedQrPayment.lift( + callWithPointer { + uniffiRustCall() { _status -> + UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_node_unified_qr_payment( + it, _status) +} + } + ) + } + - @Throws(NodeException::class) - override fun `updateChannelConfig`( - `userChannelId`: UserChannelId, - `counterpartyNodeId`: PublicKey, - `channelConfig`: ChannelConfig, - ) = callWithPointer { - uniffiRustCallWithError(NodeException) { _status -> - UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_node_update_channel_config( - it, - FfiConverterTypeUserChannelId.lower(`userChannelId`), - FfiConverterTypePublicKey.lower(`counterpartyNodeId`), - FfiConverterTypeChannelConfig.lower(`channelConfig`), - _status, - ) - } + + @Throws(NodeException::class)override fun `updateChannelConfig`(`userChannelId`: UserChannelId, `counterpartyNodeId`: PublicKey, `channelConfig`: ChannelConfig) + = + callWithPointer { + uniffiRustCallWithError(NodeException) { _status -> + UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_node_update_channel_config( + it, FfiConverterTypeUserChannelId.lower(`userChannelId`),FfiConverterTypePublicKey.lower(`counterpartyNodeId`),FfiConverterTypeChannelConfig.lower(`channelConfig`),_status) +} } + + - override fun `verifySignature`( - `msg`: List, - `sig`: kotlin.String, - `pkey`: PublicKey, - ): kotlin.Boolean = - FfiConverterBoolean.lift( - callWithPointer { - uniffiRustCall { _status -> - UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_node_verify_signature( - it, - FfiConverterSequenceUByte.lower(`msg`), - FfiConverterString.lower(`sig`), - FfiConverterTypePublicKey.lower(`pkey`), - _status, - ) - } - }, - ) + override fun `verifySignature`(`msg`: List, `sig`: kotlin.String, `pkey`: PublicKey): kotlin.Boolean { + return FfiConverterBoolean.lift( + callWithPointer { + uniffiRustCall() { _status -> + UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_node_verify_signature( + it, FfiConverterSequenceUByte.lower(`msg`),FfiConverterString.lower(`sig`),FfiConverterTypePublicKey.lower(`pkey`),_status) +} + } + ) + } + - override fun `waitNextEvent`(): Event = - FfiConverterTypeEvent.lift( - callWithPointer { - uniffiRustCall { _status -> - UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_node_wait_next_event(it, _status) - } - }, - ) + override fun `waitNextEvent`(): Event { + return FfiConverterTypeEvent.lift( + callWithPointer { + uniffiRustCall() { _status -> + UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_node_wait_next_event( + it, _status) +} + } + ) + } + + + + + companion object + } -public object FfiConverterTypeNode : FfiConverter { - override fun lower(value: Node): Pointer = value.uniffiClonePointer() +public object FfiConverterTypeNode: FfiConverter { + + override fun lower(value: Node): Pointer { + return value.uniffiClonePointer() + } - override fun lift(value: Pointer): Node = Node(value) + override fun lift(value: Pointer): Node { + return Node(value) + } override fun read(buf: ByteBuffer): Node { // The Rust code always writes pointers as 8 bytes, and will @@ -6567,16 +6015,14 @@ public object FfiConverterTypeNode : FfiConverter { override fun allocationSize(value: Node) = 8UL - override fun write( - value: Node, - buf: ByteBuffer, - ) { + override fun write(value: Node, buf: ByteBuffer) { // The Rust code always expects pointers written as 8 bytes, // and will fail to compile if they don't fit. buf.putLong(Pointer.nativeValue(lower(value))) } } + // This template implements a class for working with a Rust struct via a Pointer/Arc // to the live Rust struct on the other side of the FFI. // @@ -6674,61 +6120,32 @@ public object FfiConverterTypeNode : FfiConverter { // [1] https://stackoverflow.com/questions/24376768/can-java-finalize-an-object-when-it-is-still-in-scope/24380219 // -public interface OnchainPaymentInterface { - fun `accelerateByCpfp`( - `txid`: Txid, - `feeRate`: FeeRate?, - `destinationAddress`: Address?, - ): Txid - - fun `bumpFeeByRbf`( - `txid`: Txid, - `feeRate`: FeeRate, - ): Txid - - fun `calculateCpfpFeeRate`( - `parentTxid`: Txid, - `urgent`: kotlin.Boolean, - ): FeeRate - - fun `calculateTotalFee`( - `address`: Address, - `amountSats`: kotlin.ULong, - `feeRate`: FeeRate?, - `utxosToSpend`: List?, - ): kotlin.ULong +public interface OnchainPaymentInterface { + + fun `accelerateByCpfp`(`txid`: Txid, `feeRate`: FeeRate?, `destinationAddress`: Address?): Txid + + fun `bumpFeeByRbf`(`txid`: Txid, `feeRate`: FeeRate): Txid + + fun `calculateCpfpFeeRate`(`parentTxid`: Txid, `urgent`: kotlin.Boolean): FeeRate + + fun `calculateTotalFee`(`address`: Address, `amountSats`: kotlin.ULong, `feeRate`: FeeRate?, `utxosToSpend`: List?): kotlin.ULong + fun `listSpendableOutputs`(): List - + fun `newAddress`(): Address - - fun `selectUtxosWithAlgorithm`( - `targetAmountSats`: kotlin.ULong, - `feeRate`: FeeRate?, - `algorithm`: CoinSelectionAlgorithm, - `utxos`: List?, - ): List - - fun `sendAllToAddress`( - `address`: Address, - `retainReserve`: kotlin.Boolean, - `feeRate`: FeeRate?, - ): Txid - - fun `sendToAddress`( - `address`: Address, - `amountSats`: kotlin.ULong, - `feeRate`: FeeRate?, - `utxosToSpend`: List?, - ): Txid - + + fun `selectUtxosWithAlgorithm`(`targetAmountSats`: kotlin.ULong, `feeRate`: FeeRate?, `algorithm`: CoinSelectionAlgorithm, `utxos`: List?): List + + fun `sendAllToAddress`(`address`: Address, `retainReserve`: kotlin.Boolean, `feeRate`: FeeRate?): Txid + + fun `sendToAddress`(`address`: Address, `amountSats`: kotlin.ULong, `feeRate`: FeeRate?, `utxosToSpend`: List?): Txid + companion object } -open class OnchainPayment : - Disposable, - AutoCloseable, - OnchainPaymentInterface { +open class OnchainPayment: Disposable, AutoCloseable, OnchainPaymentInterface { + constructor(pointer: Pointer) { this.pointer = pointer this.cleanable = UniffiLib.CLEANER.register(this, UniffiCleanAction(pointer)) @@ -6778,7 +6195,7 @@ open class OnchainPayment : if (c == Long.MAX_VALUE) { throw IllegalStateException("${this.javaClass.simpleName} call counter would overflow") } - } while (!this.callCounter.compareAndSet(c, c + 1L)) + } while (! this.callCounter.compareAndSet(c, c + 1L)) // Now we can safely do the method call without the pointer being freed concurrently. try { return block(this.uniffiClonePointer()) @@ -6792,9 +6209,7 @@ open class OnchainPayment : // Use a static inner class instead of a closure so as not to accidentally // capture `this` as part of the cleanable's action. - private class UniffiCleanAction( - private val pointer: Pointer?, - ) : Runnable { + private class UniffiCleanAction(private val pointer: Pointer?) : Runnable { override fun run() { pointer?.let { ptr -> uniffiRustCall { status -> @@ -6804,180 +6219,146 @@ open class OnchainPayment : } } - fun uniffiClonePointer(): Pointer = - uniffiRustCall { status -> + fun uniffiClonePointer(): Pointer { + return uniffiRustCall() { status -> UniffiLib.INSTANCE.uniffi_ldk_node_fn_clone_onchainpayment(pointer!!, status) } + } - @Throws(NodeException::class) - override fun `accelerateByCpfp`( - `txid`: Txid, - `feeRate`: FeeRate?, - `destinationAddress`: Address?, - ): Txid = - FfiConverterTypeTxid.lift( - callWithPointer { - uniffiRustCallWithError(NodeException) { _status -> - UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_onchainpayment_accelerate_by_cpfp( - it, - FfiConverterTypeTxid.lower(`txid`), - FfiConverterOptionalTypeFeeRate.lower(`feeRate`), - FfiConverterOptionalTypeAddress.lower(`destinationAddress`), - _status, - ) - } - }, - ) + + @Throws(NodeException::class)override fun `accelerateByCpfp`(`txid`: Txid, `feeRate`: FeeRate?, `destinationAddress`: Address?): Txid { + return FfiConverterTypeTxid.lift( + callWithPointer { + uniffiRustCallWithError(NodeException) { _status -> + UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_onchainpayment_accelerate_by_cpfp( + it, FfiConverterTypeTxid.lower(`txid`),FfiConverterOptionalTypeFeeRate.lower(`feeRate`),FfiConverterOptionalTypeAddress.lower(`destinationAddress`),_status) +} + } + ) + } + - @Throws(NodeException::class) - override fun `bumpFeeByRbf`( - `txid`: Txid, - `feeRate`: FeeRate, - ): Txid = - FfiConverterTypeTxid.lift( - callWithPointer { - uniffiRustCallWithError(NodeException) { _status -> - UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_onchainpayment_bump_fee_by_rbf( - it, - FfiConverterTypeTxid.lower(`txid`), - FfiConverterTypeFeeRate.lower(`feeRate`), - _status, - ) - } - }, - ) + + @Throws(NodeException::class)override fun `bumpFeeByRbf`(`txid`: Txid, `feeRate`: FeeRate): Txid { + return FfiConverterTypeTxid.lift( + callWithPointer { + uniffiRustCallWithError(NodeException) { _status -> + UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_onchainpayment_bump_fee_by_rbf( + it, FfiConverterTypeTxid.lower(`txid`),FfiConverterTypeFeeRate.lower(`feeRate`),_status) +} + } + ) + } + - @Throws(NodeException::class) - override fun `calculateCpfpFeeRate`( - `parentTxid`: Txid, - `urgent`: kotlin.Boolean, - ): FeeRate = - FfiConverterTypeFeeRate.lift( - callWithPointer { - uniffiRustCallWithError(NodeException) { _status -> - UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_onchainpayment_calculate_cpfp_fee_rate( - it, - FfiConverterTypeTxid.lower(`parentTxid`), - FfiConverterBoolean.lower(`urgent`), - _status, - ) - } - }, - ) + + @Throws(NodeException::class)override fun `calculateCpfpFeeRate`(`parentTxid`: Txid, `urgent`: kotlin.Boolean): FeeRate { + return FfiConverterTypeFeeRate.lift( + callWithPointer { + uniffiRustCallWithError(NodeException) { _status -> + UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_onchainpayment_calculate_cpfp_fee_rate( + it, FfiConverterTypeTxid.lower(`parentTxid`),FfiConverterBoolean.lower(`urgent`),_status) +} + } + ) + } + - @Throws(NodeException::class) - override fun `calculateTotalFee`( - `address`: Address, - `amountSats`: kotlin.ULong, - `feeRate`: FeeRate?, - `utxosToSpend`: List?, - ): kotlin.ULong = - FfiConverterULong.lift( - callWithPointer { - uniffiRustCallWithError(NodeException) { _status -> - UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_onchainpayment_calculate_total_fee( - it, - FfiConverterTypeAddress.lower(`address`), - FfiConverterULong.lower(`amountSats`), - FfiConverterOptionalTypeFeeRate.lower(`feeRate`), - FfiConverterOptionalSequenceTypeSpendableUtxo.lower(`utxosToSpend`), - _status, - ) - } - }, - ) + + @Throws(NodeException::class)override fun `calculateTotalFee`(`address`: Address, `amountSats`: kotlin.ULong, `feeRate`: FeeRate?, `utxosToSpend`: List?): kotlin.ULong { + return FfiConverterULong.lift( + callWithPointer { + uniffiRustCallWithError(NodeException) { _status -> + UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_onchainpayment_calculate_total_fee( + it, FfiConverterTypeAddress.lower(`address`),FfiConverterULong.lower(`amountSats`),FfiConverterOptionalTypeFeeRate.lower(`feeRate`),FfiConverterOptionalSequenceTypeSpendableUtxo.lower(`utxosToSpend`),_status) +} + } + ) + } + - @Throws(NodeException::class) - override fun `listSpendableOutputs`(): List = - FfiConverterSequenceTypeSpendableUtxo.lift( - callWithPointer { - uniffiRustCallWithError(NodeException) { _status -> - UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_onchainpayment_list_spendable_outputs(it, _status) - } - }, - ) + + @Throws(NodeException::class)override fun `listSpendableOutputs`(): List { + return FfiConverterSequenceTypeSpendableUtxo.lift( + callWithPointer { + uniffiRustCallWithError(NodeException) { _status -> + UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_onchainpayment_list_spendable_outputs( + it, _status) +} + } + ) + } + - @Throws(NodeException::class) - override fun `newAddress`(): Address = - FfiConverterTypeAddress.lift( - callWithPointer { - uniffiRustCallWithError(NodeException) { _status -> - UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_onchainpayment_new_address(it, _status) - } - }, - ) + + @Throws(NodeException::class)override fun `newAddress`(): Address { + return FfiConverterTypeAddress.lift( + callWithPointer { + uniffiRustCallWithError(NodeException) { _status -> + UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_onchainpayment_new_address( + it, _status) +} + } + ) + } + - @Throws(NodeException::class) - override fun `selectUtxosWithAlgorithm`( - `targetAmountSats`: kotlin.ULong, - `feeRate`: FeeRate?, - `algorithm`: CoinSelectionAlgorithm, - `utxos`: List?, - ): List = - FfiConverterSequenceTypeSpendableUtxo.lift( - callWithPointer { - uniffiRustCallWithError(NodeException) { _status -> - UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_onchainpayment_select_utxos_with_algorithm( - it, - FfiConverterULong.lower(`targetAmountSats`), - FfiConverterOptionalTypeFeeRate.lower(`feeRate`), - FfiConverterTypeCoinSelectionAlgorithm.lower(`algorithm`), - FfiConverterOptionalSequenceTypeSpendableUtxo.lower(`utxos`), - _status, - ) - } - }, - ) + + @Throws(NodeException::class)override fun `selectUtxosWithAlgorithm`(`targetAmountSats`: kotlin.ULong, `feeRate`: FeeRate?, `algorithm`: CoinSelectionAlgorithm, `utxos`: List?): List { + return FfiConverterSequenceTypeSpendableUtxo.lift( + callWithPointer { + uniffiRustCallWithError(NodeException) { _status -> + UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_onchainpayment_select_utxos_with_algorithm( + it, FfiConverterULong.lower(`targetAmountSats`),FfiConverterOptionalTypeFeeRate.lower(`feeRate`),FfiConverterTypeCoinSelectionAlgorithm.lower(`algorithm`),FfiConverterOptionalSequenceTypeSpendableUtxo.lower(`utxos`),_status) +} + } + ) + } + - @Throws(NodeException::class) - override fun `sendAllToAddress`( - `address`: Address, - `retainReserve`: kotlin.Boolean, - `feeRate`: FeeRate?, - ): Txid = - FfiConverterTypeTxid.lift( - callWithPointer { - uniffiRustCallWithError(NodeException) { _status -> - UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_onchainpayment_send_all_to_address( - it, - FfiConverterTypeAddress.lower(`address`), - FfiConverterBoolean.lower(`retainReserve`), - FfiConverterOptionalTypeFeeRate.lower(`feeRate`), - _status, - ) - } - }, - ) + + @Throws(NodeException::class)override fun `sendAllToAddress`(`address`: Address, `retainReserve`: kotlin.Boolean, `feeRate`: FeeRate?): Txid { + return FfiConverterTypeTxid.lift( + callWithPointer { + uniffiRustCallWithError(NodeException) { _status -> + UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_onchainpayment_send_all_to_address( + it, FfiConverterTypeAddress.lower(`address`),FfiConverterBoolean.lower(`retainReserve`),FfiConverterOptionalTypeFeeRate.lower(`feeRate`),_status) +} + } + ) + } + - @Throws(NodeException::class) - override fun `sendToAddress`( - `address`: Address, - `amountSats`: kotlin.ULong, - `feeRate`: FeeRate?, - `utxosToSpend`: List?, - ): Txid = - FfiConverterTypeTxid.lift( - callWithPointer { - uniffiRustCallWithError(NodeException) { _status -> - UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_onchainpayment_send_to_address( - it, - FfiConverterTypeAddress.lower(`address`), - FfiConverterULong.lower(`amountSats`), - FfiConverterOptionalTypeFeeRate.lower(`feeRate`), - FfiConverterOptionalSequenceTypeSpendableUtxo.lower(`utxosToSpend`), - _status, - ) - } - }, - ) + + @Throws(NodeException::class)override fun `sendToAddress`(`address`: Address, `amountSats`: kotlin.ULong, `feeRate`: FeeRate?, `utxosToSpend`: List?): Txid { + return FfiConverterTypeTxid.lift( + callWithPointer { + uniffiRustCallWithError(NodeException) { _status -> + UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_onchainpayment_send_to_address( + it, FfiConverterTypeAddress.lower(`address`),FfiConverterULong.lower(`amountSats`),FfiConverterOptionalTypeFeeRate.lower(`feeRate`),FfiConverterOptionalSequenceTypeSpendableUtxo.lower(`utxosToSpend`),_status) +} + } + ) + } + + + + + companion object + } -public object FfiConverterTypeOnchainPayment : FfiConverter { - override fun lower(value: OnchainPayment): Pointer = value.uniffiClonePointer() +public object FfiConverterTypeOnchainPayment: FfiConverter { - override fun lift(value: Pointer): OnchainPayment = OnchainPayment(value) + override fun lower(value: OnchainPayment): Pointer { + return value.uniffiClonePointer() + } + + override fun lift(value: Pointer): OnchainPayment { + return OnchainPayment(value) + } override fun read(buf: ByteBuffer): OnchainPayment { // The Rust code always writes pointers as 8 bytes, and will @@ -6987,16 +6368,14 @@ public object FfiConverterTypeOnchainPayment : FfiConverter // to the live Rust struct on the other side of the FFI. // @@ -7094,32 +6473,20 @@ public object FfiConverterTypeOnchainPayment : FfiConverter, - ): PaymentId +public interface SpontaneousPaymentInterface { + + fun `send`(`amountMsat`: kotlin.ULong, `nodeId`: PublicKey, `sendingParameters`: SendingParameters?): PaymentId + + fun `sendProbes`(`amountMsat`: kotlin.ULong, `nodeId`: PublicKey) + + fun `sendWithCustomTlvs`(`amountMsat`: kotlin.ULong, `nodeId`: PublicKey, `sendingParameters`: SendingParameters?, `customTlvs`: List): PaymentId + companion object } -open class SpontaneousPayment : - Disposable, - AutoCloseable, - SpontaneousPaymentInterface { +open class SpontaneousPayment: Disposable, AutoCloseable, SpontaneousPaymentInterface { + constructor(pointer: Pointer) { this.pointer = pointer this.cleanable = UniffiLib.CLEANER.register(this, UniffiCleanAction(pointer)) @@ -7169,7 +6536,7 @@ open class SpontaneousPayment : if (c == Long.MAX_VALUE) { throw IllegalStateException("${this.javaClass.simpleName} call counter would overflow") } - } while (!this.callCounter.compareAndSet(c, c + 1L)) + } while (! this.callCounter.compareAndSet(c, c + 1L)) // Now we can safely do the method call without the pointer being freed concurrently. try { return block(this.uniffiClonePointer()) @@ -7183,9 +6550,7 @@ open class SpontaneousPayment : // Use a static inner class instead of a closure so as not to accidentally // capture `this` as part of the cleanable's action. - private class UniffiCleanAction( - private val pointer: Pointer?, - ) : Runnable { + private class UniffiCleanAction(private val pointer: Pointer?) : Runnable { override fun run() { pointer?.let { ptr -> uniffiRustCall { status -> @@ -7195,75 +6560,67 @@ open class SpontaneousPayment : } } - fun uniffiClonePointer(): Pointer = - uniffiRustCall { status -> + fun uniffiClonePointer(): Pointer { + return uniffiRustCall() { status -> UniffiLib.INSTANCE.uniffi_ldk_node_fn_clone_spontaneouspayment(pointer!!, status) } + } - @Throws(NodeException::class) - override fun `send`( - `amountMsat`: kotlin.ULong, - `nodeId`: PublicKey, - `sendingParameters`: SendingParameters?, - ): PaymentId = - FfiConverterTypePaymentId.lift( - callWithPointer { - uniffiRustCallWithError(NodeException) { _status -> - UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_spontaneouspayment_send( - it, - FfiConverterULong.lower(`amountMsat`), - FfiConverterTypePublicKey.lower(`nodeId`), - FfiConverterOptionalTypeSendingParameters.lower(`sendingParameters`), - _status, - ) - } - }, - ) + + @Throws(NodeException::class)override fun `send`(`amountMsat`: kotlin.ULong, `nodeId`: PublicKey, `sendingParameters`: SendingParameters?): PaymentId { + return FfiConverterTypePaymentId.lift( + callWithPointer { + uniffiRustCallWithError(NodeException) { _status -> + UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_spontaneouspayment_send( + it, FfiConverterULong.lower(`amountMsat`),FfiConverterTypePublicKey.lower(`nodeId`),FfiConverterOptionalTypeSendingParameters.lower(`sendingParameters`),_status) +} + } + ) + } + - @Throws(NodeException::class) - override fun `sendProbes`( - `amountMsat`: kotlin.ULong, - `nodeId`: PublicKey, - ) = callWithPointer { - uniffiRustCallWithError(NodeException) { _status -> - UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_spontaneouspayment_send_probes( - it, - FfiConverterULong.lower(`amountMsat`), - FfiConverterTypePublicKey.lower(`nodeId`), - _status, - ) - } + + @Throws(NodeException::class)override fun `sendProbes`(`amountMsat`: kotlin.ULong, `nodeId`: PublicKey) + = + callWithPointer { + uniffiRustCallWithError(NodeException) { _status -> + UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_spontaneouspayment_send_probes( + it, FfiConverterULong.lower(`amountMsat`),FfiConverterTypePublicKey.lower(`nodeId`),_status) +} } + + - @Throws(NodeException::class) - override fun `sendWithCustomTlvs`( - `amountMsat`: kotlin.ULong, - `nodeId`: PublicKey, - `sendingParameters`: SendingParameters?, - `customTlvs`: List, - ): PaymentId = - FfiConverterTypePaymentId.lift( - callWithPointer { - uniffiRustCallWithError(NodeException) { _status -> - UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_spontaneouspayment_send_with_custom_tlvs( - it, - FfiConverterULong.lower(`amountMsat`), - FfiConverterTypePublicKey.lower(`nodeId`), - FfiConverterOptionalTypeSendingParameters.lower(`sendingParameters`), - FfiConverterSequenceTypeCustomTlvRecord.lower(`customTlvs`), - _status, - ) - } - }, - ) + + @Throws(NodeException::class)override fun `sendWithCustomTlvs`(`amountMsat`: kotlin.ULong, `nodeId`: PublicKey, `sendingParameters`: SendingParameters?, `customTlvs`: List): PaymentId { + return FfiConverterTypePaymentId.lift( + callWithPointer { + uniffiRustCallWithError(NodeException) { _status -> + UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_spontaneouspayment_send_with_custom_tlvs( + it, FfiConverterULong.lower(`amountMsat`),FfiConverterTypePublicKey.lower(`nodeId`),FfiConverterOptionalTypeSendingParameters.lower(`sendingParameters`),FfiConverterSequenceTypeCustomTlvRecord.lower(`customTlvs`),_status) +} + } + ) + } + + + + + companion object + } -public object FfiConverterTypeSpontaneousPayment : FfiConverter { - override fun lower(value: SpontaneousPayment): Pointer = value.uniffiClonePointer() +public object FfiConverterTypeSpontaneousPayment: FfiConverter { + + override fun lower(value: SpontaneousPayment): Pointer { + return value.uniffiClonePointer() + } - override fun lift(value: Pointer): SpontaneousPayment = SpontaneousPayment(value) + override fun lift(value: Pointer): SpontaneousPayment { + return SpontaneousPayment(value) + } override fun read(buf: ByteBuffer): SpontaneousPayment { // The Rust code always writes pointers as 8 bytes, and will @@ -7273,16 +6630,14 @@ public object FfiConverterTypeSpontaneousPayment : FfiConverter // to the live Rust struct on the other side of the FFI. // @@ -7380,22 +6735,18 @@ public object FfiConverterTypeSpontaneousPayment : FfiConverter uniffiRustCall { status -> @@ -7471,48 +6820,55 @@ open class UnifiedQrPayment : } } - fun uniffiClonePointer(): Pointer = - uniffiRustCall { status -> + fun uniffiClonePointer(): Pointer { + return uniffiRustCall() { status -> UniffiLib.INSTANCE.uniffi_ldk_node_fn_clone_unifiedqrpayment(pointer!!, status) } + } - @Throws(NodeException::class) - override fun `receive`( - `amountSats`: kotlin.ULong, - `message`: kotlin.String, - `expirySec`: kotlin.UInt, - ): kotlin.String = - FfiConverterString.lift( - callWithPointer { - uniffiRustCallWithError(NodeException) { _status -> - UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_unifiedqrpayment_receive( - it, - FfiConverterULong.lower(`amountSats`), - FfiConverterString.lower(`message`), - FfiConverterUInt.lower(`expirySec`), - _status, - ) - } - }, - ) + + @Throws(NodeException::class)override fun `receive`(`amountSats`: kotlin.ULong, `message`: kotlin.String, `expirySec`: kotlin.UInt): kotlin.String { + return FfiConverterString.lift( + callWithPointer { + uniffiRustCallWithError(NodeException) { _status -> + UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_unifiedqrpayment_receive( + it, FfiConverterULong.lower(`amountSats`),FfiConverterString.lower(`message`),FfiConverterUInt.lower(`expirySec`),_status) +} + } + ) + } + - @Throws(NodeException::class) - override fun `send`(`uriStr`: kotlin.String): QrPaymentResult = - FfiConverterTypeQrPaymentResult.lift( - callWithPointer { - uniffiRustCallWithError(NodeException) { _status -> - UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_unifiedqrpayment_send(it, FfiConverterString.lower(`uriStr`), _status) - } - }, - ) + + @Throws(NodeException::class)override fun `send`(`uriStr`: kotlin.String): QrPaymentResult { + return FfiConverterTypeQrPaymentResult.lift( + callWithPointer { + uniffiRustCallWithError(NodeException) { _status -> + UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_unifiedqrpayment_send( + it, FfiConverterString.lower(`uriStr`),_status) +} + } + ) + } + + + + + companion object + } -public object FfiConverterTypeUnifiedQrPayment : FfiConverter { - override fun lower(value: UnifiedQrPayment): Pointer = value.uniffiClonePointer() +public object FfiConverterTypeUnifiedQrPayment: FfiConverter { - override fun lift(value: Pointer): UnifiedQrPayment = UnifiedQrPayment(value) + override fun lower(value: UnifiedQrPayment): Pointer { + return value.uniffiClonePointer() + } + + override fun lift(value: Pointer): UnifiedQrPayment { + return UnifiedQrPayment(value) + } override fun read(buf: ByteBuffer): UnifiedQrPayment { // The Rust code always writes pointers as 8 bytes, and will @@ -7522,16 +6878,14 @@ public object FfiConverterTypeUnifiedQrPayment : FfiConverter // to the live Rust struct on the other side of the FFI. // @@ -7629,16 +6983,16 @@ public object FfiConverterTypeUnifiedQrPayment : FfiConverter): Map - + companion object } -open class VssHeaderProvider : - Disposable, - AutoCloseable, - VssHeaderProviderInterface { +open class VssHeaderProvider: Disposable, AutoCloseable, VssHeaderProviderInterface { + constructor(pointer: Pointer) { this.pointer = pointer this.cleanable = UniffiLib.CLEANER.register(this, UniffiCleanAction(pointer)) @@ -7688,7 +7042,7 @@ open class VssHeaderProvider : if (c == Long.MAX_VALUE) { throw IllegalStateException("${this.javaClass.simpleName} call counter would overflow") } - } while (!this.callCounter.compareAndSet(c, c + 1L)) + } while (! this.callCounter.compareAndSet(c, c + 1L)) // Now we can safely do the method call without the pointer being freed concurrently. try { return block(this.uniffiClonePointer()) @@ -7702,9 +7056,7 @@ open class VssHeaderProvider : // Use a static inner class instead of a closure so as not to accidentally // capture `this` as part of the cleanable's action. - private class UniffiCleanAction( - private val pointer: Pointer?, - ) : Runnable { + private class UniffiCleanAction(private val pointer: Pointer?) : Runnable { override fun run() { pointer?.let { ptr -> uniffiRustCall { status -> @@ -7714,43 +7066,50 @@ open class VssHeaderProvider : } } - fun uniffiClonePointer(): Pointer = - uniffiRustCall { status -> + fun uniffiClonePointer(): Pointer { + return uniffiRustCall() { status -> UniffiLib.INSTANCE.uniffi_ldk_node_fn_clone_vssheaderprovider(pointer!!, status) } + } + @Throws(VssHeaderProviderException::class) @Suppress("ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE") - override suspend fun `getHeaders`(`request`: List): Map = - uniffiRustCallAsync( - callWithPointer { thisPtr -> - UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_vssheaderprovider_get_headers( - thisPtr, - FfiConverterSequenceUByte.lower(`request`), - ) - }, - { - future, - callback, - continuation, - -> - UniffiLib.INSTANCE.ffi_ldk_node_rust_future_poll_rust_buffer(future, callback, continuation) - }, - { future, continuation -> UniffiLib.INSTANCE.ffi_ldk_node_rust_future_complete_rust_buffer(future, continuation) }, - { future -> UniffiLib.INSTANCE.ffi_ldk_node_rust_future_free_rust_buffer(future) }, - // lift function - { FfiConverterMapStringString.lift(it) }, - // Error FFI converter - VssHeaderProviderException.ErrorHandler, - ) + override suspend fun `getHeaders`(`request`: List) : Map { + return uniffiRustCallAsync( + callWithPointer { thisPtr -> + UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_vssheaderprovider_get_headers( + thisPtr, + FfiConverterSequenceUByte.lower(`request`), + ) + }, + { future, callback, continuation -> UniffiLib.INSTANCE.ffi_ldk_node_rust_future_poll_rust_buffer(future, callback, continuation) }, + { future, continuation -> UniffiLib.INSTANCE.ffi_ldk_node_rust_future_complete_rust_buffer(future, continuation) }, + { future -> UniffiLib.INSTANCE.ffi_ldk_node_rust_future_free_rust_buffer(future) }, + // lift function + { FfiConverterMapStringString.lift(it) }, + // Error FFI converter + VssHeaderProviderException.ErrorHandler, + ) + } + + + + companion object + } -public object FfiConverterTypeVssHeaderProvider : FfiConverter { - override fun lower(value: VssHeaderProvider): Pointer = value.uniffiClonePointer() +public object FfiConverterTypeVssHeaderProvider: FfiConverter { + + override fun lower(value: VssHeaderProvider): Pointer { + return value.uniffiClonePointer() + } - override fun lift(value: Pointer): VssHeaderProvider = VssHeaderProvider(value) + override fun lift(value: Pointer): VssHeaderProvider { + return VssHeaderProvider(value) + } override fun read(buf: ByteBuffer): VssHeaderProvider { // The Rust code always writes pointers as 8 bytes, and will @@ -7760,92 +7119,92 @@ public object FfiConverterTypeVssHeaderProvider : FfiConverter, - var `perChannelReserveSats`: kotlin.ULong, + + +data class AnchorChannelsConfig ( + var `trustedPeersNoReserve`: List, + var `perChannelReserveSats`: kotlin.ULong ) { + companion object } -public object FfiConverterTypeAnchorChannelsConfig : FfiConverterRustBuffer { - override fun read(buf: ByteBuffer): AnchorChannelsConfig = - AnchorChannelsConfig( +public object FfiConverterTypeAnchorChannelsConfig: FfiConverterRustBuffer { + override fun read(buf: ByteBuffer): AnchorChannelsConfig { + return AnchorChannelsConfig( FfiConverterSequenceTypePublicKey.read(buf), FfiConverterULong.read(buf), ) + } - override fun allocationSize(value: AnchorChannelsConfig) = - ( + override fun allocationSize(value: AnchorChannelsConfig) = ( FfiConverterSequenceTypePublicKey.allocationSize(value.`trustedPeersNoReserve`) + - FfiConverterULong.allocationSize(value.`perChannelReserveSats`) - ) + FfiConverterULong.allocationSize(value.`perChannelReserveSats`) + ) - override fun write( - value: AnchorChannelsConfig, - buf: ByteBuffer, - ) { - FfiConverterSequenceTypePublicKey.write(value.`trustedPeersNoReserve`, buf) - FfiConverterULong.write(value.`perChannelReserveSats`, buf) + override fun write(value: AnchorChannelsConfig, buf: ByteBuffer) { + FfiConverterSequenceTypePublicKey.write(value.`trustedPeersNoReserve`, buf) + FfiConverterULong.write(value.`perChannelReserveSats`, buf) } } -data class BackgroundSyncConfig( - var `onchainWalletSyncIntervalSecs`: kotlin.ULong, - var `lightningWalletSyncIntervalSecs`: kotlin.ULong, - var `feeRateCacheUpdateIntervalSecs`: kotlin.ULong, + + +data class BackgroundSyncConfig ( + var `onchainWalletSyncIntervalSecs`: kotlin.ULong, + var `lightningWalletSyncIntervalSecs`: kotlin.ULong, + var `feeRateCacheUpdateIntervalSecs`: kotlin.ULong ) { + companion object } -public object FfiConverterTypeBackgroundSyncConfig : FfiConverterRustBuffer { - override fun read(buf: ByteBuffer): BackgroundSyncConfig = - BackgroundSyncConfig( +public object FfiConverterTypeBackgroundSyncConfig: FfiConverterRustBuffer { + override fun read(buf: ByteBuffer): BackgroundSyncConfig { + return BackgroundSyncConfig( FfiConverterULong.read(buf), FfiConverterULong.read(buf), FfiConverterULong.read(buf), ) + } - override fun allocationSize(value: BackgroundSyncConfig) = - ( + override fun allocationSize(value: BackgroundSyncConfig) = ( FfiConverterULong.allocationSize(value.`onchainWalletSyncIntervalSecs`) + - FfiConverterULong.allocationSize(value.`lightningWalletSyncIntervalSecs`) + - FfiConverterULong.allocationSize(value.`feeRateCacheUpdateIntervalSecs`) - ) + FfiConverterULong.allocationSize(value.`lightningWalletSyncIntervalSecs`) + + FfiConverterULong.allocationSize(value.`feeRateCacheUpdateIntervalSecs`) + ) - override fun write( - value: BackgroundSyncConfig, - buf: ByteBuffer, - ) { - FfiConverterULong.write(value.`onchainWalletSyncIntervalSecs`, buf) - FfiConverterULong.write(value.`lightningWalletSyncIntervalSecs`, buf) - FfiConverterULong.write(value.`feeRateCacheUpdateIntervalSecs`, buf) + override fun write(value: BackgroundSyncConfig, buf: ByteBuffer) { + FfiConverterULong.write(value.`onchainWalletSyncIntervalSecs`, buf) + FfiConverterULong.write(value.`lightningWalletSyncIntervalSecs`, buf) + FfiConverterULong.write(value.`feeRateCacheUpdateIntervalSecs`, buf) } } -data class BalanceDetails( - var `totalOnchainBalanceSats`: kotlin.ULong, - var `spendableOnchainBalanceSats`: kotlin.ULong, - var `totalAnchorChannelsReserveSats`: kotlin.ULong, - var `totalLightningBalanceSats`: kotlin.ULong, - var `lightningBalances`: List, - var `pendingBalancesFromChannelClosures`: List, + + +data class BalanceDetails ( + var `totalOnchainBalanceSats`: kotlin.ULong, + var `spendableOnchainBalanceSats`: kotlin.ULong, + var `totalAnchorChannelsReserveSats`: kotlin.ULong, + var `totalLightningBalanceSats`: kotlin.ULong, + var `lightningBalances`: List, + var `pendingBalancesFromChannelClosures`: List ) { + companion object } -public object FfiConverterTypeBalanceDetails : FfiConverterRustBuffer { - override fun read(buf: ByteBuffer): BalanceDetails = - BalanceDetails( +public object FfiConverterTypeBalanceDetails: FfiConverterRustBuffer { + override fun read(buf: ByteBuffer): BalanceDetails { + return BalanceDetails( FfiConverterULong.read(buf), FfiConverterULong.read(buf), FfiConverterULong.read(buf), @@ -7853,125 +7212,125 @@ public object FfiConverterTypeBalanceDetails : FfiConverterRustBuffer { - override fun read(buf: ByteBuffer): BestBlock = - BestBlock( +public object FfiConverterTypeBestBlock: FfiConverterRustBuffer { + override fun read(buf: ByteBuffer): BestBlock { + return BestBlock( FfiConverterTypeBlockHash.read(buf), FfiConverterUInt.read(buf), ) + } - override fun allocationSize(value: BestBlock) = - ( + override fun allocationSize(value: BestBlock) = ( FfiConverterTypeBlockHash.allocationSize(value.`blockHash`) + - FfiConverterUInt.allocationSize(value.`height`) - ) + FfiConverterUInt.allocationSize(value.`height`) + ) - override fun write( - value: BestBlock, - buf: ByteBuffer, - ) { - FfiConverterTypeBlockHash.write(value.`blockHash`, buf) - FfiConverterUInt.write(value.`height`, buf) + override fun write(value: BestBlock, buf: ByteBuffer) { + FfiConverterTypeBlockHash.write(value.`blockHash`, buf) + FfiConverterUInt.write(value.`height`, buf) } } -data class Bolt11PaymentInfo( - var `state`: PaymentState, - var `expiresAt`: DateTime, - var `feeTotalSat`: kotlin.ULong, - var `orderTotalSat`: kotlin.ULong, - var `invoice`: Bolt11Invoice, + + +data class Bolt11PaymentInfo ( + var `state`: PaymentState, + var `expiresAt`: DateTime, + var `feeTotalSat`: kotlin.ULong, + var `orderTotalSat`: kotlin.ULong, + var `invoice`: Bolt11Invoice ) : Disposable { + @Suppress("UNNECESSARY_SAFE_CALL") // codegen is much simpler if we unconditionally emit safe calls here override fun destroy() { - Disposable.destroy( - this.`state`, - this.`expiresAt`, - this.`feeTotalSat`, - this.`orderTotalSat`, - this.`invoice`, - ) - } - + + Disposable.destroy( + this.`state`, + this.`expiresAt`, + this.`feeTotalSat`, + this.`orderTotalSat`, + this.`invoice`) + } + companion object } -public object FfiConverterTypeBolt11PaymentInfo : FfiConverterRustBuffer { - override fun read(buf: ByteBuffer): Bolt11PaymentInfo = - Bolt11PaymentInfo( +public object FfiConverterTypeBolt11PaymentInfo: FfiConverterRustBuffer { + override fun read(buf: ByteBuffer): Bolt11PaymentInfo { + return Bolt11PaymentInfo( FfiConverterTypePaymentState.read(buf), FfiConverterTypeDateTime.read(buf), FfiConverterULong.read(buf), FfiConverterULong.read(buf), FfiConverterTypeBolt11Invoice.read(buf), ) + } - override fun allocationSize(value: Bolt11PaymentInfo) = - ( + override fun allocationSize(value: Bolt11PaymentInfo) = ( FfiConverterTypePaymentState.allocationSize(value.`state`) + - FfiConverterTypeDateTime.allocationSize(value.`expiresAt`) + - FfiConverterULong.allocationSize(value.`feeTotalSat`) + - FfiConverterULong.allocationSize(value.`orderTotalSat`) + - FfiConverterTypeBolt11Invoice.allocationSize(value.`invoice`) - ) + FfiConverterTypeDateTime.allocationSize(value.`expiresAt`) + + FfiConverterULong.allocationSize(value.`feeTotalSat`) + + FfiConverterULong.allocationSize(value.`orderTotalSat`) + + FfiConverterTypeBolt11Invoice.allocationSize(value.`invoice`) + ) + + override fun write(value: Bolt11PaymentInfo, buf: ByteBuffer) { + FfiConverterTypePaymentState.write(value.`state`, buf) + FfiConverterTypeDateTime.write(value.`expiresAt`, buf) + FfiConverterULong.write(value.`feeTotalSat`, buf) + FfiConverterULong.write(value.`orderTotalSat`, buf) + FfiConverterTypeBolt11Invoice.write(value.`invoice`, buf) + } +} + - override fun write( - value: Bolt11PaymentInfo, - buf: ByteBuffer, - ) { - FfiConverterTypePaymentState.write(value.`state`, buf) - FfiConverterTypeDateTime.write(value.`expiresAt`, buf) - FfiConverterULong.write(value.`feeTotalSat`, buf) - FfiConverterULong.write(value.`orderTotalSat`, buf) - FfiConverterTypeBolt11Invoice.write(value.`invoice`, buf) - } -} - -data class ChannelConfig( - var `forwardingFeeProportionalMillionths`: kotlin.UInt, - var `forwardingFeeBaseMsat`: kotlin.UInt, - var `cltvExpiryDelta`: kotlin.UShort, - var `maxDustHtlcExposure`: MaxDustHtlcExposure, - var `forceCloseAvoidanceMaxFeeSatoshis`: kotlin.ULong, - var `acceptUnderpayingHtlcs`: kotlin.Boolean, + +data class ChannelConfig ( + var `forwardingFeeProportionalMillionths`: kotlin.UInt, + var `forwardingFeeBaseMsat`: kotlin.UInt, + var `cltvExpiryDelta`: kotlin.UShort, + var `maxDustHtlcExposure`: MaxDustHtlcExposure, + var `forceCloseAvoidanceMaxFeeSatoshis`: kotlin.ULong, + var `acceptUnderpayingHtlcs`: kotlin.Boolean ) { + companion object } -public object FfiConverterTypeChannelConfig : FfiConverterRustBuffer { - override fun read(buf: ByteBuffer): ChannelConfig = - ChannelConfig( +public object FfiConverterTypeChannelConfig: FfiConverterRustBuffer { + override fun read(buf: ByteBuffer): ChannelConfig { + return ChannelConfig( FfiConverterUInt.read(buf), FfiConverterUInt.read(buf), FfiConverterUShort.read(buf), @@ -7979,69 +7338,69 @@ public object FfiConverterTypeChannelConfig : FfiConverterRustBuffer { - override fun read(buf: ByteBuffer): ChannelDetails = - ChannelDetails( +public object FfiConverterTypeChannelDetails: FfiConverterRustBuffer { + override fun read(buf: ByteBuffer): ChannelDetails { + return ChannelDetails( FfiConverterTypeChannelId.read(buf), FfiConverterTypePublicKey.read(buf), FfiConverterOptionalTypeOutPoint.read(buf), @@ -8074,168 +7433,168 @@ public object FfiConverterTypeChannelDetails : FfiConverterRustBuffer { - override fun read(buf: ByteBuffer): ChannelInfo = - ChannelInfo( +public object FfiConverterTypeChannelInfo: FfiConverterRustBuffer { + override fun read(buf: ByteBuffer): ChannelInfo { + return ChannelInfo( FfiConverterTypeNodeId.read(buf), FfiConverterOptionalTypeChannelUpdateInfo.read(buf), FfiConverterTypeNodeId.read(buf), FfiConverterOptionalTypeChannelUpdateInfo.read(buf), FfiConverterOptionalULong.read(buf), ) + } - override fun allocationSize(value: ChannelInfo) = - ( + override fun allocationSize(value: ChannelInfo) = ( FfiConverterTypeNodeId.allocationSize(value.`nodeOne`) + - FfiConverterOptionalTypeChannelUpdateInfo.allocationSize(value.`oneToTwo`) + - FfiConverterTypeNodeId.allocationSize(value.`nodeTwo`) + - FfiConverterOptionalTypeChannelUpdateInfo.allocationSize(value.`twoToOne`) + - FfiConverterOptionalULong.allocationSize(value.`capacitySats`) - ) + FfiConverterOptionalTypeChannelUpdateInfo.allocationSize(value.`oneToTwo`) + + FfiConverterTypeNodeId.allocationSize(value.`nodeTwo`) + + FfiConverterOptionalTypeChannelUpdateInfo.allocationSize(value.`twoToOne`) + + FfiConverterOptionalULong.allocationSize(value.`capacitySats`) + ) - override fun write( - value: ChannelInfo, - buf: ByteBuffer, - ) { - FfiConverterTypeNodeId.write(value.`nodeOne`, buf) - FfiConverterOptionalTypeChannelUpdateInfo.write(value.`oneToTwo`, buf) - FfiConverterTypeNodeId.write(value.`nodeTwo`, buf) - FfiConverterOptionalTypeChannelUpdateInfo.write(value.`twoToOne`, buf) - FfiConverterOptionalULong.write(value.`capacitySats`, buf) + override fun write(value: ChannelInfo, buf: ByteBuffer) { + FfiConverterTypeNodeId.write(value.`nodeOne`, buf) + FfiConverterOptionalTypeChannelUpdateInfo.write(value.`oneToTwo`, buf) + FfiConverterTypeNodeId.write(value.`nodeTwo`, buf) + FfiConverterOptionalTypeChannelUpdateInfo.write(value.`twoToOne`, buf) + FfiConverterOptionalULong.write(value.`capacitySats`, buf) } } -data class ChannelOrderInfo( - var `fundedAt`: DateTime, - var `fundingOutpoint`: OutPoint, - var `expiresAt`: DateTime, + + +data class ChannelOrderInfo ( + var `fundedAt`: DateTime, + var `fundingOutpoint`: OutPoint, + var `expiresAt`: DateTime ) { + companion object } -public object FfiConverterTypeChannelOrderInfo : FfiConverterRustBuffer { - override fun read(buf: ByteBuffer): ChannelOrderInfo = - ChannelOrderInfo( +public object FfiConverterTypeChannelOrderInfo: FfiConverterRustBuffer { + override fun read(buf: ByteBuffer): ChannelOrderInfo { + return ChannelOrderInfo( FfiConverterTypeDateTime.read(buf), FfiConverterTypeOutPoint.read(buf), FfiConverterTypeDateTime.read(buf), ) + } - override fun allocationSize(value: ChannelOrderInfo) = - ( + override fun allocationSize(value: ChannelOrderInfo) = ( FfiConverterTypeDateTime.allocationSize(value.`fundedAt`) + - FfiConverterTypeOutPoint.allocationSize(value.`fundingOutpoint`) + - FfiConverterTypeDateTime.allocationSize(value.`expiresAt`) - ) + FfiConverterTypeOutPoint.allocationSize(value.`fundingOutpoint`) + + FfiConverterTypeDateTime.allocationSize(value.`expiresAt`) + ) - override fun write( - value: ChannelOrderInfo, - buf: ByteBuffer, - ) { - FfiConverterTypeDateTime.write(value.`fundedAt`, buf) - FfiConverterTypeOutPoint.write(value.`fundingOutpoint`, buf) - FfiConverterTypeDateTime.write(value.`expiresAt`, buf) + override fun write(value: ChannelOrderInfo, buf: ByteBuffer) { + FfiConverterTypeDateTime.write(value.`fundedAt`, buf) + FfiConverterTypeOutPoint.write(value.`fundingOutpoint`, buf) + FfiConverterTypeDateTime.write(value.`expiresAt`, buf) } } -data class ChannelUpdateInfo( - var `lastUpdate`: kotlin.UInt, - var `enabled`: kotlin.Boolean, - var `cltvExpiryDelta`: kotlin.UShort, - var `htlcMinimumMsat`: kotlin.ULong, - var `htlcMaximumMsat`: kotlin.ULong, - var `fees`: RoutingFees, + + +data class ChannelUpdateInfo ( + var `lastUpdate`: kotlin.UInt, + var `enabled`: kotlin.Boolean, + var `cltvExpiryDelta`: kotlin.UShort, + var `htlcMinimumMsat`: kotlin.ULong, + var `htlcMaximumMsat`: kotlin.ULong, + var `fees`: RoutingFees ) { + companion object } -public object FfiConverterTypeChannelUpdateInfo : FfiConverterRustBuffer { - override fun read(buf: ByteBuffer): ChannelUpdateInfo = - ChannelUpdateInfo( +public object FfiConverterTypeChannelUpdateInfo: FfiConverterRustBuffer { + override fun read(buf: ByteBuffer): ChannelUpdateInfo { + return ChannelUpdateInfo( FfiConverterUInt.read(buf), FfiConverterBoolean.read(buf), FfiConverterUShort.read(buf), @@ -8243,47 +7602,47 @@ public object FfiConverterTypeChannelUpdateInfo : FfiConverterRustBuffer?, - var `announcementAddresses`: List?, - var `nodeAlias`: NodeAlias?, - var `trustedPeers0conf`: List, - var `probingLiquidityLimitMultiplier`: kotlin.ULong, - var `anchorChannelsConfig`: AnchorChannelsConfig?, - var `sendingParameters`: SendingParameters?, + +data class Config ( + var `storageDirPath`: kotlin.String, + var `network`: Network, + var `listeningAddresses`: List?, + var `announcementAddresses`: List?, + var `nodeAlias`: NodeAlias?, + var `trustedPeers0conf`: List, + var `probingLiquidityLimitMultiplier`: kotlin.ULong, + var `anchorChannelsConfig`: AnchorChannelsConfig?, + var `sendingParameters`: SendingParameters? ) { + companion object } -public object FfiConverterTypeConfig : FfiConverterRustBuffer { - override fun read(buf: ByteBuffer): Config = - Config( +public object FfiConverterTypeConfig: FfiConverterRustBuffer { + override fun read(buf: ByteBuffer): Config { + return Config( FfiConverterString.read(buf), FfiConverterTypeNetwork.read(buf), FfiConverterOptionalSequenceTypeSocketAddress.read(buf), @@ -8294,208 +7653,208 @@ public object FfiConverterTypeConfig : FfiConverterRustBuffer { FfiConverterOptionalTypeAnchorChannelsConfig.read(buf), FfiConverterOptionalTypeSendingParameters.read(buf), ) + } - override fun allocationSize(value: Config) = - ( + override fun allocationSize(value: Config) = ( FfiConverterString.allocationSize(value.`storageDirPath`) + - FfiConverterTypeNetwork.allocationSize(value.`network`) + - FfiConverterOptionalSequenceTypeSocketAddress.allocationSize(value.`listeningAddresses`) + - FfiConverterOptionalSequenceTypeSocketAddress.allocationSize(value.`announcementAddresses`) + - FfiConverterOptionalTypeNodeAlias.allocationSize(value.`nodeAlias`) + - FfiConverterSequenceTypePublicKey.allocationSize(value.`trustedPeers0conf`) + - FfiConverterULong.allocationSize(value.`probingLiquidityLimitMultiplier`) + - FfiConverterOptionalTypeAnchorChannelsConfig.allocationSize(value.`anchorChannelsConfig`) + - FfiConverterOptionalTypeSendingParameters.allocationSize(value.`sendingParameters`) - ) + FfiConverterTypeNetwork.allocationSize(value.`network`) + + FfiConverterOptionalSequenceTypeSocketAddress.allocationSize(value.`listeningAddresses`) + + FfiConverterOptionalSequenceTypeSocketAddress.allocationSize(value.`announcementAddresses`) + + FfiConverterOptionalTypeNodeAlias.allocationSize(value.`nodeAlias`) + + FfiConverterSequenceTypePublicKey.allocationSize(value.`trustedPeers0conf`) + + FfiConverterULong.allocationSize(value.`probingLiquidityLimitMultiplier`) + + FfiConverterOptionalTypeAnchorChannelsConfig.allocationSize(value.`anchorChannelsConfig`) + + FfiConverterOptionalTypeSendingParameters.allocationSize(value.`sendingParameters`) + ) + + override fun write(value: Config, buf: ByteBuffer) { + FfiConverterString.write(value.`storageDirPath`, buf) + FfiConverterTypeNetwork.write(value.`network`, buf) + FfiConverterOptionalSequenceTypeSocketAddress.write(value.`listeningAddresses`, buf) + FfiConverterOptionalSequenceTypeSocketAddress.write(value.`announcementAddresses`, buf) + FfiConverterOptionalTypeNodeAlias.write(value.`nodeAlias`, buf) + FfiConverterSequenceTypePublicKey.write(value.`trustedPeers0conf`, buf) + FfiConverterULong.write(value.`probingLiquidityLimitMultiplier`, buf) + FfiConverterOptionalTypeAnchorChannelsConfig.write(value.`anchorChannelsConfig`, buf) + FfiConverterOptionalTypeSendingParameters.write(value.`sendingParameters`, buf) + } +} + - override fun write( - value: Config, - buf: ByteBuffer, - ) { - FfiConverterString.write(value.`storageDirPath`, buf) - FfiConverterTypeNetwork.write(value.`network`, buf) - FfiConverterOptionalSequenceTypeSocketAddress.write(value.`listeningAddresses`, buf) - FfiConverterOptionalSequenceTypeSocketAddress.write(value.`announcementAddresses`, buf) - FfiConverterOptionalTypeNodeAlias.write(value.`nodeAlias`, buf) - FfiConverterSequenceTypePublicKey.write(value.`trustedPeers0conf`, buf) - FfiConverterULong.write(value.`probingLiquidityLimitMultiplier`, buf) - FfiConverterOptionalTypeAnchorChannelsConfig.write(value.`anchorChannelsConfig`, buf) - FfiConverterOptionalTypeSendingParameters.write(value.`sendingParameters`, buf) - } -} - -data class CustomTlvRecord( - var `typeNum`: kotlin.ULong, - var `value`: List, + +data class CustomTlvRecord ( + var `typeNum`: kotlin.ULong, + var `value`: List ) { + companion object } -public object FfiConverterTypeCustomTlvRecord : FfiConverterRustBuffer { - override fun read(buf: ByteBuffer): CustomTlvRecord = - CustomTlvRecord( +public object FfiConverterTypeCustomTlvRecord: FfiConverterRustBuffer { + override fun read(buf: ByteBuffer): CustomTlvRecord { + return CustomTlvRecord( FfiConverterULong.read(buf), FfiConverterSequenceUByte.read(buf), ) + } - override fun allocationSize(value: CustomTlvRecord) = - ( + override fun allocationSize(value: CustomTlvRecord) = ( FfiConverterULong.allocationSize(value.`typeNum`) + - FfiConverterSequenceUByte.allocationSize(value.`value`) - ) + FfiConverterSequenceUByte.allocationSize(value.`value`) + ) - override fun write( - value: CustomTlvRecord, - buf: ByteBuffer, - ) { - FfiConverterULong.write(value.`typeNum`, buf) - FfiConverterSequenceUByte.write(value.`value`, buf) + override fun write(value: CustomTlvRecord, buf: ByteBuffer) { + FfiConverterULong.write(value.`typeNum`, buf) + FfiConverterSequenceUByte.write(value.`value`, buf) } } -data class ElectrumSyncConfig( - var `backgroundSyncConfig`: BackgroundSyncConfig?, + + +data class ElectrumSyncConfig ( + var `backgroundSyncConfig`: BackgroundSyncConfig? ) { + companion object } -public object FfiConverterTypeElectrumSyncConfig : FfiConverterRustBuffer { - override fun read(buf: ByteBuffer): ElectrumSyncConfig = - ElectrumSyncConfig( +public object FfiConverterTypeElectrumSyncConfig: FfiConverterRustBuffer { + override fun read(buf: ByteBuffer): ElectrumSyncConfig { + return ElectrumSyncConfig( FfiConverterOptionalTypeBackgroundSyncConfig.read(buf), ) + } - override fun allocationSize(value: ElectrumSyncConfig) = - ( + override fun allocationSize(value: ElectrumSyncConfig) = ( FfiConverterOptionalTypeBackgroundSyncConfig.allocationSize(value.`backgroundSyncConfig`) - ) + ) - override fun write( - value: ElectrumSyncConfig, - buf: ByteBuffer, - ) { - FfiConverterOptionalTypeBackgroundSyncConfig.write(value.`backgroundSyncConfig`, buf) + override fun write(value: ElectrumSyncConfig, buf: ByteBuffer) { + FfiConverterOptionalTypeBackgroundSyncConfig.write(value.`backgroundSyncConfig`, buf) } } -data class EsploraSyncConfig( - var `backgroundSyncConfig`: BackgroundSyncConfig?, + + +data class EsploraSyncConfig ( + var `backgroundSyncConfig`: BackgroundSyncConfig? ) { + companion object } -public object FfiConverterTypeEsploraSyncConfig : FfiConverterRustBuffer { - override fun read(buf: ByteBuffer): EsploraSyncConfig = - EsploraSyncConfig( +public object FfiConverterTypeEsploraSyncConfig: FfiConverterRustBuffer { + override fun read(buf: ByteBuffer): EsploraSyncConfig { + return EsploraSyncConfig( FfiConverterOptionalTypeBackgroundSyncConfig.read(buf), ) + } - override fun allocationSize(value: EsploraSyncConfig) = - ( + override fun allocationSize(value: EsploraSyncConfig) = ( FfiConverterOptionalTypeBackgroundSyncConfig.allocationSize(value.`backgroundSyncConfig`) - ) + ) - override fun write( - value: EsploraSyncConfig, - buf: ByteBuffer, - ) { - FfiConverterOptionalTypeBackgroundSyncConfig.write(value.`backgroundSyncConfig`, buf) + override fun write(value: EsploraSyncConfig, buf: ByteBuffer) { + FfiConverterOptionalTypeBackgroundSyncConfig.write(value.`backgroundSyncConfig`, buf) } } -data class LspFeeLimits( - var `maxTotalOpeningFeeMsat`: kotlin.ULong?, - var `maxProportionalOpeningFeePpmMsat`: kotlin.ULong?, + + +data class LspFeeLimits ( + var `maxTotalOpeningFeeMsat`: kotlin.ULong?, + var `maxProportionalOpeningFeePpmMsat`: kotlin.ULong? ) { + companion object } -public object FfiConverterTypeLSPFeeLimits : FfiConverterRustBuffer { - override fun read(buf: ByteBuffer): LspFeeLimits = - LspFeeLimits( +public object FfiConverterTypeLSPFeeLimits: FfiConverterRustBuffer { + override fun read(buf: ByteBuffer): LspFeeLimits { + return LspFeeLimits( FfiConverterOptionalULong.read(buf), FfiConverterOptionalULong.read(buf), ) + } - override fun allocationSize(value: LspFeeLimits) = - ( + override fun allocationSize(value: LspFeeLimits) = ( FfiConverterOptionalULong.allocationSize(value.`maxTotalOpeningFeeMsat`) + - FfiConverterOptionalULong.allocationSize(value.`maxProportionalOpeningFeePpmMsat`) - ) + FfiConverterOptionalULong.allocationSize(value.`maxProportionalOpeningFeePpmMsat`) + ) - override fun write( - value: LspFeeLimits, - buf: ByteBuffer, - ) { - FfiConverterOptionalULong.write(value.`maxTotalOpeningFeeMsat`, buf) - FfiConverterOptionalULong.write(value.`maxProportionalOpeningFeePpmMsat`, buf) + override fun write(value: LspFeeLimits, buf: ByteBuffer) { + FfiConverterOptionalULong.write(value.`maxTotalOpeningFeeMsat`, buf) + FfiConverterOptionalULong.write(value.`maxProportionalOpeningFeePpmMsat`, buf) } } -data class Lsps1OrderStatus( - var `orderId`: OrderId, - var `orderParams`: OrderParameters, - var `paymentOptions`: PaymentInfo, - var `channelState`: ChannelOrderInfo?, + + +data class Lsps1OrderStatus ( + var `orderId`: OrderId, + var `orderParams`: OrderParameters, + var `paymentOptions`: PaymentInfo, + var `channelState`: ChannelOrderInfo? ) : Disposable { + @Suppress("UNNECESSARY_SAFE_CALL") // codegen is much simpler if we unconditionally emit safe calls here override fun destroy() { - Disposable.destroy( - this.`orderId`, - this.`orderParams`, - this.`paymentOptions`, - this.`channelState`, - ) - } - + + Disposable.destroy( + this.`orderId`, + this.`orderParams`, + this.`paymentOptions`, + this.`channelState`) + } + companion object } -public object FfiConverterTypeLSPS1OrderStatus : FfiConverterRustBuffer { - override fun read(buf: ByteBuffer): Lsps1OrderStatus = - Lsps1OrderStatus( +public object FfiConverterTypeLSPS1OrderStatus: FfiConverterRustBuffer { + override fun read(buf: ByteBuffer): Lsps1OrderStatus { + return Lsps1OrderStatus( FfiConverterTypeOrderId.read(buf), FfiConverterTypeOrderParameters.read(buf), FfiConverterTypePaymentInfo.read(buf), FfiConverterOptionalTypeChannelOrderInfo.read(buf), ) + } - override fun allocationSize(value: Lsps1OrderStatus) = - ( + override fun allocationSize(value: Lsps1OrderStatus) = ( FfiConverterTypeOrderId.allocationSize(value.`orderId`) + - FfiConverterTypeOrderParameters.allocationSize(value.`orderParams`) + - FfiConverterTypePaymentInfo.allocationSize(value.`paymentOptions`) + - FfiConverterOptionalTypeChannelOrderInfo.allocationSize(value.`channelState`) - ) + FfiConverterTypeOrderParameters.allocationSize(value.`orderParams`) + + FfiConverterTypePaymentInfo.allocationSize(value.`paymentOptions`) + + FfiConverterOptionalTypeChannelOrderInfo.allocationSize(value.`channelState`) + ) + + override fun write(value: Lsps1OrderStatus, buf: ByteBuffer) { + FfiConverterTypeOrderId.write(value.`orderId`, buf) + FfiConverterTypeOrderParameters.write(value.`orderParams`, buf) + FfiConverterTypePaymentInfo.write(value.`paymentOptions`, buf) + FfiConverterOptionalTypeChannelOrderInfo.write(value.`channelState`, buf) + } +} - override fun write( - value: Lsps1OrderStatus, - buf: ByteBuffer, - ) { - FfiConverterTypeOrderId.write(value.`orderId`, buf) - FfiConverterTypeOrderParameters.write(value.`orderParams`, buf) - FfiConverterTypePaymentInfo.write(value.`paymentOptions`, buf) - FfiConverterOptionalTypeChannelOrderInfo.write(value.`channelState`, buf) - } -} - -data class Lsps2ServiceConfig( - var `requireToken`: kotlin.String?, - var `advertiseService`: kotlin.Boolean, - var `channelOpeningFeePpm`: kotlin.UInt, - var `channelOverProvisioningPpm`: kotlin.UInt, - var `minChannelOpeningFeeMsat`: kotlin.ULong, - var `minChannelLifetime`: kotlin.UInt, - var `maxClientToSelfDelay`: kotlin.UInt, - var `minPaymentSizeMsat`: kotlin.ULong, - var `maxPaymentSizeMsat`: kotlin.ULong, + + +data class Lsps2ServiceConfig ( + var `requireToken`: kotlin.String?, + var `advertiseService`: kotlin.Boolean, + var `channelOpeningFeePpm`: kotlin.UInt, + var `channelOverProvisioningPpm`: kotlin.UInt, + var `minChannelOpeningFeeMsat`: kotlin.ULong, + var `minChannelLifetime`: kotlin.UInt, + var `maxClientToSelfDelay`: kotlin.UInt, + var `minPaymentSizeMsat`: kotlin.ULong, + var `maxPaymentSizeMsat`: kotlin.ULong ) { + companion object } -public object FfiConverterTypeLSPS2ServiceConfig : FfiConverterRustBuffer { - override fun read(buf: ByteBuffer): Lsps2ServiceConfig = - Lsps2ServiceConfig( +public object FfiConverterTypeLSPS2ServiceConfig: FfiConverterRustBuffer { + override fun read(buf: ByteBuffer): Lsps2ServiceConfig { + return Lsps2ServiceConfig( FfiConverterOptionalString.read(buf), FfiConverterBoolean.read(buf), FfiConverterUInt.read(buf), @@ -8506,152 +7865,152 @@ public object FfiConverterTypeLSPS2ServiceConfig : FfiConverterRustBuffer { - override fun read(buf: ByteBuffer): LogRecord = - LogRecord( +public object FfiConverterTypeLogRecord: FfiConverterRustBuffer { + override fun read(buf: ByteBuffer): LogRecord { + return LogRecord( FfiConverterTypeLogLevel.read(buf), FfiConverterString.read(buf), FfiConverterString.read(buf), FfiConverterUInt.read(buf), ) + } - override fun allocationSize(value: LogRecord) = - ( + override fun allocationSize(value: LogRecord) = ( FfiConverterTypeLogLevel.allocationSize(value.`level`) + - FfiConverterString.allocationSize(value.`args`) + - FfiConverterString.allocationSize(value.`modulePath`) + - FfiConverterUInt.allocationSize(value.`line`) - ) + FfiConverterString.allocationSize(value.`args`) + + FfiConverterString.allocationSize(value.`modulePath`) + + FfiConverterUInt.allocationSize(value.`line`) + ) - override fun write( - value: LogRecord, - buf: ByteBuffer, - ) { - FfiConverterTypeLogLevel.write(value.`level`, buf) - FfiConverterString.write(value.`args`, buf) - FfiConverterString.write(value.`modulePath`, buf) - FfiConverterUInt.write(value.`line`, buf) + override fun write(value: LogRecord, buf: ByteBuffer) { + FfiConverterTypeLogLevel.write(value.`level`, buf) + FfiConverterString.write(value.`args`, buf) + FfiConverterString.write(value.`modulePath`, buf) + FfiConverterUInt.write(value.`line`, buf) } } -data class NodeAnnouncementInfo( - var `lastUpdate`: kotlin.UInt, - var `alias`: kotlin.String, - var `addresses`: List, + + +data class NodeAnnouncementInfo ( + var `lastUpdate`: kotlin.UInt, + var `alias`: kotlin.String, + var `addresses`: List ) { + companion object } -public object FfiConverterTypeNodeAnnouncementInfo : FfiConverterRustBuffer { - override fun read(buf: ByteBuffer): NodeAnnouncementInfo = - NodeAnnouncementInfo( +public object FfiConverterTypeNodeAnnouncementInfo: FfiConverterRustBuffer { + override fun read(buf: ByteBuffer): NodeAnnouncementInfo { + return NodeAnnouncementInfo( FfiConverterUInt.read(buf), FfiConverterString.read(buf), FfiConverterSequenceTypeSocketAddress.read(buf), ) + } - override fun allocationSize(value: NodeAnnouncementInfo) = - ( + override fun allocationSize(value: NodeAnnouncementInfo) = ( FfiConverterUInt.allocationSize(value.`lastUpdate`) + - FfiConverterString.allocationSize(value.`alias`) + - FfiConverterSequenceTypeSocketAddress.allocationSize(value.`addresses`) - ) + FfiConverterString.allocationSize(value.`alias`) + + FfiConverterSequenceTypeSocketAddress.allocationSize(value.`addresses`) + ) - override fun write( - value: NodeAnnouncementInfo, - buf: ByteBuffer, - ) { - FfiConverterUInt.write(value.`lastUpdate`, buf) - FfiConverterString.write(value.`alias`, buf) - FfiConverterSequenceTypeSocketAddress.write(value.`addresses`, buf) + override fun write(value: NodeAnnouncementInfo, buf: ByteBuffer) { + FfiConverterUInt.write(value.`lastUpdate`, buf) + FfiConverterString.write(value.`alias`, buf) + FfiConverterSequenceTypeSocketAddress.write(value.`addresses`, buf) } } -data class NodeInfo( - var `channels`: List, - var `announcementInfo`: NodeAnnouncementInfo?, + + +data class NodeInfo ( + var `channels`: List, + var `announcementInfo`: NodeAnnouncementInfo? ) { + companion object } -public object FfiConverterTypeNodeInfo : FfiConverterRustBuffer { - override fun read(buf: ByteBuffer): NodeInfo = - NodeInfo( +public object FfiConverterTypeNodeInfo: FfiConverterRustBuffer { + override fun read(buf: ByteBuffer): NodeInfo { + return NodeInfo( FfiConverterSequenceULong.read(buf), FfiConverterOptionalTypeNodeAnnouncementInfo.read(buf), ) + } - override fun allocationSize(value: NodeInfo) = - ( + override fun allocationSize(value: NodeInfo) = ( FfiConverterSequenceULong.allocationSize(value.`channels`) + - FfiConverterOptionalTypeNodeAnnouncementInfo.allocationSize(value.`announcementInfo`) - ) + FfiConverterOptionalTypeNodeAnnouncementInfo.allocationSize(value.`announcementInfo`) + ) + + override fun write(value: NodeInfo, buf: ByteBuffer) { + FfiConverterSequenceULong.write(value.`channels`, buf) + FfiConverterOptionalTypeNodeAnnouncementInfo.write(value.`announcementInfo`, buf) + } +} + + - override fun write( - value: NodeInfo, - buf: ByteBuffer, - ) { - FfiConverterSequenceULong.write(value.`channels`, buf) - FfiConverterOptionalTypeNodeAnnouncementInfo.write(value.`announcementInfo`, buf) - } -} - -data class NodeStatus( - var `isRunning`: kotlin.Boolean, - var `isListening`: kotlin.Boolean, - var `currentBestBlock`: BestBlock, - var `latestLightningWalletSyncTimestamp`: kotlin.ULong?, - var `latestOnchainWalletSyncTimestamp`: kotlin.ULong?, - var `latestFeeRateCacheUpdateTimestamp`: kotlin.ULong?, - var `latestRgsSnapshotTimestamp`: kotlin.ULong?, - var `latestNodeAnnouncementBroadcastTimestamp`: kotlin.ULong?, - var `latestChannelMonitorArchivalHeight`: kotlin.UInt?, +data class NodeStatus ( + var `isRunning`: kotlin.Boolean, + var `isListening`: kotlin.Boolean, + var `currentBestBlock`: BestBlock, + var `latestLightningWalletSyncTimestamp`: kotlin.ULong?, + var `latestOnchainWalletSyncTimestamp`: kotlin.ULong?, + var `latestFeeRateCacheUpdateTimestamp`: kotlin.ULong?, + var `latestRgsSnapshotTimestamp`: kotlin.ULong?, + var `latestNodeAnnouncementBroadcastTimestamp`: kotlin.ULong?, + var `latestChannelMonitorArchivalHeight`: kotlin.UInt? ) { + companion object } -public object FfiConverterTypeNodeStatus : FfiConverterRustBuffer { - override fun read(buf: ByteBuffer): NodeStatus = - NodeStatus( +public object FfiConverterTypeNodeStatus: FfiConverterRustBuffer { + override fun read(buf: ByteBuffer): NodeStatus { + return NodeStatus( FfiConverterBoolean.read(buf), FfiConverterBoolean.read(buf), FfiConverterTypeBestBlock.read(buf), @@ -8662,66 +8021,66 @@ public object FfiConverterTypeNodeStatus : FfiConverterRustBuffer { FfiConverterOptionalULong.read(buf), FfiConverterOptionalUInt.read(buf), ) + } - override fun allocationSize(value: NodeStatus) = - ( + override fun allocationSize(value: NodeStatus) = ( FfiConverterBoolean.allocationSize(value.`isRunning`) + - FfiConverterBoolean.allocationSize(value.`isListening`) + - FfiConverterTypeBestBlock.allocationSize(value.`currentBestBlock`) + - FfiConverterOptionalULong.allocationSize(value.`latestLightningWalletSyncTimestamp`) + - FfiConverterOptionalULong.allocationSize(value.`latestOnchainWalletSyncTimestamp`) + - FfiConverterOptionalULong.allocationSize(value.`latestFeeRateCacheUpdateTimestamp`) + - FfiConverterOptionalULong.allocationSize(value.`latestRgsSnapshotTimestamp`) + - FfiConverterOptionalULong.allocationSize(value.`latestNodeAnnouncementBroadcastTimestamp`) + - FfiConverterOptionalUInt.allocationSize(value.`latestChannelMonitorArchivalHeight`) - ) + FfiConverterBoolean.allocationSize(value.`isListening`) + + FfiConverterTypeBestBlock.allocationSize(value.`currentBestBlock`) + + FfiConverterOptionalULong.allocationSize(value.`latestLightningWalletSyncTimestamp`) + + FfiConverterOptionalULong.allocationSize(value.`latestOnchainWalletSyncTimestamp`) + + FfiConverterOptionalULong.allocationSize(value.`latestFeeRateCacheUpdateTimestamp`) + + FfiConverterOptionalULong.allocationSize(value.`latestRgsSnapshotTimestamp`) + + FfiConverterOptionalULong.allocationSize(value.`latestNodeAnnouncementBroadcastTimestamp`) + + FfiConverterOptionalUInt.allocationSize(value.`latestChannelMonitorArchivalHeight`) + ) + + override fun write(value: NodeStatus, buf: ByteBuffer) { + FfiConverterBoolean.write(value.`isRunning`, buf) + FfiConverterBoolean.write(value.`isListening`, buf) + FfiConverterTypeBestBlock.write(value.`currentBestBlock`, buf) + FfiConverterOptionalULong.write(value.`latestLightningWalletSyncTimestamp`, buf) + FfiConverterOptionalULong.write(value.`latestOnchainWalletSyncTimestamp`, buf) + FfiConverterOptionalULong.write(value.`latestFeeRateCacheUpdateTimestamp`, buf) + FfiConverterOptionalULong.write(value.`latestRgsSnapshotTimestamp`, buf) + FfiConverterOptionalULong.write(value.`latestNodeAnnouncementBroadcastTimestamp`, buf) + FfiConverterOptionalUInt.write(value.`latestChannelMonitorArchivalHeight`, buf) + } +} + + - override fun write( - value: NodeStatus, - buf: ByteBuffer, - ) { - FfiConverterBoolean.write(value.`isRunning`, buf) - FfiConverterBoolean.write(value.`isListening`, buf) - FfiConverterTypeBestBlock.write(value.`currentBestBlock`, buf) - FfiConverterOptionalULong.write(value.`latestLightningWalletSyncTimestamp`, buf) - FfiConverterOptionalULong.write(value.`latestOnchainWalletSyncTimestamp`, buf) - FfiConverterOptionalULong.write(value.`latestFeeRateCacheUpdateTimestamp`, buf) - FfiConverterOptionalULong.write(value.`latestRgsSnapshotTimestamp`, buf) - FfiConverterOptionalULong.write(value.`latestNodeAnnouncementBroadcastTimestamp`, buf) - FfiConverterOptionalUInt.write(value.`latestChannelMonitorArchivalHeight`, buf) - } -} - -data class OnchainPaymentInfo( - var `state`: PaymentState, - var `expiresAt`: DateTime, - var `feeTotalSat`: kotlin.ULong, - var `orderTotalSat`: kotlin.ULong, - var `address`: Address, - var `minOnchainPaymentConfirmations`: kotlin.UShort?, - var `minFeeFor0conf`: FeeRate, - var `refundOnchainAddress`: Address?, +data class OnchainPaymentInfo ( + var `state`: PaymentState, + var `expiresAt`: DateTime, + var `feeTotalSat`: kotlin.ULong, + var `orderTotalSat`: kotlin.ULong, + var `address`: Address, + var `minOnchainPaymentConfirmations`: kotlin.UShort?, + var `minFeeFor0conf`: FeeRate, + var `refundOnchainAddress`: Address? ) : Disposable { + @Suppress("UNNECESSARY_SAFE_CALL") // codegen is much simpler if we unconditionally emit safe calls here override fun destroy() { - Disposable.destroy( - this.`state`, - this.`expiresAt`, - this.`feeTotalSat`, - this.`orderTotalSat`, - this.`address`, - this.`minOnchainPaymentConfirmations`, - this.`minFeeFor0conf`, - this.`refundOnchainAddress`, - ) - } - + + Disposable.destroy( + this.`state`, + this.`expiresAt`, + this.`feeTotalSat`, + this.`orderTotalSat`, + this.`address`, + this.`minOnchainPaymentConfirmations`, + this.`minFeeFor0conf`, + this.`refundOnchainAddress`) + } + companion object } -public object FfiConverterTypeOnchainPaymentInfo : FfiConverterRustBuffer { - override fun read(buf: ByteBuffer): OnchainPaymentInfo = - OnchainPaymentInfo( +public object FfiConverterTypeOnchainPaymentInfo: FfiConverterRustBuffer { + override fun read(buf: ByteBuffer): OnchainPaymentInfo { + return OnchainPaymentInfo( FfiConverterTypePaymentState.read(buf), FfiConverterTypeDateTime.read(buf), FfiConverterULong.read(buf), @@ -8731,49 +8090,49 @@ public object FfiConverterTypeOnchainPaymentInfo : FfiConverterRustBuffer { - override fun read(buf: ByteBuffer): OrderParameters = - OrderParameters( +public object FfiConverterTypeOrderParameters: FfiConverterRustBuffer { + override fun read(buf: ByteBuffer): OrderParameters { + return OrderParameters( FfiConverterULong.read(buf), FfiConverterULong.read(buf), FfiConverterUShort.read(buf), @@ -8782,76 +8141,76 @@ public object FfiConverterTypeOrderParameters : FfiConverterRustBuffer { - override fun read(buf: ByteBuffer): OutPoint = - OutPoint( +public object FfiConverterTypeOutPoint: FfiConverterRustBuffer { + override fun read(buf: ByteBuffer): OutPoint { + return OutPoint( FfiConverterTypeTxid.read(buf), FfiConverterUInt.read(buf), ) + } - override fun allocationSize(value: OutPoint) = - ( + override fun allocationSize(value: OutPoint) = ( FfiConverterTypeTxid.allocationSize(value.`txid`) + - FfiConverterUInt.allocationSize(value.`vout`) - ) + FfiConverterUInt.allocationSize(value.`vout`) + ) - override fun write( - value: OutPoint, - buf: ByteBuffer, - ) { - FfiConverterTypeTxid.write(value.`txid`, buf) - FfiConverterUInt.write(value.`vout`, buf) + override fun write(value: OutPoint, buf: ByteBuffer) { + FfiConverterTypeTxid.write(value.`txid`, buf) + FfiConverterUInt.write(value.`vout`, buf) } } -data class PaymentDetails( - var `id`: PaymentId, - var `kind`: PaymentKind, - var `amountMsat`: kotlin.ULong?, - var `feePaidMsat`: kotlin.ULong?, - var `direction`: PaymentDirection, - var `status`: PaymentStatus, - var `latestUpdateTimestamp`: kotlin.ULong, + + +data class PaymentDetails ( + var `id`: PaymentId, + var `kind`: PaymentKind, + var `amountMsat`: kotlin.ULong?, + var `feePaidMsat`: kotlin.ULong?, + var `direction`: PaymentDirection, + var `status`: PaymentStatus, + var `latestUpdateTimestamp`: kotlin.ULong ) { + companion object } -public object FfiConverterTypePaymentDetails : FfiConverterRustBuffer { - override fun read(buf: ByteBuffer): PaymentDetails = - PaymentDetails( +public object FfiConverterTypePaymentDetails: FfiConverterRustBuffer { + override fun read(buf: ByteBuffer): PaymentDetails { + return PaymentDetails( FfiConverterTypePaymentId.read(buf), FfiConverterTypePaymentKind.read(buf), FfiConverterOptionalULong.read(buf), @@ -8860,120 +8219,120 @@ public object FfiConverterTypePaymentDetails : FfiConverterRustBuffer { - override fun read(buf: ByteBuffer): PaymentInfo = - PaymentInfo( +public object FfiConverterTypePaymentInfo: FfiConverterRustBuffer { + override fun read(buf: ByteBuffer): PaymentInfo { + return PaymentInfo( FfiConverterOptionalTypeBolt11PaymentInfo.read(buf), FfiConverterOptionalTypeOnchainPaymentInfo.read(buf), ) + } - override fun allocationSize(value: PaymentInfo) = - ( + override fun allocationSize(value: PaymentInfo) = ( FfiConverterOptionalTypeBolt11PaymentInfo.allocationSize(value.`bolt11`) + - FfiConverterOptionalTypeOnchainPaymentInfo.allocationSize(value.`onchain`) - ) + FfiConverterOptionalTypeOnchainPaymentInfo.allocationSize(value.`onchain`) + ) - override fun write( - value: PaymentInfo, - buf: ByteBuffer, - ) { - FfiConverterOptionalTypeBolt11PaymentInfo.write(value.`bolt11`, buf) - FfiConverterOptionalTypeOnchainPaymentInfo.write(value.`onchain`, buf) + override fun write(value: PaymentInfo, buf: ByteBuffer) { + FfiConverterOptionalTypeBolt11PaymentInfo.write(value.`bolt11`, buf) + FfiConverterOptionalTypeOnchainPaymentInfo.write(value.`onchain`, buf) } } -data class PeerDetails( - var `nodeId`: PublicKey, - var `address`: SocketAddress, - var `isPersisted`: kotlin.Boolean, - var `isConnected`: kotlin.Boolean, + + +data class PeerDetails ( + var `nodeId`: PublicKey, + var `address`: SocketAddress, + var `isPersisted`: kotlin.Boolean, + var `isConnected`: kotlin.Boolean ) { + companion object } -public object FfiConverterTypePeerDetails : FfiConverterRustBuffer { - override fun read(buf: ByteBuffer): PeerDetails = - PeerDetails( +public object FfiConverterTypePeerDetails: FfiConverterRustBuffer { + override fun read(buf: ByteBuffer): PeerDetails { + return PeerDetails( FfiConverterTypePublicKey.read(buf), FfiConverterTypeSocketAddress.read(buf), FfiConverterBoolean.read(buf), FfiConverterBoolean.read(buf), ) + } - override fun allocationSize(value: PeerDetails) = - ( + override fun allocationSize(value: PeerDetails) = ( FfiConverterTypePublicKey.allocationSize(value.`nodeId`) + - FfiConverterTypeSocketAddress.allocationSize(value.`address`) + - FfiConverterBoolean.allocationSize(value.`isPersisted`) + - FfiConverterBoolean.allocationSize(value.`isConnected`) - ) + FfiConverterTypeSocketAddress.allocationSize(value.`address`) + + FfiConverterBoolean.allocationSize(value.`isPersisted`) + + FfiConverterBoolean.allocationSize(value.`isConnected`) + ) - override fun write( - value: PeerDetails, - buf: ByteBuffer, - ) { - FfiConverterTypePublicKey.write(value.`nodeId`, buf) - FfiConverterTypeSocketAddress.write(value.`address`, buf) - FfiConverterBoolean.write(value.`isPersisted`, buf) - FfiConverterBoolean.write(value.`isConnected`, buf) + override fun write(value: PeerDetails, buf: ByteBuffer) { + FfiConverterTypePublicKey.write(value.`nodeId`, buf) + FfiConverterTypeSocketAddress.write(value.`address`, buf) + FfiConverterBoolean.write(value.`isPersisted`, buf) + FfiConverterBoolean.write(value.`isConnected`, buf) } } -data class RouteHintHop( - var `srcNodeId`: PublicKey, - var `shortChannelId`: kotlin.ULong, - var `cltvExpiryDelta`: kotlin.UShort, - var `htlcMinimumMsat`: kotlin.ULong?, - var `htlcMaximumMsat`: kotlin.ULong?, - var `fees`: RoutingFees, + + +data class RouteHintHop ( + var `srcNodeId`: PublicKey, + var `shortChannelId`: kotlin.ULong, + var `cltvExpiryDelta`: kotlin.UShort, + var `htlcMinimumMsat`: kotlin.ULong?, + var `htlcMaximumMsat`: kotlin.ULong?, + var `fees`: RoutingFees ) { + companion object } -public object FfiConverterTypeRouteHintHop : FfiConverterRustBuffer { - override fun read(buf: ByteBuffer): RouteHintHop = - RouteHintHop( +public object FfiConverterTypeRouteHintHop: FfiConverterRustBuffer { + override fun read(buf: ByteBuffer): RouteHintHop { + return RouteHintHop( FfiConverterTypePublicKey.read(buf), FfiConverterULong.read(buf), FfiConverterUShort.read(buf), @@ -8981,206 +8340,202 @@ public object FfiConverterTypeRouteHintHop : FfiConverterRustBuffer { - override fun read(buf: ByteBuffer): RoutingFees = - RoutingFees( +public object FfiConverterTypeRoutingFees: FfiConverterRustBuffer { + override fun read(buf: ByteBuffer): RoutingFees { + return RoutingFees( FfiConverterUInt.read(buf), FfiConverterUInt.read(buf), ) + } - override fun allocationSize(value: RoutingFees) = - ( + override fun allocationSize(value: RoutingFees) = ( FfiConverterUInt.allocationSize(value.`baseMsat`) + - FfiConverterUInt.allocationSize(value.`proportionalMillionths`) - ) + FfiConverterUInt.allocationSize(value.`proportionalMillionths`) + ) - override fun write( - value: RoutingFees, - buf: ByteBuffer, - ) { - FfiConverterUInt.write(value.`baseMsat`, buf) - FfiConverterUInt.write(value.`proportionalMillionths`, buf) + override fun write(value: RoutingFees, buf: ByteBuffer) { + FfiConverterUInt.write(value.`baseMsat`, buf) + FfiConverterUInt.write(value.`proportionalMillionths`, buf) } } -data class SendingParameters( - var `maxTotalRoutingFeeMsat`: MaxTotalRoutingFeeLimit?, - var `maxTotalCltvExpiryDelta`: kotlin.UInt?, - var `maxPathCount`: kotlin.UByte?, - var `maxChannelSaturationPowerOfHalf`: kotlin.UByte?, + + +data class SendingParameters ( + var `maxTotalRoutingFeeMsat`: MaxTotalRoutingFeeLimit?, + var `maxTotalCltvExpiryDelta`: kotlin.UInt?, + var `maxPathCount`: kotlin.UByte?, + var `maxChannelSaturationPowerOfHalf`: kotlin.UByte? ) { + companion object } -public object FfiConverterTypeSendingParameters : FfiConverterRustBuffer { - override fun read(buf: ByteBuffer): SendingParameters = - SendingParameters( +public object FfiConverterTypeSendingParameters: FfiConverterRustBuffer { + override fun read(buf: ByteBuffer): SendingParameters { + return SendingParameters( FfiConverterOptionalTypeMaxTotalRoutingFeeLimit.read(buf), FfiConverterOptionalUInt.read(buf), FfiConverterOptionalUByte.read(buf), FfiConverterOptionalUByte.read(buf), ) + } - override fun allocationSize(value: SendingParameters) = - ( + override fun allocationSize(value: SendingParameters) = ( FfiConverterOptionalTypeMaxTotalRoutingFeeLimit.allocationSize(value.`maxTotalRoutingFeeMsat`) + - FfiConverterOptionalUInt.allocationSize(value.`maxTotalCltvExpiryDelta`) + - FfiConverterOptionalUByte.allocationSize(value.`maxPathCount`) + - FfiConverterOptionalUByte.allocationSize(value.`maxChannelSaturationPowerOfHalf`) - ) + FfiConverterOptionalUInt.allocationSize(value.`maxTotalCltvExpiryDelta`) + + FfiConverterOptionalUByte.allocationSize(value.`maxPathCount`) + + FfiConverterOptionalUByte.allocationSize(value.`maxChannelSaturationPowerOfHalf`) + ) - override fun write( - value: SendingParameters, - buf: ByteBuffer, - ) { - FfiConverterOptionalTypeMaxTotalRoutingFeeLimit.write(value.`maxTotalRoutingFeeMsat`, buf) - FfiConverterOptionalUInt.write(value.`maxTotalCltvExpiryDelta`, buf) - FfiConverterOptionalUByte.write(value.`maxPathCount`, buf) - FfiConverterOptionalUByte.write(value.`maxChannelSaturationPowerOfHalf`, buf) + override fun write(value: SendingParameters, buf: ByteBuffer) { + FfiConverterOptionalTypeMaxTotalRoutingFeeLimit.write(value.`maxTotalRoutingFeeMsat`, buf) + FfiConverterOptionalUInt.write(value.`maxTotalCltvExpiryDelta`, buf) + FfiConverterOptionalUByte.write(value.`maxPathCount`, buf) + FfiConverterOptionalUByte.write(value.`maxChannelSaturationPowerOfHalf`, buf) } } -data class SpendableUtxo( - var `outpoint`: OutPoint, - var `valueSats`: kotlin.ULong, + + +data class SpendableUtxo ( + var `outpoint`: OutPoint, + var `valueSats`: kotlin.ULong ) { + companion object } -public object FfiConverterTypeSpendableUtxo : FfiConverterRustBuffer { - override fun read(buf: ByteBuffer): SpendableUtxo = - SpendableUtxo( +public object FfiConverterTypeSpendableUtxo: FfiConverterRustBuffer { + override fun read(buf: ByteBuffer): SpendableUtxo { + return SpendableUtxo( FfiConverterTypeOutPoint.read(buf), FfiConverterULong.read(buf), ) + } - override fun allocationSize(value: SpendableUtxo) = - ( + override fun allocationSize(value: SpendableUtxo) = ( FfiConverterTypeOutPoint.allocationSize(value.`outpoint`) + - FfiConverterULong.allocationSize(value.`valueSats`) - ) + FfiConverterULong.allocationSize(value.`valueSats`) + ) - override fun write( - value: SpendableUtxo, - buf: ByteBuffer, - ) { - FfiConverterTypeOutPoint.write(value.`outpoint`, buf) - FfiConverterULong.write(value.`valueSats`, buf) + override fun write(value: SpendableUtxo, buf: ByteBuffer) { + FfiConverterTypeOutPoint.write(value.`outpoint`, buf) + FfiConverterULong.write(value.`valueSats`, buf) } } + + + enum class BalanceSource { + HOLDER_FORCE_CLOSED, COUNTERPARTY_FORCE_CLOSED, COOP_CLOSE, - HTLC, - ; - + HTLC; companion object } -public object FfiConverterTypeBalanceSource : FfiConverterRustBuffer { - override fun read(buf: ByteBuffer) = - try { - BalanceSource.values()[buf.getInt() - 1] - } catch (e: IndexOutOfBoundsException) { - throw RuntimeException("invalid enum value, something is very wrong!!", e) - } + +public object FfiConverterTypeBalanceSource: FfiConverterRustBuffer { + override fun read(buf: ByteBuffer) = try { + BalanceSource.values()[buf.getInt() - 1] + } catch (e: IndexOutOfBoundsException) { + throw RuntimeException("invalid enum value, something is very wrong!!", e) + } override fun allocationSize(value: BalanceSource) = 4UL - override fun write( - value: BalanceSource, - buf: ByteBuffer, - ) { + override fun write(value: BalanceSource, buf: ByteBuffer) { buf.putInt(value.ordinal + 1) } } + + + + sealed class Bolt11InvoiceDescription { + data class Hash( - val `hash`: kotlin.String, - ) : Bolt11InvoiceDescription() { + val `hash`: kotlin.String) : Bolt11InvoiceDescription() { companion object } - + data class Direct( - val `description`: kotlin.String, - ) : Bolt11InvoiceDescription() { + val `description`: kotlin.String) : Bolt11InvoiceDescription() { companion object } + + companion object } -public object FfiConverterTypeBolt11InvoiceDescription : FfiConverterRustBuffer { - override fun read(buf: ByteBuffer): Bolt11InvoiceDescription = - when (buf.getInt()) { - 1 -> - Bolt11InvoiceDescription.Hash( - FfiConverterString.read(buf), +public object FfiConverterTypeBolt11InvoiceDescription : FfiConverterRustBuffer{ + override fun read(buf: ByteBuffer): Bolt11InvoiceDescription { + return when(buf.getInt()) { + 1 -> Bolt11InvoiceDescription.Hash( + FfiConverterString.read(buf), ) - 2 -> - Bolt11InvoiceDescription.Direct( - FfiConverterString.read(buf), + 2 -> Bolt11InvoiceDescription.Direct( + FfiConverterString.read(buf), ) else -> throw RuntimeException("invalid enum value, something is very wrong!!") } + } - override fun allocationSize(value: Bolt11InvoiceDescription) = - when (value) { - is Bolt11InvoiceDescription.Hash -> { - // Add the size for the Int that specifies the variant plus the size needed for all fields - ( - 4UL + - FfiConverterString.allocationSize(value.`hash`) - ) - } - is Bolt11InvoiceDescription.Direct -> { - // Add the size for the Int that specifies the variant plus the size needed for all fields - ( - 4UL + - FfiConverterString.allocationSize(value.`description`) - ) - } + override fun allocationSize(value: Bolt11InvoiceDescription) = when(value) { + is Bolt11InvoiceDescription.Hash -> { + // Add the size for the Int that specifies the variant plus the size needed for all fields + ( + 4UL + + FfiConverterString.allocationSize(value.`hash`) + ) + } + is Bolt11InvoiceDescription.Direct -> { + // Add the size for the Int that specifies the variant plus the size needed for all fields + ( + 4UL + + FfiConverterString.allocationSize(value.`description`) + ) } + } - override fun write( - value: Bolt11InvoiceDescription, - buf: ByteBuffer, - ) { - when (value) { + override fun write(value: Bolt11InvoiceDescription, buf: ByteBuffer) { + when(value) { is Bolt11InvoiceDescription.Hash -> { buf.putInt(1) FfiConverterString.write(value.`hash`, buf) @@ -9195,64 +8550,42 @@ public object FfiConverterTypeBolt11InvoiceDescription : FfiConverterRustBuffer< } } -sealed class BuildException( - message: String, -) : Exception(message) { - class InvalidSeedBytes( - message: String, - ) : BuildException(message) - class InvalidSeedFile( - message: String, - ) : BuildException(message) - class InvalidSystemTime( - message: String, - ) : BuildException(message) - class InvalidChannelMonitor( - message: String, - ) : BuildException(message) - class InvalidListeningAddresses( - message: String, - ) : BuildException(message) - class InvalidAnnouncementAddresses( - message: String, - ) : BuildException(message) - class InvalidNodeAlias( - message: String, - ) : BuildException(message) - - class ReadFailed( - message: String, - ) : BuildException(message) - - class WriteFailed( - message: String, - ) : BuildException(message) - - class StoragePathAccessFailed( - message: String, - ) : BuildException(message) - - class KvStoreSetupFailed( - message: String, - ) : BuildException(message) - - class WalletSetupFailed( - message: String, - ) : BuildException(message) - - class LoggerSetupFailed( - message: String, - ) : BuildException(message) - - class NetworkMismatch( - message: String, - ) : BuildException(message) +sealed class BuildException(message: String): Exception(message) { + + class InvalidSeedBytes(message: String) : BuildException(message) + + class InvalidSeedFile(message: String) : BuildException(message) + + class InvalidSystemTime(message: String) : BuildException(message) + + class InvalidChannelMonitor(message: String) : BuildException(message) + + class InvalidListeningAddresses(message: String) : BuildException(message) + + class InvalidAnnouncementAddresses(message: String) : BuildException(message) + + class InvalidNodeAlias(message: String) : BuildException(message) + + class ReadFailed(message: String) : BuildException(message) + + class WriteFailed(message: String) : BuildException(message) + + class StoragePathAccessFailed(message: String) : BuildException(message) + + class KvStoreSetupFailed(message: String) : BuildException(message) + + class WalletSetupFailed(message: String) : BuildException(message) + + class LoggerSetupFailed(message: String) : BuildException(message) + + class NetworkMismatch(message: String) : BuildException(message) + companion object ErrorHandler : UniffiRustCallStatusErrorHandler { override fun lift(error_buf: RustBuffer.ByValue): BuildException = FfiConverterTypeBuildError.lift(error_buf) @@ -9260,8 +8593,9 @@ sealed class BuildException( } public object FfiConverterTypeBuildError : FfiConverterRustBuffer { - override fun read(buf: ByteBuffer): BuildException = - when (buf.getInt()) { + override fun read(buf: ByteBuffer): BuildException { + + return when(buf.getInt()) { 1 -> BuildException.InvalidSeedBytes(FfiConverterString.read(buf)) 2 -> BuildException.InvalidSeedFile(FfiConverterString.read(buf)) 3 -> BuildException.InvalidSystemTime(FfiConverterString.read(buf)) @@ -9278,14 +8612,15 @@ public object FfiConverterTypeBuildError : FfiConverterRustBuffer BuildException.NetworkMismatch(FfiConverterString.read(buf)) else -> throw RuntimeException("invalid error enum value, something is very wrong!!") } + + } - override fun allocationSize(value: BuildException): ULong = 4UL + override fun allocationSize(value: BuildException): ULong { + return 4UL + } - override fun write( - value: BuildException, - buf: ByteBuffer, - ) { - when (value) { + override fun write(value: BuildException, buf: ByteBuffer) { + when(value) { is BuildException.InvalidSeedBytes -> { buf.putInt(1) Unit @@ -9344,188 +8679,193 @@ public object FfiConverterTypeBuildError : FfiConverterRustBuffer { - override fun read(buf: ByteBuffer): ClosureReason = - when (buf.getInt()) { - 1 -> - ClosureReason.CounterpartyForceClosed( - FfiConverterTypeUntrustedString.read(buf), +public object FfiConverterTypeClosureReason : FfiConverterRustBuffer{ + override fun read(buf: ByteBuffer): ClosureReason { + return when(buf.getInt()) { + 1 -> ClosureReason.CounterpartyForceClosed( + FfiConverterTypeUntrustedString.read(buf), ) - 2 -> - ClosureReason.HolderForceClosed( - FfiConverterOptionalBoolean.read(buf), + 2 -> ClosureReason.HolderForceClosed( + FfiConverterOptionalBoolean.read(buf), ) 3 -> ClosureReason.LegacyCooperativeClosure 4 -> ClosureReason.CounterpartyInitiatedCooperativeClosure 5 -> ClosureReason.LocallyInitiatedCooperativeClosure 6 -> ClosureReason.CommitmentTxConfirmed 7 -> ClosureReason.FundingTimedOut - 8 -> - ClosureReason.ProcessingError( - FfiConverterString.read(buf), + 8 -> ClosureReason.ProcessingError( + FfiConverterString.read(buf), ) 9 -> ClosureReason.DisconnectedPeer 10 -> ClosureReason.OutdatedChannelManager 11 -> ClosureReason.CounterpartyCoopClosedUnfundedChannel 12 -> ClosureReason.FundingBatchClosure 13 -> ClosureReason.HtlCsTimedOut - 14 -> - ClosureReason.PeerFeerateTooLow( - FfiConverterUInt.read(buf), - FfiConverterUInt.read(buf), + 14 -> ClosureReason.PeerFeerateTooLow( + FfiConverterUInt.read(buf), + FfiConverterUInt.read(buf), ) else -> throw RuntimeException("invalid enum value, something is very wrong!!") } + } - override fun allocationSize(value: ClosureReason) = - when (value) { - is ClosureReason.CounterpartyForceClosed -> { - // Add the size for the Int that specifies the variant plus the size needed for all fields - ( - 4UL + - FfiConverterTypeUntrustedString.allocationSize(value.`peerMsg`) - ) - } - is ClosureReason.HolderForceClosed -> { - // Add the size for the Int that specifies the variant plus the size needed for all fields - ( - 4UL + - FfiConverterOptionalBoolean.allocationSize(value.`broadcastedLatestTxn`) - ) - } - is ClosureReason.LegacyCooperativeClosure -> { - // Add the size for the Int that specifies the variant plus the size needed for all fields - ( - 4UL - ) - } - is ClosureReason.CounterpartyInitiatedCooperativeClosure -> { - // Add the size for the Int that specifies the variant plus the size needed for all fields - ( - 4UL - ) - } - is ClosureReason.LocallyInitiatedCooperativeClosure -> { - // Add the size for the Int that specifies the variant plus the size needed for all fields - ( - 4UL - ) - } - is ClosureReason.CommitmentTxConfirmed -> { - // Add the size for the Int that specifies the variant plus the size needed for all fields - ( - 4UL - ) - } - is ClosureReason.FundingTimedOut -> { - // Add the size for the Int that specifies the variant plus the size needed for all fields - ( - 4UL - ) - } - is ClosureReason.ProcessingError -> { - // Add the size for the Int that specifies the variant plus the size needed for all fields - ( - 4UL + - FfiConverterString.allocationSize(value.`err`) - ) - } - is ClosureReason.DisconnectedPeer -> { - // Add the size for the Int that specifies the variant plus the size needed for all fields - ( - 4UL - ) - } - is ClosureReason.OutdatedChannelManager -> { - // Add the size for the Int that specifies the variant plus the size needed for all fields - ( - 4UL - ) - } - is ClosureReason.CounterpartyCoopClosedUnfundedChannel -> { - // Add the size for the Int that specifies the variant plus the size needed for all fields - ( - 4UL - ) - } - is ClosureReason.FundingBatchClosure -> { - // Add the size for the Int that specifies the variant plus the size needed for all fields - ( - 4UL - ) - } - is ClosureReason.HtlCsTimedOut -> { - // Add the size for the Int that specifies the variant plus the size needed for all fields - ( - 4UL - ) - } - is ClosureReason.PeerFeerateTooLow -> { - // Add the size for the Int that specifies the variant plus the size needed for all fields - ( - 4UL + - FfiConverterUInt.allocationSize(value.`peerFeerateSatPerKw`) + - FfiConverterUInt.allocationSize(value.`requiredFeerateSatPerKw`) - ) - } + override fun allocationSize(value: ClosureReason) = when(value) { + is ClosureReason.CounterpartyForceClosed -> { + // Add the size for the Int that specifies the variant plus the size needed for all fields + ( + 4UL + + FfiConverterTypeUntrustedString.allocationSize(value.`peerMsg`) + ) + } + is ClosureReason.HolderForceClosed -> { + // Add the size for the Int that specifies the variant plus the size needed for all fields + ( + 4UL + + FfiConverterOptionalBoolean.allocationSize(value.`broadcastedLatestTxn`) + ) + } + is ClosureReason.LegacyCooperativeClosure -> { + // Add the size for the Int that specifies the variant plus the size needed for all fields + ( + 4UL + ) + } + is ClosureReason.CounterpartyInitiatedCooperativeClosure -> { + // Add the size for the Int that specifies the variant plus the size needed for all fields + ( + 4UL + ) + } + is ClosureReason.LocallyInitiatedCooperativeClosure -> { + // Add the size for the Int that specifies the variant plus the size needed for all fields + ( + 4UL + ) + } + is ClosureReason.CommitmentTxConfirmed -> { + // Add the size for the Int that specifies the variant plus the size needed for all fields + ( + 4UL + ) + } + is ClosureReason.FundingTimedOut -> { + // Add the size for the Int that specifies the variant plus the size needed for all fields + ( + 4UL + ) + } + is ClosureReason.ProcessingError -> { + // Add the size for the Int that specifies the variant plus the size needed for all fields + ( + 4UL + + FfiConverterString.allocationSize(value.`err`) + ) + } + is ClosureReason.DisconnectedPeer -> { + // Add the size for the Int that specifies the variant plus the size needed for all fields + ( + 4UL + ) + } + is ClosureReason.OutdatedChannelManager -> { + // Add the size for the Int that specifies the variant plus the size needed for all fields + ( + 4UL + ) + } + is ClosureReason.CounterpartyCoopClosedUnfundedChannel -> { + // Add the size for the Int that specifies the variant plus the size needed for all fields + ( + 4UL + ) + } + is ClosureReason.FundingBatchClosure -> { + // Add the size for the Int that specifies the variant plus the size needed for all fields + ( + 4UL + ) + } + is ClosureReason.HtlCsTimedOut -> { + // Add the size for the Int that specifies the variant plus the size needed for all fields + ( + 4UL + ) + } + is ClosureReason.PeerFeerateTooLow -> { + // Add the size for the Int that specifies the variant plus the size needed for all fields + ( + 4UL + + FfiConverterUInt.allocationSize(value.`peerFeerateSatPerKw`) + + FfiConverterUInt.allocationSize(value.`requiredFeerateSatPerKw`) + ) } + } - override fun write( - value: ClosureReason, - buf: ByteBuffer, - ) { - when (value) { + override fun write(value: ClosureReason, buf: ByteBuffer) { + when(value) { is ClosureReason.CounterpartyForceClosed -> { buf.putInt(1) FfiConverterTypeUntrustedString.write(value.`peerMsg`, buf) @@ -9591,85 +8931,89 @@ public object FfiConverterTypeClosureReason : FfiConverterRustBuffer { - override fun read(buf: ByteBuffer) = - try { - CoinSelectionAlgorithm.values()[buf.getInt() - 1] - } catch (e: IndexOutOfBoundsException) { - throw RuntimeException("invalid enum value, something is very wrong!!", e) - } + +public object FfiConverterTypeCoinSelectionAlgorithm: FfiConverterRustBuffer { + override fun read(buf: ByteBuffer) = try { + CoinSelectionAlgorithm.values()[buf.getInt() - 1] + } catch (e: IndexOutOfBoundsException) { + throw RuntimeException("invalid enum value, something is very wrong!!", e) + } override fun allocationSize(value: CoinSelectionAlgorithm) = 4UL - override fun write( - value: CoinSelectionAlgorithm, - buf: ByteBuffer, - ) { + override fun write(value: CoinSelectionAlgorithm, buf: ByteBuffer) { buf.putInt(value.ordinal + 1) } } + + + + sealed class ConfirmationStatus { + data class Confirmed( - val `blockHash`: BlockHash, - val `height`: kotlin.UInt, - val `timestamp`: kotlin.ULong, - ) : ConfirmationStatus() { + val `blockHash`: BlockHash, + val `height`: kotlin.UInt, + val `timestamp`: kotlin.ULong) : ConfirmationStatus() { companion object } - + object Unconfirmed : ConfirmationStatus() + + + companion object } -public object FfiConverterTypeConfirmationStatus : FfiConverterRustBuffer { - override fun read(buf: ByteBuffer): ConfirmationStatus = - when (buf.getInt()) { - 1 -> - ConfirmationStatus.Confirmed( - FfiConverterTypeBlockHash.read(buf), - FfiConverterUInt.read(buf), - FfiConverterULong.read(buf), +public object FfiConverterTypeConfirmationStatus : FfiConverterRustBuffer{ + override fun read(buf: ByteBuffer): ConfirmationStatus { + return when(buf.getInt()) { + 1 -> ConfirmationStatus.Confirmed( + FfiConverterTypeBlockHash.read(buf), + FfiConverterUInt.read(buf), + FfiConverterULong.read(buf), ) 2 -> ConfirmationStatus.Unconfirmed else -> throw RuntimeException("invalid enum value, something is very wrong!!") } + } - override fun allocationSize(value: ConfirmationStatus) = - when (value) { - is ConfirmationStatus.Confirmed -> { - // Add the size for the Int that specifies the variant plus the size needed for all fields - ( - 4UL + - FfiConverterTypeBlockHash.allocationSize(value.`blockHash`) + - FfiConverterUInt.allocationSize(value.`height`) + - FfiConverterULong.allocationSize(value.`timestamp`) - ) - } - is ConfirmationStatus.Unconfirmed -> { - // Add the size for the Int that specifies the variant plus the size needed for all fields - ( - 4UL - ) - } + override fun allocationSize(value: ConfirmationStatus) = when(value) { + is ConfirmationStatus.Confirmed -> { + // Add the size for the Int that specifies the variant plus the size needed for all fields + ( + 4UL + + FfiConverterTypeBlockHash.allocationSize(value.`blockHash`) + + FfiConverterUInt.allocationSize(value.`height`) + + FfiConverterULong.allocationSize(value.`timestamp`) + ) + } + is ConfirmationStatus.Unconfirmed -> { + // Add the size for the Int that specifies the variant plus the size needed for all fields + ( + 4UL + ) } + } - override fun write( - value: ConfirmationStatus, - buf: ByteBuffer, - ) { - when (value) { + override fun write(value: ConfirmationStatus, buf: ByteBuffer) { + when(value) { is ConfirmationStatus.Confirmed -> { buf.putInt(1) FfiConverterTypeBlockHash.write(value.`blockHash`, buf) @@ -9685,280 +9029,269 @@ public object FfiConverterTypeConfirmationStatus : FfiConverterRustBuffer { - override fun read(buf: ByteBuffer) = - try { - Currency.values()[buf.getInt() - 1] - } catch (e: IndexOutOfBoundsException) { - throw RuntimeException("invalid enum value, something is very wrong!!", e) - } + +public object FfiConverterTypeCurrency: FfiConverterRustBuffer { + override fun read(buf: ByteBuffer) = try { + Currency.values()[buf.getInt() - 1] + } catch (e: IndexOutOfBoundsException) { + throw RuntimeException("invalid enum value, something is very wrong!!", e) + } override fun allocationSize(value: Currency) = 4UL - override fun write( - value: Currency, - buf: ByteBuffer, - ) { + override fun write(value: Currency, buf: ByteBuffer) { buf.putInt(value.ordinal + 1) } } + + + + sealed class Event { + data class PaymentSuccessful( - val `paymentId`: PaymentId?, - val `paymentHash`: PaymentHash, - val `paymentPreimage`: PaymentPreimage?, - val `feePaidMsat`: kotlin.ULong?, - ) : Event() { + val `paymentId`: PaymentId?, + val `paymentHash`: PaymentHash, + val `paymentPreimage`: PaymentPreimage?, + val `feePaidMsat`: kotlin.ULong?) : Event() { companion object } - + data class PaymentFailed( - val `paymentId`: PaymentId?, - val `paymentHash`: PaymentHash?, - val `reason`: PaymentFailureReason?, - ) : Event() { + val `paymentId`: PaymentId?, + val `paymentHash`: PaymentHash?, + val `reason`: PaymentFailureReason?) : Event() { companion object } - + data class PaymentReceived( - val `paymentId`: PaymentId?, - val `paymentHash`: PaymentHash, - val `amountMsat`: kotlin.ULong, - val `customRecords`: List, - ) : Event() { + val `paymentId`: PaymentId?, + val `paymentHash`: PaymentHash, + val `amountMsat`: kotlin.ULong, + val `customRecords`: List) : Event() { companion object } - + data class PaymentClaimable( - val `paymentId`: PaymentId, - val `paymentHash`: PaymentHash, - val `claimableAmountMsat`: kotlin.ULong, - val `claimDeadline`: kotlin.UInt?, - val `customRecords`: List, - ) : Event() { + val `paymentId`: PaymentId, + val `paymentHash`: PaymentHash, + val `claimableAmountMsat`: kotlin.ULong, + val `claimDeadline`: kotlin.UInt?, + val `customRecords`: List) : Event() { companion object } - + data class PaymentForwarded( - val `prevChannelId`: ChannelId, - val `nextChannelId`: ChannelId, - val `prevUserChannelId`: UserChannelId?, - val `nextUserChannelId`: UserChannelId?, - val `prevNodeId`: PublicKey?, - val `nextNodeId`: PublicKey?, - val `totalFeeEarnedMsat`: kotlin.ULong?, - val `skimmedFeeMsat`: kotlin.ULong?, - val `claimFromOnchainTx`: kotlin.Boolean, - val `outboundAmountForwardedMsat`: kotlin.ULong?, - ) : Event() { + val `prevChannelId`: ChannelId, + val `nextChannelId`: ChannelId, + val `prevUserChannelId`: UserChannelId?, + val `nextUserChannelId`: UserChannelId?, + val `prevNodeId`: PublicKey?, + val `nextNodeId`: PublicKey?, + val `totalFeeEarnedMsat`: kotlin.ULong?, + val `skimmedFeeMsat`: kotlin.ULong?, + val `claimFromOnchainTx`: kotlin.Boolean, + val `outboundAmountForwardedMsat`: kotlin.ULong?) : Event() { companion object } - + data class ChannelPending( - val `channelId`: ChannelId, - val `userChannelId`: UserChannelId, - val `formerTemporaryChannelId`: ChannelId, - val `counterpartyNodeId`: PublicKey, - val `fundingTxo`: OutPoint, - ) : Event() { + val `channelId`: ChannelId, + val `userChannelId`: UserChannelId, + val `formerTemporaryChannelId`: ChannelId, + val `counterpartyNodeId`: PublicKey, + val `fundingTxo`: OutPoint) : Event() { companion object } - + data class ChannelReady( - val `channelId`: ChannelId, - val `userChannelId`: UserChannelId, - val `counterpartyNodeId`: PublicKey?, - ) : Event() { + val `channelId`: ChannelId, + val `userChannelId`: UserChannelId, + val `counterpartyNodeId`: PublicKey?) : Event() { companion object } - + data class ChannelClosed( - val `channelId`: ChannelId, - val `userChannelId`: UserChannelId, - val `counterpartyNodeId`: PublicKey?, - val `reason`: ClosureReason?, - ) : Event() { + val `channelId`: ChannelId, + val `userChannelId`: UserChannelId, + val `counterpartyNodeId`: PublicKey?, + val `reason`: ClosureReason?) : Event() { companion object } + + companion object } -public object FfiConverterTypeEvent : FfiConverterRustBuffer { - override fun read(buf: ByteBuffer): Event = - when (buf.getInt()) { - 1 -> - Event.PaymentSuccessful( - FfiConverterOptionalTypePaymentId.read(buf), - FfiConverterTypePaymentHash.read(buf), - FfiConverterOptionalTypePaymentPreimage.read(buf), - FfiConverterOptionalULong.read(buf), +public object FfiConverterTypeEvent : FfiConverterRustBuffer{ + override fun read(buf: ByteBuffer): Event { + return when(buf.getInt()) { + 1 -> Event.PaymentSuccessful( + FfiConverterOptionalTypePaymentId.read(buf), + FfiConverterTypePaymentHash.read(buf), + FfiConverterOptionalTypePaymentPreimage.read(buf), + FfiConverterOptionalULong.read(buf), ) - 2 -> - Event.PaymentFailed( - FfiConverterOptionalTypePaymentId.read(buf), - FfiConverterOptionalTypePaymentHash.read(buf), - FfiConverterOptionalTypePaymentFailureReason.read(buf), + 2 -> Event.PaymentFailed( + FfiConverterOptionalTypePaymentId.read(buf), + FfiConverterOptionalTypePaymentHash.read(buf), + FfiConverterOptionalTypePaymentFailureReason.read(buf), ) - 3 -> - Event.PaymentReceived( - FfiConverterOptionalTypePaymentId.read(buf), - FfiConverterTypePaymentHash.read(buf), - FfiConverterULong.read(buf), - FfiConverterSequenceTypeCustomTlvRecord.read(buf), + 3 -> Event.PaymentReceived( + FfiConverterOptionalTypePaymentId.read(buf), + FfiConverterTypePaymentHash.read(buf), + FfiConverterULong.read(buf), + FfiConverterSequenceTypeCustomTlvRecord.read(buf), ) - 4 -> - Event.PaymentClaimable( - FfiConverterTypePaymentId.read(buf), - FfiConverterTypePaymentHash.read(buf), - FfiConverterULong.read(buf), - FfiConverterOptionalUInt.read(buf), - FfiConverterSequenceTypeCustomTlvRecord.read(buf), + 4 -> Event.PaymentClaimable( + FfiConverterTypePaymentId.read(buf), + FfiConverterTypePaymentHash.read(buf), + FfiConverterULong.read(buf), + FfiConverterOptionalUInt.read(buf), + FfiConverterSequenceTypeCustomTlvRecord.read(buf), ) - 5 -> - Event.PaymentForwarded( - FfiConverterTypeChannelId.read(buf), - FfiConverterTypeChannelId.read(buf), - FfiConverterOptionalTypeUserChannelId.read(buf), - FfiConverterOptionalTypeUserChannelId.read(buf), - FfiConverterOptionalTypePublicKey.read(buf), - FfiConverterOptionalTypePublicKey.read(buf), - FfiConverterOptionalULong.read(buf), - FfiConverterOptionalULong.read(buf), - FfiConverterBoolean.read(buf), - FfiConverterOptionalULong.read(buf), + 5 -> Event.PaymentForwarded( + FfiConverterTypeChannelId.read(buf), + FfiConverterTypeChannelId.read(buf), + FfiConverterOptionalTypeUserChannelId.read(buf), + FfiConverterOptionalTypeUserChannelId.read(buf), + FfiConverterOptionalTypePublicKey.read(buf), + FfiConverterOptionalTypePublicKey.read(buf), + FfiConverterOptionalULong.read(buf), + FfiConverterOptionalULong.read(buf), + FfiConverterBoolean.read(buf), + FfiConverterOptionalULong.read(buf), ) - 6 -> - Event.ChannelPending( - FfiConverterTypeChannelId.read(buf), - FfiConverterTypeUserChannelId.read(buf), - FfiConverterTypeChannelId.read(buf), - FfiConverterTypePublicKey.read(buf), - FfiConverterTypeOutPoint.read(buf), + 6 -> Event.ChannelPending( + FfiConverterTypeChannelId.read(buf), + FfiConverterTypeUserChannelId.read(buf), + FfiConverterTypeChannelId.read(buf), + FfiConverterTypePublicKey.read(buf), + FfiConverterTypeOutPoint.read(buf), ) - 7 -> - Event.ChannelReady( - FfiConverterTypeChannelId.read(buf), - FfiConverterTypeUserChannelId.read(buf), - FfiConverterOptionalTypePublicKey.read(buf), + 7 -> Event.ChannelReady( + FfiConverterTypeChannelId.read(buf), + FfiConverterTypeUserChannelId.read(buf), + FfiConverterOptionalTypePublicKey.read(buf), ) - 8 -> - Event.ChannelClosed( - FfiConverterTypeChannelId.read(buf), - FfiConverterTypeUserChannelId.read(buf), - FfiConverterOptionalTypePublicKey.read(buf), - FfiConverterOptionalTypeClosureReason.read(buf), + 8 -> Event.ChannelClosed( + FfiConverterTypeChannelId.read(buf), + FfiConverterTypeUserChannelId.read(buf), + FfiConverterOptionalTypePublicKey.read(buf), + FfiConverterOptionalTypeClosureReason.read(buf), ) else -> throw RuntimeException("invalid enum value, something is very wrong!!") } + } - override fun allocationSize(value: Event) = - when (value) { - is Event.PaymentSuccessful -> { - // Add the size for the Int that specifies the variant plus the size needed for all fields - ( - 4UL + - FfiConverterOptionalTypePaymentId.allocationSize(value.`paymentId`) + - FfiConverterTypePaymentHash.allocationSize(value.`paymentHash`) + - FfiConverterOptionalTypePaymentPreimage.allocationSize(value.`paymentPreimage`) + - FfiConverterOptionalULong.allocationSize(value.`feePaidMsat`) - ) - } - is Event.PaymentFailed -> { - // Add the size for the Int that specifies the variant plus the size needed for all fields - ( - 4UL + - FfiConverterOptionalTypePaymentId.allocationSize(value.`paymentId`) + - FfiConverterOptionalTypePaymentHash.allocationSize(value.`paymentHash`) + - FfiConverterOptionalTypePaymentFailureReason.allocationSize(value.`reason`) - ) - } - is Event.PaymentReceived -> { - // Add the size for the Int that specifies the variant plus the size needed for all fields - ( - 4UL + - FfiConverterOptionalTypePaymentId.allocationSize(value.`paymentId`) + - FfiConverterTypePaymentHash.allocationSize(value.`paymentHash`) + - FfiConverterULong.allocationSize(value.`amountMsat`) + - FfiConverterSequenceTypeCustomTlvRecord.allocationSize(value.`customRecords`) - ) - } - is Event.PaymentClaimable -> { - // Add the size for the Int that specifies the variant plus the size needed for all fields - ( - 4UL + - FfiConverterTypePaymentId.allocationSize(value.`paymentId`) + - FfiConverterTypePaymentHash.allocationSize(value.`paymentHash`) + - FfiConverterULong.allocationSize(value.`claimableAmountMsat`) + - FfiConverterOptionalUInt.allocationSize(value.`claimDeadline`) + - FfiConverterSequenceTypeCustomTlvRecord.allocationSize(value.`customRecords`) - ) - } - is Event.PaymentForwarded -> { - // Add the size for the Int that specifies the variant plus the size needed for all fields - ( - 4UL + - FfiConverterTypeChannelId.allocationSize(value.`prevChannelId`) + - FfiConverterTypeChannelId.allocationSize(value.`nextChannelId`) + - FfiConverterOptionalTypeUserChannelId.allocationSize(value.`prevUserChannelId`) + - FfiConverterOptionalTypeUserChannelId.allocationSize(value.`nextUserChannelId`) + - FfiConverterOptionalTypePublicKey.allocationSize(value.`prevNodeId`) + - FfiConverterOptionalTypePublicKey.allocationSize(value.`nextNodeId`) + - FfiConverterOptionalULong.allocationSize(value.`totalFeeEarnedMsat`) + - FfiConverterOptionalULong.allocationSize(value.`skimmedFeeMsat`) + - FfiConverterBoolean.allocationSize(value.`claimFromOnchainTx`) + - FfiConverterOptionalULong.allocationSize(value.`outboundAmountForwardedMsat`) - ) - } - is Event.ChannelPending -> { - // Add the size for the Int that specifies the variant plus the size needed for all fields - ( - 4UL + - FfiConverterTypeChannelId.allocationSize(value.`channelId`) + - FfiConverterTypeUserChannelId.allocationSize(value.`userChannelId`) + - FfiConverterTypeChannelId.allocationSize(value.`formerTemporaryChannelId`) + - FfiConverterTypePublicKey.allocationSize(value.`counterpartyNodeId`) + - FfiConverterTypeOutPoint.allocationSize(value.`fundingTxo`) - ) - } - is Event.ChannelReady -> { - // Add the size for the Int that specifies the variant plus the size needed for all fields - ( - 4UL + - FfiConverterTypeChannelId.allocationSize(value.`channelId`) + - FfiConverterTypeUserChannelId.allocationSize(value.`userChannelId`) + - FfiConverterOptionalTypePublicKey.allocationSize(value.`counterpartyNodeId`) - ) - } - is Event.ChannelClosed -> { - // Add the size for the Int that specifies the variant plus the size needed for all fields - ( - 4UL + - FfiConverterTypeChannelId.allocationSize(value.`channelId`) + - FfiConverterTypeUserChannelId.allocationSize(value.`userChannelId`) + - FfiConverterOptionalTypePublicKey.allocationSize(value.`counterpartyNodeId`) + - FfiConverterOptionalTypeClosureReason.allocationSize(value.`reason`) - ) - } + override fun allocationSize(value: Event) = when(value) { + is Event.PaymentSuccessful -> { + // Add the size for the Int that specifies the variant plus the size needed for all fields + ( + 4UL + + FfiConverterOptionalTypePaymentId.allocationSize(value.`paymentId`) + + FfiConverterTypePaymentHash.allocationSize(value.`paymentHash`) + + FfiConverterOptionalTypePaymentPreimage.allocationSize(value.`paymentPreimage`) + + FfiConverterOptionalULong.allocationSize(value.`feePaidMsat`) + ) + } + is Event.PaymentFailed -> { + // Add the size for the Int that specifies the variant plus the size needed for all fields + ( + 4UL + + FfiConverterOptionalTypePaymentId.allocationSize(value.`paymentId`) + + FfiConverterOptionalTypePaymentHash.allocationSize(value.`paymentHash`) + + FfiConverterOptionalTypePaymentFailureReason.allocationSize(value.`reason`) + ) + } + is Event.PaymentReceived -> { + // Add the size for the Int that specifies the variant plus the size needed for all fields + ( + 4UL + + FfiConverterOptionalTypePaymentId.allocationSize(value.`paymentId`) + + FfiConverterTypePaymentHash.allocationSize(value.`paymentHash`) + + FfiConverterULong.allocationSize(value.`amountMsat`) + + FfiConverterSequenceTypeCustomTlvRecord.allocationSize(value.`customRecords`) + ) + } + is Event.PaymentClaimable -> { + // Add the size for the Int that specifies the variant plus the size needed for all fields + ( + 4UL + + FfiConverterTypePaymentId.allocationSize(value.`paymentId`) + + FfiConverterTypePaymentHash.allocationSize(value.`paymentHash`) + + FfiConverterULong.allocationSize(value.`claimableAmountMsat`) + + FfiConverterOptionalUInt.allocationSize(value.`claimDeadline`) + + FfiConverterSequenceTypeCustomTlvRecord.allocationSize(value.`customRecords`) + ) + } + is Event.PaymentForwarded -> { + // Add the size for the Int that specifies the variant plus the size needed for all fields + ( + 4UL + + FfiConverterTypeChannelId.allocationSize(value.`prevChannelId`) + + FfiConverterTypeChannelId.allocationSize(value.`nextChannelId`) + + FfiConverterOptionalTypeUserChannelId.allocationSize(value.`prevUserChannelId`) + + FfiConverterOptionalTypeUserChannelId.allocationSize(value.`nextUserChannelId`) + + FfiConverterOptionalTypePublicKey.allocationSize(value.`prevNodeId`) + + FfiConverterOptionalTypePublicKey.allocationSize(value.`nextNodeId`) + + FfiConverterOptionalULong.allocationSize(value.`totalFeeEarnedMsat`) + + FfiConverterOptionalULong.allocationSize(value.`skimmedFeeMsat`) + + FfiConverterBoolean.allocationSize(value.`claimFromOnchainTx`) + + FfiConverterOptionalULong.allocationSize(value.`outboundAmountForwardedMsat`) + ) + } + is Event.ChannelPending -> { + // Add the size for the Int that specifies the variant plus the size needed for all fields + ( + 4UL + + FfiConverterTypeChannelId.allocationSize(value.`channelId`) + + FfiConverterTypeUserChannelId.allocationSize(value.`userChannelId`) + + FfiConverterTypeChannelId.allocationSize(value.`formerTemporaryChannelId`) + + FfiConverterTypePublicKey.allocationSize(value.`counterpartyNodeId`) + + FfiConverterTypeOutPoint.allocationSize(value.`fundingTxo`) + ) + } + is Event.ChannelReady -> { + // Add the size for the Int that specifies the variant plus the size needed for all fields + ( + 4UL + + FfiConverterTypeChannelId.allocationSize(value.`channelId`) + + FfiConverterTypeUserChannelId.allocationSize(value.`userChannelId`) + + FfiConverterOptionalTypePublicKey.allocationSize(value.`counterpartyNodeId`) + ) + } + is Event.ChannelClosed -> { + // Add the size for the Int that specifies the variant plus the size needed for all fields + ( + 4UL + + FfiConverterTypeChannelId.allocationSize(value.`channelId`) + + FfiConverterTypeUserChannelId.allocationSize(value.`userChannelId`) + + FfiConverterOptionalTypePublicKey.allocationSize(value.`counterpartyNodeId`) + + FfiConverterOptionalTypeClosureReason.allocationSize(value.`reason`) + ) } + } - override fun write( - value: Event, - buf: ByteBuffer, - ) { - when (value) { + override fun write(value: Event, buf: ByteBuffer) { + when(value) { is Event.PaymentSuccessful -> { buf.putInt(1) FfiConverterOptionalTypePaymentId.write(value.`paymentId`, buf) @@ -10033,208 +9366,200 @@ public object FfiConverterTypeEvent : FfiConverterRustBuffer { } } + + + + sealed class LightningBalance { + data class ClaimableOnChannelClose( - val `channelId`: ChannelId, - val `counterpartyNodeId`: PublicKey, - val `amountSatoshis`: kotlin.ULong, - val `transactionFeeSatoshis`: kotlin.ULong, - val `outboundPaymentHtlcRoundedMsat`: kotlin.ULong, - val `outboundForwardedHtlcRoundedMsat`: kotlin.ULong, - val `inboundClaimingHtlcRoundedMsat`: kotlin.ULong, - val `inboundHtlcRoundedMsat`: kotlin.ULong, - ) : LightningBalance() { + val `channelId`: ChannelId, + val `counterpartyNodeId`: PublicKey, + val `amountSatoshis`: kotlin.ULong, + val `transactionFeeSatoshis`: kotlin.ULong, + val `outboundPaymentHtlcRoundedMsat`: kotlin.ULong, + val `outboundForwardedHtlcRoundedMsat`: kotlin.ULong, + val `inboundClaimingHtlcRoundedMsat`: kotlin.ULong, + val `inboundHtlcRoundedMsat`: kotlin.ULong) : LightningBalance() { companion object } - + data class ClaimableAwaitingConfirmations( - val `channelId`: ChannelId, - val `counterpartyNodeId`: PublicKey, - val `amountSatoshis`: kotlin.ULong, - val `confirmationHeight`: kotlin.UInt, - val `source`: BalanceSource, - ) : LightningBalance() { + val `channelId`: ChannelId, + val `counterpartyNodeId`: PublicKey, + val `amountSatoshis`: kotlin.ULong, + val `confirmationHeight`: kotlin.UInt, + val `source`: BalanceSource) : LightningBalance() { companion object } - + data class ContentiousClaimable( - val `channelId`: ChannelId, - val `counterpartyNodeId`: PublicKey, - val `amountSatoshis`: kotlin.ULong, - val `timeoutHeight`: kotlin.UInt, - val `paymentHash`: PaymentHash, - val `paymentPreimage`: PaymentPreimage, - ) : LightningBalance() { + val `channelId`: ChannelId, + val `counterpartyNodeId`: PublicKey, + val `amountSatoshis`: kotlin.ULong, + val `timeoutHeight`: kotlin.UInt, + val `paymentHash`: PaymentHash, + val `paymentPreimage`: PaymentPreimage) : LightningBalance() { companion object } - + data class MaybeTimeoutClaimableHtlc( - val `channelId`: ChannelId, - val `counterpartyNodeId`: PublicKey, - val `amountSatoshis`: kotlin.ULong, - val `claimableHeight`: kotlin.UInt, - val `paymentHash`: PaymentHash, - val `outboundPayment`: kotlin.Boolean, - ) : LightningBalance() { + val `channelId`: ChannelId, + val `counterpartyNodeId`: PublicKey, + val `amountSatoshis`: kotlin.ULong, + val `claimableHeight`: kotlin.UInt, + val `paymentHash`: PaymentHash, + val `outboundPayment`: kotlin.Boolean) : LightningBalance() { companion object } - + data class MaybePreimageClaimableHtlc( - val `channelId`: ChannelId, - val `counterpartyNodeId`: PublicKey, - val `amountSatoshis`: kotlin.ULong, - val `expiryHeight`: kotlin.UInt, - val `paymentHash`: PaymentHash, - ) : LightningBalance() { + val `channelId`: ChannelId, + val `counterpartyNodeId`: PublicKey, + val `amountSatoshis`: kotlin.ULong, + val `expiryHeight`: kotlin.UInt, + val `paymentHash`: PaymentHash) : LightningBalance() { companion object } - + data class CounterpartyRevokedOutputClaimable( - val `channelId`: ChannelId, - val `counterpartyNodeId`: PublicKey, - val `amountSatoshis`: kotlin.ULong, - ) : LightningBalance() { + val `channelId`: ChannelId, + val `counterpartyNodeId`: PublicKey, + val `amountSatoshis`: kotlin.ULong) : LightningBalance() { companion object } + + companion object } -public object FfiConverterTypeLightningBalance : FfiConverterRustBuffer { - override fun read(buf: ByteBuffer): LightningBalance = - when (buf.getInt()) { - 1 -> - LightningBalance.ClaimableOnChannelClose( - FfiConverterTypeChannelId.read(buf), - FfiConverterTypePublicKey.read(buf), - FfiConverterULong.read(buf), - FfiConverterULong.read(buf), - FfiConverterULong.read(buf), - FfiConverterULong.read(buf), - FfiConverterULong.read(buf), - FfiConverterULong.read(buf), +public object FfiConverterTypeLightningBalance : FfiConverterRustBuffer{ + override fun read(buf: ByteBuffer): LightningBalance { + return when(buf.getInt()) { + 1 -> LightningBalance.ClaimableOnChannelClose( + FfiConverterTypeChannelId.read(buf), + FfiConverterTypePublicKey.read(buf), + FfiConverterULong.read(buf), + FfiConverterULong.read(buf), + FfiConverterULong.read(buf), + FfiConverterULong.read(buf), + FfiConverterULong.read(buf), + FfiConverterULong.read(buf), ) - 2 -> - LightningBalance.ClaimableAwaitingConfirmations( - FfiConverterTypeChannelId.read(buf), - FfiConverterTypePublicKey.read(buf), - FfiConverterULong.read(buf), - FfiConverterUInt.read(buf), - FfiConverterTypeBalanceSource.read(buf), + 2 -> LightningBalance.ClaimableAwaitingConfirmations( + FfiConverterTypeChannelId.read(buf), + FfiConverterTypePublicKey.read(buf), + FfiConverterULong.read(buf), + FfiConverterUInt.read(buf), + FfiConverterTypeBalanceSource.read(buf), ) - 3 -> - LightningBalance.ContentiousClaimable( - FfiConverterTypeChannelId.read(buf), - FfiConverterTypePublicKey.read(buf), - FfiConverterULong.read(buf), - FfiConverterUInt.read(buf), - FfiConverterTypePaymentHash.read(buf), - FfiConverterTypePaymentPreimage.read(buf), + 3 -> LightningBalance.ContentiousClaimable( + FfiConverterTypeChannelId.read(buf), + FfiConverterTypePublicKey.read(buf), + FfiConverterULong.read(buf), + FfiConverterUInt.read(buf), + FfiConverterTypePaymentHash.read(buf), + FfiConverterTypePaymentPreimage.read(buf), ) - 4 -> - LightningBalance.MaybeTimeoutClaimableHtlc( - FfiConverterTypeChannelId.read(buf), - FfiConverterTypePublicKey.read(buf), - FfiConverterULong.read(buf), - FfiConverterUInt.read(buf), - FfiConverterTypePaymentHash.read(buf), - FfiConverterBoolean.read(buf), + 4 -> LightningBalance.MaybeTimeoutClaimableHtlc( + FfiConverterTypeChannelId.read(buf), + FfiConverterTypePublicKey.read(buf), + FfiConverterULong.read(buf), + FfiConverterUInt.read(buf), + FfiConverterTypePaymentHash.read(buf), + FfiConverterBoolean.read(buf), ) - 5 -> - LightningBalance.MaybePreimageClaimableHtlc( - FfiConverterTypeChannelId.read(buf), - FfiConverterTypePublicKey.read(buf), - FfiConverterULong.read(buf), - FfiConverterUInt.read(buf), - FfiConverterTypePaymentHash.read(buf), + 5 -> LightningBalance.MaybePreimageClaimableHtlc( + FfiConverterTypeChannelId.read(buf), + FfiConverterTypePublicKey.read(buf), + FfiConverterULong.read(buf), + FfiConverterUInt.read(buf), + FfiConverterTypePaymentHash.read(buf), ) - 6 -> - LightningBalance.CounterpartyRevokedOutputClaimable( - FfiConverterTypeChannelId.read(buf), - FfiConverterTypePublicKey.read(buf), - FfiConverterULong.read(buf), + 6 -> LightningBalance.CounterpartyRevokedOutputClaimable( + FfiConverterTypeChannelId.read(buf), + FfiConverterTypePublicKey.read(buf), + FfiConverterULong.read(buf), ) else -> throw RuntimeException("invalid enum value, something is very wrong!!") } + } - override fun allocationSize(value: LightningBalance) = - when (value) { - is LightningBalance.ClaimableOnChannelClose -> { - // Add the size for the Int that specifies the variant plus the size needed for all fields - ( - 4UL + - FfiConverterTypeChannelId.allocationSize(value.`channelId`) + - FfiConverterTypePublicKey.allocationSize(value.`counterpartyNodeId`) + - FfiConverterULong.allocationSize(value.`amountSatoshis`) + - FfiConverterULong.allocationSize(value.`transactionFeeSatoshis`) + - FfiConverterULong.allocationSize(value.`outboundPaymentHtlcRoundedMsat`) + - FfiConverterULong.allocationSize(value.`outboundForwardedHtlcRoundedMsat`) + - FfiConverterULong.allocationSize(value.`inboundClaimingHtlcRoundedMsat`) + - FfiConverterULong.allocationSize(value.`inboundHtlcRoundedMsat`) - ) - } - is LightningBalance.ClaimableAwaitingConfirmations -> { - // Add the size for the Int that specifies the variant plus the size needed for all fields - ( - 4UL + - FfiConverterTypeChannelId.allocationSize(value.`channelId`) + - FfiConverterTypePublicKey.allocationSize(value.`counterpartyNodeId`) + - FfiConverterULong.allocationSize(value.`amountSatoshis`) + - FfiConverterUInt.allocationSize(value.`confirmationHeight`) + - FfiConverterTypeBalanceSource.allocationSize(value.`source`) - ) - } - is LightningBalance.ContentiousClaimable -> { - // Add the size for the Int that specifies the variant plus the size needed for all fields - ( - 4UL + - FfiConverterTypeChannelId.allocationSize(value.`channelId`) + - FfiConverterTypePublicKey.allocationSize(value.`counterpartyNodeId`) + - FfiConverterULong.allocationSize(value.`amountSatoshis`) + - FfiConverterUInt.allocationSize(value.`timeoutHeight`) + - FfiConverterTypePaymentHash.allocationSize(value.`paymentHash`) + - FfiConverterTypePaymentPreimage.allocationSize(value.`paymentPreimage`) - ) - } - is LightningBalance.MaybeTimeoutClaimableHtlc -> { - // Add the size for the Int that specifies the variant plus the size needed for all fields - ( - 4UL + - FfiConverterTypeChannelId.allocationSize(value.`channelId`) + - FfiConverterTypePublicKey.allocationSize(value.`counterpartyNodeId`) + - FfiConverterULong.allocationSize(value.`amountSatoshis`) + - FfiConverterUInt.allocationSize(value.`claimableHeight`) + - FfiConverterTypePaymentHash.allocationSize(value.`paymentHash`) + - FfiConverterBoolean.allocationSize(value.`outboundPayment`) - ) - } - is LightningBalance.MaybePreimageClaimableHtlc -> { - // Add the size for the Int that specifies the variant plus the size needed for all fields - ( - 4UL + - FfiConverterTypeChannelId.allocationSize(value.`channelId`) + - FfiConverterTypePublicKey.allocationSize(value.`counterpartyNodeId`) + - FfiConverterULong.allocationSize(value.`amountSatoshis`) + - FfiConverterUInt.allocationSize(value.`expiryHeight`) + - FfiConverterTypePaymentHash.allocationSize(value.`paymentHash`) - ) - } - is LightningBalance.CounterpartyRevokedOutputClaimable -> { - // Add the size for the Int that specifies the variant plus the size needed for all fields - ( - 4UL + - FfiConverterTypeChannelId.allocationSize(value.`channelId`) + - FfiConverterTypePublicKey.allocationSize(value.`counterpartyNodeId`) + - FfiConverterULong.allocationSize(value.`amountSatoshis`) - ) - } + override fun allocationSize(value: LightningBalance) = when(value) { + is LightningBalance.ClaimableOnChannelClose -> { + // Add the size for the Int that specifies the variant plus the size needed for all fields + ( + 4UL + + FfiConverterTypeChannelId.allocationSize(value.`channelId`) + + FfiConverterTypePublicKey.allocationSize(value.`counterpartyNodeId`) + + FfiConverterULong.allocationSize(value.`amountSatoshis`) + + FfiConverterULong.allocationSize(value.`transactionFeeSatoshis`) + + FfiConverterULong.allocationSize(value.`outboundPaymentHtlcRoundedMsat`) + + FfiConverterULong.allocationSize(value.`outboundForwardedHtlcRoundedMsat`) + + FfiConverterULong.allocationSize(value.`inboundClaimingHtlcRoundedMsat`) + + FfiConverterULong.allocationSize(value.`inboundHtlcRoundedMsat`) + ) + } + is LightningBalance.ClaimableAwaitingConfirmations -> { + // Add the size for the Int that specifies the variant plus the size needed for all fields + ( + 4UL + + FfiConverterTypeChannelId.allocationSize(value.`channelId`) + + FfiConverterTypePublicKey.allocationSize(value.`counterpartyNodeId`) + + FfiConverterULong.allocationSize(value.`amountSatoshis`) + + FfiConverterUInt.allocationSize(value.`confirmationHeight`) + + FfiConverterTypeBalanceSource.allocationSize(value.`source`) + ) } + is LightningBalance.ContentiousClaimable -> { + // Add the size for the Int that specifies the variant plus the size needed for all fields + ( + 4UL + + FfiConverterTypeChannelId.allocationSize(value.`channelId`) + + FfiConverterTypePublicKey.allocationSize(value.`counterpartyNodeId`) + + FfiConverterULong.allocationSize(value.`amountSatoshis`) + + FfiConverterUInt.allocationSize(value.`timeoutHeight`) + + FfiConverterTypePaymentHash.allocationSize(value.`paymentHash`) + + FfiConverterTypePaymentPreimage.allocationSize(value.`paymentPreimage`) + ) + } + is LightningBalance.MaybeTimeoutClaimableHtlc -> { + // Add the size for the Int that specifies the variant plus the size needed for all fields + ( + 4UL + + FfiConverterTypeChannelId.allocationSize(value.`channelId`) + + FfiConverterTypePublicKey.allocationSize(value.`counterpartyNodeId`) + + FfiConverterULong.allocationSize(value.`amountSatoshis`) + + FfiConverterUInt.allocationSize(value.`claimableHeight`) + + FfiConverterTypePaymentHash.allocationSize(value.`paymentHash`) + + FfiConverterBoolean.allocationSize(value.`outboundPayment`) + ) + } + is LightningBalance.MaybePreimageClaimableHtlc -> { + // Add the size for the Int that specifies the variant plus the size needed for all fields + ( + 4UL + + FfiConverterTypeChannelId.allocationSize(value.`channelId`) + + FfiConverterTypePublicKey.allocationSize(value.`counterpartyNodeId`) + + FfiConverterULong.allocationSize(value.`amountSatoshis`) + + FfiConverterUInt.allocationSize(value.`expiryHeight`) + + FfiConverterTypePaymentHash.allocationSize(value.`paymentHash`) + ) + } + is LightningBalance.CounterpartyRevokedOutputClaimable -> { + // Add the size for the Int that specifies the variant plus the size needed for all fields + ( + 4UL + + FfiConverterTypeChannelId.allocationSize(value.`channelId`) + + FfiConverterTypePublicKey.allocationSize(value.`counterpartyNodeId`) + + FfiConverterULong.allocationSize(value.`amountSatoshis`) + ) + } + } - override fun write( - value: LightningBalance, - buf: ByteBuffer, - ) { - when (value) { + override fun write(value: LightningBalance, buf: ByteBuffer) { + when(value) { is LightningBalance.ClaimableOnChannelClose -> { buf.putInt(1) FfiConverterTypeChannelId.write(value.`channelId`, buf) @@ -10296,89 +9621,90 @@ public object FfiConverterTypeLightningBalance : FfiConverterRustBuffer { - override fun read(buf: ByteBuffer) = - try { - LogLevel.values()[buf.getInt() - 1] - } catch (e: IndexOutOfBoundsException) { - throw RuntimeException("invalid enum value, something is very wrong!!", e) - } + +public object FfiConverterTypeLogLevel: FfiConverterRustBuffer { + override fun read(buf: ByteBuffer) = try { + LogLevel.values()[buf.getInt() - 1] + } catch (e: IndexOutOfBoundsException) { + throw RuntimeException("invalid enum value, something is very wrong!!", e) + } override fun allocationSize(value: LogLevel) = 4UL - override fun write( - value: LogLevel, - buf: ByteBuffer, - ) { + override fun write(value: LogLevel, buf: ByteBuffer) { buf.putInt(value.ordinal + 1) } } + + + + sealed class MaxDustHtlcExposure { + data class FixedLimit( - val `limitMsat`: kotlin.ULong, - ) : MaxDustHtlcExposure() { + val `limitMsat`: kotlin.ULong) : MaxDustHtlcExposure() { companion object } - + data class FeeRateMultiplier( - val `multiplier`: kotlin.ULong, - ) : MaxDustHtlcExposure() { + val `multiplier`: kotlin.ULong) : MaxDustHtlcExposure() { companion object } + + companion object } -public object FfiConverterTypeMaxDustHTLCExposure : FfiConverterRustBuffer { - override fun read(buf: ByteBuffer): MaxDustHtlcExposure = - when (buf.getInt()) { - 1 -> - MaxDustHtlcExposure.FixedLimit( - FfiConverterULong.read(buf), +public object FfiConverterTypeMaxDustHTLCExposure : FfiConverterRustBuffer{ + override fun read(buf: ByteBuffer): MaxDustHtlcExposure { + return when(buf.getInt()) { + 1 -> MaxDustHtlcExposure.FixedLimit( + FfiConverterULong.read(buf), ) - 2 -> - MaxDustHtlcExposure.FeeRateMultiplier( - FfiConverterULong.read(buf), + 2 -> MaxDustHtlcExposure.FeeRateMultiplier( + FfiConverterULong.read(buf), ) else -> throw RuntimeException("invalid enum value, something is very wrong!!") } + } - override fun allocationSize(value: MaxDustHtlcExposure) = - when (value) { - is MaxDustHtlcExposure.FixedLimit -> { - // Add the size for the Int that specifies the variant plus the size needed for all fields - ( - 4UL + - FfiConverterULong.allocationSize(value.`limitMsat`) - ) - } - is MaxDustHtlcExposure.FeeRateMultiplier -> { - // Add the size for the Int that specifies the variant plus the size needed for all fields - ( - 4UL + - FfiConverterULong.allocationSize(value.`multiplier`) - ) - } + override fun allocationSize(value: MaxDustHtlcExposure) = when(value) { + is MaxDustHtlcExposure.FixedLimit -> { + // Add the size for the Int that specifies the variant plus the size needed for all fields + ( + 4UL + + FfiConverterULong.allocationSize(value.`limitMsat`) + ) } + is MaxDustHtlcExposure.FeeRateMultiplier -> { + // Add the size for the Int that specifies the variant plus the size needed for all fields + ( + 4UL + + FfiConverterULong.allocationSize(value.`multiplier`) + ) + } + } - override fun write( - value: MaxDustHtlcExposure, - buf: ByteBuffer, - ) { - when (value) { + override fun write(value: MaxDustHtlcExposure, buf: ByteBuffer) { + when(value) { is MaxDustHtlcExposure.FixedLimit -> { buf.putInt(1) FfiConverterULong.write(value.`limitMsat`, buf) @@ -10393,51 +9719,54 @@ public object FfiConverterTypeMaxDustHTLCExposure : FfiConverterRustBuffer { - override fun read(buf: ByteBuffer): MaxTotalRoutingFeeLimit = - when (buf.getInt()) { +public object FfiConverterTypeMaxTotalRoutingFeeLimit : FfiConverterRustBuffer{ + override fun read(buf: ByteBuffer): MaxTotalRoutingFeeLimit { + return when(buf.getInt()) { 1 -> MaxTotalRoutingFeeLimit.None - 2 -> - MaxTotalRoutingFeeLimit.Some( - FfiConverterULong.read(buf), + 2 -> MaxTotalRoutingFeeLimit.Some( + FfiConverterULong.read(buf), ) else -> throw RuntimeException("invalid enum value, something is very wrong!!") } + } - override fun allocationSize(value: MaxTotalRoutingFeeLimit) = - when (value) { - is MaxTotalRoutingFeeLimit.None -> { - // Add the size for the Int that specifies the variant plus the size needed for all fields - ( - 4UL - ) - } - is MaxTotalRoutingFeeLimit.Some -> { - // Add the size for the Int that specifies the variant plus the size needed for all fields - ( - 4UL + - FfiConverterULong.allocationSize(value.`amountMsat`) - ) - } + override fun allocationSize(value: MaxTotalRoutingFeeLimit) = when(value) { + is MaxTotalRoutingFeeLimit.None -> { + // Add the size for the Int that specifies the variant plus the size needed for all fields + ( + 4UL + ) } + is MaxTotalRoutingFeeLimit.Some -> { + // Add the size for the Int that specifies the variant plus the size needed for all fields + ( + 4UL + + FfiConverterULong.allocationSize(value.`amountMsat`) + ) + } + } - override fun write( - value: MaxTotalRoutingFeeLimit, - buf: ByteBuffer, - ) { - when (value) { + override fun write(value: MaxTotalRoutingFeeLimit, buf: ByteBuffer) { + when(value) { is MaxTotalRoutingFeeLimit.None -> { buf.putInt(1) Unit @@ -10451,264 +9780,159 @@ public object FfiConverterTypeMaxTotalRoutingFeeLimit : FfiConverterRustBuffer { - override fun read(buf: ByteBuffer) = - try { - Network.values()[buf.getInt() - 1] - } catch (e: IndexOutOfBoundsException) { - throw RuntimeException("invalid enum value, something is very wrong!!", e) - } + +public object FfiConverterTypeNetwork: FfiConverterRustBuffer { + override fun read(buf: ByteBuffer) = try { + Network.values()[buf.getInt() - 1] + } catch (e: IndexOutOfBoundsException) { + throw RuntimeException("invalid enum value, something is very wrong!!", e) + } override fun allocationSize(value: Network) = 4UL - override fun write( - value: Network, - buf: ByteBuffer, - ) { + override fun write(value: Network, buf: ByteBuffer) { buf.putInt(value.ordinal + 1) } } -sealed class NodeException( - message: String, -) : Exception(message) { - class AlreadyRunning( - message: String, - ) : NodeException(message) - - class NotRunning( - message: String, - ) : NodeException(message) - - class OnchainTxCreationFailed( - message: String, - ) : NodeException(message) - - class ConnectionFailed( - message: String, - ) : NodeException(message) - - class InvoiceCreationFailed( - message: String, - ) : NodeException(message) - - class InvoiceRequestCreationFailed( - message: String, - ) : NodeException(message) - - class OfferCreationFailed( - message: String, - ) : NodeException(message) - - class RefundCreationFailed( - message: String, - ) : NodeException(message) - - class PaymentSendingFailed( - message: String, - ) : NodeException(message) - - class InvalidCustomTlvs( - message: String, - ) : NodeException(message) - - class ProbeSendingFailed( - message: String, - ) : NodeException(message) - - class ChannelCreationFailed( - message: String, - ) : NodeException(message) - - class ChannelClosingFailed( - message: String, - ) : NodeException(message) - - class ChannelConfigUpdateFailed( - message: String, - ) : NodeException(message) - - class PersistenceFailed( - message: String, - ) : NodeException(message) - - class FeerateEstimationUpdateFailed( - message: String, - ) : NodeException(message) - - class FeerateEstimationUpdateTimeout( - message: String, - ) : NodeException(message) - - class WalletOperationFailed( - message: String, - ) : NodeException(message) - - class WalletOperationTimeout( - message: String, - ) : NodeException(message) - - class OnchainTxSigningFailed( - message: String, - ) : NodeException(message) - - class TxSyncFailed( - message: String, - ) : NodeException(message) - - class TxSyncTimeout( - message: String, - ) : NodeException(message) - - class GossipUpdateFailed( - message: String, - ) : NodeException(message) - - class GossipUpdateTimeout( - message: String, - ) : NodeException(message) - - class LiquidityRequestFailed( - message: String, - ) : NodeException(message) - - class UriParameterParsingFailed( - message: String, - ) : NodeException(message) - - class InvalidAddress( - message: String, - ) : NodeException(message) - - class InvalidSocketAddress( - message: String, - ) : NodeException(message) - - class InvalidPublicKey( - message: String, - ) : NodeException(message) - - class InvalidSecretKey( - message: String, - ) : NodeException(message) - - class InvalidOfferId( - message: String, - ) : NodeException(message) - - class InvalidNodeId( - message: String, - ) : NodeException(message) - - class InvalidPaymentId( - message: String, - ) : NodeException(message) - - class InvalidPaymentHash( - message: String, - ) : NodeException(message) - - class InvalidPaymentPreimage( - message: String, - ) : NodeException(message) - - class InvalidPaymentSecret( - message: String, - ) : NodeException(message) - - class InvalidAmount( - message: String, - ) : NodeException(message) - - class InvalidInvoice( - message: String, - ) : NodeException(message) - - class InvalidOffer( - message: String, - ) : NodeException(message) - - class InvalidRefund( - message: String, - ) : NodeException(message) - - class InvalidChannelId( - message: String, - ) : NodeException(message) - - class InvalidNetwork( - message: String, - ) : NodeException(message) - - class InvalidUri( - message: String, - ) : NodeException(message) - - class InvalidQuantity( - message: String, - ) : NodeException(message) - - class InvalidNodeAlias( - message: String, - ) : NodeException(message) - - class InvalidDateTime( - message: String, - ) : NodeException(message) - - class InvalidFeeRate( - message: String, - ) : NodeException(message) - - class DuplicatePayment( - message: String, - ) : NodeException(message) - - class UnsupportedCurrency( - message: String, - ) : NodeException(message) - - class InsufficientFunds( - message: String, - ) : NodeException(message) - - class LiquiditySourceUnavailable( - message: String, - ) : NodeException(message) - class LiquidityFeeTooHigh( - message: String, - ) : NodeException(message) - class CannotRbfFundingTransaction( - message: String, - ) : NodeException(message) - class TransactionNotFound( - message: String, - ) : NodeException(message) - class TransactionAlreadyConfirmed( - message: String, - ) : NodeException(message) - class NoSpendableOutputs( - message: String, - ) : NodeException(message) - class CoinSelectionFailed( - message: String, - ) : NodeException(message) +sealed class NodeException(message: String): Exception(message) { + + class AlreadyRunning(message: String) : NodeException(message) + + class NotRunning(message: String) : NodeException(message) + + class OnchainTxCreationFailed(message: String) : NodeException(message) + + class ConnectionFailed(message: String) : NodeException(message) + + class InvoiceCreationFailed(message: String) : NodeException(message) + + class InvoiceRequestCreationFailed(message: String) : NodeException(message) + + class OfferCreationFailed(message: String) : NodeException(message) + + class RefundCreationFailed(message: String) : NodeException(message) + + class PaymentSendingFailed(message: String) : NodeException(message) + + class InvalidCustomTlvs(message: String) : NodeException(message) + + class ProbeSendingFailed(message: String) : NodeException(message) + + class RouteNotFound(message: String) : NodeException(message) + + class ChannelCreationFailed(message: String) : NodeException(message) + + class ChannelClosingFailed(message: String) : NodeException(message) + + class ChannelConfigUpdateFailed(message: String) : NodeException(message) + + class PersistenceFailed(message: String) : NodeException(message) + + class FeerateEstimationUpdateFailed(message: String) : NodeException(message) + + class FeerateEstimationUpdateTimeout(message: String) : NodeException(message) + + class WalletOperationFailed(message: String) : NodeException(message) + + class WalletOperationTimeout(message: String) : NodeException(message) + + class OnchainTxSigningFailed(message: String) : NodeException(message) + + class TxSyncFailed(message: String) : NodeException(message) + + class TxSyncTimeout(message: String) : NodeException(message) + + class GossipUpdateFailed(message: String) : NodeException(message) + + class GossipUpdateTimeout(message: String) : NodeException(message) + + class LiquidityRequestFailed(message: String) : NodeException(message) + + class UriParameterParsingFailed(message: String) : NodeException(message) + + class InvalidAddress(message: String) : NodeException(message) + + class InvalidSocketAddress(message: String) : NodeException(message) + + class InvalidPublicKey(message: String) : NodeException(message) + + class InvalidSecretKey(message: String) : NodeException(message) + + class InvalidOfferId(message: String) : NodeException(message) + + class InvalidNodeId(message: String) : NodeException(message) + + class InvalidPaymentId(message: String) : NodeException(message) + + class InvalidPaymentHash(message: String) : NodeException(message) + + class InvalidPaymentPreimage(message: String) : NodeException(message) + + class InvalidPaymentSecret(message: String) : NodeException(message) + + class InvalidAmount(message: String) : NodeException(message) + + class InvalidInvoice(message: String) : NodeException(message) + + class InvalidOffer(message: String) : NodeException(message) + + class InvalidRefund(message: String) : NodeException(message) + + class InvalidChannelId(message: String) : NodeException(message) + + class InvalidNetwork(message: String) : NodeException(message) + + class InvalidUri(message: String) : NodeException(message) + + class InvalidQuantity(message: String) : NodeException(message) + + class InvalidNodeAlias(message: String) : NodeException(message) + + class InvalidDateTime(message: String) : NodeException(message) + + class InvalidFeeRate(message: String) : NodeException(message) + + class DuplicatePayment(message: String) : NodeException(message) + + class UnsupportedCurrency(message: String) : NodeException(message) + + class InsufficientFunds(message: String) : NodeException(message) + + class LiquiditySourceUnavailable(message: String) : NodeException(message) + + class LiquidityFeeTooHigh(message: String) : NodeException(message) + + class CannotRbfFundingTransaction(message: String) : NodeException(message) + + class TransactionNotFound(message: String) : NodeException(message) + + class TransactionAlreadyConfirmed(message: String) : NodeException(message) + + class NoSpendableOutputs(message: String) : NodeException(message) + + class CoinSelectionFailed(message: String) : NodeException(message) + companion object ErrorHandler : UniffiRustCallStatusErrorHandler { override fun lift(error_buf: RustBuffer.ByValue): NodeException = FfiConverterTypeNodeError.lift(error_buf) @@ -10716,8 +9940,9 @@ sealed class NodeException( } public object FfiConverterTypeNodeError : FfiConverterRustBuffer { - override fun read(buf: ByteBuffer): NodeException = - when (buf.getInt()) { + override fun read(buf: ByteBuffer): NodeException { + + return when(buf.getInt()) { 1 -> NodeException.AlreadyRunning(FfiConverterString.read(buf)) 2 -> NodeException.NotRunning(FfiConverterString.read(buf)) 3 -> NodeException.OnchainTxCreationFailed(FfiConverterString.read(buf)) @@ -10729,62 +9954,64 @@ public object FfiConverterTypeNodeError : FfiConverterRustBuffer 9 -> NodeException.PaymentSendingFailed(FfiConverterString.read(buf)) 10 -> NodeException.InvalidCustomTlvs(FfiConverterString.read(buf)) 11 -> NodeException.ProbeSendingFailed(FfiConverterString.read(buf)) - 12 -> NodeException.ChannelCreationFailed(FfiConverterString.read(buf)) - 13 -> NodeException.ChannelClosingFailed(FfiConverterString.read(buf)) - 14 -> NodeException.ChannelConfigUpdateFailed(FfiConverterString.read(buf)) - 15 -> NodeException.PersistenceFailed(FfiConverterString.read(buf)) - 16 -> NodeException.FeerateEstimationUpdateFailed(FfiConverterString.read(buf)) - 17 -> NodeException.FeerateEstimationUpdateTimeout(FfiConverterString.read(buf)) - 18 -> NodeException.WalletOperationFailed(FfiConverterString.read(buf)) - 19 -> NodeException.WalletOperationTimeout(FfiConverterString.read(buf)) - 20 -> NodeException.OnchainTxSigningFailed(FfiConverterString.read(buf)) - 21 -> NodeException.TxSyncFailed(FfiConverterString.read(buf)) - 22 -> NodeException.TxSyncTimeout(FfiConverterString.read(buf)) - 23 -> NodeException.GossipUpdateFailed(FfiConverterString.read(buf)) - 24 -> NodeException.GossipUpdateTimeout(FfiConverterString.read(buf)) - 25 -> NodeException.LiquidityRequestFailed(FfiConverterString.read(buf)) - 26 -> NodeException.UriParameterParsingFailed(FfiConverterString.read(buf)) - 27 -> NodeException.InvalidAddress(FfiConverterString.read(buf)) - 28 -> NodeException.InvalidSocketAddress(FfiConverterString.read(buf)) - 29 -> NodeException.InvalidPublicKey(FfiConverterString.read(buf)) - 30 -> NodeException.InvalidSecretKey(FfiConverterString.read(buf)) - 31 -> NodeException.InvalidOfferId(FfiConverterString.read(buf)) - 32 -> NodeException.InvalidNodeId(FfiConverterString.read(buf)) - 33 -> NodeException.InvalidPaymentId(FfiConverterString.read(buf)) - 34 -> NodeException.InvalidPaymentHash(FfiConverterString.read(buf)) - 35 -> NodeException.InvalidPaymentPreimage(FfiConverterString.read(buf)) - 36 -> NodeException.InvalidPaymentSecret(FfiConverterString.read(buf)) - 37 -> NodeException.InvalidAmount(FfiConverterString.read(buf)) - 38 -> NodeException.InvalidInvoice(FfiConverterString.read(buf)) - 39 -> NodeException.InvalidOffer(FfiConverterString.read(buf)) - 40 -> NodeException.InvalidRefund(FfiConverterString.read(buf)) - 41 -> NodeException.InvalidChannelId(FfiConverterString.read(buf)) - 42 -> NodeException.InvalidNetwork(FfiConverterString.read(buf)) - 43 -> NodeException.InvalidUri(FfiConverterString.read(buf)) - 44 -> NodeException.InvalidQuantity(FfiConverterString.read(buf)) - 45 -> NodeException.InvalidNodeAlias(FfiConverterString.read(buf)) - 46 -> NodeException.InvalidDateTime(FfiConverterString.read(buf)) - 47 -> NodeException.InvalidFeeRate(FfiConverterString.read(buf)) - 48 -> NodeException.DuplicatePayment(FfiConverterString.read(buf)) - 49 -> NodeException.UnsupportedCurrency(FfiConverterString.read(buf)) - 50 -> NodeException.InsufficientFunds(FfiConverterString.read(buf)) - 51 -> NodeException.LiquiditySourceUnavailable(FfiConverterString.read(buf)) - 52 -> NodeException.LiquidityFeeTooHigh(FfiConverterString.read(buf)) - 53 -> NodeException.CannotRbfFundingTransaction(FfiConverterString.read(buf)) - 54 -> NodeException.TransactionNotFound(FfiConverterString.read(buf)) - 55 -> NodeException.TransactionAlreadyConfirmed(FfiConverterString.read(buf)) - 56 -> NodeException.NoSpendableOutputs(FfiConverterString.read(buf)) - 57 -> NodeException.CoinSelectionFailed(FfiConverterString.read(buf)) + 12 -> NodeException.RouteNotFound(FfiConverterString.read(buf)) + 13 -> NodeException.ChannelCreationFailed(FfiConverterString.read(buf)) + 14 -> NodeException.ChannelClosingFailed(FfiConverterString.read(buf)) + 15 -> NodeException.ChannelConfigUpdateFailed(FfiConverterString.read(buf)) + 16 -> NodeException.PersistenceFailed(FfiConverterString.read(buf)) + 17 -> NodeException.FeerateEstimationUpdateFailed(FfiConverterString.read(buf)) + 18 -> NodeException.FeerateEstimationUpdateTimeout(FfiConverterString.read(buf)) + 19 -> NodeException.WalletOperationFailed(FfiConverterString.read(buf)) + 20 -> NodeException.WalletOperationTimeout(FfiConverterString.read(buf)) + 21 -> NodeException.OnchainTxSigningFailed(FfiConverterString.read(buf)) + 22 -> NodeException.TxSyncFailed(FfiConverterString.read(buf)) + 23 -> NodeException.TxSyncTimeout(FfiConverterString.read(buf)) + 24 -> NodeException.GossipUpdateFailed(FfiConverterString.read(buf)) + 25 -> NodeException.GossipUpdateTimeout(FfiConverterString.read(buf)) + 26 -> NodeException.LiquidityRequestFailed(FfiConverterString.read(buf)) + 27 -> NodeException.UriParameterParsingFailed(FfiConverterString.read(buf)) + 28 -> NodeException.InvalidAddress(FfiConverterString.read(buf)) + 29 -> NodeException.InvalidSocketAddress(FfiConverterString.read(buf)) + 30 -> NodeException.InvalidPublicKey(FfiConverterString.read(buf)) + 31 -> NodeException.InvalidSecretKey(FfiConverterString.read(buf)) + 32 -> NodeException.InvalidOfferId(FfiConverterString.read(buf)) + 33 -> NodeException.InvalidNodeId(FfiConverterString.read(buf)) + 34 -> NodeException.InvalidPaymentId(FfiConverterString.read(buf)) + 35 -> NodeException.InvalidPaymentHash(FfiConverterString.read(buf)) + 36 -> NodeException.InvalidPaymentPreimage(FfiConverterString.read(buf)) + 37 -> NodeException.InvalidPaymentSecret(FfiConverterString.read(buf)) + 38 -> NodeException.InvalidAmount(FfiConverterString.read(buf)) + 39 -> NodeException.InvalidInvoice(FfiConverterString.read(buf)) + 40 -> NodeException.InvalidOffer(FfiConverterString.read(buf)) + 41 -> NodeException.InvalidRefund(FfiConverterString.read(buf)) + 42 -> NodeException.InvalidChannelId(FfiConverterString.read(buf)) + 43 -> NodeException.InvalidNetwork(FfiConverterString.read(buf)) + 44 -> NodeException.InvalidUri(FfiConverterString.read(buf)) + 45 -> NodeException.InvalidQuantity(FfiConverterString.read(buf)) + 46 -> NodeException.InvalidNodeAlias(FfiConverterString.read(buf)) + 47 -> NodeException.InvalidDateTime(FfiConverterString.read(buf)) + 48 -> NodeException.InvalidFeeRate(FfiConverterString.read(buf)) + 49 -> NodeException.DuplicatePayment(FfiConverterString.read(buf)) + 50 -> NodeException.UnsupportedCurrency(FfiConverterString.read(buf)) + 51 -> NodeException.InsufficientFunds(FfiConverterString.read(buf)) + 52 -> NodeException.LiquiditySourceUnavailable(FfiConverterString.read(buf)) + 53 -> NodeException.LiquidityFeeTooHigh(FfiConverterString.read(buf)) + 54 -> NodeException.CannotRbfFundingTransaction(FfiConverterString.read(buf)) + 55 -> NodeException.TransactionNotFound(FfiConverterString.read(buf)) + 56 -> NodeException.TransactionAlreadyConfirmed(FfiConverterString.read(buf)) + 57 -> NodeException.NoSpendableOutputs(FfiConverterString.read(buf)) + 58 -> NodeException.CoinSelectionFailed(FfiConverterString.read(buf)) else -> throw RuntimeException("invalid error enum value, something is very wrong!!") } + + } - override fun allocationSize(value: NodeException): ULong = 4UL + override fun allocationSize(value: NodeException): ULong { + return 4UL + } - override fun write( - value: NodeException, - buf: ByteBuffer, - ) { - when (value) { + override fun write(value: NodeException, buf: ByteBuffer) { + when(value) { is NodeException.AlreadyRunning -> { buf.putInt(1) Unit @@ -10829,221 +10056,231 @@ public object FfiConverterTypeNodeError : FfiConverterRustBuffer buf.putInt(11) Unit } - is NodeException.ChannelCreationFailed -> { + is NodeException.RouteNotFound -> { buf.putInt(12) Unit } - is NodeException.ChannelClosingFailed -> { + is NodeException.ChannelCreationFailed -> { buf.putInt(13) Unit } - is NodeException.ChannelConfigUpdateFailed -> { + is NodeException.ChannelClosingFailed -> { buf.putInt(14) Unit } - is NodeException.PersistenceFailed -> { + is NodeException.ChannelConfigUpdateFailed -> { buf.putInt(15) Unit } - is NodeException.FeerateEstimationUpdateFailed -> { + is NodeException.PersistenceFailed -> { buf.putInt(16) Unit } - is NodeException.FeerateEstimationUpdateTimeout -> { + is NodeException.FeerateEstimationUpdateFailed -> { buf.putInt(17) Unit } - is NodeException.WalletOperationFailed -> { + is NodeException.FeerateEstimationUpdateTimeout -> { buf.putInt(18) Unit } - is NodeException.WalletOperationTimeout -> { + is NodeException.WalletOperationFailed -> { buf.putInt(19) Unit } - is NodeException.OnchainTxSigningFailed -> { + is NodeException.WalletOperationTimeout -> { buf.putInt(20) Unit } - is NodeException.TxSyncFailed -> { + is NodeException.OnchainTxSigningFailed -> { buf.putInt(21) Unit } - is NodeException.TxSyncTimeout -> { + is NodeException.TxSyncFailed -> { buf.putInt(22) Unit } - is NodeException.GossipUpdateFailed -> { + is NodeException.TxSyncTimeout -> { buf.putInt(23) Unit } - is NodeException.GossipUpdateTimeout -> { + is NodeException.GossipUpdateFailed -> { buf.putInt(24) Unit } - is NodeException.LiquidityRequestFailed -> { + is NodeException.GossipUpdateTimeout -> { buf.putInt(25) Unit } - is NodeException.UriParameterParsingFailed -> { + is NodeException.LiquidityRequestFailed -> { buf.putInt(26) Unit } - is NodeException.InvalidAddress -> { + is NodeException.UriParameterParsingFailed -> { buf.putInt(27) Unit } - is NodeException.InvalidSocketAddress -> { + is NodeException.InvalidAddress -> { buf.putInt(28) Unit } - is NodeException.InvalidPublicKey -> { + is NodeException.InvalidSocketAddress -> { buf.putInt(29) Unit } - is NodeException.InvalidSecretKey -> { + is NodeException.InvalidPublicKey -> { buf.putInt(30) Unit } - is NodeException.InvalidOfferId -> { + is NodeException.InvalidSecretKey -> { buf.putInt(31) Unit } - is NodeException.InvalidNodeId -> { + is NodeException.InvalidOfferId -> { buf.putInt(32) Unit } - is NodeException.InvalidPaymentId -> { + is NodeException.InvalidNodeId -> { buf.putInt(33) Unit } - is NodeException.InvalidPaymentHash -> { + is NodeException.InvalidPaymentId -> { buf.putInt(34) Unit } - is NodeException.InvalidPaymentPreimage -> { + is NodeException.InvalidPaymentHash -> { buf.putInt(35) Unit } - is NodeException.InvalidPaymentSecret -> { + is NodeException.InvalidPaymentPreimage -> { buf.putInt(36) Unit } - is NodeException.InvalidAmount -> { + is NodeException.InvalidPaymentSecret -> { buf.putInt(37) Unit } - is NodeException.InvalidInvoice -> { + is NodeException.InvalidAmount -> { buf.putInt(38) Unit } - is NodeException.InvalidOffer -> { + is NodeException.InvalidInvoice -> { buf.putInt(39) Unit } - is NodeException.InvalidRefund -> { + is NodeException.InvalidOffer -> { buf.putInt(40) Unit } - is NodeException.InvalidChannelId -> { + is NodeException.InvalidRefund -> { buf.putInt(41) Unit } - is NodeException.InvalidNetwork -> { + is NodeException.InvalidChannelId -> { buf.putInt(42) Unit } - is NodeException.InvalidUri -> { + is NodeException.InvalidNetwork -> { buf.putInt(43) Unit } - is NodeException.InvalidQuantity -> { + is NodeException.InvalidUri -> { buf.putInt(44) Unit } - is NodeException.InvalidNodeAlias -> { + is NodeException.InvalidQuantity -> { buf.putInt(45) Unit } - is NodeException.InvalidDateTime -> { + is NodeException.InvalidNodeAlias -> { buf.putInt(46) Unit } - is NodeException.InvalidFeeRate -> { + is NodeException.InvalidDateTime -> { buf.putInt(47) Unit } - is NodeException.DuplicatePayment -> { + is NodeException.InvalidFeeRate -> { buf.putInt(48) Unit } - is NodeException.UnsupportedCurrency -> { + is NodeException.DuplicatePayment -> { buf.putInt(49) Unit } - is NodeException.InsufficientFunds -> { + is NodeException.UnsupportedCurrency -> { buf.putInt(50) Unit } - is NodeException.LiquiditySourceUnavailable -> { + is NodeException.InsufficientFunds -> { buf.putInt(51) Unit } - is NodeException.LiquidityFeeTooHigh -> { + is NodeException.LiquiditySourceUnavailable -> { buf.putInt(52) Unit } - is NodeException.CannotRbfFundingTransaction -> { + is NodeException.LiquidityFeeTooHigh -> { buf.putInt(53) Unit } - is NodeException.TransactionNotFound -> { + is NodeException.CannotRbfFundingTransaction -> { buf.putInt(54) Unit } - is NodeException.TransactionAlreadyConfirmed -> { + is NodeException.TransactionNotFound -> { buf.putInt(55) Unit } - is NodeException.NoSpendableOutputs -> { + is NodeException.TransactionAlreadyConfirmed -> { buf.putInt(56) Unit } - is NodeException.CoinSelectionFailed -> { + is NodeException.NoSpendableOutputs -> { buf.putInt(57) Unit } + is NodeException.CoinSelectionFailed -> { + buf.putInt(58) + Unit + } }.let { /* this makes the `when` an expression, which ensures it is exhaustive */ } } + } + + + enum class PaymentDirection { + INBOUND, - OUTBOUND, - ; - + OUTBOUND; companion object } -public object FfiConverterTypePaymentDirection : FfiConverterRustBuffer { - override fun read(buf: ByteBuffer) = - try { - PaymentDirection.values()[buf.getInt() - 1] - } catch (e: IndexOutOfBoundsException) { - throw RuntimeException("invalid enum value, something is very wrong!!", e) - } + +public object FfiConverterTypePaymentDirection: FfiConverterRustBuffer { + override fun read(buf: ByteBuffer) = try { + PaymentDirection.values()[buf.getInt() - 1] + } catch (e: IndexOutOfBoundsException) { + throw RuntimeException("invalid enum value, something is very wrong!!", e) + } override fun allocationSize(value: PaymentDirection) = 4UL - override fun write( - value: PaymentDirection, - buf: ByteBuffer, - ) { + override fun write(value: PaymentDirection, buf: ByteBuffer) { buf.putInt(value.ordinal + 1) } } + + + + + enum class PaymentFailureReason { + RECIPIENT_REJECTED, USER_ABANDONED, RETRIES_EXHAUSTED, @@ -11053,214 +10290,201 @@ enum class PaymentFailureReason { UNKNOWN_REQUIRED_FEATURES, INVOICE_REQUEST_EXPIRED, INVOICE_REQUEST_REJECTED, - BLINDED_PATH_CREATION_FAILED, - ; - + BLINDED_PATH_CREATION_FAILED; companion object } -public object FfiConverterTypePaymentFailureReason : FfiConverterRustBuffer { - override fun read(buf: ByteBuffer) = - try { - PaymentFailureReason.values()[buf.getInt() - 1] - } catch (e: IndexOutOfBoundsException) { - throw RuntimeException("invalid enum value, something is very wrong!!", e) - } + +public object FfiConverterTypePaymentFailureReason: FfiConverterRustBuffer { + override fun read(buf: ByteBuffer) = try { + PaymentFailureReason.values()[buf.getInt() - 1] + } catch (e: IndexOutOfBoundsException) { + throw RuntimeException("invalid enum value, something is very wrong!!", e) + } override fun allocationSize(value: PaymentFailureReason) = 4UL - override fun write( - value: PaymentFailureReason, - buf: ByteBuffer, - ) { + override fun write(value: PaymentFailureReason, buf: ByteBuffer) { buf.putInt(value.ordinal + 1) } } + + + + sealed class PaymentKind { + data class Onchain( - val `txid`: Txid, - val `status`: ConfirmationStatus, - ) : PaymentKind() { + val `txid`: Txid, + val `status`: ConfirmationStatus) : PaymentKind() { companion object } - + data class Bolt11( - val `hash`: PaymentHash, - val `preimage`: PaymentPreimage?, - val `secret`: PaymentSecret?, - val `description`: kotlin.String?, - val `bolt11`: kotlin.String?, - ) : PaymentKind() { + val `hash`: PaymentHash, + val `preimage`: PaymentPreimage?, + val `secret`: PaymentSecret?, + val `description`: kotlin.String?, + val `bolt11`: kotlin.String?) : PaymentKind() { companion object } - + data class Bolt11Jit( - val `hash`: PaymentHash, - val `preimage`: PaymentPreimage?, - val `secret`: PaymentSecret?, - val `counterpartySkimmedFeeMsat`: kotlin.ULong?, - val `lspFeeLimits`: LspFeeLimits, - val `description`: kotlin.String?, - val `bolt11`: kotlin.String?, - ) : PaymentKind() { + val `hash`: PaymentHash, + val `preimage`: PaymentPreimage?, + val `secret`: PaymentSecret?, + val `counterpartySkimmedFeeMsat`: kotlin.ULong?, + val `lspFeeLimits`: LspFeeLimits, + val `description`: kotlin.String?, + val `bolt11`: kotlin.String?) : PaymentKind() { companion object } - + data class Bolt12Offer( - val `hash`: PaymentHash?, - val `preimage`: PaymentPreimage?, - val `secret`: PaymentSecret?, - val `offerId`: OfferId, - val `payerNote`: UntrustedString?, - val `quantity`: kotlin.ULong?, - ) : PaymentKind() { + val `hash`: PaymentHash?, + val `preimage`: PaymentPreimage?, + val `secret`: PaymentSecret?, + val `offerId`: OfferId, + val `payerNote`: UntrustedString?, + val `quantity`: kotlin.ULong?) : PaymentKind() { companion object } - + data class Bolt12Refund( - val `hash`: PaymentHash?, - val `preimage`: PaymentPreimage?, - val `secret`: PaymentSecret?, - val `payerNote`: UntrustedString?, - val `quantity`: kotlin.ULong?, - ) : PaymentKind() { + val `hash`: PaymentHash?, + val `preimage`: PaymentPreimage?, + val `secret`: PaymentSecret?, + val `payerNote`: UntrustedString?, + val `quantity`: kotlin.ULong?) : PaymentKind() { companion object } - + data class Spontaneous( - val `hash`: PaymentHash, - val `preimage`: PaymentPreimage?, - ) : PaymentKind() { + val `hash`: PaymentHash, + val `preimage`: PaymentPreimage?) : PaymentKind() { companion object } + + companion object } -public object FfiConverterTypePaymentKind : FfiConverterRustBuffer { - override fun read(buf: ByteBuffer): PaymentKind = - when (buf.getInt()) { - 1 -> - PaymentKind.Onchain( - FfiConverterTypeTxid.read(buf), - FfiConverterTypeConfirmationStatus.read(buf), +public object FfiConverterTypePaymentKind : FfiConverterRustBuffer{ + override fun read(buf: ByteBuffer): PaymentKind { + return when(buf.getInt()) { + 1 -> PaymentKind.Onchain( + FfiConverterTypeTxid.read(buf), + FfiConverterTypeConfirmationStatus.read(buf), ) - 2 -> - PaymentKind.Bolt11( - FfiConverterTypePaymentHash.read(buf), - FfiConverterOptionalTypePaymentPreimage.read(buf), - FfiConverterOptionalTypePaymentSecret.read(buf), - FfiConverterOptionalString.read(buf), - FfiConverterOptionalString.read(buf), + 2 -> PaymentKind.Bolt11( + FfiConverterTypePaymentHash.read(buf), + FfiConverterOptionalTypePaymentPreimage.read(buf), + FfiConverterOptionalTypePaymentSecret.read(buf), + FfiConverterOptionalString.read(buf), + FfiConverterOptionalString.read(buf), ) - 3 -> - PaymentKind.Bolt11Jit( - FfiConverterTypePaymentHash.read(buf), - FfiConverterOptionalTypePaymentPreimage.read(buf), - FfiConverterOptionalTypePaymentSecret.read(buf), - FfiConverterOptionalULong.read(buf), - FfiConverterTypeLSPFeeLimits.read(buf), - FfiConverterOptionalString.read(buf), - FfiConverterOptionalString.read(buf), + 3 -> PaymentKind.Bolt11Jit( + FfiConverterTypePaymentHash.read(buf), + FfiConverterOptionalTypePaymentPreimage.read(buf), + FfiConverterOptionalTypePaymentSecret.read(buf), + FfiConverterOptionalULong.read(buf), + FfiConverterTypeLSPFeeLimits.read(buf), + FfiConverterOptionalString.read(buf), + FfiConverterOptionalString.read(buf), ) - 4 -> - PaymentKind.Bolt12Offer( - FfiConverterOptionalTypePaymentHash.read(buf), - FfiConverterOptionalTypePaymentPreimage.read(buf), - FfiConverterOptionalTypePaymentSecret.read(buf), - FfiConverterTypeOfferId.read(buf), - FfiConverterOptionalTypeUntrustedString.read(buf), - FfiConverterOptionalULong.read(buf), + 4 -> PaymentKind.Bolt12Offer( + FfiConverterOptionalTypePaymentHash.read(buf), + FfiConverterOptionalTypePaymentPreimage.read(buf), + FfiConverterOptionalTypePaymentSecret.read(buf), + FfiConverterTypeOfferId.read(buf), + FfiConverterOptionalTypeUntrustedString.read(buf), + FfiConverterOptionalULong.read(buf), ) - 5 -> - PaymentKind.Bolt12Refund( - FfiConverterOptionalTypePaymentHash.read(buf), - FfiConverterOptionalTypePaymentPreimage.read(buf), - FfiConverterOptionalTypePaymentSecret.read(buf), - FfiConverterOptionalTypeUntrustedString.read(buf), - FfiConverterOptionalULong.read(buf), + 5 -> PaymentKind.Bolt12Refund( + FfiConverterOptionalTypePaymentHash.read(buf), + FfiConverterOptionalTypePaymentPreimage.read(buf), + FfiConverterOptionalTypePaymentSecret.read(buf), + FfiConverterOptionalTypeUntrustedString.read(buf), + FfiConverterOptionalULong.read(buf), ) - 6 -> - PaymentKind.Spontaneous( - FfiConverterTypePaymentHash.read(buf), - FfiConverterOptionalTypePaymentPreimage.read(buf), + 6 -> PaymentKind.Spontaneous( + FfiConverterTypePaymentHash.read(buf), + FfiConverterOptionalTypePaymentPreimage.read(buf), ) else -> throw RuntimeException("invalid enum value, something is very wrong!!") } + } - override fun allocationSize(value: PaymentKind) = - when (value) { - is PaymentKind.Onchain -> { - // Add the size for the Int that specifies the variant plus the size needed for all fields - ( - 4UL + - FfiConverterTypeTxid.allocationSize(value.`txid`) + - FfiConverterTypeConfirmationStatus.allocationSize(value.`status`) - ) - } - is PaymentKind.Bolt11 -> { - // Add the size for the Int that specifies the variant plus the size needed for all fields - ( - 4UL + - FfiConverterTypePaymentHash.allocationSize(value.`hash`) + - FfiConverterOptionalTypePaymentPreimage.allocationSize(value.`preimage`) + - FfiConverterOptionalTypePaymentSecret.allocationSize(value.`secret`) + - FfiConverterOptionalString.allocationSize(value.`description`) + - FfiConverterOptionalString.allocationSize(value.`bolt11`) - ) - } - is PaymentKind.Bolt11Jit -> { - // Add the size for the Int that specifies the variant plus the size needed for all fields - ( - 4UL + - FfiConverterTypePaymentHash.allocationSize(value.`hash`) + - FfiConverterOptionalTypePaymentPreimage.allocationSize(value.`preimage`) + - FfiConverterOptionalTypePaymentSecret.allocationSize(value.`secret`) + - FfiConverterOptionalULong.allocationSize(value.`counterpartySkimmedFeeMsat`) + - FfiConverterTypeLSPFeeLimits.allocationSize(value.`lspFeeLimits`) + - FfiConverterOptionalString.allocationSize(value.`description`) + - FfiConverterOptionalString.allocationSize(value.`bolt11`) - ) - } - is PaymentKind.Bolt12Offer -> { - // Add the size for the Int that specifies the variant plus the size needed for all fields - ( - 4UL + - FfiConverterOptionalTypePaymentHash.allocationSize(value.`hash`) + - FfiConverterOptionalTypePaymentPreimage.allocationSize(value.`preimage`) + - FfiConverterOptionalTypePaymentSecret.allocationSize(value.`secret`) + - FfiConverterTypeOfferId.allocationSize(value.`offerId`) + - FfiConverterOptionalTypeUntrustedString.allocationSize(value.`payerNote`) + - FfiConverterOptionalULong.allocationSize(value.`quantity`) - ) - } - is PaymentKind.Bolt12Refund -> { - // Add the size for the Int that specifies the variant plus the size needed for all fields - ( - 4UL + - FfiConverterOptionalTypePaymentHash.allocationSize(value.`hash`) + - FfiConverterOptionalTypePaymentPreimage.allocationSize(value.`preimage`) + - FfiConverterOptionalTypePaymentSecret.allocationSize(value.`secret`) + - FfiConverterOptionalTypeUntrustedString.allocationSize(value.`payerNote`) + - FfiConverterOptionalULong.allocationSize(value.`quantity`) - ) - } - is PaymentKind.Spontaneous -> { - // Add the size for the Int that specifies the variant plus the size needed for all fields - ( - 4UL + - FfiConverterTypePaymentHash.allocationSize(value.`hash`) + - FfiConverterOptionalTypePaymentPreimage.allocationSize(value.`preimage`) - ) - } + override fun allocationSize(value: PaymentKind) = when(value) { + is PaymentKind.Onchain -> { + // Add the size for the Int that specifies the variant plus the size needed for all fields + ( + 4UL + + FfiConverterTypeTxid.allocationSize(value.`txid`) + + FfiConverterTypeConfirmationStatus.allocationSize(value.`status`) + ) } + is PaymentKind.Bolt11 -> { + // Add the size for the Int that specifies the variant plus the size needed for all fields + ( + 4UL + + FfiConverterTypePaymentHash.allocationSize(value.`hash`) + + FfiConverterOptionalTypePaymentPreimage.allocationSize(value.`preimage`) + + FfiConverterOptionalTypePaymentSecret.allocationSize(value.`secret`) + + FfiConverterOptionalString.allocationSize(value.`description`) + + FfiConverterOptionalString.allocationSize(value.`bolt11`) + ) + } + is PaymentKind.Bolt11Jit -> { + // Add the size for the Int that specifies the variant plus the size needed for all fields + ( + 4UL + + FfiConverterTypePaymentHash.allocationSize(value.`hash`) + + FfiConverterOptionalTypePaymentPreimage.allocationSize(value.`preimage`) + + FfiConverterOptionalTypePaymentSecret.allocationSize(value.`secret`) + + FfiConverterOptionalULong.allocationSize(value.`counterpartySkimmedFeeMsat`) + + FfiConverterTypeLSPFeeLimits.allocationSize(value.`lspFeeLimits`) + + FfiConverterOptionalString.allocationSize(value.`description`) + + FfiConverterOptionalString.allocationSize(value.`bolt11`) + ) + } + is PaymentKind.Bolt12Offer -> { + // Add the size for the Int that specifies the variant plus the size needed for all fields + ( + 4UL + + FfiConverterOptionalTypePaymentHash.allocationSize(value.`hash`) + + FfiConverterOptionalTypePaymentPreimage.allocationSize(value.`preimage`) + + FfiConverterOptionalTypePaymentSecret.allocationSize(value.`secret`) + + FfiConverterTypeOfferId.allocationSize(value.`offerId`) + + FfiConverterOptionalTypeUntrustedString.allocationSize(value.`payerNote`) + + FfiConverterOptionalULong.allocationSize(value.`quantity`) + ) + } + is PaymentKind.Bolt12Refund -> { + // Add the size for the Int that specifies the variant plus the size needed for all fields + ( + 4UL + + FfiConverterOptionalTypePaymentHash.allocationSize(value.`hash`) + + FfiConverterOptionalTypePaymentPreimage.allocationSize(value.`preimage`) + + FfiConverterOptionalTypePaymentSecret.allocationSize(value.`secret`) + + FfiConverterOptionalTypeUntrustedString.allocationSize(value.`payerNote`) + + FfiConverterOptionalULong.allocationSize(value.`quantity`) + ) + } + is PaymentKind.Spontaneous -> { + // Add the size for the Int that specifies the variant plus the size needed for all fields + ( + 4UL + + FfiConverterTypePaymentHash.allocationSize(value.`hash`) + + FfiConverterOptionalTypePaymentPreimage.allocationSize(value.`preimage`) + ) + } + } - override fun write( - value: PaymentKind, - buf: ByteBuffer, - ) { - when (value) { + override fun write(value: PaymentKind, buf: ByteBuffer) { + when(value) { is PaymentKind.Onchain -> { buf.putInt(1) FfiConverterTypeTxid.write(value.`txid`, buf) @@ -11316,154 +10540,154 @@ public object FfiConverterTypePaymentKind : FfiConverterRustBuffer } } + + + + + enum class PaymentState { + EXPECT_PAYMENT, PAID, - REFUNDED, - ; - + REFUNDED; companion object } -public object FfiConverterTypePaymentState : FfiConverterRustBuffer { - override fun read(buf: ByteBuffer) = - try { - PaymentState.values()[buf.getInt() - 1] - } catch (e: IndexOutOfBoundsException) { - throw RuntimeException("invalid enum value, something is very wrong!!", e) - } + +public object FfiConverterTypePaymentState: FfiConverterRustBuffer { + override fun read(buf: ByteBuffer) = try { + PaymentState.values()[buf.getInt() - 1] + } catch (e: IndexOutOfBoundsException) { + throw RuntimeException("invalid enum value, something is very wrong!!", e) + } override fun allocationSize(value: PaymentState) = 4UL - override fun write( - value: PaymentState, - buf: ByteBuffer, - ) { + override fun write(value: PaymentState, buf: ByteBuffer) { buf.putInt(value.ordinal + 1) } } + + + + + enum class PaymentStatus { + PENDING, SUCCEEDED, - FAILED, - ; - + FAILED; companion object } -public object FfiConverterTypePaymentStatus : FfiConverterRustBuffer { - override fun read(buf: ByteBuffer) = - try { - PaymentStatus.values()[buf.getInt() - 1] - } catch (e: IndexOutOfBoundsException) { - throw RuntimeException("invalid enum value, something is very wrong!!", e) - } + +public object FfiConverterTypePaymentStatus: FfiConverterRustBuffer { + override fun read(buf: ByteBuffer) = try { + PaymentStatus.values()[buf.getInt() - 1] + } catch (e: IndexOutOfBoundsException) { + throw RuntimeException("invalid enum value, something is very wrong!!", e) + } override fun allocationSize(value: PaymentStatus) = 4UL - override fun write( - value: PaymentStatus, - buf: ByteBuffer, - ) { + override fun write(value: PaymentStatus, buf: ByteBuffer) { buf.putInt(value.ordinal + 1) } } + + + + sealed class PendingSweepBalance { + data class PendingBroadcast( - val `channelId`: ChannelId?, - val `amountSatoshis`: kotlin.ULong, - ) : PendingSweepBalance() { + val `channelId`: ChannelId?, + val `amountSatoshis`: kotlin.ULong) : PendingSweepBalance() { companion object } - + data class BroadcastAwaitingConfirmation( - val `channelId`: ChannelId?, - val `latestBroadcastHeight`: kotlin.UInt, - val `latestSpendingTxid`: Txid, - val `amountSatoshis`: kotlin.ULong, - ) : PendingSweepBalance() { + val `channelId`: ChannelId?, + val `latestBroadcastHeight`: kotlin.UInt, + val `latestSpendingTxid`: Txid, + val `amountSatoshis`: kotlin.ULong) : PendingSweepBalance() { companion object } - + data class AwaitingThresholdConfirmations( - val `channelId`: ChannelId?, - val `latestSpendingTxid`: Txid, - val `confirmationHash`: BlockHash, - val `confirmationHeight`: kotlin.UInt, - val `amountSatoshis`: kotlin.ULong, - ) : PendingSweepBalance() { + val `channelId`: ChannelId?, + val `latestSpendingTxid`: Txid, + val `confirmationHash`: BlockHash, + val `confirmationHeight`: kotlin.UInt, + val `amountSatoshis`: kotlin.ULong) : PendingSweepBalance() { companion object } + + companion object } -public object FfiConverterTypePendingSweepBalance : FfiConverterRustBuffer { - override fun read(buf: ByteBuffer): PendingSweepBalance = - when (buf.getInt()) { - 1 -> - PendingSweepBalance.PendingBroadcast( - FfiConverterOptionalTypeChannelId.read(buf), - FfiConverterULong.read(buf), +public object FfiConverterTypePendingSweepBalance : FfiConverterRustBuffer{ + override fun read(buf: ByteBuffer): PendingSweepBalance { + return when(buf.getInt()) { + 1 -> PendingSweepBalance.PendingBroadcast( + FfiConverterOptionalTypeChannelId.read(buf), + FfiConverterULong.read(buf), ) - 2 -> - PendingSweepBalance.BroadcastAwaitingConfirmation( - FfiConverterOptionalTypeChannelId.read(buf), - FfiConverterUInt.read(buf), - FfiConverterTypeTxid.read(buf), - FfiConverterULong.read(buf), + 2 -> PendingSweepBalance.BroadcastAwaitingConfirmation( + FfiConverterOptionalTypeChannelId.read(buf), + FfiConverterUInt.read(buf), + FfiConverterTypeTxid.read(buf), + FfiConverterULong.read(buf), ) - 3 -> - PendingSweepBalance.AwaitingThresholdConfirmations( - FfiConverterOptionalTypeChannelId.read(buf), - FfiConverterTypeTxid.read(buf), - FfiConverterTypeBlockHash.read(buf), - FfiConverterUInt.read(buf), - FfiConverterULong.read(buf), + 3 -> PendingSweepBalance.AwaitingThresholdConfirmations( + FfiConverterOptionalTypeChannelId.read(buf), + FfiConverterTypeTxid.read(buf), + FfiConverterTypeBlockHash.read(buf), + FfiConverterUInt.read(buf), + FfiConverterULong.read(buf), ) else -> throw RuntimeException("invalid enum value, something is very wrong!!") } - - override fun allocationSize(value: PendingSweepBalance) = - when (value) { - is PendingSweepBalance.PendingBroadcast -> { - // Add the size for the Int that specifies the variant plus the size needed for all fields - ( - 4UL + - FfiConverterOptionalTypeChannelId.allocationSize(value.`channelId`) + - FfiConverterULong.allocationSize(value.`amountSatoshis`) - ) - } - is PendingSweepBalance.BroadcastAwaitingConfirmation -> { - // Add the size for the Int that specifies the variant plus the size needed for all fields - ( - 4UL + - FfiConverterOptionalTypeChannelId.allocationSize(value.`channelId`) + - FfiConverterUInt.allocationSize(value.`latestBroadcastHeight`) + - FfiConverterTypeTxid.allocationSize(value.`latestSpendingTxid`) + - FfiConverterULong.allocationSize(value.`amountSatoshis`) - ) - } - is PendingSweepBalance.AwaitingThresholdConfirmations -> { - // Add the size for the Int that specifies the variant plus the size needed for all fields - ( - 4UL + - FfiConverterOptionalTypeChannelId.allocationSize(value.`channelId`) + - FfiConverterTypeTxid.allocationSize(value.`latestSpendingTxid`) + - FfiConverterTypeBlockHash.allocationSize(value.`confirmationHash`) + - FfiConverterUInt.allocationSize(value.`confirmationHeight`) + - FfiConverterULong.allocationSize(value.`amountSatoshis`) - ) - } + } + + override fun allocationSize(value: PendingSweepBalance) = when(value) { + is PendingSweepBalance.PendingBroadcast -> { + // Add the size for the Int that specifies the variant plus the size needed for all fields + ( + 4UL + + FfiConverterOptionalTypeChannelId.allocationSize(value.`channelId`) + + FfiConverterULong.allocationSize(value.`amountSatoshis`) + ) + } + is PendingSweepBalance.BroadcastAwaitingConfirmation -> { + // Add the size for the Int that specifies the variant plus the size needed for all fields + ( + 4UL + + FfiConverterOptionalTypeChannelId.allocationSize(value.`channelId`) + + FfiConverterUInt.allocationSize(value.`latestBroadcastHeight`) + + FfiConverterTypeTxid.allocationSize(value.`latestSpendingTxid`) + + FfiConverterULong.allocationSize(value.`amountSatoshis`) + ) } + is PendingSweepBalance.AwaitingThresholdConfirmations -> { + // Add the size for the Int that specifies the variant plus the size needed for all fields + ( + 4UL + + FfiConverterOptionalTypeChannelId.allocationSize(value.`channelId`) + + FfiConverterTypeTxid.allocationSize(value.`latestSpendingTxid`) + + FfiConverterTypeBlockHash.allocationSize(value.`confirmationHash`) + + FfiConverterUInt.allocationSize(value.`confirmationHeight`) + + FfiConverterULong.allocationSize(value.`amountSatoshis`) + ) + } + } - override fun write( - value: PendingSweepBalance, - buf: ByteBuffer, - ) { - when (value) { + override fun write(value: PendingSweepBalance, buf: ByteBuffer) { + when(value) { is PendingSweepBalance.PendingBroadcast -> { buf.putInt(1) FfiConverterOptionalTypeChannelId.write(value.`channelId`, buf) @@ -11491,76 +10715,74 @@ public object FfiConverterTypePendingSweepBalance : FfiConverterRustBuffer { - override fun read(buf: ByteBuffer): QrPaymentResult = - when (buf.getInt()) { - 1 -> - QrPaymentResult.Onchain( - FfiConverterTypeTxid.read(buf), +public object FfiConverterTypeQrPaymentResult : FfiConverterRustBuffer{ + override fun read(buf: ByteBuffer): QrPaymentResult { + return when(buf.getInt()) { + 1 -> QrPaymentResult.Onchain( + FfiConverterTypeTxid.read(buf), ) - 2 -> - QrPaymentResult.Bolt11( - FfiConverterTypePaymentId.read(buf), + 2 -> QrPaymentResult.Bolt11( + FfiConverterTypePaymentId.read(buf), ) - 3 -> - QrPaymentResult.Bolt12( - FfiConverterTypePaymentId.read(buf), + 3 -> QrPaymentResult.Bolt12( + FfiConverterTypePaymentId.read(buf), ) else -> throw RuntimeException("invalid enum value, something is very wrong!!") } + } - override fun allocationSize(value: QrPaymentResult) = - when (value) { - is QrPaymentResult.Onchain -> { - // Add the size for the Int that specifies the variant plus the size needed for all fields - ( - 4UL + - FfiConverterTypeTxid.allocationSize(value.`txid`) - ) - } - is QrPaymentResult.Bolt11 -> { - // Add the size for the Int that specifies the variant plus the size needed for all fields - ( - 4UL + - FfiConverterTypePaymentId.allocationSize(value.`paymentId`) - ) - } - is QrPaymentResult.Bolt12 -> { - // Add the size for the Int that specifies the variant plus the size needed for all fields - ( - 4UL + - FfiConverterTypePaymentId.allocationSize(value.`paymentId`) - ) - } + override fun allocationSize(value: QrPaymentResult) = when(value) { + is QrPaymentResult.Onchain -> { + // Add the size for the Int that specifies the variant plus the size needed for all fields + ( + 4UL + + FfiConverterTypeTxid.allocationSize(value.`txid`) + ) } + is QrPaymentResult.Bolt11 -> { + // Add the size for the Int that specifies the variant plus the size needed for all fields + ( + 4UL + + FfiConverterTypePaymentId.allocationSize(value.`paymentId`) + ) + } + is QrPaymentResult.Bolt12 -> { + // Add the size for the Int that specifies the variant plus the size needed for all fields + ( + 4UL + + FfiConverterTypePaymentId.allocationSize(value.`paymentId`) + ) + } + } - override fun write( - value: QrPaymentResult, - buf: ByteBuffer, - ) { - when (value) { + override fun write(value: QrPaymentResult, buf: ByteBuffer) { + when(value) { is QrPaymentResult.Onchain -> { buf.putInt(1) FfiConverterTypeTxid.write(value.`txid`, buf) @@ -11580,48 +10802,47 @@ public object FfiConverterTypeQrPaymentResult : FfiConverterRustBuffer { - override fun lift(error_buf: RustBuffer.ByValue): VssHeaderProviderException = - FfiConverterTypeVssHeaderProviderError.lift(error_buf) + override fun lift(error_buf: RustBuffer.ByValue): VssHeaderProviderException = FfiConverterTypeVssHeaderProviderError.lift(error_buf) } } public object FfiConverterTypeVssHeaderProviderError : FfiConverterRustBuffer { - override fun read(buf: ByteBuffer): VssHeaderProviderException = - when (buf.getInt()) { + override fun read(buf: ByteBuffer): VssHeaderProviderException { + + return when(buf.getInt()) { 1 -> VssHeaderProviderException.InvalidData(FfiConverterString.read(buf)) 2 -> VssHeaderProviderException.RequestException(FfiConverterString.read(buf)) 3 -> VssHeaderProviderException.AuthorizationException(FfiConverterString.read(buf)) 4 -> VssHeaderProviderException.InternalException(FfiConverterString.read(buf)) else -> throw RuntimeException("invalid error enum value, something is very wrong!!") } + + } - override fun allocationSize(value: VssHeaderProviderException): ULong = 4UL + override fun allocationSize(value: VssHeaderProviderException): ULong { + return 4UL + } - override fun write( - value: VssHeaderProviderException, - buf: ByteBuffer, - ) { - when (value) { + override fun write(value: VssHeaderProviderException, buf: ByteBuffer) { + when(value) { is VssHeaderProviderException.InvalidData -> { buf.putInt(1) Unit @@ -11640,9 +10861,13 @@ public object FfiConverterTypeVssHeaderProviderError : FfiConverterRustBuffer { + + + +public object FfiConverterOptionalUByte: FfiConverterRustBuffer { override fun read(buf: ByteBuffer): kotlin.UByte? { if (buf.get().toInt() == 0) { return null @@ -11658,10 +10883,7 @@ public object FfiConverterOptionalUByte : FfiConverterRustBuffer } } - override fun write( - value: kotlin.UByte?, - buf: ByteBuffer, - ) { + override fun write(value: kotlin.UByte?, buf: ByteBuffer) { if (value == null) { buf.put(0) } else { @@ -11671,7 +10893,10 @@ public object FfiConverterOptionalUByte : FfiConverterRustBuffer } } -public object FfiConverterOptionalUShort : FfiConverterRustBuffer { + + + +public object FfiConverterOptionalUShort: FfiConverterRustBuffer { override fun read(buf: ByteBuffer): kotlin.UShort? { if (buf.get().toInt() == 0) { return null @@ -11687,10 +10912,7 @@ public object FfiConverterOptionalUShort : FfiConverterRustBuffer { + + + +public object FfiConverterOptionalUInt: FfiConverterRustBuffer { override fun read(buf: ByteBuffer): kotlin.UInt? { if (buf.get().toInt() == 0) { return null @@ -11716,10 +10941,7 @@ public object FfiConverterOptionalUInt : FfiConverterRustBuffer { } } - override fun write( - value: kotlin.UInt?, - buf: ByteBuffer, - ) { + override fun write(value: kotlin.UInt?, buf: ByteBuffer) { if (value == null) { buf.put(0) } else { @@ -11729,7 +10951,10 @@ public object FfiConverterOptionalUInt : FfiConverterRustBuffer { } } -public object FfiConverterOptionalULong : FfiConverterRustBuffer { + + + +public object FfiConverterOptionalULong: FfiConverterRustBuffer { override fun read(buf: ByteBuffer): kotlin.ULong? { if (buf.get().toInt() == 0) { return null @@ -11745,10 +10970,7 @@ public object FfiConverterOptionalULong : FfiConverterRustBuffer } } - override fun write( - value: kotlin.ULong?, - buf: ByteBuffer, - ) { + override fun write(value: kotlin.ULong?, buf: ByteBuffer) { if (value == null) { buf.put(0) } else { @@ -11758,7 +10980,10 @@ public object FfiConverterOptionalULong : FfiConverterRustBuffer } } -public object FfiConverterOptionalBoolean : FfiConverterRustBuffer { + + + +public object FfiConverterOptionalBoolean: FfiConverterRustBuffer { override fun read(buf: ByteBuffer): kotlin.Boolean? { if (buf.get().toInt() == 0) { return null @@ -11774,10 +10999,7 @@ public object FfiConverterOptionalBoolean : FfiConverterRustBuffer { + + + +public object FfiConverterOptionalString: FfiConverterRustBuffer { override fun read(buf: ByteBuffer): kotlin.String? { if (buf.get().toInt() == 0) { return null @@ -11803,10 +11028,7 @@ public object FfiConverterOptionalString : FfiConverterRustBuffer { + + + +public object FfiConverterOptionalTypeFeeRate: FfiConverterRustBuffer { override fun read(buf: ByteBuffer): FeeRate? { if (buf.get().toInt() == 0) { return null @@ -11832,10 +11057,7 @@ public object FfiConverterOptionalTypeFeeRate : FfiConverterRustBuffer } } - override fun write( - value: FeeRate?, - buf: ByteBuffer, - ) { + override fun write(value: FeeRate?, buf: ByteBuffer) { if (value == null) { buf.put(0) } else { @@ -11845,7 +11067,10 @@ public object FfiConverterOptionalTypeFeeRate : FfiConverterRustBuffer } } -public object FfiConverterOptionalTypeAnchorChannelsConfig : FfiConverterRustBuffer { + + + +public object FfiConverterOptionalTypeAnchorChannelsConfig: FfiConverterRustBuffer { override fun read(buf: ByteBuffer): AnchorChannelsConfig? { if (buf.get().toInt() == 0) { return null @@ -11861,10 +11086,7 @@ public object FfiConverterOptionalTypeAnchorChannelsConfig : FfiConverterRustBuf } } - override fun write( - value: AnchorChannelsConfig?, - buf: ByteBuffer, - ) { + override fun write(value: AnchorChannelsConfig?, buf: ByteBuffer) { if (value == null) { buf.put(0) } else { @@ -11874,7 +11096,10 @@ public object FfiConverterOptionalTypeAnchorChannelsConfig : FfiConverterRustBuf } } -public object FfiConverterOptionalTypeBackgroundSyncConfig : FfiConverterRustBuffer { + + + +public object FfiConverterOptionalTypeBackgroundSyncConfig: FfiConverterRustBuffer { override fun read(buf: ByteBuffer): BackgroundSyncConfig? { if (buf.get().toInt() == 0) { return null @@ -11890,10 +11115,7 @@ public object FfiConverterOptionalTypeBackgroundSyncConfig : FfiConverterRustBuf } } - override fun write( - value: BackgroundSyncConfig?, - buf: ByteBuffer, - ) { + override fun write(value: BackgroundSyncConfig?, buf: ByteBuffer) { if (value == null) { buf.put(0) } else { @@ -11903,7 +11125,10 @@ public object FfiConverterOptionalTypeBackgroundSyncConfig : FfiConverterRustBuf } } -public object FfiConverterOptionalTypeBolt11PaymentInfo : FfiConverterRustBuffer { + + + +public object FfiConverterOptionalTypeBolt11PaymentInfo: FfiConverterRustBuffer { override fun read(buf: ByteBuffer): Bolt11PaymentInfo? { if (buf.get().toInt() == 0) { return null @@ -11919,10 +11144,7 @@ public object FfiConverterOptionalTypeBolt11PaymentInfo : FfiConverterRustBuffer } } - override fun write( - value: Bolt11PaymentInfo?, - buf: ByteBuffer, - ) { + override fun write(value: Bolt11PaymentInfo?, buf: ByteBuffer) { if (value == null) { buf.put(0) } else { @@ -11932,7 +11154,10 @@ public object FfiConverterOptionalTypeBolt11PaymentInfo : FfiConverterRustBuffer } } -public object FfiConverterOptionalTypeChannelConfig : FfiConverterRustBuffer { + + + +public object FfiConverterOptionalTypeChannelConfig: FfiConverterRustBuffer { override fun read(buf: ByteBuffer): ChannelConfig? { if (buf.get().toInt() == 0) { return null @@ -11948,10 +11173,7 @@ public object FfiConverterOptionalTypeChannelConfig : FfiConverterRustBuffer { + + + +public object FfiConverterOptionalTypeChannelInfo: FfiConverterRustBuffer { override fun read(buf: ByteBuffer): ChannelInfo? { if (buf.get().toInt() == 0) { return null @@ -11977,10 +11202,7 @@ public object FfiConverterOptionalTypeChannelInfo : FfiConverterRustBuffer { + + + +public object FfiConverterOptionalTypeChannelOrderInfo: FfiConverterRustBuffer { override fun read(buf: ByteBuffer): ChannelOrderInfo? { if (buf.get().toInt() == 0) { return null @@ -12006,10 +11231,7 @@ public object FfiConverterOptionalTypeChannelOrderInfo : FfiConverterRustBuffer< } } - override fun write( - value: ChannelOrderInfo?, - buf: ByteBuffer, - ) { + override fun write(value: ChannelOrderInfo?, buf: ByteBuffer) { if (value == null) { buf.put(0) } else { @@ -12019,7 +11241,10 @@ public object FfiConverterOptionalTypeChannelOrderInfo : FfiConverterRustBuffer< } } -public object FfiConverterOptionalTypeChannelUpdateInfo : FfiConverterRustBuffer { + + + +public object FfiConverterOptionalTypeChannelUpdateInfo: FfiConverterRustBuffer { override fun read(buf: ByteBuffer): ChannelUpdateInfo? { if (buf.get().toInt() == 0) { return null @@ -12035,10 +11260,7 @@ public object FfiConverterOptionalTypeChannelUpdateInfo : FfiConverterRustBuffer } } - override fun write( - value: ChannelUpdateInfo?, - buf: ByteBuffer, - ) { + override fun write(value: ChannelUpdateInfo?, buf: ByteBuffer) { if (value == null) { buf.put(0) } else { @@ -12048,7 +11270,10 @@ public object FfiConverterOptionalTypeChannelUpdateInfo : FfiConverterRustBuffer } } -public object FfiConverterOptionalTypeElectrumSyncConfig : FfiConverterRustBuffer { + + + +public object FfiConverterOptionalTypeElectrumSyncConfig: FfiConverterRustBuffer { override fun read(buf: ByteBuffer): ElectrumSyncConfig? { if (buf.get().toInt() == 0) { return null @@ -12064,10 +11289,7 @@ public object FfiConverterOptionalTypeElectrumSyncConfig : FfiConverterRustBuffe } } - override fun write( - value: ElectrumSyncConfig?, - buf: ByteBuffer, - ) { + override fun write(value: ElectrumSyncConfig?, buf: ByteBuffer) { if (value == null) { buf.put(0) } else { @@ -12077,7 +11299,10 @@ public object FfiConverterOptionalTypeElectrumSyncConfig : FfiConverterRustBuffe } } -public object FfiConverterOptionalTypeEsploraSyncConfig : FfiConverterRustBuffer { + + + +public object FfiConverterOptionalTypeEsploraSyncConfig: FfiConverterRustBuffer { override fun read(buf: ByteBuffer): EsploraSyncConfig? { if (buf.get().toInt() == 0) { return null @@ -12093,10 +11318,7 @@ public object FfiConverterOptionalTypeEsploraSyncConfig : FfiConverterRustBuffer } } - override fun write( - value: EsploraSyncConfig?, - buf: ByteBuffer, - ) { + override fun write(value: EsploraSyncConfig?, buf: ByteBuffer) { if (value == null) { buf.put(0) } else { @@ -12106,7 +11328,10 @@ public object FfiConverterOptionalTypeEsploraSyncConfig : FfiConverterRustBuffer } } -public object FfiConverterOptionalTypeNodeAnnouncementInfo : FfiConverterRustBuffer { + + + +public object FfiConverterOptionalTypeNodeAnnouncementInfo: FfiConverterRustBuffer { override fun read(buf: ByteBuffer): NodeAnnouncementInfo? { if (buf.get().toInt() == 0) { return null @@ -12122,10 +11347,7 @@ public object FfiConverterOptionalTypeNodeAnnouncementInfo : FfiConverterRustBuf } } - override fun write( - value: NodeAnnouncementInfo?, - buf: ByteBuffer, - ) { + override fun write(value: NodeAnnouncementInfo?, buf: ByteBuffer) { if (value == null) { buf.put(0) } else { @@ -12135,7 +11357,10 @@ public object FfiConverterOptionalTypeNodeAnnouncementInfo : FfiConverterRustBuf } } -public object FfiConverterOptionalTypeNodeInfo : FfiConverterRustBuffer { + + + +public object FfiConverterOptionalTypeNodeInfo: FfiConverterRustBuffer { override fun read(buf: ByteBuffer): NodeInfo? { if (buf.get().toInt() == 0) { return null @@ -12151,10 +11376,7 @@ public object FfiConverterOptionalTypeNodeInfo : FfiConverterRustBuffer { + + + +public object FfiConverterOptionalTypeOnchainPaymentInfo: FfiConverterRustBuffer { override fun read(buf: ByteBuffer): OnchainPaymentInfo? { if (buf.get().toInt() == 0) { return null @@ -12180,10 +11405,7 @@ public object FfiConverterOptionalTypeOnchainPaymentInfo : FfiConverterRustBuffe } } - override fun write( - value: OnchainPaymentInfo?, - buf: ByteBuffer, - ) { + override fun write(value: OnchainPaymentInfo?, buf: ByteBuffer) { if (value == null) { buf.put(0) } else { @@ -12193,7 +11415,10 @@ public object FfiConverterOptionalTypeOnchainPaymentInfo : FfiConverterRustBuffe } } -public object FfiConverterOptionalTypeOutPoint : FfiConverterRustBuffer { + + + +public object FfiConverterOptionalTypeOutPoint: FfiConverterRustBuffer { override fun read(buf: ByteBuffer): OutPoint? { if (buf.get().toInt() == 0) { return null @@ -12209,10 +11434,7 @@ public object FfiConverterOptionalTypeOutPoint : FfiConverterRustBuffer { + + + +public object FfiConverterOptionalTypePaymentDetails: FfiConverterRustBuffer { override fun read(buf: ByteBuffer): PaymentDetails? { if (buf.get().toInt() == 0) { return null @@ -12238,10 +11463,7 @@ public object FfiConverterOptionalTypePaymentDetails : FfiConverterRustBuffer { + + + +public object FfiConverterOptionalTypeSendingParameters: FfiConverterRustBuffer { override fun read(buf: ByteBuffer): SendingParameters? { if (buf.get().toInt() == 0) { return null @@ -12267,10 +11492,7 @@ public object FfiConverterOptionalTypeSendingParameters : FfiConverterRustBuffer } } - override fun write( - value: SendingParameters?, - buf: ByteBuffer, - ) { + override fun write(value: SendingParameters?, buf: ByteBuffer) { if (value == null) { buf.put(0) } else { @@ -12280,7 +11502,10 @@ public object FfiConverterOptionalTypeSendingParameters : FfiConverterRustBuffer } } -public object FfiConverterOptionalTypeClosureReason : FfiConverterRustBuffer { + + + +public object FfiConverterOptionalTypeClosureReason: FfiConverterRustBuffer { override fun read(buf: ByteBuffer): ClosureReason? { if (buf.get().toInt() == 0) { return null @@ -12296,10 +11521,7 @@ public object FfiConverterOptionalTypeClosureReason : FfiConverterRustBuffer { + + + +public object FfiConverterOptionalTypeEvent: FfiConverterRustBuffer { override fun read(buf: ByteBuffer): Event? { if (buf.get().toInt() == 0) { return null @@ -12325,10 +11550,7 @@ public object FfiConverterOptionalTypeEvent : FfiConverterRustBuffer { } } - override fun write( - value: Event?, - buf: ByteBuffer, - ) { + override fun write(value: Event?, buf: ByteBuffer) { if (value == null) { buf.put(0) } else { @@ -12338,7 +11560,10 @@ public object FfiConverterOptionalTypeEvent : FfiConverterRustBuffer { } } -public object FfiConverterOptionalTypeLogLevel : FfiConverterRustBuffer { + + + +public object FfiConverterOptionalTypeLogLevel: FfiConverterRustBuffer { override fun read(buf: ByteBuffer): LogLevel? { if (buf.get().toInt() == 0) { return null @@ -12354,10 +11579,7 @@ public object FfiConverterOptionalTypeLogLevel : FfiConverterRustBuffer { + + + +public object FfiConverterOptionalTypeMaxTotalRoutingFeeLimit: FfiConverterRustBuffer { override fun read(buf: ByteBuffer): MaxTotalRoutingFeeLimit? { if (buf.get().toInt() == 0) { return null @@ -12383,10 +11608,7 @@ public object FfiConverterOptionalTypeMaxTotalRoutingFeeLimit : FfiConverterRust } } - override fun write( - value: MaxTotalRoutingFeeLimit?, - buf: ByteBuffer, - ) { + override fun write(value: MaxTotalRoutingFeeLimit?, buf: ByteBuffer) { if (value == null) { buf.put(0) } else { @@ -12396,7 +11618,10 @@ public object FfiConverterOptionalTypeMaxTotalRoutingFeeLimit : FfiConverterRust } } -public object FfiConverterOptionalTypePaymentFailureReason : FfiConverterRustBuffer { + + + +public object FfiConverterOptionalTypePaymentFailureReason: FfiConverterRustBuffer { override fun read(buf: ByteBuffer): PaymentFailureReason? { if (buf.get().toInt() == 0) { return null @@ -12412,10 +11637,7 @@ public object FfiConverterOptionalTypePaymentFailureReason : FfiConverterRustBuf } } - override fun write( - value: PaymentFailureReason?, - buf: ByteBuffer, - ) { + override fun write(value: PaymentFailureReason?, buf: ByteBuffer) { if (value == null) { buf.put(0) } else { @@ -12425,7 +11647,10 @@ public object FfiConverterOptionalTypePaymentFailureReason : FfiConverterRustBuf } } -public object FfiConverterOptionalSequenceTypeSpendableUtxo : FfiConverterRustBuffer?> { + + + +public object FfiConverterOptionalSequenceTypeSpendableUtxo: FfiConverterRustBuffer?> { override fun read(buf: ByteBuffer): List? { if (buf.get().toInt() == 0) { return null @@ -12441,10 +11666,7 @@ public object FfiConverterOptionalSequenceTypeSpendableUtxo : FfiConverterRustBu } } - override fun write( - value: List?, - buf: ByteBuffer, - ) { + override fun write(value: List?, buf: ByteBuffer) { if (value == null) { buf.put(0) } else { @@ -12454,7 +11676,10 @@ public object FfiConverterOptionalSequenceTypeSpendableUtxo : FfiConverterRustBu } } -public object FfiConverterOptionalSequenceTypeSocketAddress : FfiConverterRustBuffer?> { + + + +public object FfiConverterOptionalSequenceTypeSocketAddress: FfiConverterRustBuffer?> { override fun read(buf: ByteBuffer): List? { if (buf.get().toInt() == 0) { return null @@ -12470,10 +11695,7 @@ public object FfiConverterOptionalSequenceTypeSocketAddress : FfiConverterRustBu } } - override fun write( - value: List?, - buf: ByteBuffer, - ) { + override fun write(value: List?, buf: ByteBuffer) { if (value == null) { buf.put(0) } else { @@ -12483,7 +11705,10 @@ public object FfiConverterOptionalSequenceTypeSocketAddress : FfiConverterRustBu } } -public object FfiConverterOptionalTypeAddress : FfiConverterRustBuffer { + + + +public object FfiConverterOptionalTypeAddress: FfiConverterRustBuffer { override fun read(buf: ByteBuffer): Address? { if (buf.get().toInt() == 0) { return null @@ -12499,10 +11724,7 @@ public object FfiConverterOptionalTypeAddress : FfiConverterRustBuffer } } - override fun write( - value: Address?, - buf: ByteBuffer, - ) { + override fun write(value: Address?, buf: ByteBuffer) { if (value == null) { buf.put(0) } else { @@ -12512,7 +11734,10 @@ public object FfiConverterOptionalTypeAddress : FfiConverterRustBuffer } } -public object FfiConverterOptionalTypeChannelId : FfiConverterRustBuffer { + + + +public object FfiConverterOptionalTypeChannelId: FfiConverterRustBuffer { override fun read(buf: ByteBuffer): ChannelId? { if (buf.get().toInt() == 0) { return null @@ -12528,10 +11753,7 @@ public object FfiConverterOptionalTypeChannelId : FfiConverterRustBuffer { + + + +public object FfiConverterOptionalTypeNodeAlias: FfiConverterRustBuffer { override fun read(buf: ByteBuffer): NodeAlias? { if (buf.get().toInt() == 0) { return null @@ -12557,10 +11782,7 @@ public object FfiConverterOptionalTypeNodeAlias : FfiConverterRustBuffer { + + + +public object FfiConverterOptionalTypePaymentHash: FfiConverterRustBuffer { override fun read(buf: ByteBuffer): PaymentHash? { if (buf.get().toInt() == 0) { return null @@ -12586,10 +11811,7 @@ public object FfiConverterOptionalTypePaymentHash : FfiConverterRustBuffer { + + + +public object FfiConverterOptionalTypePaymentId: FfiConverterRustBuffer { override fun read(buf: ByteBuffer): PaymentId? { if (buf.get().toInt() == 0) { return null @@ -12615,10 +11840,7 @@ public object FfiConverterOptionalTypePaymentId : FfiConverterRustBuffer { + + + +public object FfiConverterOptionalTypePaymentPreimage: FfiConverterRustBuffer { override fun read(buf: ByteBuffer): PaymentPreimage? { if (buf.get().toInt() == 0) { return null @@ -12644,10 +11869,7 @@ public object FfiConverterOptionalTypePaymentPreimage : FfiConverterRustBuffer

{ + + + +public object FfiConverterOptionalTypePaymentSecret: FfiConverterRustBuffer { override fun read(buf: ByteBuffer): PaymentSecret? { if (buf.get().toInt() == 0) { return null @@ -12673,10 +11898,7 @@ public object FfiConverterOptionalTypePaymentSecret : FfiConverterRustBuffer { + + + +public object FfiConverterOptionalTypePublicKey: FfiConverterRustBuffer { override fun read(buf: ByteBuffer): PublicKey? { if (buf.get().toInt() == 0) { return null @@ -12702,10 +11927,7 @@ public object FfiConverterOptionalTypePublicKey : FfiConverterRustBuffer { + + + +public object FfiConverterOptionalTypeUntrustedString: FfiConverterRustBuffer { override fun read(buf: ByteBuffer): UntrustedString? { if (buf.get().toInt() == 0) { return null @@ -12731,10 +11956,7 @@ public object FfiConverterOptionalTypeUntrustedString : FfiConverterRustBuffer { + + + +public object FfiConverterOptionalTypeUserChannelId: FfiConverterRustBuffer { override fun read(buf: ByteBuffer): UserChannelId? { if (buf.get().toInt() == 0) { return null @@ -12760,10 +11985,7 @@ public object FfiConverterOptionalTypeUserChannelId : FfiConverterRustBuffer> { + + + +public object FfiConverterSequenceUByte: FfiConverterRustBuffer> { override fun read(buf: ByteBuffer): List { val len = buf.getInt() return List(len) { @@ -12787,10 +12012,7 @@ public object FfiConverterSequenceUByte : FfiConverterRustBuffer, - buf: ByteBuffer, - ) { + override fun write(value: List, buf: ByteBuffer) { buf.putInt(value.size) value.iterator().forEach { FfiConverterUByte.write(it, buf) @@ -12798,7 +12020,10 @@ public object FfiConverterSequenceUByte : FfiConverterRustBuffer> { + + + +public object FfiConverterSequenceULong: FfiConverterRustBuffer> { override fun read(buf: ByteBuffer): List { val len = buf.getInt() return List(len) { @@ -12812,10 +12037,7 @@ public object FfiConverterSequenceULong : FfiConverterRustBuffer, - buf: ByteBuffer, - ) { + override fun write(value: List, buf: ByteBuffer) { buf.putInt(value.size) value.iterator().forEach { FfiConverterULong.write(it, buf) @@ -12823,7 +12045,10 @@ public object FfiConverterSequenceULong : FfiConverterRustBuffer> { + + + +public object FfiConverterSequenceTypeChannelDetails: FfiConverterRustBuffer> { override fun read(buf: ByteBuffer): List { val len = buf.getInt() return List(len) { @@ -12837,10 +12062,7 @@ public object FfiConverterSequenceTypeChannelDetails : FfiConverterRustBuffer

  • , - buf: ByteBuffer, - ) { + override fun write(value: List, buf: ByteBuffer) { buf.putInt(value.size) value.iterator().forEach { FfiConverterTypeChannelDetails.write(it, buf) @@ -12848,7 +12070,10 @@ public object FfiConverterSequenceTypeChannelDetails : FfiConverterRustBuffer
  • > { + + + +public object FfiConverterSequenceTypeCustomTlvRecord: FfiConverterRustBuffer> { override fun read(buf: ByteBuffer): List { val len = buf.getInt() return List(len) { @@ -12862,10 +12087,7 @@ public object FfiConverterSequenceTypeCustomTlvRecord : FfiConverterRustBuffer, - buf: ByteBuffer, - ) { + override fun write(value: List, buf: ByteBuffer) { buf.putInt(value.size) value.iterator().forEach { FfiConverterTypeCustomTlvRecord.write(it, buf) @@ -12873,7 +12095,10 @@ public object FfiConverterSequenceTypeCustomTlvRecord : FfiConverterRustBuffer> { + + + +public object FfiConverterSequenceTypePaymentDetails: FfiConverterRustBuffer> { override fun read(buf: ByteBuffer): List { val len = buf.getInt() return List(len) { @@ -12887,10 +12112,7 @@ public object FfiConverterSequenceTypePaymentDetails : FfiConverterRustBuffer
  • , - buf: ByteBuffer, - ) { + override fun write(value: List, buf: ByteBuffer) { buf.putInt(value.size) value.iterator().forEach { FfiConverterTypePaymentDetails.write(it, buf) @@ -12898,7 +12120,10 @@ public object FfiConverterSequenceTypePaymentDetails : FfiConverterRustBuffer
  • > { + + + +public object FfiConverterSequenceTypePeerDetails: FfiConverterRustBuffer> { override fun read(buf: ByteBuffer): List { val len = buf.getInt() return List(len) { @@ -12912,10 +12137,7 @@ public object FfiConverterSequenceTypePeerDetails : FfiConverterRustBuffer, - buf: ByteBuffer, - ) { + override fun write(value: List, buf: ByteBuffer) { buf.putInt(value.size) value.iterator().forEach { FfiConverterTypePeerDetails.write(it, buf) @@ -12923,7 +12145,10 @@ public object FfiConverterSequenceTypePeerDetails : FfiConverterRustBuffer> { + + + +public object FfiConverterSequenceTypeRouteHintHop: FfiConverterRustBuffer> { override fun read(buf: ByteBuffer): List { val len = buf.getInt() return List(len) { @@ -12937,10 +12162,7 @@ public object FfiConverterSequenceTypeRouteHintHop : FfiConverterRustBuffer, - buf: ByteBuffer, - ) { + override fun write(value: List, buf: ByteBuffer) { buf.putInt(value.size) value.iterator().forEach { FfiConverterTypeRouteHintHop.write(it, buf) @@ -12948,7 +12170,10 @@ public object FfiConverterSequenceTypeRouteHintHop : FfiConverterRustBuffer> { + + + +public object FfiConverterSequenceTypeSpendableUtxo: FfiConverterRustBuffer> { override fun read(buf: ByteBuffer): List { val len = buf.getInt() return List(len) { @@ -12962,10 +12187,7 @@ public object FfiConverterSequenceTypeSpendableUtxo : FfiConverterRustBuffer, - buf: ByteBuffer, - ) { + override fun write(value: List, buf: ByteBuffer) { buf.putInt(value.size) value.iterator().forEach { FfiConverterTypeSpendableUtxo.write(it, buf) @@ -12973,7 +12195,10 @@ public object FfiConverterSequenceTypeSpendableUtxo : FfiConverterRustBuffer> { + + + +public object FfiConverterSequenceTypeLightningBalance: FfiConverterRustBuffer> { override fun read(buf: ByteBuffer): List { val len = buf.getInt() return List(len) { @@ -12987,10 +12212,7 @@ public object FfiConverterSequenceTypeLightningBalance : FfiConverterRustBuffer< return sizeForLength + sizeForItems } - override fun write( - value: List, - buf: ByteBuffer, - ) { + override fun write(value: List, buf: ByteBuffer) { buf.putInt(value.size) value.iterator().forEach { FfiConverterTypeLightningBalance.write(it, buf) @@ -12998,7 +12220,10 @@ public object FfiConverterSequenceTypeLightningBalance : FfiConverterRustBuffer< } } -public object FfiConverterSequenceTypePendingSweepBalance : FfiConverterRustBuffer> { + + + +public object FfiConverterSequenceTypePendingSweepBalance: FfiConverterRustBuffer> { override fun read(buf: ByteBuffer): List { val len = buf.getInt() return List(len) { @@ -13012,10 +12237,7 @@ public object FfiConverterSequenceTypePendingSweepBalance : FfiConverterRustBuff return sizeForLength + sizeForItems } - override fun write( - value: List, - buf: ByteBuffer, - ) { + override fun write(value: List, buf: ByteBuffer) { buf.putInt(value.size) value.iterator().forEach { FfiConverterTypePendingSweepBalance.write(it, buf) @@ -13023,7 +12245,10 @@ public object FfiConverterSequenceTypePendingSweepBalance : FfiConverterRustBuff } } -public object FfiConverterSequenceSequenceTypeRouteHintHop : FfiConverterRustBuffer>> { + + + +public object FfiConverterSequenceSequenceTypeRouteHintHop: FfiConverterRustBuffer>> { override fun read(buf: ByteBuffer): List> { val len = buf.getInt() return List>(len) { @@ -13037,10 +12262,7 @@ public object FfiConverterSequenceSequenceTypeRouteHintHop : FfiConverterRustBuf return sizeForLength + sizeForItems } - override fun write( - value: List>, - buf: ByteBuffer, - ) { + override fun write(value: List>, buf: ByteBuffer) { buf.putInt(value.size) value.iterator().forEach { FfiConverterSequenceTypeRouteHintHop.write(it, buf) @@ -13048,7 +12270,10 @@ public object FfiConverterSequenceSequenceTypeRouteHintHop : FfiConverterRustBuf } } -public object FfiConverterSequenceTypeAddress : FfiConverterRustBuffer> { + + + +public object FfiConverterSequenceTypeAddress: FfiConverterRustBuffer> { override fun read(buf: ByteBuffer): List
    { val len = buf.getInt() return List
    (len) { @@ -13062,10 +12287,7 @@ public object FfiConverterSequenceTypeAddress : FfiConverterRustBuffer, - buf: ByteBuffer, - ) { + override fun write(value: List
    , buf: ByteBuffer) { buf.putInt(value.size) value.iterator().forEach { FfiConverterTypeAddress.write(it, buf) @@ -13073,7 +12295,10 @@ public object FfiConverterSequenceTypeAddress : FfiConverterRustBuffer> { + + + +public object FfiConverterSequenceTypeNodeId: FfiConverterRustBuffer> { override fun read(buf: ByteBuffer): List { val len = buf.getInt() return List(len) { @@ -13087,10 +12312,7 @@ public object FfiConverterSequenceTypeNodeId : FfiConverterRustBuffer, - buf: ByteBuffer, - ) { + override fun write(value: List, buf: ByteBuffer) { buf.putInt(value.size) value.iterator().forEach { FfiConverterTypeNodeId.write(it, buf) @@ -13098,7 +12320,10 @@ public object FfiConverterSequenceTypeNodeId : FfiConverterRustBuffer> { + + + +public object FfiConverterSequenceTypePublicKey: FfiConverterRustBuffer> { override fun read(buf: ByteBuffer): List { val len = buf.getInt() return List(len) { @@ -13112,10 +12337,7 @@ public object FfiConverterSequenceTypePublicKey : FfiConverterRustBuffer, - buf: ByteBuffer, - ) { + override fun write(value: List, buf: ByteBuffer) { buf.putInt(value.size) value.iterator().forEach { FfiConverterTypePublicKey.write(it, buf) @@ -13123,7 +12345,10 @@ public object FfiConverterSequenceTypePublicKey : FfiConverterRustBuffer> { + + + +public object FfiConverterSequenceTypeSocketAddress: FfiConverterRustBuffer> { override fun read(buf: ByteBuffer): List { val len = buf.getInt() return List(len) { @@ -13137,10 +12362,7 @@ public object FfiConverterSequenceTypeSocketAddress : FfiConverterRustBuffer, - buf: ByteBuffer, - ) { + override fun write(value: List, buf: ByteBuffer) { buf.putInt(value.size) value.iterator().forEach { FfiConverterTypeSocketAddress.write(it, buf) @@ -13148,7 +12370,9 @@ public object FfiConverterSequenceTypeSocketAddress : FfiConverterRustBuffer> { + + +public object FfiConverterMapStringString: FfiConverterRustBuffer> { override fun read(buf: ByteBuffer): Map { val len = buf.getInt() return buildMap(len) { @@ -13162,19 +12386,14 @@ public object FfiConverterMapStringString : FfiConverterRustBuffer): ULong { val spaceForMapSize = 4UL - val spaceForChildren = - value - .map { (k, v) -> - FfiConverterString.allocationSize(k) + - FfiConverterString.allocationSize(v) - }.sum() + val spaceForChildren = value.map { (k, v) -> + FfiConverterString.allocationSize(k) + + FfiConverterString.allocationSize(v) + }.sum() return spaceForMapSize + spaceForChildren } - override fun write( - value: Map, - buf: ByteBuffer, - ) { + override fun write(value: Map, buf: ByteBuffer) { buf.putInt(value.size) // The parens on `(k, v)` here ensure we're calling the right method, // which is important for compatibility with older android devices. @@ -13186,6 +12405,8 @@ public object FfiConverterMapStringString : FfiConverterRustBuffer - UniffiLib.INSTANCE.uniffi_ldk_node_fn_func_default_config(_status) - }, - ) -fun `generateEntropyMnemonic`(): Mnemonic = - FfiConverterTypeMnemonic.lift( - uniffiRustCall { _status -> - UniffiLib.INSTANCE.uniffi_ldk_node_fn_func_generate_entropy_mnemonic(_status) - }, + + + + + + fun `defaultConfig`(): Config { + return FfiConverterTypeConfig.lift( + uniffiRustCall() { _status -> + UniffiLib.INSTANCE.uniffi_ldk_node_fn_func_default_config( + _status) +} + ) + } + + fun `generateEntropyMnemonic`(): Mnemonic { + return FfiConverterTypeMnemonic.lift( + uniffiRustCall() { _status -> + UniffiLib.INSTANCE.uniffi_ldk_node_fn_func_generate_entropy_mnemonic( + _status) +} ) + } + + + diff --git a/bindings/ldk_node.udl b/bindings/ldk_node.udl index a7fdbcb4b..7deec464c 100644 --- a/bindings/ldk_node.udl +++ b/bindings/ldk_node.udl @@ -189,6 +189,10 @@ interface Bolt11Payment { Bolt11Invoice receive_via_jit_channel(u64 amount_msat, [ByRef]Bolt11InvoiceDescription description, u32 expiry_secs, u64? max_lsp_fee_limit_msat); [Throws=NodeError] Bolt11Invoice receive_variable_amount_via_jit_channel([ByRef]Bolt11InvoiceDescription description, u32 expiry_secs, u64? max_proportional_lsp_fee_limit_ppm_msat); + [Throws=NodeError] + u64 estimate_routing_fees([ByRef]Bolt11Invoice invoice); + [Throws=NodeError] + u64 estimate_routing_fees_using_amount([ByRef]Bolt11Invoice invoice, u64 amount_msat); }; interface Bolt12Payment { @@ -285,6 +289,7 @@ enum NodeError { "PaymentSendingFailed", "InvalidCustomTlvs", "ProbeSendingFailed", + "RouteNotFound", "ChannelCreationFailed", "ChannelClosingFailed", "ChannelConfigUpdateFailed", diff --git a/bindings/swift/Sources/LDKNode/LDKNode.swift b/bindings/swift/Sources/LDKNode/LDKNode.swift index 25febdfb0..635a94cc5 100644 --- a/bindings/swift/Sources/LDKNode/LDKNode.swift +++ b/bindings/swift/Sources/LDKNode/LDKNode.swift @@ -9,10 +9,10 @@ import Foundation // might be in a separate module, or it might be compiled inline into // this module. This is a bit of light hackery to work with both. #if canImport(LDKNodeFFI) - import LDKNodeFFI +import LDKNodeFFI #endif -private extension RustBuffer { +fileprivate extension RustBuffer { // Allocate a new buffer, copying the contents of a `UInt8` array. init(bytes: [UInt8]) { let rbuf = bytes.withUnsafeBufferPointer { ptr in @@ -22,7 +22,7 @@ private extension RustBuffer { } static func empty() -> RustBuffer { - RustBuffer(capacity: 0, len: 0, data: nil) + RustBuffer(capacity: 0, len:0, data: nil) } static func from(_ ptr: UnsafeBufferPointer) -> RustBuffer { @@ -36,7 +36,7 @@ private extension RustBuffer { } } -private extension ForeignBytes { +fileprivate extension ForeignBytes { init(bufferPointer: UnsafeBufferPointer) { self.init(len: Int32(bufferPointer.count), data: bufferPointer.baseAddress) } @@ -49,7 +49,7 @@ private extension ForeignBytes { // Helper classes/extensions that don't change. // Someday, this will be in a library of its own. -private extension Data { +fileprivate extension Data { init(rustBuffer: RustBuffer) { // TODO: This copies the buffer. Can we read directly from a // Rust buffer? @@ -71,15 +71,15 @@ private extension Data { // // Instead, the read() method and these helper functions input a tuple of data -private func createReader(data: Data) -> (data: Data, offset: Data.Index) { +fileprivate func createReader(data: Data) -> (data: Data, offset: Data.Index) { (data: data, offset: 0) } // Reads an integer at the current offset, in big-endian order, and advances // the offset on success. Throws if reading the integer would move the // offset past the end of the buffer. -private func readInt(_ reader: inout (data: Data, offset: Data.Index)) throws -> T { - let range = reader.offset ..< reader.offset + MemoryLayout.size +fileprivate func readInt(_ reader: inout (data: Data, offset: Data.Index)) throws -> T { + let range = reader.offset...size guard reader.data.count >= range.upperBound else { throw UniffiInternalError.bufferOverflow } @@ -89,38 +89,38 @@ private func readInt(_ reader: inout (data: Data, offset: return value as! T } var value: T = 0 - let _ = withUnsafeMutableBytes(of: &value) { reader.data.copyBytes(to: $0, from: range) } + let _ = withUnsafeMutableBytes(of: &value, { reader.data.copyBytes(to: $0, from: range)}) reader.offset = range.upperBound return value.bigEndian } // Reads an arbitrary number of bytes, to be used to read // raw bytes, this is useful when lifting strings -private func readBytes(_ reader: inout (data: Data, offset: Data.Index), count: Int) throws -> [UInt8] { - let range = reader.offset ..< (reader.offset + count) +fileprivate func readBytes(_ reader: inout (data: Data, offset: Data.Index), count: Int) throws -> Array { + let range = reader.offset..<(reader.offset+count) guard reader.data.count >= range.upperBound else { throw UniffiInternalError.bufferOverflow } var value = [UInt8](repeating: 0, count: count) - value.withUnsafeMutableBufferPointer { buffer in + value.withUnsafeMutableBufferPointer({ buffer in reader.data.copyBytes(to: buffer, from: range) - } + }) reader.offset = range.upperBound return value } // Reads a float at the current offset. -private func readFloat(_ reader: inout (data: Data, offset: Data.Index)) throws -> Float { - return try Float(bitPattern: readInt(&reader)) +fileprivate func readFloat(_ reader: inout (data: Data, offset: Data.Index)) throws -> Float { + return Float(bitPattern: try readInt(&reader)) } // Reads a float at the current offset. -private func readDouble(_ reader: inout (data: Data, offset: Data.Index)) throws -> Double { - return try Double(bitPattern: readInt(&reader)) +fileprivate func readDouble(_ reader: inout (data: Data, offset: Data.Index)) throws -> Double { + return Double(bitPattern: try readInt(&reader)) } // Indicates if the offset has reached the end of the buffer. -private func hasRemaining(_ reader: (data: Data, offset: Data.Index)) -> Bool { +fileprivate func hasRemaining(_ reader: (data: Data, offset: Data.Index)) -> Bool { return reader.offset < reader.data.count } @@ -128,11 +128,11 @@ private func hasRemaining(_ reader: (data: Data, offset: Data.Index)) -> Bool { // struct, but we use standalone functions instead in order to make external // types work. See the above discussion on Readers for details. -private func createWriter() -> [UInt8] { +fileprivate func createWriter() -> [UInt8] { return [] } -private func writeBytes(_ writer: inout [UInt8], _ byteArr: S) where S: Sequence, S.Element == UInt8 { +fileprivate func writeBytes(_ writer: inout [UInt8], _ byteArr: S) where S: Sequence, S.Element == UInt8 { writer.append(contentsOf: byteArr) } @@ -140,22 +140,22 @@ private func writeBytes(_ writer: inout [UInt8], _ byteArr: S) where S: Seque // // Warning: make sure what you are trying to write // is in the correct type! -private func writeInt(_ writer: inout [UInt8], _ value: T) { +fileprivate func writeInt(_ writer: inout [UInt8], _ value: T) { var value = value.bigEndian withUnsafeBytes(of: &value) { writer.append(contentsOf: $0) } } -private func writeFloat(_ writer: inout [UInt8], _ value: Float) { +fileprivate func writeFloat(_ writer: inout [UInt8], _ value: Float) { writeInt(&writer, value.bitPattern) } -private func writeDouble(_ writer: inout [UInt8], _ value: Double) { +fileprivate func writeDouble(_ writer: inout [UInt8], _ value: Double) { writeInt(&writer, value.bitPattern) } // Protocol for types that transfer other types across the FFI. This is // analogous go the Rust trait of the same name. -private protocol FfiConverter { +fileprivate protocol FfiConverter { associatedtype FfiType associatedtype SwiftType @@ -166,7 +166,7 @@ private protocol FfiConverter { } // Types conforming to `Primitive` pass themselves directly over the FFI. -private protocol FfiConverterPrimitive: FfiConverter where FfiType == SwiftType {} +fileprivate protocol FfiConverterPrimitive: FfiConverter where FfiType == SwiftType { } extension FfiConverterPrimitive { public static func lift(_ value: FfiType) throws -> SwiftType { @@ -180,7 +180,7 @@ extension FfiConverterPrimitive { // Types conforming to `FfiConverterRustBuffer` lift and lower into a `RustBuffer`. // Used for complex types where it's hard to write a custom lift/lower. -private protocol FfiConverterRustBuffer: FfiConverter where FfiType == RustBuffer {} +fileprivate protocol FfiConverterRustBuffer: FfiConverter where FfiType == RustBuffer {} extension FfiConverterRustBuffer { public static func lift(_ buf: RustBuffer) throws -> SwiftType { @@ -194,15 +194,14 @@ extension FfiConverterRustBuffer { } public static func lower(_ value: SwiftType) -> RustBuffer { - var writer = createWriter() - write(value, into: &writer) - return RustBuffer(bytes: writer) + var writer = createWriter() + write(value, into: &writer) + return RustBuffer(bytes: writer) } } - // An error type for FFI errors. These errors occur at the UniFFI level, not // the library level. -private enum UniffiInternalError: LocalizedError { +fileprivate enum UniffiInternalError: LocalizedError { case bufferOverflow case incompleteData case unexpectedOptionalTag @@ -228,24 +227,24 @@ private enum UniffiInternalError: LocalizedError { } } -private extension NSLock { +fileprivate extension NSLock { func withLock(f: () throws -> T) rethrows -> T { - lock() + self.lock() defer { self.unlock() } return try f() } } -private let CALL_SUCCESS: Int8 = 0 -private let CALL_ERROR: Int8 = 1 -private let CALL_UNEXPECTED_ERROR: Int8 = 2 -private let CALL_CANCELLED: Int8 = 3 +fileprivate let CALL_SUCCESS: Int8 = 0 +fileprivate let CALL_ERROR: Int8 = 1 +fileprivate let CALL_UNEXPECTED_ERROR: Int8 = 2 +fileprivate let CALL_CANCELLED: Int8 = 3 -private extension RustCallStatus { +fileprivate extension RustCallStatus { init() { self.init( code: CALL_SUCCESS, - errorBuf: RustBuffer( + errorBuf: RustBuffer.init( capacity: 0, len: 0, data: nil @@ -260,8 +259,7 @@ private func rustCall(_ callback: (UnsafeMutablePointer) -> T private func rustCallWithError( _ errorHandler: @escaping (RustBuffer) throws -> Error, - _ callback: (UnsafeMutablePointer) -> T -) throws -> T { + _ callback: (UnsafeMutablePointer) -> T) throws -> T { try makeRustCall(callback, errorHandler: errorHandler) } @@ -270,7 +268,7 @@ private func makeRustCall( errorHandler: ((RustBuffer) throws -> Error)? ) throws -> T { uniffiEnsureInitialized() - var callStatus = RustCallStatus() + var callStatus = RustCallStatus.init() let returnedVal = callback(&callStatus) try uniffiCheckCallStatus(callStatus: callStatus, errorHandler: errorHandler) return returnedVal @@ -281,44 +279,44 @@ private func uniffiCheckCallStatus( errorHandler: ((RustBuffer) throws -> Error)? ) throws { switch callStatus.code { - case CALL_SUCCESS: - return + case CALL_SUCCESS: + return - case CALL_ERROR: - if let errorHandler = errorHandler { - throw try errorHandler(callStatus.errorBuf) - } else { - callStatus.errorBuf.deallocate() - throw UniffiInternalError.unexpectedRustCallError - } + case CALL_ERROR: + if let errorHandler = errorHandler { + throw try errorHandler(callStatus.errorBuf) + } else { + callStatus.errorBuf.deallocate() + throw UniffiInternalError.unexpectedRustCallError + } - case CALL_UNEXPECTED_ERROR: - // When the rust code sees a panic, it tries to construct a RustBuffer - // with the message. But if that code panics, then it just sends back - // an empty buffer. - if callStatus.errorBuf.len > 0 { - throw try UniffiInternalError.rustPanic(FfiConverterString.lift(callStatus.errorBuf)) - } else { - callStatus.errorBuf.deallocate() - throw UniffiInternalError.rustPanic("Rust panic") - } + case CALL_UNEXPECTED_ERROR: + // When the rust code sees a panic, it tries to construct a RustBuffer + // with the message. But if that code panics, then it just sends back + // an empty buffer. + if callStatus.errorBuf.len > 0 { + throw UniffiInternalError.rustPanic(try FfiConverterString.lift(callStatus.errorBuf)) + } else { + callStatus.errorBuf.deallocate() + throw UniffiInternalError.rustPanic("Rust panic") + } - case CALL_CANCELLED: - fatalError("Cancellation not supported yet") + case CALL_CANCELLED: + fatalError("Cancellation not supported yet") - default: - throw UniffiInternalError.unexpectedRustCallStatusCode + default: + throw UniffiInternalError.unexpectedRustCallStatusCode } } private func uniffiTraitInterfaceCall( callStatus: UnsafeMutablePointer, makeCall: () throws -> T, - writeReturn: (T) -> Void + writeReturn: (T) -> () ) { do { try writeReturn(makeCall()) - } catch { + } catch let error { callStatus.pointee.code = CALL_UNEXPECTED_ERROR callStatus.pointee.errorBuf = FfiConverterString.lower(String(describing: error)) } @@ -327,7 +325,7 @@ private func uniffiTraitInterfaceCall( private func uniffiTraitInterfaceCallWithError( callStatus: UnsafeMutablePointer, makeCall: () throws -> T, - writeReturn: (T) -> Void, + writeReturn: (T) -> (), lowerError: (E) -> RustBuffer ) { do { @@ -340,8 +338,7 @@ private func uniffiTraitInterfaceCallWithError( callStatus.pointee.errorBuf = FfiConverterString.lower(String(describing: error)) } } - -private class UniffiHandleMap { +fileprivate class UniffiHandleMap { private var map: [UInt64: T] = [:] private let lock = NSLock() private var currentHandle: UInt64 = 1 @@ -355,7 +352,7 @@ private class UniffiHandleMap { } } - func get(handle: UInt64) throws -> T { + func get(handle: UInt64) throws -> T { try lock.withLock { guard let obj = map[handle] else { throw UniffiInternalError.unexpectedStaleHandle @@ -375,13 +372,17 @@ private class UniffiHandleMap { } var count: Int { - map.count + get { + map.count + } } } + // Public interface members begin here. -private struct FfiConverterUInt8: FfiConverterPrimitive { + +fileprivate struct FfiConverterUInt8: FfiConverterPrimitive { typealias FfiType = UInt8 typealias SwiftType = UInt8 @@ -394,7 +395,7 @@ private struct FfiConverterUInt8: FfiConverterPrimitive { } } -private struct FfiConverterUInt16: FfiConverterPrimitive { +fileprivate struct FfiConverterUInt16: FfiConverterPrimitive { typealias FfiType = UInt16 typealias SwiftType = UInt16 @@ -407,7 +408,7 @@ private struct FfiConverterUInt16: FfiConverterPrimitive { } } -private struct FfiConverterUInt32: FfiConverterPrimitive { +fileprivate struct FfiConverterUInt32: FfiConverterPrimitive { typealias FfiType = UInt32 typealias SwiftType = UInt32 @@ -420,7 +421,7 @@ private struct FfiConverterUInt32: FfiConverterPrimitive { } } -private struct FfiConverterUInt64: FfiConverterPrimitive { +fileprivate struct FfiConverterUInt64: FfiConverterPrimitive { typealias FfiType = UInt64 typealias SwiftType = UInt64 @@ -433,7 +434,7 @@ private struct FfiConverterUInt64: FfiConverterPrimitive { } } -private struct FfiConverterBool: FfiConverter { +fileprivate struct FfiConverterBool : FfiConverter { typealias FfiType = Int8 typealias SwiftType = Bool @@ -454,7 +455,7 @@ private struct FfiConverterBool: FfiConverter { } } -private struct FfiConverterString: FfiConverter { +fileprivate struct FfiConverterString: FfiConverter { typealias SwiftType = String typealias FfiType = RustBuffer @@ -482,7 +483,7 @@ private struct FfiConverterString: FfiConverter { public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> String { let len: Int32 = try readInt(&buf) - return try String(bytes: readBytes(&buf, count: Int(len)), encoding: String.Encoding.utf8)! + return String(bytes: try readBytes(&buf, count: Int(len)), encoding: String.Encoding.utf8)! } public static func write(_ value: String, into buf: inout [UInt8]) { @@ -492,12 +493,12 @@ private struct FfiConverterString: FfiConverter { } } -private struct FfiConverterData: FfiConverterRustBuffer { +fileprivate struct FfiConverterData: FfiConverterRustBuffer { typealias SwiftType = Data public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> Data { let len: Int32 = try readInt(&buf) - return try Data(readBytes(&buf, count: Int(len))) + return Data(try readBytes(&buf, count: Int(len))) } public static func write(_ value: Data, into buf: inout [UInt8]) { @@ -507,46 +508,50 @@ private struct FfiConverterData: FfiConverterRustBuffer { } } -public protocol Bolt11InvoiceProtocol: AnyObject { - func amountMilliSatoshis() -> UInt64? - - func currency() -> Currency - func expiryTimeSeconds() -> UInt64 - func fallbackAddresses() -> [Address] - func invoiceDescription() -> Bolt11InvoiceDescription - - func isExpired() -> Bool - - func minFinalCltvExpiryDelta() -> UInt64 - - func network() -> Network - - func paymentHash() -> PaymentHash - - func paymentSecret() -> PaymentSecret - - func recoverPayeePubKey() -> PublicKey - - func routeHints() -> [[RouteHintHop]] - - func secondsSinceEpoch() -> UInt64 - - func secondsUntilExpiry() -> UInt64 - - func signableHash() -> [UInt8] - - func wouldExpire(atTimeSeconds: UInt64) -> Bool +public protocol Bolt11InvoiceProtocol : AnyObject { + + func amountMilliSatoshis() -> UInt64? + + func currency() -> Currency + + func expiryTimeSeconds() -> UInt64 + + func fallbackAddresses() -> [Address] + + func invoiceDescription() -> Bolt11InvoiceDescription + + func isExpired() -> Bool + + func minFinalCltvExpiryDelta() -> UInt64 + + func network() -> Network + + func paymentHash() -> PaymentHash + + func paymentSecret() -> PaymentSecret + + func recoverPayeePubKey() -> PublicKey + + func routeHints() -> [[RouteHintHop]] + + func secondsSinceEpoch() -> UInt64 + + func secondsUntilExpiry() -> UInt64 + + func signableHash() -> [UInt8] + + func wouldExpire(atTimeSeconds: UInt64) -> Bool + } open class Bolt11Invoice: CustomDebugStringConvertible, CustomStringConvertible, Equatable, - Bolt11InvoiceProtocol -{ + Bolt11InvoiceProtocol { fileprivate let pointer: UnsafeMutableRawPointer! /// Used to instantiate a [FFIObject] without an actual pointer, for fakes in tests, mostly. @@ -557,7 +562,7 @@ open class Bolt11Invoice: // TODO: We'd like this to be `private` but for Swifty reasons, // we can't implement `FfiConverter` without making this `required` and we can't // make it `required` without making it `public`. - public required init(unsafeFromRawPointer pointer: UnsafeMutableRawPointer) { + required public init(unsafeFromRawPointer pointer: UnsafeMutableRawPointer) { self.pointer = pointer } @@ -566,14 +571,13 @@ open class Bolt11Invoice: /// /// - Warning: /// Any object instantiated with this constructor cannot be passed to an actual Rust-backed object. Since there isn't a backing [Pointer] the FFI lower functions will crash. - public init(noPointer _: NoPointer) { - pointer = nil + public init(noPointer: NoPointer) { + self.pointer = nil } public func uniffiClonePointer() -> UnsafeMutableRawPointer { return try! rustCall { uniffi_ldk_node_fn_clone_bolt11invoice(self.pointer, $0) } } - // No primary constructor declared for this class. deinit { @@ -584,138 +588,160 @@ open class Bolt11Invoice: try! rustCall { uniffi_ldk_node_fn_free_bolt11invoice(pointer, $0) } } - public static func fromStr(invoiceStr: String) throws -> Bolt11Invoice { - return try FfiConverterTypeBolt11Invoice.lift(rustCallWithError(FfiConverterTypeNodeError.lift) { - uniffi_ldk_node_fn_constructor_bolt11invoice_from_str( - FfiConverterString.lower(invoiceStr), $0 - ) - }) - } - - open func amountMilliSatoshis() -> UInt64? { - return try! FfiConverterOptionUInt64.lift(try! rustCall { - uniffi_ldk_node_fn_method_bolt11invoice_amount_milli_satoshis(self.uniffiClonePointer(), $0) - }) - } - - open func currency() -> Currency { - return try! FfiConverterTypeCurrency.lift(try! rustCall { - uniffi_ldk_node_fn_method_bolt11invoice_currency(self.uniffiClonePointer(), $0) - }) - } - - open func expiryTimeSeconds() -> UInt64 { - return try! FfiConverterUInt64.lift(try! rustCall { - uniffi_ldk_node_fn_method_bolt11invoice_expiry_time_seconds(self.uniffiClonePointer(), $0) - }) - } - - open func fallbackAddresses() -> [Address] { - return try! FfiConverterSequenceTypeAddress.lift(try! rustCall { - uniffi_ldk_node_fn_method_bolt11invoice_fallback_addresses(self.uniffiClonePointer(), $0) - }) - } - - open func invoiceDescription() -> Bolt11InvoiceDescription { - return try! FfiConverterTypeBolt11InvoiceDescription.lift(try! rustCall { - uniffi_ldk_node_fn_method_bolt11invoice_invoice_description(self.uniffiClonePointer(), $0) - }) - } - - open func isExpired() -> Bool { - return try! FfiConverterBool.lift(try! rustCall { - uniffi_ldk_node_fn_method_bolt11invoice_is_expired(self.uniffiClonePointer(), $0) - }) - } - - open func minFinalCltvExpiryDelta() -> UInt64 { - return try! FfiConverterUInt64.lift(try! rustCall { - uniffi_ldk_node_fn_method_bolt11invoice_min_final_cltv_expiry_delta(self.uniffiClonePointer(), $0) - }) - } - - open func network() -> Network { - return try! FfiConverterTypeNetwork.lift(try! rustCall { - uniffi_ldk_node_fn_method_bolt11invoice_network(self.uniffiClonePointer(), $0) - }) - } - - open func paymentHash() -> PaymentHash { - return try! FfiConverterTypePaymentHash.lift(try! rustCall { - uniffi_ldk_node_fn_method_bolt11invoice_payment_hash(self.uniffiClonePointer(), $0) - }) - } - - open func paymentSecret() -> PaymentSecret { - return try! FfiConverterTypePaymentSecret.lift(try! rustCall { - uniffi_ldk_node_fn_method_bolt11invoice_payment_secret(self.uniffiClonePointer(), $0) - }) - } - - open func recoverPayeePubKey() -> PublicKey { - return try! FfiConverterTypePublicKey.lift(try! rustCall { - uniffi_ldk_node_fn_method_bolt11invoice_recover_payee_pub_key(self.uniffiClonePointer(), $0) - }) - } - - open func routeHints() -> [[RouteHintHop]] { - return try! FfiConverterSequenceSequenceTypeRouteHintHop.lift(try! rustCall { - uniffi_ldk_node_fn_method_bolt11invoice_route_hints(self.uniffiClonePointer(), $0) - }) - } - - open func secondsSinceEpoch() -> UInt64 { - return try! FfiConverterUInt64.lift(try! rustCall { - uniffi_ldk_node_fn_method_bolt11invoice_seconds_since_epoch(self.uniffiClonePointer(), $0) - }) - } - - open func secondsUntilExpiry() -> UInt64 { - return try! FfiConverterUInt64.lift(try! rustCall { - uniffi_ldk_node_fn_method_bolt11invoice_seconds_until_expiry(self.uniffiClonePointer(), $0) - }) - } - - open func signableHash() -> [UInt8] { - return try! FfiConverterSequenceUInt8.lift(try! rustCall { - uniffi_ldk_node_fn_method_bolt11invoice_signable_hash(self.uniffiClonePointer(), $0) - }) - } - - open func wouldExpire(atTimeSeconds: UInt64) -> Bool { - return try! FfiConverterBool.lift(try! rustCall { - uniffi_ldk_node_fn_method_bolt11invoice_would_expire(self.uniffiClonePointer(), - FfiConverterUInt64.lower(atTimeSeconds), $0) - }) - } + +public static func fromStr(invoiceStr: String)throws -> Bolt11Invoice { + return try FfiConverterTypeBolt11Invoice.lift(try rustCallWithError(FfiConverterTypeNodeError.lift) { + uniffi_ldk_node_fn_constructor_bolt11invoice_from_str( + FfiConverterString.lower(invoiceStr),$0 + ) +}) +} + + +open func amountMilliSatoshis() -> UInt64? { + return try! FfiConverterOptionUInt64.lift(try! rustCall() { + uniffi_ldk_node_fn_method_bolt11invoice_amount_milli_satoshis(self.uniffiClonePointer(),$0 + ) +}) +} + +open func currency() -> Currency { + return try! FfiConverterTypeCurrency.lift(try! rustCall() { + uniffi_ldk_node_fn_method_bolt11invoice_currency(self.uniffiClonePointer(),$0 + ) +}) +} + +open func expiryTimeSeconds() -> UInt64 { + return try! FfiConverterUInt64.lift(try! rustCall() { + uniffi_ldk_node_fn_method_bolt11invoice_expiry_time_seconds(self.uniffiClonePointer(),$0 + ) +}) +} + +open func fallbackAddresses() -> [Address] { + return try! FfiConverterSequenceTypeAddress.lift(try! rustCall() { + uniffi_ldk_node_fn_method_bolt11invoice_fallback_addresses(self.uniffiClonePointer(),$0 + ) +}) +} + +open func invoiceDescription() -> Bolt11InvoiceDescription { + return try! FfiConverterTypeBolt11InvoiceDescription.lift(try! rustCall() { + uniffi_ldk_node_fn_method_bolt11invoice_invoice_description(self.uniffiClonePointer(),$0 + ) +}) +} + +open func isExpired() -> Bool { + return try! FfiConverterBool.lift(try! rustCall() { + uniffi_ldk_node_fn_method_bolt11invoice_is_expired(self.uniffiClonePointer(),$0 + ) +}) +} + +open func minFinalCltvExpiryDelta() -> UInt64 { + return try! FfiConverterUInt64.lift(try! rustCall() { + uniffi_ldk_node_fn_method_bolt11invoice_min_final_cltv_expiry_delta(self.uniffiClonePointer(),$0 + ) +}) +} + +open func network() -> Network { + return try! FfiConverterTypeNetwork.lift(try! rustCall() { + uniffi_ldk_node_fn_method_bolt11invoice_network(self.uniffiClonePointer(),$0 + ) +}) +} + +open func paymentHash() -> PaymentHash { + return try! FfiConverterTypePaymentHash.lift(try! rustCall() { + uniffi_ldk_node_fn_method_bolt11invoice_payment_hash(self.uniffiClonePointer(),$0 + ) +}) +} + +open func paymentSecret() -> PaymentSecret { + return try! FfiConverterTypePaymentSecret.lift(try! rustCall() { + uniffi_ldk_node_fn_method_bolt11invoice_payment_secret(self.uniffiClonePointer(),$0 + ) +}) +} + +open func recoverPayeePubKey() -> PublicKey { + return try! FfiConverterTypePublicKey.lift(try! rustCall() { + uniffi_ldk_node_fn_method_bolt11invoice_recover_payee_pub_key(self.uniffiClonePointer(),$0 + ) +}) +} + +open func routeHints() -> [[RouteHintHop]] { + return try! FfiConverterSequenceSequenceTypeRouteHintHop.lift(try! rustCall() { + uniffi_ldk_node_fn_method_bolt11invoice_route_hints(self.uniffiClonePointer(),$0 + ) +}) +} + +open func secondsSinceEpoch() -> UInt64 { + return try! FfiConverterUInt64.lift(try! rustCall() { + uniffi_ldk_node_fn_method_bolt11invoice_seconds_since_epoch(self.uniffiClonePointer(),$0 + ) +}) +} + +open func secondsUntilExpiry() -> UInt64 { + return try! FfiConverterUInt64.lift(try! rustCall() { + uniffi_ldk_node_fn_method_bolt11invoice_seconds_until_expiry(self.uniffiClonePointer(),$0 + ) +}) +} + +open func signableHash() -> [UInt8] { + return try! FfiConverterSequenceUInt8.lift(try! rustCall() { + uniffi_ldk_node_fn_method_bolt11invoice_signable_hash(self.uniffiClonePointer(),$0 + ) +}) +} + +open func wouldExpire(atTimeSeconds: UInt64) -> Bool { + return try! FfiConverterBool.lift(try! rustCall() { + uniffi_ldk_node_fn_method_bolt11invoice_would_expire(self.uniffiClonePointer(), + FfiConverterUInt64.lower(atTimeSeconds),$0 + ) +}) +} + open var debugDescription: String { - return try! FfiConverterString.lift( - try! rustCall { - uniffi_ldk_node_fn_method_bolt11invoice_uniffi_trait_debug(self.uniffiClonePointer(), $0) - } + return try! FfiConverterString.lift( + try! rustCall() { + uniffi_ldk_node_fn_method_bolt11invoice_uniffi_trait_debug(self.uniffiClonePointer(),$0 + ) +} ) } - open var description: String { - return try! FfiConverterString.lift( - try! rustCall { - uniffi_ldk_node_fn_method_bolt11invoice_uniffi_trait_display(self.uniffiClonePointer(), $0) - } + return try! FfiConverterString.lift( + try! rustCall() { + uniffi_ldk_node_fn_method_bolt11invoice_uniffi_trait_display(self.uniffiClonePointer(),$0 + ) +} ) } - public static func == (self: Bolt11Invoice, other: Bolt11Invoice) -> Bool { - return try! FfiConverterBool.lift( - try! rustCall { - uniffi_ldk_node_fn_method_bolt11invoice_uniffi_trait_eq_eq(self.uniffiClonePointer(), - FfiConverterTypeBolt11Invoice.lower(other), $0) - } + return try! FfiConverterBool.lift( + try! rustCall() { + uniffi_ldk_node_fn_method_bolt11invoice_uniffi_trait_eq_eq(self.uniffiClonePointer(), + FfiConverterTypeBolt11Invoice.lower(other),$0 + ) +} ) } + } public struct FfiConverterTypeBolt11Invoice: FfiConverter { + typealias FfiType = UnsafeMutableRawPointer typealias SwiftType = Bolt11Invoice @@ -732,7 +758,7 @@ public struct FfiConverterTypeBolt11Invoice: FfiConverter { // The Rust code won't compile if a pointer won't fit in a UInt64. // We have to go via `UInt` because that's the thing that's the size of a pointer. let ptr = UnsafeMutableRawPointer(bitPattern: UInt(truncatingIfNeeded: v)) - if ptr == nil { + if (ptr == nil) { throw UniffiInternalError.unexpectedNullPointer } return try lift(ptr!) @@ -745,6 +771,9 @@ public struct FfiConverterTypeBolt11Invoice: FfiConverter { } } + + + public func FfiConverterTypeBolt11Invoice_lift(_ pointer: UnsafeMutableRawPointer) throws -> Bolt11Invoice { return try FfiConverterTypeBolt11Invoice.lift(pointer) } @@ -753,35 +782,43 @@ public func FfiConverterTypeBolt11Invoice_lower(_ value: Bolt11Invoice) -> Unsaf return FfiConverterTypeBolt11Invoice.lower(value) } -public protocol Bolt11PaymentProtocol: AnyObject { - func claimForHash(paymentHash: PaymentHash, claimableAmountMsat: UInt64, preimage: PaymentPreimage) throws - func failForHash(paymentHash: PaymentHash) throws - func receive(amountMsat: UInt64, description: Bolt11InvoiceDescription, expirySecs: UInt32) throws -> Bolt11Invoice - func receiveForHash(amountMsat: UInt64, description: Bolt11InvoiceDescription, expirySecs: UInt32, paymentHash: PaymentHash) throws -> Bolt11Invoice - - func receiveVariableAmount(description: Bolt11InvoiceDescription, expirySecs: UInt32) throws -> Bolt11Invoice - - func receiveVariableAmountForHash(description: Bolt11InvoiceDescription, expirySecs: UInt32, paymentHash: PaymentHash) throws -> Bolt11Invoice - - func receiveVariableAmountViaJitChannel(description: Bolt11InvoiceDescription, expirySecs: UInt32, maxProportionalLspFeeLimitPpmMsat: UInt64?) throws -> Bolt11Invoice - - func receiveViaJitChannel(amountMsat: UInt64, description: Bolt11InvoiceDescription, expirySecs: UInt32, maxLspFeeLimitMsat: UInt64?) throws -> Bolt11Invoice - - func send(invoice: Bolt11Invoice, sendingParameters: SendingParameters?) throws -> PaymentId - - func sendProbes(invoice: Bolt11Invoice) throws - - func sendProbesUsingAmount(invoice: Bolt11Invoice, amountMsat: UInt64) throws - - func sendUsingAmount(invoice: Bolt11Invoice, amountMsat: UInt64, sendingParameters: SendingParameters?) throws -> PaymentId +public protocol Bolt11PaymentProtocol : AnyObject { + + func claimForHash(paymentHash: PaymentHash, claimableAmountMsat: UInt64, preimage: PaymentPreimage) throws + + func estimateRoutingFees(invoice: Bolt11Invoice) throws -> UInt64 + + func estimateRoutingFeesUsingAmount(invoice: Bolt11Invoice, amountMsat: UInt64) throws -> UInt64 + + func failForHash(paymentHash: PaymentHash) throws + + func receive(amountMsat: UInt64, description: Bolt11InvoiceDescription, expirySecs: UInt32) throws -> Bolt11Invoice + + func receiveForHash(amountMsat: UInt64, description: Bolt11InvoiceDescription, expirySecs: UInt32, paymentHash: PaymentHash) throws -> Bolt11Invoice + + func receiveVariableAmount(description: Bolt11InvoiceDescription, expirySecs: UInt32) throws -> Bolt11Invoice + + func receiveVariableAmountForHash(description: Bolt11InvoiceDescription, expirySecs: UInt32, paymentHash: PaymentHash) throws -> Bolt11Invoice + + func receiveVariableAmountViaJitChannel(description: Bolt11InvoiceDescription, expirySecs: UInt32, maxProportionalLspFeeLimitPpmMsat: UInt64?) throws -> Bolt11Invoice + + func receiveViaJitChannel(amountMsat: UInt64, description: Bolt11InvoiceDescription, expirySecs: UInt32, maxLspFeeLimitMsat: UInt64?) throws -> Bolt11Invoice + + func send(invoice: Bolt11Invoice, sendingParameters: SendingParameters?) throws -> PaymentId + + func sendProbes(invoice: Bolt11Invoice) throws + + func sendProbesUsingAmount(invoice: Bolt11Invoice, amountMsat: UInt64) throws + + func sendUsingAmount(invoice: Bolt11Invoice, amountMsat: UInt64, sendingParameters: SendingParameters?) throws -> PaymentId + } open class Bolt11Payment: - Bolt11PaymentProtocol -{ + Bolt11PaymentProtocol { fileprivate let pointer: UnsafeMutableRawPointer! /// Used to instantiate a [FFIObject] without an actual pointer, for fakes in tests, mostly. @@ -792,7 +829,7 @@ open class Bolt11Payment: // TODO: We'd like this to be `private` but for Swifty reasons, // we can't implement `FfiConverter` without making this `required` and we can't // make it `required` without making it `public`. - public required init(unsafeFromRawPointer pointer: UnsafeMutableRawPointer) { + required public init(unsafeFromRawPointer pointer: UnsafeMutableRawPointer) { self.pointer = pointer } @@ -801,14 +838,13 @@ open class Bolt11Payment: /// /// - Warning: /// Any object instantiated with this constructor cannot be passed to an actual Rust-backed object. Since there isn't a backing [Pointer] the FFI lower functions will crash. - public init(noPointer _: NoPointer) { - pointer = nil + public init(noPointer: NoPointer) { + self.pointer = nil } public func uniffiClonePointer() -> UnsafeMutableRawPointer { return try! rustCall { uniffi_ldk_node_fn_clone_bolt11payment(self.pointer, $0) } } - // No primary constructor declared for this class. deinit { @@ -819,107 +855,142 @@ open class Bolt11Payment: try! rustCall { uniffi_ldk_node_fn_free_bolt11payment(pointer, $0) } } - open func claimForHash(paymentHash: PaymentHash, claimableAmountMsat: UInt64, preimage: PaymentPreimage) throws { try rustCallWithError(FfiConverterTypeNodeError.lift) { - uniffi_ldk_node_fn_method_bolt11payment_claim_for_hash(self.uniffiClonePointer(), - FfiConverterTypePaymentHash.lower(paymentHash), - FfiConverterUInt64.lower(claimableAmountMsat), - FfiConverterTypePaymentPreimage.lower(preimage), $0) - } - } - - open func failForHash(paymentHash: PaymentHash) throws { try rustCallWithError(FfiConverterTypeNodeError.lift) { - uniffi_ldk_node_fn_method_bolt11payment_fail_for_hash(self.uniffiClonePointer(), - FfiConverterTypePaymentHash.lower(paymentHash), $0) - } - } - - open func receive(amountMsat: UInt64, description: Bolt11InvoiceDescription, expirySecs: UInt32) throws -> Bolt11Invoice { - return try FfiConverterTypeBolt11Invoice.lift(rustCallWithError(FfiConverterTypeNodeError.lift) { - uniffi_ldk_node_fn_method_bolt11payment_receive(self.uniffiClonePointer(), - FfiConverterUInt64.lower(amountMsat), - FfiConverterTypeBolt11InvoiceDescription.lower(description), - FfiConverterUInt32.lower(expirySecs), $0) - }) - } - - open func receiveForHash(amountMsat: UInt64, description: Bolt11InvoiceDescription, expirySecs: UInt32, paymentHash: PaymentHash) throws -> Bolt11Invoice { - return try FfiConverterTypeBolt11Invoice.lift(rustCallWithError(FfiConverterTypeNodeError.lift) { - uniffi_ldk_node_fn_method_bolt11payment_receive_for_hash(self.uniffiClonePointer(), - FfiConverterUInt64.lower(amountMsat), - FfiConverterTypeBolt11InvoiceDescription.lower(description), - FfiConverterUInt32.lower(expirySecs), - FfiConverterTypePaymentHash.lower(paymentHash), $0) - }) - } - - open func receiveVariableAmount(description: Bolt11InvoiceDescription, expirySecs: UInt32) throws -> Bolt11Invoice { - return try FfiConverterTypeBolt11Invoice.lift(rustCallWithError(FfiConverterTypeNodeError.lift) { - uniffi_ldk_node_fn_method_bolt11payment_receive_variable_amount(self.uniffiClonePointer(), - FfiConverterTypeBolt11InvoiceDescription.lower(description), - FfiConverterUInt32.lower(expirySecs), $0) - }) - } - - open func receiveVariableAmountForHash(description: Bolt11InvoiceDescription, expirySecs: UInt32, paymentHash: PaymentHash) throws -> Bolt11Invoice { - return try FfiConverterTypeBolt11Invoice.lift(rustCallWithError(FfiConverterTypeNodeError.lift) { - uniffi_ldk_node_fn_method_bolt11payment_receive_variable_amount_for_hash(self.uniffiClonePointer(), - FfiConverterTypeBolt11InvoiceDescription.lower(description), - FfiConverterUInt32.lower(expirySecs), - FfiConverterTypePaymentHash.lower(paymentHash), $0) - }) - } - - open func receiveVariableAmountViaJitChannel(description: Bolt11InvoiceDescription, expirySecs: UInt32, maxProportionalLspFeeLimitPpmMsat: UInt64?) throws -> Bolt11Invoice { - return try FfiConverterTypeBolt11Invoice.lift(rustCallWithError(FfiConverterTypeNodeError.lift) { - uniffi_ldk_node_fn_method_bolt11payment_receive_variable_amount_via_jit_channel(self.uniffiClonePointer(), - FfiConverterTypeBolt11InvoiceDescription.lower(description), - FfiConverterUInt32.lower(expirySecs), - FfiConverterOptionUInt64.lower(maxProportionalLspFeeLimitPpmMsat), $0) - }) - } - - open func receiveViaJitChannel(amountMsat: UInt64, description: Bolt11InvoiceDescription, expirySecs: UInt32, maxLspFeeLimitMsat: UInt64?) throws -> Bolt11Invoice { - return try FfiConverterTypeBolt11Invoice.lift(rustCallWithError(FfiConverterTypeNodeError.lift) { - uniffi_ldk_node_fn_method_bolt11payment_receive_via_jit_channel(self.uniffiClonePointer(), - FfiConverterUInt64.lower(amountMsat), - FfiConverterTypeBolt11InvoiceDescription.lower(description), - FfiConverterUInt32.lower(expirySecs), - FfiConverterOptionUInt64.lower(maxLspFeeLimitMsat), $0) - }) - } - - open func send(invoice: Bolt11Invoice, sendingParameters: SendingParameters?) throws -> PaymentId { - return try FfiConverterTypePaymentId.lift(rustCallWithError(FfiConverterTypeNodeError.lift) { - uniffi_ldk_node_fn_method_bolt11payment_send(self.uniffiClonePointer(), - FfiConverterTypeBolt11Invoice.lower(invoice), - FfiConverterOptionTypeSendingParameters.lower(sendingParameters), $0) - }) - } - - open func sendProbes(invoice: Bolt11Invoice) throws { try rustCallWithError(FfiConverterTypeNodeError.lift) { - uniffi_ldk_node_fn_method_bolt11payment_send_probes(self.uniffiClonePointer(), - FfiConverterTypeBolt11Invoice.lower(invoice), $0) - } - } + - open func sendProbesUsingAmount(invoice: Bolt11Invoice, amountMsat: UInt64) throws { try rustCallWithError(FfiConverterTypeNodeError.lift) { - uniffi_ldk_node_fn_method_bolt11payment_send_probes_using_amount(self.uniffiClonePointer(), - FfiConverterTypeBolt11Invoice.lower(invoice), - FfiConverterUInt64.lower(amountMsat), $0) - } - } + +open func claimForHash(paymentHash: PaymentHash, claimableAmountMsat: UInt64, preimage: PaymentPreimage)throws {try rustCallWithError(FfiConverterTypeNodeError.lift) { + uniffi_ldk_node_fn_method_bolt11payment_claim_for_hash(self.uniffiClonePointer(), + FfiConverterTypePaymentHash.lower(paymentHash), + FfiConverterUInt64.lower(claimableAmountMsat), + FfiConverterTypePaymentPreimage.lower(preimage),$0 + ) +} +} + +open func estimateRoutingFees(invoice: Bolt11Invoice)throws -> UInt64 { + return try FfiConverterUInt64.lift(try rustCallWithError(FfiConverterTypeNodeError.lift) { + uniffi_ldk_node_fn_method_bolt11payment_estimate_routing_fees(self.uniffiClonePointer(), + FfiConverterTypeBolt11Invoice.lower(invoice),$0 + ) +}) +} + +open func estimateRoutingFeesUsingAmount(invoice: Bolt11Invoice, amountMsat: UInt64)throws -> UInt64 { + return try FfiConverterUInt64.lift(try rustCallWithError(FfiConverterTypeNodeError.lift) { + uniffi_ldk_node_fn_method_bolt11payment_estimate_routing_fees_using_amount(self.uniffiClonePointer(), + FfiConverterTypeBolt11Invoice.lower(invoice), + FfiConverterUInt64.lower(amountMsat),$0 + ) +}) +} + +open func failForHash(paymentHash: PaymentHash)throws {try rustCallWithError(FfiConverterTypeNodeError.lift) { + uniffi_ldk_node_fn_method_bolt11payment_fail_for_hash(self.uniffiClonePointer(), + FfiConverterTypePaymentHash.lower(paymentHash),$0 + ) +} +} + +open func receive(amountMsat: UInt64, description: Bolt11InvoiceDescription, expirySecs: UInt32)throws -> Bolt11Invoice { + return try FfiConverterTypeBolt11Invoice.lift(try rustCallWithError(FfiConverterTypeNodeError.lift) { + uniffi_ldk_node_fn_method_bolt11payment_receive(self.uniffiClonePointer(), + FfiConverterUInt64.lower(amountMsat), + FfiConverterTypeBolt11InvoiceDescription.lower(description), + FfiConverterUInt32.lower(expirySecs),$0 + ) +}) +} + +open func receiveForHash(amountMsat: UInt64, description: Bolt11InvoiceDescription, expirySecs: UInt32, paymentHash: PaymentHash)throws -> Bolt11Invoice { + return try FfiConverterTypeBolt11Invoice.lift(try rustCallWithError(FfiConverterTypeNodeError.lift) { + uniffi_ldk_node_fn_method_bolt11payment_receive_for_hash(self.uniffiClonePointer(), + FfiConverterUInt64.lower(amountMsat), + FfiConverterTypeBolt11InvoiceDescription.lower(description), + FfiConverterUInt32.lower(expirySecs), + FfiConverterTypePaymentHash.lower(paymentHash),$0 + ) +}) +} + +open func receiveVariableAmount(description: Bolt11InvoiceDescription, expirySecs: UInt32)throws -> Bolt11Invoice { + return try FfiConverterTypeBolt11Invoice.lift(try rustCallWithError(FfiConverterTypeNodeError.lift) { + uniffi_ldk_node_fn_method_bolt11payment_receive_variable_amount(self.uniffiClonePointer(), + FfiConverterTypeBolt11InvoiceDescription.lower(description), + FfiConverterUInt32.lower(expirySecs),$0 + ) +}) +} + +open func receiveVariableAmountForHash(description: Bolt11InvoiceDescription, expirySecs: UInt32, paymentHash: PaymentHash)throws -> Bolt11Invoice { + return try FfiConverterTypeBolt11Invoice.lift(try rustCallWithError(FfiConverterTypeNodeError.lift) { + uniffi_ldk_node_fn_method_bolt11payment_receive_variable_amount_for_hash(self.uniffiClonePointer(), + FfiConverterTypeBolt11InvoiceDescription.lower(description), + FfiConverterUInt32.lower(expirySecs), + FfiConverterTypePaymentHash.lower(paymentHash),$0 + ) +}) +} + +open func receiveVariableAmountViaJitChannel(description: Bolt11InvoiceDescription, expirySecs: UInt32, maxProportionalLspFeeLimitPpmMsat: UInt64?)throws -> Bolt11Invoice { + return try FfiConverterTypeBolt11Invoice.lift(try rustCallWithError(FfiConverterTypeNodeError.lift) { + uniffi_ldk_node_fn_method_bolt11payment_receive_variable_amount_via_jit_channel(self.uniffiClonePointer(), + FfiConverterTypeBolt11InvoiceDescription.lower(description), + FfiConverterUInt32.lower(expirySecs), + FfiConverterOptionUInt64.lower(maxProportionalLspFeeLimitPpmMsat),$0 + ) +}) +} + +open func receiveViaJitChannel(amountMsat: UInt64, description: Bolt11InvoiceDescription, expirySecs: UInt32, maxLspFeeLimitMsat: UInt64?)throws -> Bolt11Invoice { + return try FfiConverterTypeBolt11Invoice.lift(try rustCallWithError(FfiConverterTypeNodeError.lift) { + uniffi_ldk_node_fn_method_bolt11payment_receive_via_jit_channel(self.uniffiClonePointer(), + FfiConverterUInt64.lower(amountMsat), + FfiConverterTypeBolt11InvoiceDescription.lower(description), + FfiConverterUInt32.lower(expirySecs), + FfiConverterOptionUInt64.lower(maxLspFeeLimitMsat),$0 + ) +}) +} + +open func send(invoice: Bolt11Invoice, sendingParameters: SendingParameters?)throws -> PaymentId { + return try FfiConverterTypePaymentId.lift(try rustCallWithError(FfiConverterTypeNodeError.lift) { + uniffi_ldk_node_fn_method_bolt11payment_send(self.uniffiClonePointer(), + FfiConverterTypeBolt11Invoice.lower(invoice), + FfiConverterOptionTypeSendingParameters.lower(sendingParameters),$0 + ) +}) +} + +open func sendProbes(invoice: Bolt11Invoice)throws {try rustCallWithError(FfiConverterTypeNodeError.lift) { + uniffi_ldk_node_fn_method_bolt11payment_send_probes(self.uniffiClonePointer(), + FfiConverterTypeBolt11Invoice.lower(invoice),$0 + ) +} +} + +open func sendProbesUsingAmount(invoice: Bolt11Invoice, amountMsat: UInt64)throws {try rustCallWithError(FfiConverterTypeNodeError.lift) { + uniffi_ldk_node_fn_method_bolt11payment_send_probes_using_amount(self.uniffiClonePointer(), + FfiConverterTypeBolt11Invoice.lower(invoice), + FfiConverterUInt64.lower(amountMsat),$0 + ) +} +} + +open func sendUsingAmount(invoice: Bolt11Invoice, amountMsat: UInt64, sendingParameters: SendingParameters?)throws -> PaymentId { + return try FfiConverterTypePaymentId.lift(try rustCallWithError(FfiConverterTypeNodeError.lift) { + uniffi_ldk_node_fn_method_bolt11payment_send_using_amount(self.uniffiClonePointer(), + FfiConverterTypeBolt11Invoice.lower(invoice), + FfiConverterUInt64.lower(amountMsat), + FfiConverterOptionTypeSendingParameters.lower(sendingParameters),$0 + ) +}) +} + - open func sendUsingAmount(invoice: Bolt11Invoice, amountMsat: UInt64, sendingParameters: SendingParameters?) throws -> PaymentId { - return try FfiConverterTypePaymentId.lift(rustCallWithError(FfiConverterTypeNodeError.lift) { - uniffi_ldk_node_fn_method_bolt11payment_send_using_amount(self.uniffiClonePointer(), - FfiConverterTypeBolt11Invoice.lower(invoice), - FfiConverterUInt64.lower(amountMsat), - FfiConverterOptionTypeSendingParameters.lower(sendingParameters), $0) - }) - } } public struct FfiConverterTypeBolt11Payment: FfiConverter { + typealias FfiType = UnsafeMutableRawPointer typealias SwiftType = Bolt11Payment @@ -936,7 +1007,7 @@ public struct FfiConverterTypeBolt11Payment: FfiConverter { // The Rust code won't compile if a pointer won't fit in a UInt64. // We have to go via `UInt` because that's the thing that's the size of a pointer. let ptr = UnsafeMutableRawPointer(bitPattern: UInt(truncatingIfNeeded: v)) - if ptr == nil { + if (ptr == nil) { throw UniffiInternalError.unexpectedNullPointer } return try lift(ptr!) @@ -949,6 +1020,9 @@ public struct FfiConverterTypeBolt11Payment: FfiConverter { } } + + + public func FfiConverterTypeBolt11Payment_lift(_ pointer: UnsafeMutableRawPointer) throws -> Bolt11Payment { return try FfiConverterTypeBolt11Payment.lift(pointer) } @@ -957,23 +1031,27 @@ public func FfiConverterTypeBolt11Payment_lower(_ value: Bolt11Payment) -> Unsaf return FfiConverterTypeBolt11Payment.lower(value) } -public protocol Bolt12PaymentProtocol: AnyObject { - func initiateRefund(amountMsat: UInt64, expirySecs: UInt32, quantity: UInt64?, payerNote: String?) throws -> Refund - - func receive(amountMsat: UInt64, description: String, expirySecs: UInt32?, quantity: UInt64?) throws -> Offer - func receiveVariableAmount(description: String, expirySecs: UInt32?) throws -> Offer - func requestRefundPayment(refund: Refund) throws -> Bolt12Invoice - func send(offer: Offer, quantity: UInt64?, payerNote: String?) throws -> PaymentId - - func sendUsingAmount(offer: Offer, amountMsat: UInt64, quantity: UInt64?, payerNote: String?) throws -> PaymentId +public protocol Bolt12PaymentProtocol : AnyObject { + + func initiateRefund(amountMsat: UInt64, expirySecs: UInt32, quantity: UInt64?, payerNote: String?) throws -> Refund + + func receive(amountMsat: UInt64, description: String, expirySecs: UInt32?, quantity: UInt64?) throws -> Offer + + func receiveVariableAmount(description: String, expirySecs: UInt32?) throws -> Offer + + func requestRefundPayment(refund: Refund) throws -> Bolt12Invoice + + func send(offer: Offer, quantity: UInt64?, payerNote: String?) throws -> PaymentId + + func sendUsingAmount(offer: Offer, amountMsat: UInt64, quantity: UInt64?, payerNote: String?) throws -> PaymentId + } open class Bolt12Payment: - Bolt12PaymentProtocol -{ + Bolt12PaymentProtocol { fileprivate let pointer: UnsafeMutableRawPointer! /// Used to instantiate a [FFIObject] without an actual pointer, for fakes in tests, mostly. @@ -984,7 +1062,7 @@ open class Bolt12Payment: // TODO: We'd like this to be `private` but for Swifty reasons, // we can't implement `FfiConverter` without making this `required` and we can't // make it `required` without making it `public`. - public required init(unsafeFromRawPointer pointer: UnsafeMutableRawPointer) { + required public init(unsafeFromRawPointer pointer: UnsafeMutableRawPointer) { self.pointer = pointer } @@ -993,14 +1071,13 @@ open class Bolt12Payment: /// /// - Warning: /// Any object instantiated with this constructor cannot be passed to an actual Rust-backed object. Since there isn't a backing [Pointer] the FFI lower functions will crash. - public init(noPointer _: NoPointer) { - pointer = nil + public init(noPointer: NoPointer) { + self.pointer = nil } public func uniffiClonePointer() -> UnsafeMutableRawPointer { return try! rustCall { uniffi_ldk_node_fn_clone_bolt12payment(self.pointer, $0) } } - // No primary constructor declared for this class. deinit { @@ -1011,62 +1088,74 @@ open class Bolt12Payment: try! rustCall { uniffi_ldk_node_fn_free_bolt12payment(pointer, $0) } } - open func initiateRefund(amountMsat: UInt64, expirySecs: UInt32, quantity: UInt64?, payerNote: String?) throws -> Refund { - return try FfiConverterTypeRefund.lift(rustCallWithError(FfiConverterTypeNodeError.lift) { - uniffi_ldk_node_fn_method_bolt12payment_initiate_refund(self.uniffiClonePointer(), - FfiConverterUInt64.lower(amountMsat), - FfiConverterUInt32.lower(expirySecs), - FfiConverterOptionUInt64.lower(quantity), - FfiConverterOptionString.lower(payerNote), $0) - }) - } - - open func receive(amountMsat: UInt64, description: String, expirySecs: UInt32?, quantity: UInt64?) throws -> Offer { - return try FfiConverterTypeOffer.lift(rustCallWithError(FfiConverterTypeNodeError.lift) { - uniffi_ldk_node_fn_method_bolt12payment_receive(self.uniffiClonePointer(), - FfiConverterUInt64.lower(amountMsat), - FfiConverterString.lower(description), - FfiConverterOptionUInt32.lower(expirySecs), - FfiConverterOptionUInt64.lower(quantity), $0) - }) - } - - open func receiveVariableAmount(description: String, expirySecs: UInt32?) throws -> Offer { - return try FfiConverterTypeOffer.lift(rustCallWithError(FfiConverterTypeNodeError.lift) { - uniffi_ldk_node_fn_method_bolt12payment_receive_variable_amount(self.uniffiClonePointer(), - FfiConverterString.lower(description), - FfiConverterOptionUInt32.lower(expirySecs), $0) - }) - } - - open func requestRefundPayment(refund: Refund) throws -> Bolt12Invoice { - return try FfiConverterTypeBolt12Invoice.lift(rustCallWithError(FfiConverterTypeNodeError.lift) { - uniffi_ldk_node_fn_method_bolt12payment_request_refund_payment(self.uniffiClonePointer(), - FfiConverterTypeRefund.lower(refund), $0) - }) - } + - open func send(offer: Offer, quantity: UInt64?, payerNote: String?) throws -> PaymentId { - return try FfiConverterTypePaymentId.lift(rustCallWithError(FfiConverterTypeNodeError.lift) { - uniffi_ldk_node_fn_method_bolt12payment_send(self.uniffiClonePointer(), - FfiConverterTypeOffer.lower(offer), - FfiConverterOptionUInt64.lower(quantity), - FfiConverterOptionString.lower(payerNote), $0) - }) - } + +open func initiateRefund(amountMsat: UInt64, expirySecs: UInt32, quantity: UInt64?, payerNote: String?)throws -> Refund { + return try FfiConverterTypeRefund.lift(try rustCallWithError(FfiConverterTypeNodeError.lift) { + uniffi_ldk_node_fn_method_bolt12payment_initiate_refund(self.uniffiClonePointer(), + FfiConverterUInt64.lower(amountMsat), + FfiConverterUInt32.lower(expirySecs), + FfiConverterOptionUInt64.lower(quantity), + FfiConverterOptionString.lower(payerNote),$0 + ) +}) +} + +open func receive(amountMsat: UInt64, description: String, expirySecs: UInt32?, quantity: UInt64?)throws -> Offer { + return try FfiConverterTypeOffer.lift(try rustCallWithError(FfiConverterTypeNodeError.lift) { + uniffi_ldk_node_fn_method_bolt12payment_receive(self.uniffiClonePointer(), + FfiConverterUInt64.lower(amountMsat), + FfiConverterString.lower(description), + FfiConverterOptionUInt32.lower(expirySecs), + FfiConverterOptionUInt64.lower(quantity),$0 + ) +}) +} + +open func receiveVariableAmount(description: String, expirySecs: UInt32?)throws -> Offer { + return try FfiConverterTypeOffer.lift(try rustCallWithError(FfiConverterTypeNodeError.lift) { + uniffi_ldk_node_fn_method_bolt12payment_receive_variable_amount(self.uniffiClonePointer(), + FfiConverterString.lower(description), + FfiConverterOptionUInt32.lower(expirySecs),$0 + ) +}) +} + +open func requestRefundPayment(refund: Refund)throws -> Bolt12Invoice { + return try FfiConverterTypeBolt12Invoice.lift(try rustCallWithError(FfiConverterTypeNodeError.lift) { + uniffi_ldk_node_fn_method_bolt12payment_request_refund_payment(self.uniffiClonePointer(), + FfiConverterTypeRefund.lower(refund),$0 + ) +}) +} + +open func send(offer: Offer, quantity: UInt64?, payerNote: String?)throws -> PaymentId { + return try FfiConverterTypePaymentId.lift(try rustCallWithError(FfiConverterTypeNodeError.lift) { + uniffi_ldk_node_fn_method_bolt12payment_send(self.uniffiClonePointer(), + FfiConverterTypeOffer.lower(offer), + FfiConverterOptionUInt64.lower(quantity), + FfiConverterOptionString.lower(payerNote),$0 + ) +}) +} + +open func sendUsingAmount(offer: Offer, amountMsat: UInt64, quantity: UInt64?, payerNote: String?)throws -> PaymentId { + return try FfiConverterTypePaymentId.lift(try rustCallWithError(FfiConverterTypeNodeError.lift) { + uniffi_ldk_node_fn_method_bolt12payment_send_using_amount(self.uniffiClonePointer(), + FfiConverterTypeOffer.lower(offer), + FfiConverterUInt64.lower(amountMsat), + FfiConverterOptionUInt64.lower(quantity), + FfiConverterOptionString.lower(payerNote),$0 + ) +}) +} + - open func sendUsingAmount(offer: Offer, amountMsat: UInt64, quantity: UInt64?, payerNote: String?) throws -> PaymentId { - return try FfiConverterTypePaymentId.lift(rustCallWithError(FfiConverterTypeNodeError.lift) { - uniffi_ldk_node_fn_method_bolt12payment_send_using_amount(self.uniffiClonePointer(), - FfiConverterTypeOffer.lower(offer), - FfiConverterUInt64.lower(amountMsat), - FfiConverterOptionUInt64.lower(quantity), - FfiConverterOptionString.lower(payerNote), $0) - }) - } } public struct FfiConverterTypeBolt12Payment: FfiConverter { + typealias FfiType = UnsafeMutableRawPointer typealias SwiftType = Bolt12Payment @@ -1083,7 +1172,7 @@ public struct FfiConverterTypeBolt12Payment: FfiConverter { // The Rust code won't compile if a pointer won't fit in a UInt64. // We have to go via `UInt` because that's the thing that's the size of a pointer. let ptr = UnsafeMutableRawPointer(bitPattern: UInt(truncatingIfNeeded: v)) - if ptr == nil { + if (ptr == nil) { throw UniffiInternalError.unexpectedNullPointer } return try lift(ptr!) @@ -1096,6 +1185,9 @@ public struct FfiConverterTypeBolt12Payment: FfiConverter { } } + + + public func FfiConverterTypeBolt12Payment_lift(_ pointer: UnsafeMutableRawPointer) throws -> Bolt12Payment { return try FfiConverterTypeBolt12Payment.lift(pointer) } @@ -1104,57 +1196,61 @@ public func FfiConverterTypeBolt12Payment_lower(_ value: Bolt12Payment) -> Unsaf return FfiConverterTypeBolt12Payment.lower(value) } -public protocol BuilderProtocol: AnyObject { - func build() throws -> Node - - func buildWithFsStore() throws -> Node - - func buildWithVssStore(vssUrl: String, storeId: String, lnurlAuthServerUrl: String, fixedHeaders: [String: String]) throws -> Node - - func buildWithVssStoreAndFixedHeaders(vssUrl: String, storeId: String, fixedHeaders: [String: String]) throws -> Node - - func buildWithVssStoreAndHeaderProvider(vssUrl: String, storeId: String, headerProvider: VssHeaderProvider) throws -> Node - - func setAnnouncementAddresses(announcementAddresses: [SocketAddress]) throws - - func setChainSourceBitcoindRpc(rpcHost: String, rpcPort: UInt16, rpcUser: String, rpcPassword: String) - - func setChainSourceElectrum(serverUrl: String, config: ElectrumSyncConfig?) - - func setChainSourceEsplora(serverUrl: String, config: EsploraSyncConfig?) - - func setCustomLogger(logWriter: LogWriter) - func setEntropyBip39Mnemonic(mnemonic: Mnemonic, passphrase: String?) - func setEntropySeedBytes(seedBytes: [UInt8]) throws - func setEntropySeedPath(seedPath: String) - - func setFilesystemLogger(logFilePath: String?, maxLogLevel: LogLevel?) - - func setGossipSourceP2p() - - func setGossipSourceRgs(rgsServerUrl: String) - - func setLiquiditySourceLsps1(nodeId: PublicKey, address: SocketAddress, token: String?) - - func setLiquiditySourceLsps2(nodeId: PublicKey, address: SocketAddress, token: String?) - - func setListeningAddresses(listeningAddresses: [SocketAddress]) throws - - func setLogFacadeLogger() - - func setNetwork(network: Network) - - func setNodeAlias(nodeAlias: String) throws - - func setStorageDirPath(storageDirPath: String) +public protocol BuilderProtocol : AnyObject { + + func build() throws -> Node + + func buildWithFsStore() throws -> Node + + func buildWithVssStore(vssUrl: String, storeId: String, lnurlAuthServerUrl: String, fixedHeaders: [String: String]) throws -> Node + + func buildWithVssStoreAndFixedHeaders(vssUrl: String, storeId: String, fixedHeaders: [String: String]) throws -> Node + + func buildWithVssStoreAndHeaderProvider(vssUrl: String, storeId: String, headerProvider: VssHeaderProvider) throws -> Node + + func setAnnouncementAddresses(announcementAddresses: [SocketAddress]) throws + + func setChainSourceBitcoindRpc(rpcHost: String, rpcPort: UInt16, rpcUser: String, rpcPassword: String) + + func setChainSourceElectrum(serverUrl: String, config: ElectrumSyncConfig?) + + func setChainSourceEsplora(serverUrl: String, config: EsploraSyncConfig?) + + func setCustomLogger(logWriter: LogWriter) + + func setEntropyBip39Mnemonic(mnemonic: Mnemonic, passphrase: String?) + + func setEntropySeedBytes(seedBytes: [UInt8]) throws + + func setEntropySeedPath(seedPath: String) + + func setFilesystemLogger(logFilePath: String?, maxLogLevel: LogLevel?) + + func setGossipSourceP2p() + + func setGossipSourceRgs(rgsServerUrl: String) + + func setLiquiditySourceLsps1(nodeId: PublicKey, address: SocketAddress, token: String?) + + func setLiquiditySourceLsps2(nodeId: PublicKey, address: SocketAddress, token: String?) + + func setListeningAddresses(listeningAddresses: [SocketAddress]) throws + + func setLogFacadeLogger() + + func setNetwork(network: Network) + + func setNodeAlias(nodeAlias: String) throws + + func setStorageDirPath(storageDirPath: String) + } open class Builder: - BuilderProtocol -{ + BuilderProtocol { fileprivate let pointer: UnsafeMutableRawPointer! /// Used to instantiate a [FFIObject] without an actual pointer, for fakes in tests, mostly. @@ -1165,7 +1261,7 @@ open class Builder: // TODO: We'd like this to be `private` but for Swifty reasons, // we can't implement `FfiConverter` without making this `required` and we can't // make it `required` without making it `public`. - public required init(unsafeFromRawPointer pointer: UnsafeMutableRawPointer) { + required public init(unsafeFromRawPointer pointer: UnsafeMutableRawPointer) { self.pointer = pointer } @@ -1174,22 +1270,21 @@ open class Builder: /// /// - Warning: /// Any object instantiated with this constructor cannot be passed to an actual Rust-backed object. Since there isn't a backing [Pointer] the FFI lower functions will crash. - public init(noPointer _: NoPointer) { - pointer = nil + public init(noPointer: NoPointer) { + self.pointer = nil } public func uniffiClonePointer() -> UnsafeMutableRawPointer { return try! rustCall { uniffi_ldk_node_fn_clone_builder(self.pointer, $0) } } - - public convenience init() { - let pointer = - try! rustCall { - uniffi_ldk_node_fn_constructor_builder_new($0 - ) - } - self.init(unsafeFromRawPointer: pointer) - } +public convenience init() { + let pointer = + try! rustCall() { + uniffi_ldk_node_fn_constructor_builder_new($0 + ) +} + self.init(unsafeFromRawPointer: pointer) +} deinit { guard let pointer = pointer else { @@ -1199,173 +1294,202 @@ open class Builder: try! rustCall { uniffi_ldk_node_fn_free_builder(pointer, $0) } } - public static func fromConfig(config: Config) -> Builder { - return try! FfiConverterTypeBuilder.lift(try! rustCall { - uniffi_ldk_node_fn_constructor_builder_from_config( - FfiConverterTypeConfig.lower(config), $0 - ) - }) - } - - open func build() throws -> Node { - return try FfiConverterTypeNode.lift(rustCallWithError(FfiConverterTypeBuildError.lift) { - uniffi_ldk_node_fn_method_builder_build(self.uniffiClonePointer(), $0) - }) - } - - open func buildWithFsStore() throws -> Node { - return try FfiConverterTypeNode.lift(rustCallWithError(FfiConverterTypeBuildError.lift) { - uniffi_ldk_node_fn_method_builder_build_with_fs_store(self.uniffiClonePointer(), $0) - }) - } - - open func buildWithVssStore(vssUrl: String, storeId: String, lnurlAuthServerUrl: String, fixedHeaders: [String: String]) throws -> Node { - return try FfiConverterTypeNode.lift(rustCallWithError(FfiConverterTypeBuildError.lift) { - uniffi_ldk_node_fn_method_builder_build_with_vss_store(self.uniffiClonePointer(), - FfiConverterString.lower(vssUrl), - FfiConverterString.lower(storeId), - FfiConverterString.lower(lnurlAuthServerUrl), - FfiConverterDictionaryStringString.lower(fixedHeaders), $0) - }) - } - - open func buildWithVssStoreAndFixedHeaders(vssUrl: String, storeId: String, fixedHeaders: [String: String]) throws -> Node { - return try FfiConverterTypeNode.lift(rustCallWithError(FfiConverterTypeBuildError.lift) { - uniffi_ldk_node_fn_method_builder_build_with_vss_store_and_fixed_headers(self.uniffiClonePointer(), - FfiConverterString.lower(vssUrl), - FfiConverterString.lower(storeId), - FfiConverterDictionaryStringString.lower(fixedHeaders), $0) - }) - } - - open func buildWithVssStoreAndHeaderProvider(vssUrl: String, storeId: String, headerProvider: VssHeaderProvider) throws -> Node { - return try FfiConverterTypeNode.lift(rustCallWithError(FfiConverterTypeBuildError.lift) { - uniffi_ldk_node_fn_method_builder_build_with_vss_store_and_header_provider(self.uniffiClonePointer(), - FfiConverterString.lower(vssUrl), - FfiConverterString.lower(storeId), - FfiConverterTypeVssHeaderProvider.lower(headerProvider), $0) - }) - } - - open func setAnnouncementAddresses(announcementAddresses: [SocketAddress]) throws { try rustCallWithError(FfiConverterTypeBuildError.lift) { - uniffi_ldk_node_fn_method_builder_set_announcement_addresses(self.uniffiClonePointer(), - FfiConverterSequenceTypeSocketAddress.lower(announcementAddresses), $0) - } - } - - open func setChainSourceBitcoindRpc(rpcHost: String, rpcPort: UInt16, rpcUser: String, rpcPassword: String) { try! rustCall { - uniffi_ldk_node_fn_method_builder_set_chain_source_bitcoind_rpc(self.uniffiClonePointer(), - FfiConverterString.lower(rpcHost), - FfiConverterUInt16.lower(rpcPort), - FfiConverterString.lower(rpcUser), - FfiConverterString.lower(rpcPassword), $0) - } - } - - open func setChainSourceElectrum(serverUrl: String, config: ElectrumSyncConfig?) { try! rustCall { - uniffi_ldk_node_fn_method_builder_set_chain_source_electrum(self.uniffiClonePointer(), - FfiConverterString.lower(serverUrl), - FfiConverterOptionTypeElectrumSyncConfig.lower(config), $0) - } - } - - open func setChainSourceEsplora(serverUrl: String, config: EsploraSyncConfig?) { try! rustCall { - uniffi_ldk_node_fn_method_builder_set_chain_source_esplora(self.uniffiClonePointer(), - FfiConverterString.lower(serverUrl), - FfiConverterOptionTypeEsploraSyncConfig.lower(config), $0) - } - } - - open func setCustomLogger(logWriter: LogWriter) { try! rustCall { - uniffi_ldk_node_fn_method_builder_set_custom_logger(self.uniffiClonePointer(), - FfiConverterTypeLogWriter.lower(logWriter), $0) - } - } + +public static func fromConfig(config: Config) -> Builder { + return try! FfiConverterTypeBuilder.lift(try! rustCall() { + uniffi_ldk_node_fn_constructor_builder_from_config( + FfiConverterTypeConfig.lower(config),$0 + ) +}) +} + - open func setEntropyBip39Mnemonic(mnemonic: Mnemonic, passphrase: String?) { try! rustCall { - uniffi_ldk_node_fn_method_builder_set_entropy_bip39_mnemonic(self.uniffiClonePointer(), - FfiConverterTypeMnemonic.lower(mnemonic), - FfiConverterOptionString.lower(passphrase), $0) - } - } - - open func setEntropySeedBytes(seedBytes: [UInt8]) throws { try rustCallWithError(FfiConverterTypeBuildError.lift) { - uniffi_ldk_node_fn_method_builder_set_entropy_seed_bytes(self.uniffiClonePointer(), - FfiConverterSequenceUInt8.lower(seedBytes), $0) - } - } - - open func setEntropySeedPath(seedPath: String) { try! rustCall { - uniffi_ldk_node_fn_method_builder_set_entropy_seed_path(self.uniffiClonePointer(), - FfiConverterString.lower(seedPath), $0) - } - } - - open func setFilesystemLogger(logFilePath: String?, maxLogLevel: LogLevel?) { try! rustCall { - uniffi_ldk_node_fn_method_builder_set_filesystem_logger(self.uniffiClonePointer(), - FfiConverterOptionString.lower(logFilePath), - FfiConverterOptionTypeLogLevel.lower(maxLogLevel), $0) - } - } - - open func setGossipSourceP2p() { try! rustCall { - uniffi_ldk_node_fn_method_builder_set_gossip_source_p2p(self.uniffiClonePointer(), $0) - } - } - - open func setGossipSourceRgs(rgsServerUrl: String) { try! rustCall { - uniffi_ldk_node_fn_method_builder_set_gossip_source_rgs(self.uniffiClonePointer(), - FfiConverterString.lower(rgsServerUrl), $0) - } - } - - open func setLiquiditySourceLsps1(nodeId: PublicKey, address: SocketAddress, token: String?) { try! rustCall { - uniffi_ldk_node_fn_method_builder_set_liquidity_source_lsps1(self.uniffiClonePointer(), - FfiConverterTypePublicKey.lower(nodeId), - FfiConverterTypeSocketAddress.lower(address), - FfiConverterOptionString.lower(token), $0) - } - } - - open func setLiquiditySourceLsps2(nodeId: PublicKey, address: SocketAddress, token: String?) { try! rustCall { - uniffi_ldk_node_fn_method_builder_set_liquidity_source_lsps2(self.uniffiClonePointer(), - FfiConverterTypePublicKey.lower(nodeId), - FfiConverterTypeSocketAddress.lower(address), - FfiConverterOptionString.lower(token), $0) - } - } - - open func setListeningAddresses(listeningAddresses: [SocketAddress]) throws { try rustCallWithError(FfiConverterTypeBuildError.lift) { - uniffi_ldk_node_fn_method_builder_set_listening_addresses(self.uniffiClonePointer(), - FfiConverterSequenceTypeSocketAddress.lower(listeningAddresses), $0) - } - } - - open func setLogFacadeLogger() { try! rustCall { - uniffi_ldk_node_fn_method_builder_set_log_facade_logger(self.uniffiClonePointer(), $0) - } - } - - open func setNetwork(network: Network) { try! rustCall { - uniffi_ldk_node_fn_method_builder_set_network(self.uniffiClonePointer(), - FfiConverterTypeNetwork.lower(network), $0) - } - } - - open func setNodeAlias(nodeAlias: String) throws { try rustCallWithError(FfiConverterTypeBuildError.lift) { - uniffi_ldk_node_fn_method_builder_set_node_alias(self.uniffiClonePointer(), - FfiConverterString.lower(nodeAlias), $0) - } - } + +open func build()throws -> Node { + return try FfiConverterTypeNode.lift(try rustCallWithError(FfiConverterTypeBuildError.lift) { + uniffi_ldk_node_fn_method_builder_build(self.uniffiClonePointer(),$0 + ) +}) +} + +open func buildWithFsStore()throws -> Node { + return try FfiConverterTypeNode.lift(try rustCallWithError(FfiConverterTypeBuildError.lift) { + uniffi_ldk_node_fn_method_builder_build_with_fs_store(self.uniffiClonePointer(),$0 + ) +}) +} + +open func buildWithVssStore(vssUrl: String, storeId: String, lnurlAuthServerUrl: String, fixedHeaders: [String: String])throws -> Node { + return try FfiConverterTypeNode.lift(try rustCallWithError(FfiConverterTypeBuildError.lift) { + uniffi_ldk_node_fn_method_builder_build_with_vss_store(self.uniffiClonePointer(), + FfiConverterString.lower(vssUrl), + FfiConverterString.lower(storeId), + FfiConverterString.lower(lnurlAuthServerUrl), + FfiConverterDictionaryStringString.lower(fixedHeaders),$0 + ) +}) +} + +open func buildWithVssStoreAndFixedHeaders(vssUrl: String, storeId: String, fixedHeaders: [String: String])throws -> Node { + return try FfiConverterTypeNode.lift(try rustCallWithError(FfiConverterTypeBuildError.lift) { + uniffi_ldk_node_fn_method_builder_build_with_vss_store_and_fixed_headers(self.uniffiClonePointer(), + FfiConverterString.lower(vssUrl), + FfiConverterString.lower(storeId), + FfiConverterDictionaryStringString.lower(fixedHeaders),$0 + ) +}) +} + +open func buildWithVssStoreAndHeaderProvider(vssUrl: String, storeId: String, headerProvider: VssHeaderProvider)throws -> Node { + return try FfiConverterTypeNode.lift(try rustCallWithError(FfiConverterTypeBuildError.lift) { + uniffi_ldk_node_fn_method_builder_build_with_vss_store_and_header_provider(self.uniffiClonePointer(), + FfiConverterString.lower(vssUrl), + FfiConverterString.lower(storeId), + FfiConverterTypeVssHeaderProvider.lower(headerProvider),$0 + ) +}) +} + +open func setAnnouncementAddresses(announcementAddresses: [SocketAddress])throws {try rustCallWithError(FfiConverterTypeBuildError.lift) { + uniffi_ldk_node_fn_method_builder_set_announcement_addresses(self.uniffiClonePointer(), + FfiConverterSequenceTypeSocketAddress.lower(announcementAddresses),$0 + ) +} +} + +open func setChainSourceBitcoindRpc(rpcHost: String, rpcPort: UInt16, rpcUser: String, rpcPassword: String) {try! rustCall() { + uniffi_ldk_node_fn_method_builder_set_chain_source_bitcoind_rpc(self.uniffiClonePointer(), + FfiConverterString.lower(rpcHost), + FfiConverterUInt16.lower(rpcPort), + FfiConverterString.lower(rpcUser), + FfiConverterString.lower(rpcPassword),$0 + ) +} +} + +open func setChainSourceElectrum(serverUrl: String, config: ElectrumSyncConfig?) {try! rustCall() { + uniffi_ldk_node_fn_method_builder_set_chain_source_electrum(self.uniffiClonePointer(), + FfiConverterString.lower(serverUrl), + FfiConverterOptionTypeElectrumSyncConfig.lower(config),$0 + ) +} +} + +open func setChainSourceEsplora(serverUrl: String, config: EsploraSyncConfig?) {try! rustCall() { + uniffi_ldk_node_fn_method_builder_set_chain_source_esplora(self.uniffiClonePointer(), + FfiConverterString.lower(serverUrl), + FfiConverterOptionTypeEsploraSyncConfig.lower(config),$0 + ) +} +} + +open func setCustomLogger(logWriter: LogWriter) {try! rustCall() { + uniffi_ldk_node_fn_method_builder_set_custom_logger(self.uniffiClonePointer(), + FfiConverterTypeLogWriter.lower(logWriter),$0 + ) +} +} + +open func setEntropyBip39Mnemonic(mnemonic: Mnemonic, passphrase: String?) {try! rustCall() { + uniffi_ldk_node_fn_method_builder_set_entropy_bip39_mnemonic(self.uniffiClonePointer(), + FfiConverterTypeMnemonic.lower(mnemonic), + FfiConverterOptionString.lower(passphrase),$0 + ) +} +} + +open func setEntropySeedBytes(seedBytes: [UInt8])throws {try rustCallWithError(FfiConverterTypeBuildError.lift) { + uniffi_ldk_node_fn_method_builder_set_entropy_seed_bytes(self.uniffiClonePointer(), + FfiConverterSequenceUInt8.lower(seedBytes),$0 + ) +} +} + +open func setEntropySeedPath(seedPath: String) {try! rustCall() { + uniffi_ldk_node_fn_method_builder_set_entropy_seed_path(self.uniffiClonePointer(), + FfiConverterString.lower(seedPath),$0 + ) +} +} + +open func setFilesystemLogger(logFilePath: String?, maxLogLevel: LogLevel?) {try! rustCall() { + uniffi_ldk_node_fn_method_builder_set_filesystem_logger(self.uniffiClonePointer(), + FfiConverterOptionString.lower(logFilePath), + FfiConverterOptionTypeLogLevel.lower(maxLogLevel),$0 + ) +} +} + +open func setGossipSourceP2p() {try! rustCall() { + uniffi_ldk_node_fn_method_builder_set_gossip_source_p2p(self.uniffiClonePointer(),$0 + ) +} +} + +open func setGossipSourceRgs(rgsServerUrl: String) {try! rustCall() { + uniffi_ldk_node_fn_method_builder_set_gossip_source_rgs(self.uniffiClonePointer(), + FfiConverterString.lower(rgsServerUrl),$0 + ) +} +} + +open func setLiquiditySourceLsps1(nodeId: PublicKey, address: SocketAddress, token: String?) {try! rustCall() { + uniffi_ldk_node_fn_method_builder_set_liquidity_source_lsps1(self.uniffiClonePointer(), + FfiConverterTypePublicKey.lower(nodeId), + FfiConverterTypeSocketAddress.lower(address), + FfiConverterOptionString.lower(token),$0 + ) +} +} + +open func setLiquiditySourceLsps2(nodeId: PublicKey, address: SocketAddress, token: String?) {try! rustCall() { + uniffi_ldk_node_fn_method_builder_set_liquidity_source_lsps2(self.uniffiClonePointer(), + FfiConverterTypePublicKey.lower(nodeId), + FfiConverterTypeSocketAddress.lower(address), + FfiConverterOptionString.lower(token),$0 + ) +} +} + +open func setListeningAddresses(listeningAddresses: [SocketAddress])throws {try rustCallWithError(FfiConverterTypeBuildError.lift) { + uniffi_ldk_node_fn_method_builder_set_listening_addresses(self.uniffiClonePointer(), + FfiConverterSequenceTypeSocketAddress.lower(listeningAddresses),$0 + ) +} +} + +open func setLogFacadeLogger() {try! rustCall() { + uniffi_ldk_node_fn_method_builder_set_log_facade_logger(self.uniffiClonePointer(),$0 + ) +} +} + +open func setNetwork(network: Network) {try! rustCall() { + uniffi_ldk_node_fn_method_builder_set_network(self.uniffiClonePointer(), + FfiConverterTypeNetwork.lower(network),$0 + ) +} +} + +open func setNodeAlias(nodeAlias: String)throws {try rustCallWithError(FfiConverterTypeBuildError.lift) { + uniffi_ldk_node_fn_method_builder_set_node_alias(self.uniffiClonePointer(), + FfiConverterString.lower(nodeAlias),$0 + ) +} +} + +open func setStorageDirPath(storageDirPath: String) {try! rustCall() { + uniffi_ldk_node_fn_method_builder_set_storage_dir_path(self.uniffiClonePointer(), + FfiConverterString.lower(storageDirPath),$0 + ) +} +} + - open func setStorageDirPath(storageDirPath: String) { try! rustCall { - uniffi_ldk_node_fn_method_builder_set_storage_dir_path(self.uniffiClonePointer(), - FfiConverterString.lower(storageDirPath), $0) - } - } } public struct FfiConverterTypeBuilder: FfiConverter { + typealias FfiType = UnsafeMutableRawPointer typealias SwiftType = Builder @@ -1382,7 +1506,7 @@ public struct FfiConverterTypeBuilder: FfiConverter { // The Rust code won't compile if a pointer won't fit in a UInt64. // We have to go via `UInt` because that's the thing that's the size of a pointer. let ptr = UnsafeMutableRawPointer(bitPattern: UInt(truncatingIfNeeded: v)) - if ptr == nil { + if (ptr == nil) { throw UniffiInternalError.unexpectedNullPointer } return try lift(ptr!) @@ -1395,6 +1519,9 @@ public struct FfiConverterTypeBuilder: FfiConverter { } } + + + public func FfiConverterTypeBuilder_lift(_ pointer: UnsafeMutableRawPointer) throws -> Builder { return try FfiConverterTypeBuilder.lift(pointer) } @@ -1403,17 +1530,21 @@ public func FfiConverterTypeBuilder_lower(_ value: Builder) -> UnsafeMutableRawP return FfiConverterTypeBuilder.lower(value) } -public protocol FeeRateProtocol: AnyObject { - func toSatPerKwu() -> UInt64 - func toSatPerVbCeil() -> UInt64 - func toSatPerVbFloor() -> UInt64 + +public protocol FeeRateProtocol : AnyObject { + + func toSatPerKwu() -> UInt64 + + func toSatPerVbCeil() -> UInt64 + + func toSatPerVbFloor() -> UInt64 + } open class FeeRate: - FeeRateProtocol -{ + FeeRateProtocol { fileprivate let pointer: UnsafeMutableRawPointer! /// Used to instantiate a [FFIObject] without an actual pointer, for fakes in tests, mostly. @@ -1424,7 +1555,7 @@ open class FeeRate: // TODO: We'd like this to be `private` but for Swifty reasons, // we can't implement `FfiConverter` without making this `required` and we can't // make it `required` without making it `public`. - public required init(unsafeFromRawPointer pointer: UnsafeMutableRawPointer) { + required public init(unsafeFromRawPointer pointer: UnsafeMutableRawPointer) { self.pointer = pointer } @@ -1433,14 +1564,13 @@ open class FeeRate: /// /// - Warning: /// Any object instantiated with this constructor cannot be passed to an actual Rust-backed object. Since there isn't a backing [Pointer] the FFI lower functions will crash. - public init(noPointer _: NoPointer) { - pointer = nil + public init(noPointer: NoPointer) { + self.pointer = nil } public func uniffiClonePointer() -> UnsafeMutableRawPointer { return try! rustCall { uniffi_ldk_node_fn_clone_feerate(self.pointer, $0) } } - // No primary constructor declared for this class. deinit { @@ -1451,42 +1581,51 @@ open class FeeRate: try! rustCall { uniffi_ldk_node_fn_free_feerate(pointer, $0) } } - public static func fromSatPerKwu(satKwu: UInt64) -> FeeRate { - return try! FfiConverterTypeFeeRate.lift(try! rustCall { - uniffi_ldk_node_fn_constructor_feerate_from_sat_per_kwu( - FfiConverterUInt64.lower(satKwu), $0 - ) - }) - } - - public static func fromSatPerVbUnchecked(satVb: UInt64) -> FeeRate { - return try! FfiConverterTypeFeeRate.lift(try! rustCall { - uniffi_ldk_node_fn_constructor_feerate_from_sat_per_vb_unchecked( - FfiConverterUInt64.lower(satVb), $0 - ) - }) - } - - open func toSatPerKwu() -> UInt64 { - return try! FfiConverterUInt64.lift(try! rustCall { - uniffi_ldk_node_fn_method_feerate_to_sat_per_kwu(self.uniffiClonePointer(), $0) - }) - } + +public static func fromSatPerKwu(satKwu: UInt64) -> FeeRate { + return try! FfiConverterTypeFeeRate.lift(try! rustCall() { + uniffi_ldk_node_fn_constructor_feerate_from_sat_per_kwu( + FfiConverterUInt64.lower(satKwu),$0 + ) +}) +} + +public static func fromSatPerVbUnchecked(satVb: UInt64) -> FeeRate { + return try! FfiConverterTypeFeeRate.lift(try! rustCall() { + uniffi_ldk_node_fn_constructor_feerate_from_sat_per_vb_unchecked( + FfiConverterUInt64.lower(satVb),$0 + ) +}) +} + - open func toSatPerVbCeil() -> UInt64 { - return try! FfiConverterUInt64.lift(try! rustCall { - uniffi_ldk_node_fn_method_feerate_to_sat_per_vb_ceil(self.uniffiClonePointer(), $0) - }) - } + +open func toSatPerKwu() -> UInt64 { + return try! FfiConverterUInt64.lift(try! rustCall() { + uniffi_ldk_node_fn_method_feerate_to_sat_per_kwu(self.uniffiClonePointer(),$0 + ) +}) +} + +open func toSatPerVbCeil() -> UInt64 { + return try! FfiConverterUInt64.lift(try! rustCall() { + uniffi_ldk_node_fn_method_feerate_to_sat_per_vb_ceil(self.uniffiClonePointer(),$0 + ) +}) +} + +open func toSatPerVbFloor() -> UInt64 { + return try! FfiConverterUInt64.lift(try! rustCall() { + uniffi_ldk_node_fn_method_feerate_to_sat_per_vb_floor(self.uniffiClonePointer(),$0 + ) +}) +} + - open func toSatPerVbFloor() -> UInt64 { - return try! FfiConverterUInt64.lift(try! rustCall { - uniffi_ldk_node_fn_method_feerate_to_sat_per_vb_floor(self.uniffiClonePointer(), $0) - }) - } } public struct FfiConverterTypeFeeRate: FfiConverter { + typealias FfiType = UnsafeMutableRawPointer typealias SwiftType = FeeRate @@ -1503,7 +1642,7 @@ public struct FfiConverterTypeFeeRate: FfiConverter { // The Rust code won't compile if a pointer won't fit in a UInt64. // We have to go via `UInt` because that's the thing that's the size of a pointer. let ptr = UnsafeMutableRawPointer(bitPattern: UInt(truncatingIfNeeded: v)) - if ptr == nil { + if (ptr == nil) { throw UniffiInternalError.unexpectedNullPointer } return try lift(ptr!) @@ -1516,6 +1655,9 @@ public struct FfiConverterTypeFeeRate: FfiConverter { } } + + + public func FfiConverterTypeFeeRate_lift(_ pointer: UnsafeMutableRawPointer) throws -> FeeRate { return try FfiConverterTypeFeeRate.lift(pointer) } @@ -1524,15 +1666,19 @@ public func FfiConverterTypeFeeRate_lower(_ value: FeeRate) -> UnsafeMutableRawP return FfiConverterTypeFeeRate.lower(value) } -public protocol Lsps1LiquidityProtocol: AnyObject { - func checkOrderStatus(orderId: OrderId) throws -> Lsps1OrderStatus - func requestChannel(lspBalanceSat: UInt64, clientBalanceSat: UInt64, channelExpiryBlocks: UInt32, announceChannel: Bool) throws -> Lsps1OrderStatus + + +public protocol Lsps1LiquidityProtocol : AnyObject { + + func checkOrderStatus(orderId: OrderId) throws -> Lsps1OrderStatus + + func requestChannel(lspBalanceSat: UInt64, clientBalanceSat: UInt64, channelExpiryBlocks: UInt32, announceChannel: Bool) throws -> Lsps1OrderStatus + } open class Lsps1Liquidity: - Lsps1LiquidityProtocol -{ + Lsps1LiquidityProtocol { fileprivate let pointer: UnsafeMutableRawPointer! /// Used to instantiate a [FFIObject] without an actual pointer, for fakes in tests, mostly. @@ -1543,7 +1689,7 @@ open class Lsps1Liquidity: // TODO: We'd like this to be `private` but for Swifty reasons, // we can't implement `FfiConverter` without making this `required` and we can't // make it `required` without making it `public`. - public required init(unsafeFromRawPointer pointer: UnsafeMutableRawPointer) { + required public init(unsafeFromRawPointer pointer: UnsafeMutableRawPointer) { self.pointer = pointer } @@ -1552,14 +1698,13 @@ open class Lsps1Liquidity: /// /// - Warning: /// Any object instantiated with this constructor cannot be passed to an actual Rust-backed object. Since there isn't a backing [Pointer] the FFI lower functions will crash. - public init(noPointer _: NoPointer) { - pointer = nil + public init(noPointer: NoPointer) { + self.pointer = nil } public func uniffiClonePointer() -> UnsafeMutableRawPointer { return try! rustCall { uniffi_ldk_node_fn_clone_lsps1liquidity(self.pointer, $0) } } - // No primary constructor declared for this class. deinit { @@ -1570,25 +1715,33 @@ open class Lsps1Liquidity: try! rustCall { uniffi_ldk_node_fn_free_lsps1liquidity(pointer, $0) } } - open func checkOrderStatus(orderId: OrderId) throws -> Lsps1OrderStatus { - return try FfiConverterTypeLSPS1OrderStatus.lift(rustCallWithError(FfiConverterTypeNodeError.lift) { - uniffi_ldk_node_fn_method_lsps1liquidity_check_order_status(self.uniffiClonePointer(), - FfiConverterTypeOrderId.lower(orderId), $0) - }) - } + + + +open func checkOrderStatus(orderId: OrderId)throws -> Lsps1OrderStatus { + return try FfiConverterTypeLSPS1OrderStatus.lift(try rustCallWithError(FfiConverterTypeNodeError.lift) { + uniffi_ldk_node_fn_method_lsps1liquidity_check_order_status(self.uniffiClonePointer(), + FfiConverterTypeOrderId.lower(orderId),$0 + ) +}) +} + +open func requestChannel(lspBalanceSat: UInt64, clientBalanceSat: UInt64, channelExpiryBlocks: UInt32, announceChannel: Bool)throws -> Lsps1OrderStatus { + return try FfiConverterTypeLSPS1OrderStatus.lift(try rustCallWithError(FfiConverterTypeNodeError.lift) { + uniffi_ldk_node_fn_method_lsps1liquidity_request_channel(self.uniffiClonePointer(), + FfiConverterUInt64.lower(lspBalanceSat), + FfiConverterUInt64.lower(clientBalanceSat), + FfiConverterUInt32.lower(channelExpiryBlocks), + FfiConverterBool.lower(announceChannel),$0 + ) +}) +} + - open func requestChannel(lspBalanceSat: UInt64, clientBalanceSat: UInt64, channelExpiryBlocks: UInt32, announceChannel: Bool) throws -> Lsps1OrderStatus { - return try FfiConverterTypeLSPS1OrderStatus.lift(rustCallWithError(FfiConverterTypeNodeError.lift) { - uniffi_ldk_node_fn_method_lsps1liquidity_request_channel(self.uniffiClonePointer(), - FfiConverterUInt64.lower(lspBalanceSat), - FfiConverterUInt64.lower(clientBalanceSat), - FfiConverterUInt32.lower(channelExpiryBlocks), - FfiConverterBool.lower(announceChannel), $0) - }) - } } public struct FfiConverterTypeLSPS1Liquidity: FfiConverter { + typealias FfiType = UnsafeMutableRawPointer typealias SwiftType = Lsps1Liquidity @@ -1605,7 +1758,7 @@ public struct FfiConverterTypeLSPS1Liquidity: FfiConverter { // The Rust code won't compile if a pointer won't fit in a UInt64. // We have to go via `UInt` because that's the thing that's the size of a pointer. let ptr = UnsafeMutableRawPointer(bitPattern: UInt(truncatingIfNeeded: v)) - if ptr == nil { + if (ptr == nil) { throw UniffiInternalError.unexpectedNullPointer } return try lift(ptr!) @@ -1618,6 +1771,9 @@ public struct FfiConverterTypeLSPS1Liquidity: FfiConverter { } } + + + public func FfiConverterTypeLSPS1Liquidity_lift(_ pointer: UnsafeMutableRawPointer) throws -> Lsps1Liquidity { return try FfiConverterTypeLSPS1Liquidity.lift(pointer) } @@ -1626,13 +1782,17 @@ public func FfiConverterTypeLSPS1Liquidity_lower(_ value: Lsps1Liquidity) -> Uns return FfiConverterTypeLSPS1Liquidity.lower(value) } -public protocol LogWriter: AnyObject { - func log(record: LogRecord) + + + +public protocol LogWriter : AnyObject { + + func log(record: LogRecord) + } open class LogWriterImpl: - LogWriter -{ + LogWriter { fileprivate let pointer: UnsafeMutableRawPointer! /// Used to instantiate a [FFIObject] without an actual pointer, for fakes in tests, mostly. @@ -1643,7 +1803,7 @@ open class LogWriterImpl: // TODO: We'd like this to be `private` but for Swifty reasons, // we can't implement `FfiConverter` without making this `required` and we can't // make it `required` without making it `public`. - public required init(unsafeFromRawPointer pointer: UnsafeMutableRawPointer) { + required public init(unsafeFromRawPointer pointer: UnsafeMutableRawPointer) { self.pointer = pointer } @@ -1652,14 +1812,13 @@ open class LogWriterImpl: /// /// - Warning: /// Any object instantiated with this constructor cannot be passed to an actual Rust-backed object. Since there isn't a backing [Pointer] the FFI lower functions will crash. - public init(noPointer _: NoPointer) { - pointer = nil + public init(noPointer: NoPointer) { + self.pointer = nil } public func uniffiClonePointer() -> UnsafeMutableRawPointer { return try! rustCall { uniffi_ldk_node_fn_clone_logwriter(self.pointer, $0) } } - // No primary constructor declared for this class. deinit { @@ -1670,13 +1829,18 @@ open class LogWriterImpl: try! rustCall { uniffi_ldk_node_fn_free_logwriter(pointer, $0) } } - open func log(record: LogRecord) { try! rustCall { - uniffi_ldk_node_fn_method_logwriter_log(self.uniffiClonePointer(), - FfiConverterTypeLogRecord.lower(record), $0) - } - } + + + +open func log(record: LogRecord) {try! rustCall() { + uniffi_ldk_node_fn_method_logwriter_log(self.uniffiClonePointer(), + FfiConverterTypeLogRecord.lower(record),$0 + ) } +} + +} // Magic number for the Rust proxy to call using the same mechanism as every other method, // to free the callback once it's dropped by Rust. private let IDX_CALLBACK_FREE: Int32 = 0 @@ -1686,26 +1850,28 @@ private let UNIFFI_CALLBACK_ERROR: Int32 = 1 private let UNIFFI_CALLBACK_UNEXPECTED_ERROR: Int32 = 2 // Put the implementation in a struct so we don't pollute the top-level namespace -private enum UniffiCallbackInterfaceLogWriter { +fileprivate struct UniffiCallbackInterfaceLogWriter { + // Create the VTable using a series of closures. // Swift automatically converts these into C callback functions. - static var vtable: UniffiVTableCallbackInterfaceLogWriter = .init( + static var vtable: UniffiVTableCallbackInterfaceLogWriter = UniffiVTableCallbackInterfaceLogWriter( log: { ( uniffiHandle: UInt64, record: RustBuffer, - _: UnsafeMutableRawPointer, + uniffiOutReturn: UnsafeMutableRawPointer, uniffiCallStatus: UnsafeMutablePointer ) in let makeCall = { - () throws in + () throws -> () in guard let uniffiObj = try? FfiConverterTypeLogWriter.handleMap.get(handle: uniffiHandle) else { throw UniffiInternalError.unexpectedStaleHandle } - return try uniffiObj.log( - record: FfiConverterTypeLogRecord.lift(record) + return uniffiObj.log( + record: try FfiConverterTypeLogRecord.lift(record) ) } + let writeReturn = { () } uniffiTraitInterfaceCall( callStatus: uniffiCallStatus, @@ -1713,7 +1879,7 @@ private enum UniffiCallbackInterfaceLogWriter { writeReturn: writeReturn ) }, - uniffiFree: { (uniffiHandle: UInt64) in + uniffiFree: { (uniffiHandle: UInt64) -> () in let result = try? FfiConverterTypeLogWriter.handleMap.remove(handle: uniffiHandle) if result == nil { print("Uniffi callback interface LogWriter: handle missing in uniffiFree") @@ -1748,7 +1914,7 @@ public struct FfiConverterTypeLogWriter: FfiConverter { // The Rust code won't compile if a pointer won't fit in a UInt64. // We have to go via `UInt` because that's the thing that's the size of a pointer. let ptr = UnsafeMutableRawPointer(bitPattern: UInt(truncatingIfNeeded: v)) - if ptr == nil { + if (ptr == nil) { throw UniffiInternalError.unexpectedNullPointer } return try lift(ptr!) @@ -1761,6 +1927,9 @@ public struct FfiConverterTypeLogWriter: FfiConverter { } } + + + public func FfiConverterTypeLogWriter_lift(_ pointer: UnsafeMutableRawPointer) throws -> LogWriter { return try FfiConverterTypeLogWriter.lift(pointer) } @@ -1769,19 +1938,23 @@ public func FfiConverterTypeLogWriter_lower(_ value: LogWriter) -> UnsafeMutable return FfiConverterTypeLogWriter.lower(value) } -public protocol NetworkGraphProtocol: AnyObject { - func channel(shortChannelId: UInt64) -> ChannelInfo? - func listChannels() -> [UInt64] - func listNodes() -> [NodeId] - func node(nodeId: NodeId) -> NodeInfo? +public protocol NetworkGraphProtocol : AnyObject { + + func channel(shortChannelId: UInt64) -> ChannelInfo? + + func listChannels() -> [UInt64] + + func listNodes() -> [NodeId] + + func node(nodeId: NodeId) -> NodeInfo? + } open class NetworkGraph: - NetworkGraphProtocol -{ + NetworkGraphProtocol { fileprivate let pointer: UnsafeMutableRawPointer! /// Used to instantiate a [FFIObject] without an actual pointer, for fakes in tests, mostly. @@ -1792,7 +1965,7 @@ open class NetworkGraph: // TODO: We'd like this to be `private` but for Swifty reasons, // we can't implement `FfiConverter` without making this `required` and we can't // make it `required` without making it `public`. - public required init(unsafeFromRawPointer pointer: UnsafeMutableRawPointer) { + required public init(unsafeFromRawPointer pointer: UnsafeMutableRawPointer) { self.pointer = pointer } @@ -1801,14 +1974,13 @@ open class NetworkGraph: /// /// - Warning: /// Any object instantiated with this constructor cannot be passed to an actual Rust-backed object. Since there isn't a backing [Pointer] the FFI lower functions will crash. - public init(noPointer _: NoPointer) { - pointer = nil + public init(noPointer: NoPointer) { + self.pointer = nil } public func uniffiClonePointer() -> UnsafeMutableRawPointer { return try! rustCall { uniffi_ldk_node_fn_clone_networkgraph(self.pointer, $0) } } - // No primary constructor declared for this class. deinit { @@ -1819,34 +1991,44 @@ open class NetworkGraph: try! rustCall { uniffi_ldk_node_fn_free_networkgraph(pointer, $0) } } - open func channel(shortChannelId: UInt64) -> ChannelInfo? { - return try! FfiConverterOptionTypeChannelInfo.lift(try! rustCall { - uniffi_ldk_node_fn_method_networkgraph_channel(self.uniffiClonePointer(), - FfiConverterUInt64.lower(shortChannelId), $0) - }) - } - - open func listChannels() -> [UInt64] { - return try! FfiConverterSequenceUInt64.lift(try! rustCall { - uniffi_ldk_node_fn_method_networkgraph_list_channels(self.uniffiClonePointer(), $0) - }) - } + - open func listNodes() -> [NodeId] { - return try! FfiConverterSequenceTypeNodeId.lift(try! rustCall { - uniffi_ldk_node_fn_method_networkgraph_list_nodes(self.uniffiClonePointer(), $0) - }) - } + +open func channel(shortChannelId: UInt64) -> ChannelInfo? { + return try! FfiConverterOptionTypeChannelInfo.lift(try! rustCall() { + uniffi_ldk_node_fn_method_networkgraph_channel(self.uniffiClonePointer(), + FfiConverterUInt64.lower(shortChannelId),$0 + ) +}) +} + +open func listChannels() -> [UInt64] { + return try! FfiConverterSequenceUInt64.lift(try! rustCall() { + uniffi_ldk_node_fn_method_networkgraph_list_channels(self.uniffiClonePointer(),$0 + ) +}) +} + +open func listNodes() -> [NodeId] { + return try! FfiConverterSequenceTypeNodeId.lift(try! rustCall() { + uniffi_ldk_node_fn_method_networkgraph_list_nodes(self.uniffiClonePointer(),$0 + ) +}) +} + +open func node(nodeId: NodeId) -> NodeInfo? { + return try! FfiConverterOptionTypeNodeInfo.lift(try! rustCall() { + uniffi_ldk_node_fn_method_networkgraph_node(self.uniffiClonePointer(), + FfiConverterTypeNodeId.lower(nodeId),$0 + ) +}) +} + - open func node(nodeId: NodeId) -> NodeInfo? { - return try! FfiConverterOptionTypeNodeInfo.lift(try! rustCall { - uniffi_ldk_node_fn_method_networkgraph_node(self.uniffiClonePointer(), - FfiConverterTypeNodeId.lower(nodeId), $0) - }) - } } public struct FfiConverterTypeNetworkGraph: FfiConverter { + typealias FfiType = UnsafeMutableRawPointer typealias SwiftType = NetworkGraph @@ -1863,7 +2045,7 @@ public struct FfiConverterTypeNetworkGraph: FfiConverter { // The Rust code won't compile if a pointer won't fit in a UInt64. // We have to go via `UInt` because that's the thing that's the size of a pointer. let ptr = UnsafeMutableRawPointer(bitPattern: UInt(truncatingIfNeeded: v)) - if ptr == nil { + if (ptr == nil) { throw UniffiInternalError.unexpectedNullPointer } return try lift(ptr!) @@ -1876,6 +2058,9 @@ public struct FfiConverterTypeNetworkGraph: FfiConverter { } } + + + public func FfiConverterTypeNetworkGraph_lift(_ pointer: UnsafeMutableRawPointer) throws -> NetworkGraph { return try FfiConverterTypeNetworkGraph.lift(pointer) } @@ -1884,83 +2069,87 @@ public func FfiConverterTypeNetworkGraph_lower(_ value: NetworkGraph) -> UnsafeM return FfiConverterTypeNetworkGraph.lower(value) } -public protocol NodeProtocol: AnyObject { - func announcementAddresses() -> [SocketAddress]? - - func bolt11Payment() -> Bolt11Payment - - func bolt12Payment() -> Bolt12Payment - - func closeChannel(userChannelId: UserChannelId, counterpartyNodeId: PublicKey) throws - - func config() -> Config - - func connect(nodeId: PublicKey, address: SocketAddress, persist: Bool) throws - - func disconnect(nodeId: PublicKey) throws - - func eventHandled() throws - - func exportPathfindingScores() throws -> Data - - func forceCloseChannel(userChannelId: UserChannelId, counterpartyNodeId: PublicKey, reason: String?) throws - - func listBalances() -> BalanceDetails - - func listChannels() -> [ChannelDetails] - - func listPayments() -> [PaymentDetails] - - func listPeers() -> [PeerDetails] - - func listeningAddresses() -> [SocketAddress]? - - func lsps1Liquidity() -> Lsps1Liquidity - - func networkGraph() -> NetworkGraph - - func nextEvent() -> Event? - - func nextEventAsync() async -> Event - - func nodeAlias() -> NodeAlias? - - func nodeId() -> PublicKey - - func onchainPayment() -> OnchainPayment - - func openAnnouncedChannel(nodeId: PublicKey, address: SocketAddress, channelAmountSats: UInt64, pushToCounterpartyMsat: UInt64?, channelConfig: ChannelConfig?) throws -> UserChannelId - func openChannel(nodeId: PublicKey, address: SocketAddress, channelAmountSats: UInt64, pushToCounterpartyMsat: UInt64?, channelConfig: ChannelConfig?) throws -> UserChannelId - func payment(paymentId: PaymentId) -> PaymentDetails? - func removePayment(paymentId: PaymentId) throws - - func signMessage(msg: [UInt8]) -> String - - func spontaneousPayment() -> SpontaneousPayment - - func start() throws - - func status() -> NodeStatus - - func stop() throws - - func syncWallets() throws - - func unifiedQrPayment() -> UnifiedQrPayment - - func updateChannelConfig(userChannelId: UserChannelId, counterpartyNodeId: PublicKey, channelConfig: ChannelConfig) throws - - func verifySignature(msg: [UInt8], sig: String, pkey: PublicKey) -> Bool - - func waitNextEvent() -> Event +public protocol NodeProtocol : AnyObject { + + func announcementAddresses() -> [SocketAddress]? + + func bolt11Payment() -> Bolt11Payment + + func bolt12Payment() -> Bolt12Payment + + func closeChannel(userChannelId: UserChannelId, counterpartyNodeId: PublicKey) throws + + func config() -> Config + + func connect(nodeId: PublicKey, address: SocketAddress, persist: Bool) throws + + func disconnect(nodeId: PublicKey) throws + + func eventHandled() throws + + func exportPathfindingScores() throws -> Data + + func forceCloseChannel(userChannelId: UserChannelId, counterpartyNodeId: PublicKey, reason: String?) throws + + func listBalances() -> BalanceDetails + + func listChannels() -> [ChannelDetails] + + func listPayments() -> [PaymentDetails] + + func listPeers() -> [PeerDetails] + + func listeningAddresses() -> [SocketAddress]? + + func lsps1Liquidity() -> Lsps1Liquidity + + func networkGraph() -> NetworkGraph + + func nextEvent() -> Event? + + func nextEventAsync() async -> Event + + func nodeAlias() -> NodeAlias? + + func nodeId() -> PublicKey + + func onchainPayment() -> OnchainPayment + + func openAnnouncedChannel(nodeId: PublicKey, address: SocketAddress, channelAmountSats: UInt64, pushToCounterpartyMsat: UInt64?, channelConfig: ChannelConfig?) throws -> UserChannelId + + func openChannel(nodeId: PublicKey, address: SocketAddress, channelAmountSats: UInt64, pushToCounterpartyMsat: UInt64?, channelConfig: ChannelConfig?) throws -> UserChannelId + + func payment(paymentId: PaymentId) -> PaymentDetails? + + func removePayment(paymentId: PaymentId) throws + + func signMessage(msg: [UInt8]) -> String + + func spontaneousPayment() -> SpontaneousPayment + + func start() throws + + func status() -> NodeStatus + + func stop() throws + + func syncWallets() throws + + func unifiedQrPayment() -> UnifiedQrPayment + + func updateChannelConfig(userChannelId: UserChannelId, counterpartyNodeId: PublicKey, channelConfig: ChannelConfig) throws + + func verifySignature(msg: [UInt8], sig: String, pkey: PublicKey) -> Bool + + func waitNextEvent() -> Event + } open class Node: - NodeProtocol -{ + NodeProtocol { fileprivate let pointer: UnsafeMutableRawPointer! /// Used to instantiate a [FFIObject] without an actual pointer, for fakes in tests, mostly. @@ -1971,7 +2160,7 @@ open class Node: // TODO: We'd like this to be `private` but for Swifty reasons, // we can't implement `FfiConverter` without making this `required` and we can't // make it `required` without making it `public`. - public required init(unsafeFromRawPointer pointer: UnsafeMutableRawPointer) { + required public init(unsafeFromRawPointer pointer: UnsafeMutableRawPointer) { self.pointer = pointer } @@ -1980,14 +2169,13 @@ open class Node: /// /// - Warning: /// Any object instantiated with this constructor cannot be passed to an actual Rust-backed object. Since there isn't a backing [Pointer] the FFI lower functions will crash. - public init(noPointer _: NoPointer) { - pointer = nil + public init(noPointer: NoPointer) { + self.pointer = nil } public func uniffiClonePointer() -> UnsafeMutableRawPointer { return try! rustCall { uniffi_ldk_node_fn_clone_node(self.pointer, $0) } } - // No primary constructor declared for this class. deinit { @@ -1998,252 +2186,295 @@ open class Node: try! rustCall { uniffi_ldk_node_fn_free_node(pointer, $0) } } - open func announcementAddresses() -> [SocketAddress]? { - return try! FfiConverterOptionSequenceTypeSocketAddress.lift(try! rustCall { - uniffi_ldk_node_fn_method_node_announcement_addresses(self.uniffiClonePointer(), $0) - }) - } - - open func bolt11Payment() -> Bolt11Payment { - return try! FfiConverterTypeBolt11Payment.lift(try! rustCall { - uniffi_ldk_node_fn_method_node_bolt11_payment(self.uniffiClonePointer(), $0) - }) - } - - open func bolt12Payment() -> Bolt12Payment { - return try! FfiConverterTypeBolt12Payment.lift(try! rustCall { - uniffi_ldk_node_fn_method_node_bolt12_payment(self.uniffiClonePointer(), $0) - }) - } - - open func closeChannel(userChannelId: UserChannelId, counterpartyNodeId: PublicKey) throws { try rustCallWithError(FfiConverterTypeNodeError.lift) { - uniffi_ldk_node_fn_method_node_close_channel(self.uniffiClonePointer(), - FfiConverterTypeUserChannelId.lower(userChannelId), - FfiConverterTypePublicKey.lower(counterpartyNodeId), $0) - } - } - - open func config() -> Config { - return try! FfiConverterTypeConfig.lift(try! rustCall { - uniffi_ldk_node_fn_method_node_config(self.uniffiClonePointer(), $0) - }) - } - - open func connect(nodeId: PublicKey, address: SocketAddress, persist: Bool) throws { try rustCallWithError(FfiConverterTypeNodeError.lift) { - uniffi_ldk_node_fn_method_node_connect(self.uniffiClonePointer(), - FfiConverterTypePublicKey.lower(nodeId), - FfiConverterTypeSocketAddress.lower(address), - FfiConverterBool.lower(persist), $0) - } - } - - open func disconnect(nodeId: PublicKey) throws { try rustCallWithError(FfiConverterTypeNodeError.lift) { - uniffi_ldk_node_fn_method_node_disconnect(self.uniffiClonePointer(), - FfiConverterTypePublicKey.lower(nodeId), $0) - } - } - - open func eventHandled() throws { try rustCallWithError(FfiConverterTypeNodeError.lift) { - uniffi_ldk_node_fn_method_node_event_handled(self.uniffiClonePointer(), $0) - } - } - - open func exportPathfindingScores() throws -> Data { - return try FfiConverterData.lift(rustCallWithError(FfiConverterTypeNodeError.lift) { - uniffi_ldk_node_fn_method_node_export_pathfinding_scores(self.uniffiClonePointer(), $0) - }) - } - - open func forceCloseChannel(userChannelId: UserChannelId, counterpartyNodeId: PublicKey, reason: String?) throws { try rustCallWithError(FfiConverterTypeNodeError.lift) { - uniffi_ldk_node_fn_method_node_force_close_channel(self.uniffiClonePointer(), - FfiConverterTypeUserChannelId.lower(userChannelId), - FfiConverterTypePublicKey.lower(counterpartyNodeId), - FfiConverterOptionString.lower(reason), $0) - } - } - - open func listBalances() -> BalanceDetails { - return try! FfiConverterTypeBalanceDetails.lift(try! rustCall { - uniffi_ldk_node_fn_method_node_list_balances(self.uniffiClonePointer(), $0) - }) - } - - open func listChannels() -> [ChannelDetails] { - return try! FfiConverterSequenceTypeChannelDetails.lift(try! rustCall { - uniffi_ldk_node_fn_method_node_list_channels(self.uniffiClonePointer(), $0) - }) - } - - open func listPayments() -> [PaymentDetails] { - return try! FfiConverterSequenceTypePaymentDetails.lift(try! rustCall { - uniffi_ldk_node_fn_method_node_list_payments(self.uniffiClonePointer(), $0) - }) - } - - open func listPeers() -> [PeerDetails] { - return try! FfiConverterSequenceTypePeerDetails.lift(try! rustCall { - uniffi_ldk_node_fn_method_node_list_peers(self.uniffiClonePointer(), $0) - }) - } - - open func listeningAddresses() -> [SocketAddress]? { - return try! FfiConverterOptionSequenceTypeSocketAddress.lift(try! rustCall { - uniffi_ldk_node_fn_method_node_listening_addresses(self.uniffiClonePointer(), $0) - }) - } - - open func lsps1Liquidity() -> Lsps1Liquidity { - return try! FfiConverterTypeLSPS1Liquidity.lift(try! rustCall { - uniffi_ldk_node_fn_method_node_lsps1_liquidity(self.uniffiClonePointer(), $0) - }) - } - - open func networkGraph() -> NetworkGraph { - return try! FfiConverterTypeNetworkGraph.lift(try! rustCall { - uniffi_ldk_node_fn_method_node_network_graph(self.uniffiClonePointer(), $0) - }) - } - - open func nextEvent() -> Event? { - return try! FfiConverterOptionTypeEvent.lift(try! rustCall { - uniffi_ldk_node_fn_method_node_next_event(self.uniffiClonePointer(), $0) - }) - } - - open func nextEventAsync() async -> Event { - return - try! await uniffiRustCallAsync( - rustFutureFunc: { - uniffi_ldk_node_fn_method_node_next_event_async( - self.uniffiClonePointer() - ) - }, - pollFunc: ffi_ldk_node_rust_future_poll_rust_buffer, - completeFunc: ffi_ldk_node_rust_future_complete_rust_buffer, - freeFunc: ffi_ldk_node_rust_future_free_rust_buffer, - liftFunc: FfiConverterTypeEvent.lift, - errorHandler: nil - ) - } - - open func nodeAlias() -> NodeAlias? { - return try! FfiConverterOptionTypeNodeAlias.lift(try! rustCall { - uniffi_ldk_node_fn_method_node_node_alias(self.uniffiClonePointer(), $0) - }) - } - - open func nodeId() -> PublicKey { - return try! FfiConverterTypePublicKey.lift(try! rustCall { - uniffi_ldk_node_fn_method_node_node_id(self.uniffiClonePointer(), $0) - }) - } - - open func onchainPayment() -> OnchainPayment { - return try! FfiConverterTypeOnchainPayment.lift(try! rustCall { - uniffi_ldk_node_fn_method_node_onchain_payment(self.uniffiClonePointer(), $0) - }) - } - - open func openAnnouncedChannel(nodeId: PublicKey, address: SocketAddress, channelAmountSats: UInt64, pushToCounterpartyMsat: UInt64?, channelConfig: ChannelConfig?) throws -> UserChannelId { - return try FfiConverterTypeUserChannelId.lift(rustCallWithError(FfiConverterTypeNodeError.lift) { - uniffi_ldk_node_fn_method_node_open_announced_channel(self.uniffiClonePointer(), - FfiConverterTypePublicKey.lower(nodeId), - FfiConverterTypeSocketAddress.lower(address), - FfiConverterUInt64.lower(channelAmountSats), - FfiConverterOptionUInt64.lower(pushToCounterpartyMsat), - FfiConverterOptionTypeChannelConfig.lower(channelConfig), $0) - }) - } + - open func openChannel(nodeId: PublicKey, address: SocketAddress, channelAmountSats: UInt64, pushToCounterpartyMsat: UInt64?, channelConfig: ChannelConfig?) throws -> UserChannelId { - return try FfiConverterTypeUserChannelId.lift(rustCallWithError(FfiConverterTypeNodeError.lift) { - uniffi_ldk_node_fn_method_node_open_channel(self.uniffiClonePointer(), - FfiConverterTypePublicKey.lower(nodeId), - FfiConverterTypeSocketAddress.lower(address), - FfiConverterUInt64.lower(channelAmountSats), - FfiConverterOptionUInt64.lower(pushToCounterpartyMsat), - FfiConverterOptionTypeChannelConfig.lower(channelConfig), $0) - }) - } - - open func payment(paymentId: PaymentId) -> PaymentDetails? { - return try! FfiConverterOptionTypePaymentDetails.lift(try! rustCall { - uniffi_ldk_node_fn_method_node_payment(self.uniffiClonePointer(), - FfiConverterTypePaymentId.lower(paymentId), $0) - }) - } - - open func removePayment(paymentId: PaymentId) throws { try rustCallWithError(FfiConverterTypeNodeError.lift) { - uniffi_ldk_node_fn_method_node_remove_payment(self.uniffiClonePointer(), - FfiConverterTypePaymentId.lower(paymentId), $0) - } - } - - open func signMessage(msg: [UInt8]) -> String { - return try! FfiConverterString.lift(try! rustCall { - uniffi_ldk_node_fn_method_node_sign_message(self.uniffiClonePointer(), - FfiConverterSequenceUInt8.lower(msg), $0) - }) - } - - open func spontaneousPayment() -> SpontaneousPayment { - return try! FfiConverterTypeSpontaneousPayment.lift(try! rustCall { - uniffi_ldk_node_fn_method_node_spontaneous_payment(self.uniffiClonePointer(), $0) - }) - } - - open func start() throws { try rustCallWithError(FfiConverterTypeNodeError.lift) { - uniffi_ldk_node_fn_method_node_start(self.uniffiClonePointer(), $0) - } - } - - open func status() -> NodeStatus { - return try! FfiConverterTypeNodeStatus.lift(try! rustCall { - uniffi_ldk_node_fn_method_node_status(self.uniffiClonePointer(), $0) - }) - } - - open func stop() throws { try rustCallWithError(FfiConverterTypeNodeError.lift) { - uniffi_ldk_node_fn_method_node_stop(self.uniffiClonePointer(), $0) - } - } - - open func syncWallets() throws { try rustCallWithError(FfiConverterTypeNodeError.lift) { - uniffi_ldk_node_fn_method_node_sync_wallets(self.uniffiClonePointer(), $0) - } - } - - open func unifiedQrPayment() -> UnifiedQrPayment { - return try! FfiConverterTypeUnifiedQrPayment.lift(try! rustCall { - uniffi_ldk_node_fn_method_node_unified_qr_payment(self.uniffiClonePointer(), $0) - }) - } - - open func updateChannelConfig(userChannelId: UserChannelId, counterpartyNodeId: PublicKey, channelConfig: ChannelConfig) throws { try rustCallWithError(FfiConverterTypeNodeError.lift) { - uniffi_ldk_node_fn_method_node_update_channel_config(self.uniffiClonePointer(), - FfiConverterTypeUserChannelId.lower(userChannelId), - FfiConverterTypePublicKey.lower(counterpartyNodeId), - FfiConverterTypeChannelConfig.lower(channelConfig), $0) - } - } - - open func verifySignature(msg: [UInt8], sig: String, pkey: PublicKey) -> Bool { - return try! FfiConverterBool.lift(try! rustCall { - uniffi_ldk_node_fn_method_node_verify_signature(self.uniffiClonePointer(), - FfiConverterSequenceUInt8.lower(msg), - FfiConverterString.lower(sig), - FfiConverterTypePublicKey.lower(pkey), $0) - }) - } + +open func announcementAddresses() -> [SocketAddress]? { + return try! FfiConverterOptionSequenceTypeSocketAddress.lift(try! rustCall() { + uniffi_ldk_node_fn_method_node_announcement_addresses(self.uniffiClonePointer(),$0 + ) +}) +} + +open func bolt11Payment() -> Bolt11Payment { + return try! FfiConverterTypeBolt11Payment.lift(try! rustCall() { + uniffi_ldk_node_fn_method_node_bolt11_payment(self.uniffiClonePointer(),$0 + ) +}) +} + +open func bolt12Payment() -> Bolt12Payment { + return try! FfiConverterTypeBolt12Payment.lift(try! rustCall() { + uniffi_ldk_node_fn_method_node_bolt12_payment(self.uniffiClonePointer(),$0 + ) +}) +} + +open func closeChannel(userChannelId: UserChannelId, counterpartyNodeId: PublicKey)throws {try rustCallWithError(FfiConverterTypeNodeError.lift) { + uniffi_ldk_node_fn_method_node_close_channel(self.uniffiClonePointer(), + FfiConverterTypeUserChannelId.lower(userChannelId), + FfiConverterTypePublicKey.lower(counterpartyNodeId),$0 + ) +} +} + +open func config() -> Config { + return try! FfiConverterTypeConfig.lift(try! rustCall() { + uniffi_ldk_node_fn_method_node_config(self.uniffiClonePointer(),$0 + ) +}) +} + +open func connect(nodeId: PublicKey, address: SocketAddress, persist: Bool)throws {try rustCallWithError(FfiConverterTypeNodeError.lift) { + uniffi_ldk_node_fn_method_node_connect(self.uniffiClonePointer(), + FfiConverterTypePublicKey.lower(nodeId), + FfiConverterTypeSocketAddress.lower(address), + FfiConverterBool.lower(persist),$0 + ) +} +} + +open func disconnect(nodeId: PublicKey)throws {try rustCallWithError(FfiConverterTypeNodeError.lift) { + uniffi_ldk_node_fn_method_node_disconnect(self.uniffiClonePointer(), + FfiConverterTypePublicKey.lower(nodeId),$0 + ) +} +} + +open func eventHandled()throws {try rustCallWithError(FfiConverterTypeNodeError.lift) { + uniffi_ldk_node_fn_method_node_event_handled(self.uniffiClonePointer(),$0 + ) +} +} + +open func exportPathfindingScores()throws -> Data { + return try FfiConverterData.lift(try rustCallWithError(FfiConverterTypeNodeError.lift) { + uniffi_ldk_node_fn_method_node_export_pathfinding_scores(self.uniffiClonePointer(),$0 + ) +}) +} + +open func forceCloseChannel(userChannelId: UserChannelId, counterpartyNodeId: PublicKey, reason: String?)throws {try rustCallWithError(FfiConverterTypeNodeError.lift) { + uniffi_ldk_node_fn_method_node_force_close_channel(self.uniffiClonePointer(), + FfiConverterTypeUserChannelId.lower(userChannelId), + FfiConverterTypePublicKey.lower(counterpartyNodeId), + FfiConverterOptionString.lower(reason),$0 + ) +} +} + +open func listBalances() -> BalanceDetails { + return try! FfiConverterTypeBalanceDetails.lift(try! rustCall() { + uniffi_ldk_node_fn_method_node_list_balances(self.uniffiClonePointer(),$0 + ) +}) +} + +open func listChannels() -> [ChannelDetails] { + return try! FfiConverterSequenceTypeChannelDetails.lift(try! rustCall() { + uniffi_ldk_node_fn_method_node_list_channels(self.uniffiClonePointer(),$0 + ) +}) +} + +open func listPayments() -> [PaymentDetails] { + return try! FfiConverterSequenceTypePaymentDetails.lift(try! rustCall() { + uniffi_ldk_node_fn_method_node_list_payments(self.uniffiClonePointer(),$0 + ) +}) +} + +open func listPeers() -> [PeerDetails] { + return try! FfiConverterSequenceTypePeerDetails.lift(try! rustCall() { + uniffi_ldk_node_fn_method_node_list_peers(self.uniffiClonePointer(),$0 + ) +}) +} + +open func listeningAddresses() -> [SocketAddress]? { + return try! FfiConverterOptionSequenceTypeSocketAddress.lift(try! rustCall() { + uniffi_ldk_node_fn_method_node_listening_addresses(self.uniffiClonePointer(),$0 + ) +}) +} + +open func lsps1Liquidity() -> Lsps1Liquidity { + return try! FfiConverterTypeLSPS1Liquidity.lift(try! rustCall() { + uniffi_ldk_node_fn_method_node_lsps1_liquidity(self.uniffiClonePointer(),$0 + ) +}) +} + +open func networkGraph() -> NetworkGraph { + return try! FfiConverterTypeNetworkGraph.lift(try! rustCall() { + uniffi_ldk_node_fn_method_node_network_graph(self.uniffiClonePointer(),$0 + ) +}) +} + +open func nextEvent() -> Event? { + return try! FfiConverterOptionTypeEvent.lift(try! rustCall() { + uniffi_ldk_node_fn_method_node_next_event(self.uniffiClonePointer(),$0 + ) +}) +} + +open func nextEventAsync()async -> Event { + return + try! await uniffiRustCallAsync( + rustFutureFunc: { + uniffi_ldk_node_fn_method_node_next_event_async( + self.uniffiClonePointer() + + ) + }, + pollFunc: ffi_ldk_node_rust_future_poll_rust_buffer, + completeFunc: ffi_ldk_node_rust_future_complete_rust_buffer, + freeFunc: ffi_ldk_node_rust_future_free_rust_buffer, + liftFunc: FfiConverterTypeEvent.lift, + errorHandler: nil + + ) +} + +open func nodeAlias() -> NodeAlias? { + return try! FfiConverterOptionTypeNodeAlias.lift(try! rustCall() { + uniffi_ldk_node_fn_method_node_node_alias(self.uniffiClonePointer(),$0 + ) +}) +} + +open func nodeId() -> PublicKey { + return try! FfiConverterTypePublicKey.lift(try! rustCall() { + uniffi_ldk_node_fn_method_node_node_id(self.uniffiClonePointer(),$0 + ) +}) +} + +open func onchainPayment() -> OnchainPayment { + return try! FfiConverterTypeOnchainPayment.lift(try! rustCall() { + uniffi_ldk_node_fn_method_node_onchain_payment(self.uniffiClonePointer(),$0 + ) +}) +} + +open func openAnnouncedChannel(nodeId: PublicKey, address: SocketAddress, channelAmountSats: UInt64, pushToCounterpartyMsat: UInt64?, channelConfig: ChannelConfig?)throws -> UserChannelId { + return try FfiConverterTypeUserChannelId.lift(try rustCallWithError(FfiConverterTypeNodeError.lift) { + uniffi_ldk_node_fn_method_node_open_announced_channel(self.uniffiClonePointer(), + FfiConverterTypePublicKey.lower(nodeId), + FfiConverterTypeSocketAddress.lower(address), + FfiConverterUInt64.lower(channelAmountSats), + FfiConverterOptionUInt64.lower(pushToCounterpartyMsat), + FfiConverterOptionTypeChannelConfig.lower(channelConfig),$0 + ) +}) +} + +open func openChannel(nodeId: PublicKey, address: SocketAddress, channelAmountSats: UInt64, pushToCounterpartyMsat: UInt64?, channelConfig: ChannelConfig?)throws -> UserChannelId { + return try FfiConverterTypeUserChannelId.lift(try rustCallWithError(FfiConverterTypeNodeError.lift) { + uniffi_ldk_node_fn_method_node_open_channel(self.uniffiClonePointer(), + FfiConverterTypePublicKey.lower(nodeId), + FfiConverterTypeSocketAddress.lower(address), + FfiConverterUInt64.lower(channelAmountSats), + FfiConverterOptionUInt64.lower(pushToCounterpartyMsat), + FfiConverterOptionTypeChannelConfig.lower(channelConfig),$0 + ) +}) +} + +open func payment(paymentId: PaymentId) -> PaymentDetails? { + return try! FfiConverterOptionTypePaymentDetails.lift(try! rustCall() { + uniffi_ldk_node_fn_method_node_payment(self.uniffiClonePointer(), + FfiConverterTypePaymentId.lower(paymentId),$0 + ) +}) +} + +open func removePayment(paymentId: PaymentId)throws {try rustCallWithError(FfiConverterTypeNodeError.lift) { + uniffi_ldk_node_fn_method_node_remove_payment(self.uniffiClonePointer(), + FfiConverterTypePaymentId.lower(paymentId),$0 + ) +} +} + +open func signMessage(msg: [UInt8]) -> String { + return try! FfiConverterString.lift(try! rustCall() { + uniffi_ldk_node_fn_method_node_sign_message(self.uniffiClonePointer(), + FfiConverterSequenceUInt8.lower(msg),$0 + ) +}) +} + +open func spontaneousPayment() -> SpontaneousPayment { + return try! FfiConverterTypeSpontaneousPayment.lift(try! rustCall() { + uniffi_ldk_node_fn_method_node_spontaneous_payment(self.uniffiClonePointer(),$0 + ) +}) +} + +open func start()throws {try rustCallWithError(FfiConverterTypeNodeError.lift) { + uniffi_ldk_node_fn_method_node_start(self.uniffiClonePointer(),$0 + ) +} +} + +open func status() -> NodeStatus { + return try! FfiConverterTypeNodeStatus.lift(try! rustCall() { + uniffi_ldk_node_fn_method_node_status(self.uniffiClonePointer(),$0 + ) +}) +} + +open func stop()throws {try rustCallWithError(FfiConverterTypeNodeError.lift) { + uniffi_ldk_node_fn_method_node_stop(self.uniffiClonePointer(),$0 + ) +} +} + +open func syncWallets()throws {try rustCallWithError(FfiConverterTypeNodeError.lift) { + uniffi_ldk_node_fn_method_node_sync_wallets(self.uniffiClonePointer(),$0 + ) +} +} + +open func unifiedQrPayment() -> UnifiedQrPayment { + return try! FfiConverterTypeUnifiedQrPayment.lift(try! rustCall() { + uniffi_ldk_node_fn_method_node_unified_qr_payment(self.uniffiClonePointer(),$0 + ) +}) +} + +open func updateChannelConfig(userChannelId: UserChannelId, counterpartyNodeId: PublicKey, channelConfig: ChannelConfig)throws {try rustCallWithError(FfiConverterTypeNodeError.lift) { + uniffi_ldk_node_fn_method_node_update_channel_config(self.uniffiClonePointer(), + FfiConverterTypeUserChannelId.lower(userChannelId), + FfiConverterTypePublicKey.lower(counterpartyNodeId), + FfiConverterTypeChannelConfig.lower(channelConfig),$0 + ) +} +} + +open func verifySignature(msg: [UInt8], sig: String, pkey: PublicKey) -> Bool { + return try! FfiConverterBool.lift(try! rustCall() { + uniffi_ldk_node_fn_method_node_verify_signature(self.uniffiClonePointer(), + FfiConverterSequenceUInt8.lower(msg), + FfiConverterString.lower(sig), + FfiConverterTypePublicKey.lower(pkey),$0 + ) +}) +} + +open func waitNextEvent() -> Event { + return try! FfiConverterTypeEvent.lift(try! rustCall() { + uniffi_ldk_node_fn_method_node_wait_next_event(self.uniffiClonePointer(),$0 + ) +}) +} + - open func waitNextEvent() -> Event { - return try! FfiConverterTypeEvent.lift(try! rustCall { - uniffi_ldk_node_fn_method_node_wait_next_event(self.uniffiClonePointer(), $0) - }) - } } public struct FfiConverterTypeNode: FfiConverter { + typealias FfiType = UnsafeMutableRawPointer typealias SwiftType = Node @@ -2260,7 +2491,7 @@ public struct FfiConverterTypeNode: FfiConverter { // The Rust code won't compile if a pointer won't fit in a UInt64. // We have to go via `UInt` because that's the thing that's the size of a pointer. let ptr = UnsafeMutableRawPointer(bitPattern: UInt(truncatingIfNeeded: v)) - if ptr == nil { + if (ptr == nil) { throw UniffiInternalError.unexpectedNullPointer } return try lift(ptr!) @@ -2273,6 +2504,9 @@ public struct FfiConverterTypeNode: FfiConverter { } } + + + public func FfiConverterTypeNode_lift(_ pointer: UnsafeMutableRawPointer) throws -> Node { return try FfiConverterTypeNode.lift(pointer) } @@ -2281,29 +2515,33 @@ public func FfiConverterTypeNode_lower(_ value: Node) -> UnsafeMutableRawPointer return FfiConverterTypeNode.lower(value) } -public protocol OnchainPaymentProtocol: AnyObject { - func accelerateByCpfp(txid: Txid, feeRate: FeeRate?, destinationAddress: Address?) throws -> Txid - - func bumpFeeByRbf(txid: Txid, feeRate: FeeRate) throws -> Txid - - func calculateCpfpFeeRate(parentTxid: Txid, urgent: Bool) throws -> FeeRate - - func calculateTotalFee(address: Address, amountSats: UInt64, feeRate: FeeRate?, utxosToSpend: [SpendableUtxo]?) throws -> UInt64 - func listSpendableOutputs() throws -> [SpendableUtxo] - func newAddress() throws -> Address - func selectUtxosWithAlgorithm(targetAmountSats: UInt64, feeRate: FeeRate?, algorithm: CoinSelectionAlgorithm, utxos: [SpendableUtxo]?) throws -> [SpendableUtxo] - - func sendAllToAddress(address: Address, retainReserve: Bool, feeRate: FeeRate?) throws -> Txid - - func sendToAddress(address: Address, amountSats: UInt64, feeRate: FeeRate?, utxosToSpend: [SpendableUtxo]?) throws -> Txid +public protocol OnchainPaymentProtocol : AnyObject { + + func accelerateByCpfp(txid: Txid, feeRate: FeeRate?, destinationAddress: Address?) throws -> Txid + + func bumpFeeByRbf(txid: Txid, feeRate: FeeRate) throws -> Txid + + func calculateCpfpFeeRate(parentTxid: Txid, urgent: Bool) throws -> FeeRate + + func calculateTotalFee(address: Address, amountSats: UInt64, feeRate: FeeRate?, utxosToSpend: [SpendableUtxo]?) throws -> UInt64 + + func listSpendableOutputs() throws -> [SpendableUtxo] + + func newAddress() throws -> Address + + func selectUtxosWithAlgorithm(targetAmountSats: UInt64, feeRate: FeeRate?, algorithm: CoinSelectionAlgorithm, utxos: [SpendableUtxo]?) throws -> [SpendableUtxo] + + func sendAllToAddress(address: Address, retainReserve: Bool, feeRate: FeeRate?) throws -> Txid + + func sendToAddress(address: Address, amountSats: UInt64, feeRate: FeeRate?, utxosToSpend: [SpendableUtxo]?) throws -> Txid + } open class OnchainPayment: - OnchainPaymentProtocol -{ + OnchainPaymentProtocol { fileprivate let pointer: UnsafeMutableRawPointer! /// Used to instantiate a [FFIObject] without an actual pointer, for fakes in tests, mostly. @@ -2314,7 +2552,7 @@ open class OnchainPayment: // TODO: We'd like this to be `private` but for Swifty reasons, // we can't implement `FfiConverter` without making this `required` and we can't // make it `required` without making it `public`. - public required init(unsafeFromRawPointer pointer: UnsafeMutableRawPointer) { + required public init(unsafeFromRawPointer pointer: UnsafeMutableRawPointer) { self.pointer = pointer } @@ -2323,14 +2561,13 @@ open class OnchainPayment: /// /// - Warning: /// Any object instantiated with this constructor cannot be passed to an actual Rust-backed object. Since there isn't a backing [Pointer] the FFI lower functions will crash. - public init(noPointer _: NoPointer) { - pointer = nil + public init(noPointer: NoPointer) { + self.pointer = nil } public func uniffiClonePointer() -> UnsafeMutableRawPointer { return try! rustCall { uniffi_ldk_node_fn_clone_onchainpayment(self.pointer, $0) } } - // No primary constructor declared for this class. deinit { @@ -2341,84 +2578,99 @@ open class OnchainPayment: try! rustCall { uniffi_ldk_node_fn_free_onchainpayment(pointer, $0) } } - open func accelerateByCpfp(txid: Txid, feeRate: FeeRate?, destinationAddress: Address?) throws -> Txid { - return try FfiConverterTypeTxid.lift(rustCallWithError(FfiConverterTypeNodeError.lift) { - uniffi_ldk_node_fn_method_onchainpayment_accelerate_by_cpfp(self.uniffiClonePointer(), - FfiConverterTypeTxid.lower(txid), - FfiConverterOptionTypeFeeRate.lower(feeRate), - FfiConverterOptionTypeAddress.lower(destinationAddress), $0) - }) - } - - open func bumpFeeByRbf(txid: Txid, feeRate: FeeRate) throws -> Txid { - return try FfiConverterTypeTxid.lift(rustCallWithError(FfiConverterTypeNodeError.lift) { - uniffi_ldk_node_fn_method_onchainpayment_bump_fee_by_rbf(self.uniffiClonePointer(), - FfiConverterTypeTxid.lower(txid), - FfiConverterTypeFeeRate.lower(feeRate), $0) - }) - } - - open func calculateCpfpFeeRate(parentTxid: Txid, urgent: Bool) throws -> FeeRate { - return try FfiConverterTypeFeeRate.lift(rustCallWithError(FfiConverterTypeNodeError.lift) { - uniffi_ldk_node_fn_method_onchainpayment_calculate_cpfp_fee_rate(self.uniffiClonePointer(), - FfiConverterTypeTxid.lower(parentTxid), - FfiConverterBool.lower(urgent), $0) - }) - } - - open func calculateTotalFee(address: Address, amountSats: UInt64, feeRate: FeeRate?, utxosToSpend: [SpendableUtxo]?) throws -> UInt64 { - return try FfiConverterUInt64.lift(rustCallWithError(FfiConverterTypeNodeError.lift) { - uniffi_ldk_node_fn_method_onchainpayment_calculate_total_fee(self.uniffiClonePointer(), - FfiConverterTypeAddress.lower(address), - FfiConverterUInt64.lower(amountSats), - FfiConverterOptionTypeFeeRate.lower(feeRate), - FfiConverterOptionSequenceTypeSpendableUtxo.lower(utxosToSpend), $0) - }) - } - - open func listSpendableOutputs() throws -> [SpendableUtxo] { - return try FfiConverterSequenceTypeSpendableUtxo.lift(rustCallWithError(FfiConverterTypeNodeError.lift) { - uniffi_ldk_node_fn_method_onchainpayment_list_spendable_outputs(self.uniffiClonePointer(), $0) - }) - } - - open func newAddress() throws -> Address { - return try FfiConverterTypeAddress.lift(rustCallWithError(FfiConverterTypeNodeError.lift) { - uniffi_ldk_node_fn_method_onchainpayment_new_address(self.uniffiClonePointer(), $0) - }) - } - - open func selectUtxosWithAlgorithm(targetAmountSats: UInt64, feeRate: FeeRate?, algorithm: CoinSelectionAlgorithm, utxos: [SpendableUtxo]?) throws -> [SpendableUtxo] { - return try FfiConverterSequenceTypeSpendableUtxo.lift(rustCallWithError(FfiConverterTypeNodeError.lift) { - uniffi_ldk_node_fn_method_onchainpayment_select_utxos_with_algorithm(self.uniffiClonePointer(), - FfiConverterUInt64.lower(targetAmountSats), - FfiConverterOptionTypeFeeRate.lower(feeRate), - FfiConverterTypeCoinSelectionAlgorithm.lower(algorithm), - FfiConverterOptionSequenceTypeSpendableUtxo.lower(utxos), $0) - }) - } + - open func sendAllToAddress(address: Address, retainReserve: Bool, feeRate: FeeRate?) throws -> Txid { - return try FfiConverterTypeTxid.lift(rustCallWithError(FfiConverterTypeNodeError.lift) { - uniffi_ldk_node_fn_method_onchainpayment_send_all_to_address(self.uniffiClonePointer(), - FfiConverterTypeAddress.lower(address), - FfiConverterBool.lower(retainReserve), - FfiConverterOptionTypeFeeRate.lower(feeRate), $0) - }) - } + +open func accelerateByCpfp(txid: Txid, feeRate: FeeRate?, destinationAddress: Address?)throws -> Txid { + return try FfiConverterTypeTxid.lift(try rustCallWithError(FfiConverterTypeNodeError.lift) { + uniffi_ldk_node_fn_method_onchainpayment_accelerate_by_cpfp(self.uniffiClonePointer(), + FfiConverterTypeTxid.lower(txid), + FfiConverterOptionTypeFeeRate.lower(feeRate), + FfiConverterOptionTypeAddress.lower(destinationAddress),$0 + ) +}) +} + +open func bumpFeeByRbf(txid: Txid, feeRate: FeeRate)throws -> Txid { + return try FfiConverterTypeTxid.lift(try rustCallWithError(FfiConverterTypeNodeError.lift) { + uniffi_ldk_node_fn_method_onchainpayment_bump_fee_by_rbf(self.uniffiClonePointer(), + FfiConverterTypeTxid.lower(txid), + FfiConverterTypeFeeRate.lower(feeRate),$0 + ) +}) +} + +open func calculateCpfpFeeRate(parentTxid: Txid, urgent: Bool)throws -> FeeRate { + return try FfiConverterTypeFeeRate.lift(try rustCallWithError(FfiConverterTypeNodeError.lift) { + uniffi_ldk_node_fn_method_onchainpayment_calculate_cpfp_fee_rate(self.uniffiClonePointer(), + FfiConverterTypeTxid.lower(parentTxid), + FfiConverterBool.lower(urgent),$0 + ) +}) +} + +open func calculateTotalFee(address: Address, amountSats: UInt64, feeRate: FeeRate?, utxosToSpend: [SpendableUtxo]?)throws -> UInt64 { + return try FfiConverterUInt64.lift(try rustCallWithError(FfiConverterTypeNodeError.lift) { + uniffi_ldk_node_fn_method_onchainpayment_calculate_total_fee(self.uniffiClonePointer(), + FfiConverterTypeAddress.lower(address), + FfiConverterUInt64.lower(amountSats), + FfiConverterOptionTypeFeeRate.lower(feeRate), + FfiConverterOptionSequenceTypeSpendableUtxo.lower(utxosToSpend),$0 + ) +}) +} + +open func listSpendableOutputs()throws -> [SpendableUtxo] { + return try FfiConverterSequenceTypeSpendableUtxo.lift(try rustCallWithError(FfiConverterTypeNodeError.lift) { + uniffi_ldk_node_fn_method_onchainpayment_list_spendable_outputs(self.uniffiClonePointer(),$0 + ) +}) +} + +open func newAddress()throws -> Address { + return try FfiConverterTypeAddress.lift(try rustCallWithError(FfiConverterTypeNodeError.lift) { + uniffi_ldk_node_fn_method_onchainpayment_new_address(self.uniffiClonePointer(),$0 + ) +}) +} + +open func selectUtxosWithAlgorithm(targetAmountSats: UInt64, feeRate: FeeRate?, algorithm: CoinSelectionAlgorithm, utxos: [SpendableUtxo]?)throws -> [SpendableUtxo] { + return try FfiConverterSequenceTypeSpendableUtxo.lift(try rustCallWithError(FfiConverterTypeNodeError.lift) { + uniffi_ldk_node_fn_method_onchainpayment_select_utxos_with_algorithm(self.uniffiClonePointer(), + FfiConverterUInt64.lower(targetAmountSats), + FfiConverterOptionTypeFeeRate.lower(feeRate), + FfiConverterTypeCoinSelectionAlgorithm.lower(algorithm), + FfiConverterOptionSequenceTypeSpendableUtxo.lower(utxos),$0 + ) +}) +} + +open func sendAllToAddress(address: Address, retainReserve: Bool, feeRate: FeeRate?)throws -> Txid { + return try FfiConverterTypeTxid.lift(try rustCallWithError(FfiConverterTypeNodeError.lift) { + uniffi_ldk_node_fn_method_onchainpayment_send_all_to_address(self.uniffiClonePointer(), + FfiConverterTypeAddress.lower(address), + FfiConverterBool.lower(retainReserve), + FfiConverterOptionTypeFeeRate.lower(feeRate),$0 + ) +}) +} + +open func sendToAddress(address: Address, amountSats: UInt64, feeRate: FeeRate?, utxosToSpend: [SpendableUtxo]?)throws -> Txid { + return try FfiConverterTypeTxid.lift(try rustCallWithError(FfiConverterTypeNodeError.lift) { + uniffi_ldk_node_fn_method_onchainpayment_send_to_address(self.uniffiClonePointer(), + FfiConverterTypeAddress.lower(address), + FfiConverterUInt64.lower(amountSats), + FfiConverterOptionTypeFeeRate.lower(feeRate), + FfiConverterOptionSequenceTypeSpendableUtxo.lower(utxosToSpend),$0 + ) +}) +} + - open func sendToAddress(address: Address, amountSats: UInt64, feeRate: FeeRate?, utxosToSpend: [SpendableUtxo]?) throws -> Txid { - return try FfiConverterTypeTxid.lift(rustCallWithError(FfiConverterTypeNodeError.lift) { - uniffi_ldk_node_fn_method_onchainpayment_send_to_address(self.uniffiClonePointer(), - FfiConverterTypeAddress.lower(address), - FfiConverterUInt64.lower(amountSats), - FfiConverterOptionTypeFeeRate.lower(feeRate), - FfiConverterOptionSequenceTypeSpendableUtxo.lower(utxosToSpend), $0) - }) - } } public struct FfiConverterTypeOnchainPayment: FfiConverter { + typealias FfiType = UnsafeMutableRawPointer typealias SwiftType = OnchainPayment @@ -2435,7 +2687,7 @@ public struct FfiConverterTypeOnchainPayment: FfiConverter { // The Rust code won't compile if a pointer won't fit in a UInt64. // We have to go via `UInt` because that's the thing that's the size of a pointer. let ptr = UnsafeMutableRawPointer(bitPattern: UInt(truncatingIfNeeded: v)) - if ptr == nil { + if (ptr == nil) { throw UniffiInternalError.unexpectedNullPointer } return try lift(ptr!) @@ -2448,6 +2700,9 @@ public struct FfiConverterTypeOnchainPayment: FfiConverter { } } + + + public func FfiConverterTypeOnchainPayment_lift(_ pointer: UnsafeMutableRawPointer) throws -> OnchainPayment { return try FfiConverterTypeOnchainPayment.lift(pointer) } @@ -2456,17 +2711,21 @@ public func FfiConverterTypeOnchainPayment_lower(_ value: OnchainPayment) -> Uns return FfiConverterTypeOnchainPayment.lower(value) } -public protocol SpontaneousPaymentProtocol: AnyObject { - func send(amountMsat: UInt64, nodeId: PublicKey, sendingParameters: SendingParameters?) throws -> PaymentId - func sendProbes(amountMsat: UInt64, nodeId: PublicKey) throws - func sendWithCustomTlvs(amountMsat: UInt64, nodeId: PublicKey, sendingParameters: SendingParameters?, customTlvs: [CustomTlvRecord]) throws -> PaymentId + +public protocol SpontaneousPaymentProtocol : AnyObject { + + func send(amountMsat: UInt64, nodeId: PublicKey, sendingParameters: SendingParameters?) throws -> PaymentId + + func sendProbes(amountMsat: UInt64, nodeId: PublicKey) throws + + func sendWithCustomTlvs(amountMsat: UInt64, nodeId: PublicKey, sendingParameters: SendingParameters?, customTlvs: [CustomTlvRecord]) throws -> PaymentId + } open class SpontaneousPayment: - SpontaneousPaymentProtocol -{ + SpontaneousPaymentProtocol { fileprivate let pointer: UnsafeMutableRawPointer! /// Used to instantiate a [FFIObject] without an actual pointer, for fakes in tests, mostly. @@ -2477,7 +2736,7 @@ open class SpontaneousPayment: // TODO: We'd like this to be `private` but for Swifty reasons, // we can't implement `FfiConverter` without making this `required` and we can't // make it `required` without making it `public`. - public required init(unsafeFromRawPointer pointer: UnsafeMutableRawPointer) { + required public init(unsafeFromRawPointer pointer: UnsafeMutableRawPointer) { self.pointer = pointer } @@ -2486,14 +2745,13 @@ open class SpontaneousPayment: /// /// - Warning: /// Any object instantiated with this constructor cannot be passed to an actual Rust-backed object. Since there isn't a backing [Pointer] the FFI lower functions will crash. - public init(noPointer _: NoPointer) { - pointer = nil + public init(noPointer: NoPointer) { + self.pointer = nil } public func uniffiClonePointer() -> UnsafeMutableRawPointer { return try! rustCall { uniffi_ldk_node_fn_clone_spontaneouspayment(self.pointer, $0) } } - // No primary constructor declared for this class. deinit { @@ -2504,34 +2762,43 @@ open class SpontaneousPayment: try! rustCall { uniffi_ldk_node_fn_free_spontaneouspayment(pointer, $0) } } - open func send(amountMsat: UInt64, nodeId: PublicKey, sendingParameters: SendingParameters?) throws -> PaymentId { - return try FfiConverterTypePaymentId.lift(rustCallWithError(FfiConverterTypeNodeError.lift) { - uniffi_ldk_node_fn_method_spontaneouspayment_send(self.uniffiClonePointer(), - FfiConverterUInt64.lower(amountMsat), - FfiConverterTypePublicKey.lower(nodeId), - FfiConverterOptionTypeSendingParameters.lower(sendingParameters), $0) - }) - } + - open func sendProbes(amountMsat: UInt64, nodeId: PublicKey) throws { try rustCallWithError(FfiConverterTypeNodeError.lift) { - uniffi_ldk_node_fn_method_spontaneouspayment_send_probes(self.uniffiClonePointer(), - FfiConverterUInt64.lower(amountMsat), - FfiConverterTypePublicKey.lower(nodeId), $0) - } - } + +open func send(amountMsat: UInt64, nodeId: PublicKey, sendingParameters: SendingParameters?)throws -> PaymentId { + return try FfiConverterTypePaymentId.lift(try rustCallWithError(FfiConverterTypeNodeError.lift) { + uniffi_ldk_node_fn_method_spontaneouspayment_send(self.uniffiClonePointer(), + FfiConverterUInt64.lower(amountMsat), + FfiConverterTypePublicKey.lower(nodeId), + FfiConverterOptionTypeSendingParameters.lower(sendingParameters),$0 + ) +}) +} + +open func sendProbes(amountMsat: UInt64, nodeId: PublicKey)throws {try rustCallWithError(FfiConverterTypeNodeError.lift) { + uniffi_ldk_node_fn_method_spontaneouspayment_send_probes(self.uniffiClonePointer(), + FfiConverterUInt64.lower(amountMsat), + FfiConverterTypePublicKey.lower(nodeId),$0 + ) +} +} + +open func sendWithCustomTlvs(amountMsat: UInt64, nodeId: PublicKey, sendingParameters: SendingParameters?, customTlvs: [CustomTlvRecord])throws -> PaymentId { + return try FfiConverterTypePaymentId.lift(try rustCallWithError(FfiConverterTypeNodeError.lift) { + uniffi_ldk_node_fn_method_spontaneouspayment_send_with_custom_tlvs(self.uniffiClonePointer(), + FfiConverterUInt64.lower(amountMsat), + FfiConverterTypePublicKey.lower(nodeId), + FfiConverterOptionTypeSendingParameters.lower(sendingParameters), + FfiConverterSequenceTypeCustomTlvRecord.lower(customTlvs),$0 + ) +}) +} + - open func sendWithCustomTlvs(amountMsat: UInt64, nodeId: PublicKey, sendingParameters: SendingParameters?, customTlvs: [CustomTlvRecord]) throws -> PaymentId { - return try FfiConverterTypePaymentId.lift(rustCallWithError(FfiConverterTypeNodeError.lift) { - uniffi_ldk_node_fn_method_spontaneouspayment_send_with_custom_tlvs(self.uniffiClonePointer(), - FfiConverterUInt64.lower(amountMsat), - FfiConverterTypePublicKey.lower(nodeId), - FfiConverterOptionTypeSendingParameters.lower(sendingParameters), - FfiConverterSequenceTypeCustomTlvRecord.lower(customTlvs), $0) - }) - } } public struct FfiConverterTypeSpontaneousPayment: FfiConverter { + typealias FfiType = UnsafeMutableRawPointer typealias SwiftType = SpontaneousPayment @@ -2548,7 +2815,7 @@ public struct FfiConverterTypeSpontaneousPayment: FfiConverter { // The Rust code won't compile if a pointer won't fit in a UInt64. // We have to go via `UInt` because that's the thing that's the size of a pointer. let ptr = UnsafeMutableRawPointer(bitPattern: UInt(truncatingIfNeeded: v)) - if ptr == nil { + if (ptr == nil) { throw UniffiInternalError.unexpectedNullPointer } return try lift(ptr!) @@ -2561,6 +2828,9 @@ public struct FfiConverterTypeSpontaneousPayment: FfiConverter { } } + + + public func FfiConverterTypeSpontaneousPayment_lift(_ pointer: UnsafeMutableRawPointer) throws -> SpontaneousPayment { return try FfiConverterTypeSpontaneousPayment.lift(pointer) } @@ -2569,15 +2839,19 @@ public func FfiConverterTypeSpontaneousPayment_lower(_ value: SpontaneousPayment return FfiConverterTypeSpontaneousPayment.lower(value) } -public protocol UnifiedQrPaymentProtocol: AnyObject { - func receive(amountSats: UInt64, message: String, expirySec: UInt32) throws -> String - func send(uriStr: String) throws -> QrPaymentResult + + +public protocol UnifiedQrPaymentProtocol : AnyObject { + + func receive(amountSats: UInt64, message: String, expirySec: UInt32) throws -> String + + func send(uriStr: String) throws -> QrPaymentResult + } open class UnifiedQrPayment: - UnifiedQrPaymentProtocol -{ + UnifiedQrPaymentProtocol { fileprivate let pointer: UnsafeMutableRawPointer! /// Used to instantiate a [FFIObject] without an actual pointer, for fakes in tests, mostly. @@ -2588,7 +2862,7 @@ open class UnifiedQrPayment: // TODO: We'd like this to be `private` but for Swifty reasons, // we can't implement `FfiConverter` without making this `required` and we can't // make it `required` without making it `public`. - public required init(unsafeFromRawPointer pointer: UnsafeMutableRawPointer) { + required public init(unsafeFromRawPointer pointer: UnsafeMutableRawPointer) { self.pointer = pointer } @@ -2597,14 +2871,13 @@ open class UnifiedQrPayment: /// /// - Warning: /// Any object instantiated with this constructor cannot be passed to an actual Rust-backed object. Since there isn't a backing [Pointer] the FFI lower functions will crash. - public init(noPointer _: NoPointer) { - pointer = nil + public init(noPointer: NoPointer) { + self.pointer = nil } public func uniffiClonePointer() -> UnsafeMutableRawPointer { return try! rustCall { uniffi_ldk_node_fn_clone_unifiedqrpayment(self.pointer, $0) } } - // No primary constructor declared for this class. deinit { @@ -2615,24 +2888,32 @@ open class UnifiedQrPayment: try! rustCall { uniffi_ldk_node_fn_free_unifiedqrpayment(pointer, $0) } } - open func receive(amountSats: UInt64, message: String, expirySec: UInt32) throws -> String { - return try FfiConverterString.lift(rustCallWithError(FfiConverterTypeNodeError.lift) { - uniffi_ldk_node_fn_method_unifiedqrpayment_receive(self.uniffiClonePointer(), - FfiConverterUInt64.lower(amountSats), - FfiConverterString.lower(message), - FfiConverterUInt32.lower(expirySec), $0) - }) - } + + + +open func receive(amountSats: UInt64, message: String, expirySec: UInt32)throws -> String { + return try FfiConverterString.lift(try rustCallWithError(FfiConverterTypeNodeError.lift) { + uniffi_ldk_node_fn_method_unifiedqrpayment_receive(self.uniffiClonePointer(), + FfiConverterUInt64.lower(amountSats), + FfiConverterString.lower(message), + FfiConverterUInt32.lower(expirySec),$0 + ) +}) +} + +open func send(uriStr: String)throws -> QrPaymentResult { + return try FfiConverterTypeQrPaymentResult.lift(try rustCallWithError(FfiConverterTypeNodeError.lift) { + uniffi_ldk_node_fn_method_unifiedqrpayment_send(self.uniffiClonePointer(), + FfiConverterString.lower(uriStr),$0 + ) +}) +} + - open func send(uriStr: String) throws -> QrPaymentResult { - return try FfiConverterTypeQrPaymentResult.lift(rustCallWithError(FfiConverterTypeNodeError.lift) { - uniffi_ldk_node_fn_method_unifiedqrpayment_send(self.uniffiClonePointer(), - FfiConverterString.lower(uriStr), $0) - }) - } } public struct FfiConverterTypeUnifiedQrPayment: FfiConverter { + typealias FfiType = UnsafeMutableRawPointer typealias SwiftType = UnifiedQrPayment @@ -2649,7 +2930,7 @@ public struct FfiConverterTypeUnifiedQrPayment: FfiConverter { // The Rust code won't compile if a pointer won't fit in a UInt64. // We have to go via `UInt` because that's the thing that's the size of a pointer. let ptr = UnsafeMutableRawPointer(bitPattern: UInt(truncatingIfNeeded: v)) - if ptr == nil { + if (ptr == nil) { throw UniffiInternalError.unexpectedNullPointer } return try lift(ptr!) @@ -2662,6 +2943,9 @@ public struct FfiConverterTypeUnifiedQrPayment: FfiConverter { } } + + + public func FfiConverterTypeUnifiedQrPayment_lift(_ pointer: UnsafeMutableRawPointer) throws -> UnifiedQrPayment { return try FfiConverterTypeUnifiedQrPayment.lift(pointer) } @@ -2670,13 +2954,17 @@ public func FfiConverterTypeUnifiedQrPayment_lower(_ value: UnifiedQrPayment) -> return FfiConverterTypeUnifiedQrPayment.lower(value) } -public protocol VssHeaderProviderProtocol: AnyObject { - func getHeaders(request: [UInt8]) async throws -> [String: String] + + + +public protocol VssHeaderProviderProtocol : AnyObject { + + func getHeaders(request: [UInt8]) async throws -> [String: String] + } open class VssHeaderProvider: - VssHeaderProviderProtocol -{ + VssHeaderProviderProtocol { fileprivate let pointer: UnsafeMutableRawPointer! /// Used to instantiate a [FFIObject] without an actual pointer, for fakes in tests, mostly. @@ -2687,7 +2975,7 @@ open class VssHeaderProvider: // TODO: We'd like this to be `private` but for Swifty reasons, // we can't implement `FfiConverter` without making this `required` and we can't // make it `required` without making it `public`. - public required init(unsafeFromRawPointer pointer: UnsafeMutableRawPointer) { + required public init(unsafeFromRawPointer pointer: UnsafeMutableRawPointer) { self.pointer = pointer } @@ -2696,14 +2984,13 @@ open class VssHeaderProvider: /// /// - Warning: /// Any object instantiated with this constructor cannot be passed to an actual Rust-backed object. Since there isn't a backing [Pointer] the FFI lower functions will crash. - public init(noPointer _: NoPointer) { - pointer = nil + public init(noPointer: NoPointer) { + self.pointer = nil } public func uniffiClonePointer() -> UnsafeMutableRawPointer { return try! rustCall { uniffi_ldk_node_fn_clone_vssheaderprovider(self.pointer, $0) } } - // No primary constructor declared for this class. deinit { @@ -2714,25 +3001,31 @@ open class VssHeaderProvider: try! rustCall { uniffi_ldk_node_fn_free_vssheaderprovider(pointer, $0) } } - open func getHeaders(request: [UInt8]) async throws -> [String: String] { - return - try await uniffiRustCallAsync( - rustFutureFunc: { - uniffi_ldk_node_fn_method_vssheaderprovider_get_headers( - self.uniffiClonePointer(), - FfiConverterSequenceUInt8.lower(request) - ) - }, - pollFunc: ffi_ldk_node_rust_future_poll_rust_buffer, - completeFunc: ffi_ldk_node_rust_future_complete_rust_buffer, - freeFunc: ffi_ldk_node_rust_future_free_rust_buffer, - liftFunc: FfiConverterDictionaryStringString.lift, - errorHandler: FfiConverterTypeVssHeaderProviderError.lift - ) - } + + + +open func getHeaders(request: [UInt8])async throws -> [String: String] { + return + try await uniffiRustCallAsync( + rustFutureFunc: { + uniffi_ldk_node_fn_method_vssheaderprovider_get_headers( + self.uniffiClonePointer(), + FfiConverterSequenceUInt8.lower(request) + ) + }, + pollFunc: ffi_ldk_node_rust_future_poll_rust_buffer, + completeFunc: ffi_ldk_node_rust_future_complete_rust_buffer, + freeFunc: ffi_ldk_node_rust_future_free_rust_buffer, + liftFunc: FfiConverterDictionaryStringString.lift, + errorHandler: FfiConverterTypeVssHeaderProviderError.lift + ) +} + + } public struct FfiConverterTypeVssHeaderProvider: FfiConverter { + typealias FfiType = UnsafeMutableRawPointer typealias SwiftType = VssHeaderProvider @@ -2749,7 +3042,7 @@ public struct FfiConverterTypeVssHeaderProvider: FfiConverter { // The Rust code won't compile if a pointer won't fit in a UInt64. // We have to go via `UInt` because that's the thing that's the size of a pointer. let ptr = UnsafeMutableRawPointer(bitPattern: UInt(truncatingIfNeeded: v)) - if ptr == nil { + if (ptr == nil) { throw UniffiInternalError.unexpectedNullPointer } return try lift(ptr!) @@ -2762,6 +3055,9 @@ public struct FfiConverterTypeVssHeaderProvider: FfiConverter { } } + + + public func FfiConverterTypeVssHeaderProvider_lift(_ pointer: UnsafeMutableRawPointer) throws -> VssHeaderProvider { return try FfiConverterTypeVssHeaderProvider.lift(pointer) } @@ -2770,6 +3066,7 @@ public func FfiConverterTypeVssHeaderProvider_lower(_ value: VssHeaderProvider) return FfiConverterTypeVssHeaderProvider.lower(value) } + public struct AnchorChannelsConfig { public var trustedPeersNoReserve: [PublicKey] public var perChannelReserveSats: UInt64 @@ -2782,8 +3079,10 @@ public struct AnchorChannelsConfig { } } + + extension AnchorChannelsConfig: Equatable, Hashable { - public static func == (lhs: AnchorChannelsConfig, rhs: AnchorChannelsConfig) -> Bool { + public static func ==(lhs: AnchorChannelsConfig, rhs: AnchorChannelsConfig) -> Bool { if lhs.trustedPeersNoReserve != rhs.trustedPeersNoReserve { return false } @@ -2799,13 +3098,14 @@ extension AnchorChannelsConfig: Equatable, Hashable { } } + public struct FfiConverterTypeAnchorChannelsConfig: FfiConverterRustBuffer { public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> AnchorChannelsConfig { return try AnchorChannelsConfig( - trustedPeersNoReserve: FfiConverterSequenceTypePublicKey.read(from: &buf), + trustedPeersNoReserve: FfiConverterSequenceTypePublicKey.read(from: &buf), perChannelReserveSats: FfiConverterUInt64.read(from: &buf) - ) + ) } public static func write(_ value: AnchorChannelsConfig, into buf: inout [UInt8]) { @@ -2814,6 +3114,7 @@ public struct FfiConverterTypeAnchorChannelsConfig: FfiConverterRustBuffer { } } + public func FfiConverterTypeAnchorChannelsConfig_lift(_ buf: RustBuffer) throws -> AnchorChannelsConfig { return try FfiConverterTypeAnchorChannelsConfig.lift(buf) } @@ -2822,6 +3123,7 @@ public func FfiConverterTypeAnchorChannelsConfig_lower(_ value: AnchorChannelsCo return FfiConverterTypeAnchorChannelsConfig.lower(value) } + public struct BackgroundSyncConfig { public var onchainWalletSyncIntervalSecs: UInt64 public var lightningWalletSyncIntervalSecs: UInt64 @@ -2836,8 +3138,10 @@ public struct BackgroundSyncConfig { } } + + extension BackgroundSyncConfig: Equatable, Hashable { - public static func == (lhs: BackgroundSyncConfig, rhs: BackgroundSyncConfig) -> Bool { + public static func ==(lhs: BackgroundSyncConfig, rhs: BackgroundSyncConfig) -> Bool { if lhs.onchainWalletSyncIntervalSecs != rhs.onchainWalletSyncIntervalSecs { return false } @@ -2857,14 +3161,15 @@ extension BackgroundSyncConfig: Equatable, Hashable { } } + public struct FfiConverterTypeBackgroundSyncConfig: FfiConverterRustBuffer { public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> BackgroundSyncConfig { return try BackgroundSyncConfig( - onchainWalletSyncIntervalSecs: FfiConverterUInt64.read(from: &buf), - lightningWalletSyncIntervalSecs: FfiConverterUInt64.read(from: &buf), + onchainWalletSyncIntervalSecs: FfiConverterUInt64.read(from: &buf), + lightningWalletSyncIntervalSecs: FfiConverterUInt64.read(from: &buf), feeRateCacheUpdateIntervalSecs: FfiConverterUInt64.read(from: &buf) - ) + ) } public static func write(_ value: BackgroundSyncConfig, into buf: inout [UInt8]) { @@ -2874,6 +3179,7 @@ public struct FfiConverterTypeBackgroundSyncConfig: FfiConverterRustBuffer { } } + public func FfiConverterTypeBackgroundSyncConfig_lift(_ buf: RustBuffer) throws -> BackgroundSyncConfig { return try FfiConverterTypeBackgroundSyncConfig.lift(buf) } @@ -2882,6 +3188,7 @@ public func FfiConverterTypeBackgroundSyncConfig_lower(_ value: BackgroundSyncCo return FfiConverterTypeBackgroundSyncConfig.lower(value) } + public struct BalanceDetails { public var totalOnchainBalanceSats: UInt64 public var spendableOnchainBalanceSats: UInt64 @@ -2902,8 +3209,10 @@ public struct BalanceDetails { } } + + extension BalanceDetails: Equatable, Hashable { - public static func == (lhs: BalanceDetails, rhs: BalanceDetails) -> Bool { + public static func ==(lhs: BalanceDetails, rhs: BalanceDetails) -> Bool { if lhs.totalOnchainBalanceSats != rhs.totalOnchainBalanceSats { return false } @@ -2935,17 +3244,18 @@ extension BalanceDetails: Equatable, Hashable { } } + public struct FfiConverterTypeBalanceDetails: FfiConverterRustBuffer { public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> BalanceDetails { return try BalanceDetails( - totalOnchainBalanceSats: FfiConverterUInt64.read(from: &buf), - spendableOnchainBalanceSats: FfiConverterUInt64.read(from: &buf), - totalAnchorChannelsReserveSats: FfiConverterUInt64.read(from: &buf), - totalLightningBalanceSats: FfiConverterUInt64.read(from: &buf), - lightningBalances: FfiConverterSequenceTypeLightningBalance.read(from: &buf), + totalOnchainBalanceSats: FfiConverterUInt64.read(from: &buf), + spendableOnchainBalanceSats: FfiConverterUInt64.read(from: &buf), + totalAnchorChannelsReserveSats: FfiConverterUInt64.read(from: &buf), + totalLightningBalanceSats: FfiConverterUInt64.read(from: &buf), + lightningBalances: FfiConverterSequenceTypeLightningBalance.read(from: &buf), pendingBalancesFromChannelClosures: FfiConverterSequenceTypePendingSweepBalance.read(from: &buf) - ) + ) } public static func write(_ value: BalanceDetails, into buf: inout [UInt8]) { @@ -2958,6 +3268,7 @@ public struct FfiConverterTypeBalanceDetails: FfiConverterRustBuffer { } } + public func FfiConverterTypeBalanceDetails_lift(_ buf: RustBuffer) throws -> BalanceDetails { return try FfiConverterTypeBalanceDetails.lift(buf) } @@ -2966,6 +3277,7 @@ public func FfiConverterTypeBalanceDetails_lower(_ value: BalanceDetails) -> Rus return FfiConverterTypeBalanceDetails.lower(value) } + public struct BestBlock { public var blockHash: BlockHash public var height: UInt32 @@ -2978,8 +3290,10 @@ public struct BestBlock { } } + + extension BestBlock: Equatable, Hashable { - public static func == (lhs: BestBlock, rhs: BestBlock) -> Bool { + public static func ==(lhs: BestBlock, rhs: BestBlock) -> Bool { if lhs.blockHash != rhs.blockHash { return false } @@ -2995,13 +3309,14 @@ extension BestBlock: Equatable, Hashable { } } + public struct FfiConverterTypeBestBlock: FfiConverterRustBuffer { public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> BestBlock { return try BestBlock( - blockHash: FfiConverterTypeBlockHash.read(from: &buf), + blockHash: FfiConverterTypeBlockHash.read(from: &buf), height: FfiConverterUInt32.read(from: &buf) - ) + ) } public static func write(_ value: BestBlock, into buf: inout [UInt8]) { @@ -3010,6 +3325,7 @@ public struct FfiConverterTypeBestBlock: FfiConverterRustBuffer { } } + public func FfiConverterTypeBestBlock_lift(_ buf: RustBuffer) throws -> BestBlock { return try FfiConverterTypeBestBlock.lift(buf) } @@ -3018,6 +3334,7 @@ public func FfiConverterTypeBestBlock_lower(_ value: BestBlock) -> RustBuffer { return FfiConverterTypeBestBlock.lower(value) } + public struct Bolt11PaymentInfo { public var state: PaymentState public var expiresAt: DateTime @@ -3036,16 +3353,18 @@ public struct Bolt11PaymentInfo { } } + + public struct FfiConverterTypeBolt11PaymentInfo: FfiConverterRustBuffer { public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> Bolt11PaymentInfo { return try Bolt11PaymentInfo( - state: FfiConverterTypePaymentState.read(from: &buf), - expiresAt: FfiConverterTypeDateTime.read(from: &buf), - feeTotalSat: FfiConverterUInt64.read(from: &buf), - orderTotalSat: FfiConverterUInt64.read(from: &buf), + state: FfiConverterTypePaymentState.read(from: &buf), + expiresAt: FfiConverterTypeDateTime.read(from: &buf), + feeTotalSat: FfiConverterUInt64.read(from: &buf), + orderTotalSat: FfiConverterUInt64.read(from: &buf), invoice: FfiConverterTypeBolt11Invoice.read(from: &buf) - ) + ) } public static func write(_ value: Bolt11PaymentInfo, into buf: inout [UInt8]) { @@ -3057,6 +3376,7 @@ public struct FfiConverterTypeBolt11PaymentInfo: FfiConverterRustBuffer { } } + public func FfiConverterTypeBolt11PaymentInfo_lift(_ buf: RustBuffer) throws -> Bolt11PaymentInfo { return try FfiConverterTypeBolt11PaymentInfo.lift(buf) } @@ -3065,6 +3385,7 @@ public func FfiConverterTypeBolt11PaymentInfo_lower(_ value: Bolt11PaymentInfo) return FfiConverterTypeBolt11PaymentInfo.lower(value) } + public struct ChannelConfig { public var forwardingFeeProportionalMillionths: UInt32 public var forwardingFeeBaseMsat: UInt32 @@ -3085,8 +3406,10 @@ public struct ChannelConfig { } } + + extension ChannelConfig: Equatable, Hashable { - public static func == (lhs: ChannelConfig, rhs: ChannelConfig) -> Bool { + public static func ==(lhs: ChannelConfig, rhs: ChannelConfig) -> Bool { if lhs.forwardingFeeProportionalMillionths != rhs.forwardingFeeProportionalMillionths { return false } @@ -3118,17 +3441,18 @@ extension ChannelConfig: Equatable, Hashable { } } + public struct FfiConverterTypeChannelConfig: FfiConverterRustBuffer { public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> ChannelConfig { return try ChannelConfig( - forwardingFeeProportionalMillionths: FfiConverterUInt32.read(from: &buf), - forwardingFeeBaseMsat: FfiConverterUInt32.read(from: &buf), - cltvExpiryDelta: FfiConverterUInt16.read(from: &buf), - maxDustHtlcExposure: FfiConverterTypeMaxDustHTLCExposure.read(from: &buf), - forceCloseAvoidanceMaxFeeSatoshis: FfiConverterUInt64.read(from: &buf), + forwardingFeeProportionalMillionths: FfiConverterUInt32.read(from: &buf), + forwardingFeeBaseMsat: FfiConverterUInt32.read(from: &buf), + cltvExpiryDelta: FfiConverterUInt16.read(from: &buf), + maxDustHtlcExposure: FfiConverterTypeMaxDustHTLCExposure.read(from: &buf), + forceCloseAvoidanceMaxFeeSatoshis: FfiConverterUInt64.read(from: &buf), acceptUnderpayingHtlcs: FfiConverterBool.read(from: &buf) - ) + ) } public static func write(_ value: ChannelConfig, into buf: inout [UInt8]) { @@ -3141,6 +3465,7 @@ public struct FfiConverterTypeChannelConfig: FfiConverterRustBuffer { } } + public func FfiConverterTypeChannelConfig_lift(_ buf: RustBuffer) throws -> ChannelConfig { return try FfiConverterTypeChannelConfig.lift(buf) } @@ -3149,6 +3474,7 @@ public func FfiConverterTypeChannelConfig_lower(_ value: ChannelConfig) -> RustB return FfiConverterTypeChannelConfig.lower(value) } + public struct ChannelDetails { public var channelId: ChannelId public var counterpartyNodeId: PublicKey @@ -3219,8 +3545,10 @@ public struct ChannelDetails { } } + + extension ChannelDetails: Equatable, Hashable { - public static func == (lhs: ChannelDetails, rhs: ChannelDetails) -> Bool { + public static func ==(lhs: ChannelDetails, rhs: ChannelDetails) -> Bool { if lhs.channelId != rhs.channelId { return false } @@ -3352,42 +3680,43 @@ extension ChannelDetails: Equatable, Hashable { } } + public struct FfiConverterTypeChannelDetails: FfiConverterRustBuffer { public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> ChannelDetails { return try ChannelDetails( - channelId: FfiConverterTypeChannelId.read(from: &buf), - counterpartyNodeId: FfiConverterTypePublicKey.read(from: &buf), - fundingTxo: FfiConverterOptionTypeOutPoint.read(from: &buf), - shortChannelId: FfiConverterOptionUInt64.read(from: &buf), - outboundScidAlias: FfiConverterOptionUInt64.read(from: &buf), - inboundScidAlias: FfiConverterOptionUInt64.read(from: &buf), - channelValueSats: FfiConverterUInt64.read(from: &buf), - unspendablePunishmentReserve: FfiConverterOptionUInt64.read(from: &buf), - userChannelId: FfiConverterTypeUserChannelId.read(from: &buf), - feerateSatPer1000Weight: FfiConverterUInt32.read(from: &buf), - outboundCapacityMsat: FfiConverterUInt64.read(from: &buf), - inboundCapacityMsat: FfiConverterUInt64.read(from: &buf), - confirmationsRequired: FfiConverterOptionUInt32.read(from: &buf), - confirmations: FfiConverterOptionUInt32.read(from: &buf), - isOutbound: FfiConverterBool.read(from: &buf), - isChannelReady: FfiConverterBool.read(from: &buf), - isUsable: FfiConverterBool.read(from: &buf), - isAnnounced: FfiConverterBool.read(from: &buf), - cltvExpiryDelta: FfiConverterOptionUInt16.read(from: &buf), - counterpartyUnspendablePunishmentReserve: FfiConverterUInt64.read(from: &buf), - counterpartyOutboundHtlcMinimumMsat: FfiConverterOptionUInt64.read(from: &buf), - counterpartyOutboundHtlcMaximumMsat: FfiConverterOptionUInt64.read(from: &buf), - counterpartyForwardingInfoFeeBaseMsat: FfiConverterOptionUInt32.read(from: &buf), - counterpartyForwardingInfoFeeProportionalMillionths: FfiConverterOptionUInt32.read(from: &buf), - counterpartyForwardingInfoCltvExpiryDelta: FfiConverterOptionUInt16.read(from: &buf), - nextOutboundHtlcLimitMsat: FfiConverterUInt64.read(from: &buf), - nextOutboundHtlcMinimumMsat: FfiConverterUInt64.read(from: &buf), - forceCloseSpendDelay: FfiConverterOptionUInt16.read(from: &buf), - inboundHtlcMinimumMsat: FfiConverterUInt64.read(from: &buf), - inboundHtlcMaximumMsat: FfiConverterOptionUInt64.read(from: &buf), + channelId: FfiConverterTypeChannelId.read(from: &buf), + counterpartyNodeId: FfiConverterTypePublicKey.read(from: &buf), + fundingTxo: FfiConverterOptionTypeOutPoint.read(from: &buf), + shortChannelId: FfiConverterOptionUInt64.read(from: &buf), + outboundScidAlias: FfiConverterOptionUInt64.read(from: &buf), + inboundScidAlias: FfiConverterOptionUInt64.read(from: &buf), + channelValueSats: FfiConverterUInt64.read(from: &buf), + unspendablePunishmentReserve: FfiConverterOptionUInt64.read(from: &buf), + userChannelId: FfiConverterTypeUserChannelId.read(from: &buf), + feerateSatPer1000Weight: FfiConverterUInt32.read(from: &buf), + outboundCapacityMsat: FfiConverterUInt64.read(from: &buf), + inboundCapacityMsat: FfiConverterUInt64.read(from: &buf), + confirmationsRequired: FfiConverterOptionUInt32.read(from: &buf), + confirmations: FfiConverterOptionUInt32.read(from: &buf), + isOutbound: FfiConverterBool.read(from: &buf), + isChannelReady: FfiConverterBool.read(from: &buf), + isUsable: FfiConverterBool.read(from: &buf), + isAnnounced: FfiConverterBool.read(from: &buf), + cltvExpiryDelta: FfiConverterOptionUInt16.read(from: &buf), + counterpartyUnspendablePunishmentReserve: FfiConverterUInt64.read(from: &buf), + counterpartyOutboundHtlcMinimumMsat: FfiConverterOptionUInt64.read(from: &buf), + counterpartyOutboundHtlcMaximumMsat: FfiConverterOptionUInt64.read(from: &buf), + counterpartyForwardingInfoFeeBaseMsat: FfiConverterOptionUInt32.read(from: &buf), + counterpartyForwardingInfoFeeProportionalMillionths: FfiConverterOptionUInt32.read(from: &buf), + counterpartyForwardingInfoCltvExpiryDelta: FfiConverterOptionUInt16.read(from: &buf), + nextOutboundHtlcLimitMsat: FfiConverterUInt64.read(from: &buf), + nextOutboundHtlcMinimumMsat: FfiConverterUInt64.read(from: &buf), + forceCloseSpendDelay: FfiConverterOptionUInt16.read(from: &buf), + inboundHtlcMinimumMsat: FfiConverterUInt64.read(from: &buf), + inboundHtlcMaximumMsat: FfiConverterOptionUInt64.read(from: &buf), config: FfiConverterTypeChannelConfig.read(from: &buf) - ) + ) } public static func write(_ value: ChannelDetails, into buf: inout [UInt8]) { @@ -3425,6 +3754,7 @@ public struct FfiConverterTypeChannelDetails: FfiConverterRustBuffer { } } + public func FfiConverterTypeChannelDetails_lift(_ buf: RustBuffer) throws -> ChannelDetails { return try FfiConverterTypeChannelDetails.lift(buf) } @@ -3433,6 +3763,7 @@ public func FfiConverterTypeChannelDetails_lower(_ value: ChannelDetails) -> Rus return FfiConverterTypeChannelDetails.lower(value) } + public struct ChannelInfo { public var nodeOne: NodeId public var oneToTwo: ChannelUpdateInfo? @@ -3451,8 +3782,10 @@ public struct ChannelInfo { } } + + extension ChannelInfo: Equatable, Hashable { - public static func == (lhs: ChannelInfo, rhs: ChannelInfo) -> Bool { + public static func ==(lhs: ChannelInfo, rhs: ChannelInfo) -> Bool { if lhs.nodeOne != rhs.nodeOne { return false } @@ -3480,16 +3813,17 @@ extension ChannelInfo: Equatable, Hashable { } } + public struct FfiConverterTypeChannelInfo: FfiConverterRustBuffer { public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> ChannelInfo { return try ChannelInfo( - nodeOne: FfiConverterTypeNodeId.read(from: &buf), - oneToTwo: FfiConverterOptionTypeChannelUpdateInfo.read(from: &buf), - nodeTwo: FfiConverterTypeNodeId.read(from: &buf), - twoToOne: FfiConverterOptionTypeChannelUpdateInfo.read(from: &buf), + nodeOne: FfiConverterTypeNodeId.read(from: &buf), + oneToTwo: FfiConverterOptionTypeChannelUpdateInfo.read(from: &buf), + nodeTwo: FfiConverterTypeNodeId.read(from: &buf), + twoToOne: FfiConverterOptionTypeChannelUpdateInfo.read(from: &buf), capacitySats: FfiConverterOptionUInt64.read(from: &buf) - ) + ) } public static func write(_ value: ChannelInfo, into buf: inout [UInt8]) { @@ -3501,6 +3835,7 @@ public struct FfiConverterTypeChannelInfo: FfiConverterRustBuffer { } } + public func FfiConverterTypeChannelInfo_lift(_ buf: RustBuffer) throws -> ChannelInfo { return try FfiConverterTypeChannelInfo.lift(buf) } @@ -3509,6 +3844,7 @@ public func FfiConverterTypeChannelInfo_lower(_ value: ChannelInfo) -> RustBuffe return FfiConverterTypeChannelInfo.lower(value) } + public struct ChannelOrderInfo { public var fundedAt: DateTime public var fundingOutpoint: OutPoint @@ -3523,8 +3859,10 @@ public struct ChannelOrderInfo { } } + + extension ChannelOrderInfo: Equatable, Hashable { - public static func == (lhs: ChannelOrderInfo, rhs: ChannelOrderInfo) -> Bool { + public static func ==(lhs: ChannelOrderInfo, rhs: ChannelOrderInfo) -> Bool { if lhs.fundedAt != rhs.fundedAt { return false } @@ -3544,14 +3882,15 @@ extension ChannelOrderInfo: Equatable, Hashable { } } + public struct FfiConverterTypeChannelOrderInfo: FfiConverterRustBuffer { public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> ChannelOrderInfo { return try ChannelOrderInfo( - fundedAt: FfiConverterTypeDateTime.read(from: &buf), - fundingOutpoint: FfiConverterTypeOutPoint.read(from: &buf), + fundedAt: FfiConverterTypeDateTime.read(from: &buf), + fundingOutpoint: FfiConverterTypeOutPoint.read(from: &buf), expiresAt: FfiConverterTypeDateTime.read(from: &buf) - ) + ) } public static func write(_ value: ChannelOrderInfo, into buf: inout [UInt8]) { @@ -3561,6 +3900,7 @@ public struct FfiConverterTypeChannelOrderInfo: FfiConverterRustBuffer { } } + public func FfiConverterTypeChannelOrderInfo_lift(_ buf: RustBuffer) throws -> ChannelOrderInfo { return try FfiConverterTypeChannelOrderInfo.lift(buf) } @@ -3569,6 +3909,7 @@ public func FfiConverterTypeChannelOrderInfo_lower(_ value: ChannelOrderInfo) -> return FfiConverterTypeChannelOrderInfo.lower(value) } + public struct ChannelUpdateInfo { public var lastUpdate: UInt32 public var enabled: Bool @@ -3589,8 +3930,10 @@ public struct ChannelUpdateInfo { } } + + extension ChannelUpdateInfo: Equatable, Hashable { - public static func == (lhs: ChannelUpdateInfo, rhs: ChannelUpdateInfo) -> Bool { + public static func ==(lhs: ChannelUpdateInfo, rhs: ChannelUpdateInfo) -> Bool { if lhs.lastUpdate != rhs.lastUpdate { return false } @@ -3622,17 +3965,18 @@ extension ChannelUpdateInfo: Equatable, Hashable { } } + public struct FfiConverterTypeChannelUpdateInfo: FfiConverterRustBuffer { public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> ChannelUpdateInfo { return try ChannelUpdateInfo( - lastUpdate: FfiConverterUInt32.read(from: &buf), - enabled: FfiConverterBool.read(from: &buf), - cltvExpiryDelta: FfiConverterUInt16.read(from: &buf), - htlcMinimumMsat: FfiConverterUInt64.read(from: &buf), - htlcMaximumMsat: FfiConverterUInt64.read(from: &buf), + lastUpdate: FfiConverterUInt32.read(from: &buf), + enabled: FfiConverterBool.read(from: &buf), + cltvExpiryDelta: FfiConverterUInt16.read(from: &buf), + htlcMinimumMsat: FfiConverterUInt64.read(from: &buf), + htlcMaximumMsat: FfiConverterUInt64.read(from: &buf), fees: FfiConverterTypeRoutingFees.read(from: &buf) - ) + ) } public static func write(_ value: ChannelUpdateInfo, into buf: inout [UInt8]) { @@ -3645,6 +3989,7 @@ public struct FfiConverterTypeChannelUpdateInfo: FfiConverterRustBuffer { } } + public func FfiConverterTypeChannelUpdateInfo_lift(_ buf: RustBuffer) throws -> ChannelUpdateInfo { return try FfiConverterTypeChannelUpdateInfo.lift(buf) } @@ -3653,6 +3998,7 @@ public func FfiConverterTypeChannelUpdateInfo_lower(_ value: ChannelUpdateInfo) return FfiConverterTypeChannelUpdateInfo.lower(value) } + public struct Config { public var storageDirPath: String public var network: Network @@ -3679,8 +4025,10 @@ public struct Config { } } + + extension Config: Equatable, Hashable { - public static func == (lhs: Config, rhs: Config) -> Bool { + public static func ==(lhs: Config, rhs: Config) -> Bool { if lhs.storageDirPath != rhs.storageDirPath { return false } @@ -3724,20 +4072,21 @@ extension Config: Equatable, Hashable { } } + public struct FfiConverterTypeConfig: FfiConverterRustBuffer { public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> Config { return try Config( - storageDirPath: FfiConverterString.read(from: &buf), - network: FfiConverterTypeNetwork.read(from: &buf), - listeningAddresses: FfiConverterOptionSequenceTypeSocketAddress.read(from: &buf), - announcementAddresses: FfiConverterOptionSequenceTypeSocketAddress.read(from: &buf), - nodeAlias: FfiConverterOptionTypeNodeAlias.read(from: &buf), - trustedPeers0conf: FfiConverterSequenceTypePublicKey.read(from: &buf), - probingLiquidityLimitMultiplier: FfiConverterUInt64.read(from: &buf), - anchorChannelsConfig: FfiConverterOptionTypeAnchorChannelsConfig.read(from: &buf), + storageDirPath: FfiConverterString.read(from: &buf), + network: FfiConverterTypeNetwork.read(from: &buf), + listeningAddresses: FfiConverterOptionSequenceTypeSocketAddress.read(from: &buf), + announcementAddresses: FfiConverterOptionSequenceTypeSocketAddress.read(from: &buf), + nodeAlias: FfiConverterOptionTypeNodeAlias.read(from: &buf), + trustedPeers0conf: FfiConverterSequenceTypePublicKey.read(from: &buf), + probingLiquidityLimitMultiplier: FfiConverterUInt64.read(from: &buf), + anchorChannelsConfig: FfiConverterOptionTypeAnchorChannelsConfig.read(from: &buf), sendingParameters: FfiConverterOptionTypeSendingParameters.read(from: &buf) - ) + ) } public static func write(_ value: Config, into buf: inout [UInt8]) { @@ -3753,6 +4102,7 @@ public struct FfiConverterTypeConfig: FfiConverterRustBuffer { } } + public func FfiConverterTypeConfig_lift(_ buf: RustBuffer) throws -> Config { return try FfiConverterTypeConfig.lift(buf) } @@ -3761,6 +4111,7 @@ public func FfiConverterTypeConfig_lower(_ value: Config) -> RustBuffer { return FfiConverterTypeConfig.lower(value) } + public struct CustomTlvRecord { public var typeNum: UInt64 public var value: [UInt8] @@ -3773,8 +4124,10 @@ public struct CustomTlvRecord { } } + + extension CustomTlvRecord: Equatable, Hashable { - public static func == (lhs: CustomTlvRecord, rhs: CustomTlvRecord) -> Bool { + public static func ==(lhs: CustomTlvRecord, rhs: CustomTlvRecord) -> Bool { if lhs.typeNum != rhs.typeNum { return false } @@ -3790,13 +4143,14 @@ extension CustomTlvRecord: Equatable, Hashable { } } + public struct FfiConverterTypeCustomTlvRecord: FfiConverterRustBuffer { public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> CustomTlvRecord { return try CustomTlvRecord( - typeNum: FfiConverterUInt64.read(from: &buf), + typeNum: FfiConverterUInt64.read(from: &buf), value: FfiConverterSequenceUInt8.read(from: &buf) - ) + ) } public static func write(_ value: CustomTlvRecord, into buf: inout [UInt8]) { @@ -3805,6 +4159,7 @@ public struct FfiConverterTypeCustomTlvRecord: FfiConverterRustBuffer { } } + public func FfiConverterTypeCustomTlvRecord_lift(_ buf: RustBuffer) throws -> CustomTlvRecord { return try FfiConverterTypeCustomTlvRecord.lift(buf) } @@ -3813,6 +4168,7 @@ public func FfiConverterTypeCustomTlvRecord_lower(_ value: CustomTlvRecord) -> R return FfiConverterTypeCustomTlvRecord.lower(value) } + public struct ElectrumSyncConfig { public var backgroundSyncConfig: BackgroundSyncConfig? @@ -3823,8 +4179,10 @@ public struct ElectrumSyncConfig { } } + + extension ElectrumSyncConfig: Equatable, Hashable { - public static func == (lhs: ElectrumSyncConfig, rhs: ElectrumSyncConfig) -> Bool { + public static func ==(lhs: ElectrumSyncConfig, rhs: ElectrumSyncConfig) -> Bool { if lhs.backgroundSyncConfig != rhs.backgroundSyncConfig { return false } @@ -3836,12 +4194,13 @@ extension ElectrumSyncConfig: Equatable, Hashable { } } + public struct FfiConverterTypeElectrumSyncConfig: FfiConverterRustBuffer { public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> ElectrumSyncConfig { return try ElectrumSyncConfig( backgroundSyncConfig: FfiConverterOptionTypeBackgroundSyncConfig.read(from: &buf) - ) + ) } public static func write(_ value: ElectrumSyncConfig, into buf: inout [UInt8]) { @@ -3849,6 +4208,7 @@ public struct FfiConverterTypeElectrumSyncConfig: FfiConverterRustBuffer { } } + public func FfiConverterTypeElectrumSyncConfig_lift(_ buf: RustBuffer) throws -> ElectrumSyncConfig { return try FfiConverterTypeElectrumSyncConfig.lift(buf) } @@ -3857,6 +4217,7 @@ public func FfiConverterTypeElectrumSyncConfig_lower(_ value: ElectrumSyncConfig return FfiConverterTypeElectrumSyncConfig.lower(value) } + public struct EsploraSyncConfig { public var backgroundSyncConfig: BackgroundSyncConfig? @@ -3867,8 +4228,10 @@ public struct EsploraSyncConfig { } } + + extension EsploraSyncConfig: Equatable, Hashable { - public static func == (lhs: EsploraSyncConfig, rhs: EsploraSyncConfig) -> Bool { + public static func ==(lhs: EsploraSyncConfig, rhs: EsploraSyncConfig) -> Bool { if lhs.backgroundSyncConfig != rhs.backgroundSyncConfig { return false } @@ -3880,12 +4243,13 @@ extension EsploraSyncConfig: Equatable, Hashable { } } + public struct FfiConverterTypeEsploraSyncConfig: FfiConverterRustBuffer { public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> EsploraSyncConfig { return try EsploraSyncConfig( backgroundSyncConfig: FfiConverterOptionTypeBackgroundSyncConfig.read(from: &buf) - ) + ) } public static func write(_ value: EsploraSyncConfig, into buf: inout [UInt8]) { @@ -3893,6 +4257,7 @@ public struct FfiConverterTypeEsploraSyncConfig: FfiConverterRustBuffer { } } + public func FfiConverterTypeEsploraSyncConfig_lift(_ buf: RustBuffer) throws -> EsploraSyncConfig { return try FfiConverterTypeEsploraSyncConfig.lift(buf) } @@ -3901,6 +4266,7 @@ public func FfiConverterTypeEsploraSyncConfig_lower(_ value: EsploraSyncConfig) return FfiConverterTypeEsploraSyncConfig.lower(value) } + public struct LspFeeLimits { public var maxTotalOpeningFeeMsat: UInt64? public var maxProportionalOpeningFeePpmMsat: UInt64? @@ -3913,8 +4279,10 @@ public struct LspFeeLimits { } } + + extension LspFeeLimits: Equatable, Hashable { - public static func == (lhs: LspFeeLimits, rhs: LspFeeLimits) -> Bool { + public static func ==(lhs: LspFeeLimits, rhs: LspFeeLimits) -> Bool { if lhs.maxTotalOpeningFeeMsat != rhs.maxTotalOpeningFeeMsat { return false } @@ -3930,13 +4298,14 @@ extension LspFeeLimits: Equatable, Hashable { } } + public struct FfiConverterTypeLSPFeeLimits: FfiConverterRustBuffer { public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> LspFeeLimits { return try LspFeeLimits( - maxTotalOpeningFeeMsat: FfiConverterOptionUInt64.read(from: &buf), + maxTotalOpeningFeeMsat: FfiConverterOptionUInt64.read(from: &buf), maxProportionalOpeningFeePpmMsat: FfiConverterOptionUInt64.read(from: &buf) - ) + ) } public static func write(_ value: LspFeeLimits, into buf: inout [UInt8]) { @@ -3945,6 +4314,7 @@ public struct FfiConverterTypeLSPFeeLimits: FfiConverterRustBuffer { } } + public func FfiConverterTypeLSPFeeLimits_lift(_ buf: RustBuffer) throws -> LspFeeLimits { return try FfiConverterTypeLSPFeeLimits.lift(buf) } @@ -3953,6 +4323,7 @@ public func FfiConverterTypeLSPFeeLimits_lower(_ value: LspFeeLimits) -> RustBuf return FfiConverterTypeLSPFeeLimits.lower(value) } + public struct Lsps1OrderStatus { public var orderId: OrderId public var orderParams: OrderParameters @@ -3969,15 +4340,17 @@ public struct Lsps1OrderStatus { } } + + public struct FfiConverterTypeLSPS1OrderStatus: FfiConverterRustBuffer { public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> Lsps1OrderStatus { return try Lsps1OrderStatus( - orderId: FfiConverterTypeOrderId.read(from: &buf), - orderParams: FfiConverterTypeOrderParameters.read(from: &buf), - paymentOptions: FfiConverterTypePaymentInfo.read(from: &buf), + orderId: FfiConverterTypeOrderId.read(from: &buf), + orderParams: FfiConverterTypeOrderParameters.read(from: &buf), + paymentOptions: FfiConverterTypePaymentInfo.read(from: &buf), channelState: FfiConverterOptionTypeChannelOrderInfo.read(from: &buf) - ) + ) } public static func write(_ value: Lsps1OrderStatus, into buf: inout [UInt8]) { @@ -3988,6 +4361,7 @@ public struct FfiConverterTypeLSPS1OrderStatus: FfiConverterRustBuffer { } } + public func FfiConverterTypeLSPS1OrderStatus_lift(_ buf: RustBuffer) throws -> Lsps1OrderStatus { return try FfiConverterTypeLSPS1OrderStatus.lift(buf) } @@ -3996,6 +4370,7 @@ public func FfiConverterTypeLSPS1OrderStatus_lower(_ value: Lsps1OrderStatus) -> return FfiConverterTypeLSPS1OrderStatus.lower(value) } + public struct Lsps2ServiceConfig { public var requireToken: String? public var advertiseService: Bool @@ -4022,8 +4397,10 @@ public struct Lsps2ServiceConfig { } } + + extension Lsps2ServiceConfig: Equatable, Hashable { - public static func == (lhs: Lsps2ServiceConfig, rhs: Lsps2ServiceConfig) -> Bool { + public static func ==(lhs: Lsps2ServiceConfig, rhs: Lsps2ServiceConfig) -> Bool { if lhs.requireToken != rhs.requireToken { return false } @@ -4067,20 +4444,21 @@ extension Lsps2ServiceConfig: Equatable, Hashable { } } + public struct FfiConverterTypeLSPS2ServiceConfig: FfiConverterRustBuffer { public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> Lsps2ServiceConfig { return try Lsps2ServiceConfig( - requireToken: FfiConverterOptionString.read(from: &buf), - advertiseService: FfiConverterBool.read(from: &buf), - channelOpeningFeePpm: FfiConverterUInt32.read(from: &buf), - channelOverProvisioningPpm: FfiConverterUInt32.read(from: &buf), - minChannelOpeningFeeMsat: FfiConverterUInt64.read(from: &buf), - minChannelLifetime: FfiConverterUInt32.read(from: &buf), - maxClientToSelfDelay: FfiConverterUInt32.read(from: &buf), - minPaymentSizeMsat: FfiConverterUInt64.read(from: &buf), + requireToken: FfiConverterOptionString.read(from: &buf), + advertiseService: FfiConverterBool.read(from: &buf), + channelOpeningFeePpm: FfiConverterUInt32.read(from: &buf), + channelOverProvisioningPpm: FfiConverterUInt32.read(from: &buf), + minChannelOpeningFeeMsat: FfiConverterUInt64.read(from: &buf), + minChannelLifetime: FfiConverterUInt32.read(from: &buf), + maxClientToSelfDelay: FfiConverterUInt32.read(from: &buf), + minPaymentSizeMsat: FfiConverterUInt64.read(from: &buf), maxPaymentSizeMsat: FfiConverterUInt64.read(from: &buf) - ) + ) } public static func write(_ value: Lsps2ServiceConfig, into buf: inout [UInt8]) { @@ -4096,6 +4474,7 @@ public struct FfiConverterTypeLSPS2ServiceConfig: FfiConverterRustBuffer { } } + public func FfiConverterTypeLSPS2ServiceConfig_lift(_ buf: RustBuffer) throws -> Lsps2ServiceConfig { return try FfiConverterTypeLSPS2ServiceConfig.lift(buf) } @@ -4104,6 +4483,7 @@ public func FfiConverterTypeLSPS2ServiceConfig_lower(_ value: Lsps2ServiceConfig return FfiConverterTypeLSPS2ServiceConfig.lower(value) } + public struct LogRecord { public var level: LogLevel public var args: String @@ -4120,8 +4500,10 @@ public struct LogRecord { } } + + extension LogRecord: Equatable, Hashable { - public static func == (lhs: LogRecord, rhs: LogRecord) -> Bool { + public static func ==(lhs: LogRecord, rhs: LogRecord) -> Bool { if lhs.level != rhs.level { return false } @@ -4145,15 +4527,16 @@ extension LogRecord: Equatable, Hashable { } } + public struct FfiConverterTypeLogRecord: FfiConverterRustBuffer { public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> LogRecord { return try LogRecord( - level: FfiConverterTypeLogLevel.read(from: &buf), - args: FfiConverterString.read(from: &buf), - modulePath: FfiConverterString.read(from: &buf), + level: FfiConverterTypeLogLevel.read(from: &buf), + args: FfiConverterString.read(from: &buf), + modulePath: FfiConverterString.read(from: &buf), line: FfiConverterUInt32.read(from: &buf) - ) + ) } public static func write(_ value: LogRecord, into buf: inout [UInt8]) { @@ -4164,6 +4547,7 @@ public struct FfiConverterTypeLogRecord: FfiConverterRustBuffer { } } + public func FfiConverterTypeLogRecord_lift(_ buf: RustBuffer) throws -> LogRecord { return try FfiConverterTypeLogRecord.lift(buf) } @@ -4172,6 +4556,7 @@ public func FfiConverterTypeLogRecord_lower(_ value: LogRecord) -> RustBuffer { return FfiConverterTypeLogRecord.lower(value) } + public struct NodeAnnouncementInfo { public var lastUpdate: UInt32 public var alias: String @@ -4186,8 +4571,10 @@ public struct NodeAnnouncementInfo { } } + + extension NodeAnnouncementInfo: Equatable, Hashable { - public static func == (lhs: NodeAnnouncementInfo, rhs: NodeAnnouncementInfo) -> Bool { + public static func ==(lhs: NodeAnnouncementInfo, rhs: NodeAnnouncementInfo) -> Bool { if lhs.lastUpdate != rhs.lastUpdate { return false } @@ -4207,14 +4594,15 @@ extension NodeAnnouncementInfo: Equatable, Hashable { } } + public struct FfiConverterTypeNodeAnnouncementInfo: FfiConverterRustBuffer { public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> NodeAnnouncementInfo { return try NodeAnnouncementInfo( - lastUpdate: FfiConverterUInt32.read(from: &buf), - alias: FfiConverterString.read(from: &buf), + lastUpdate: FfiConverterUInt32.read(from: &buf), + alias: FfiConverterString.read(from: &buf), addresses: FfiConverterSequenceTypeSocketAddress.read(from: &buf) - ) + ) } public static func write(_ value: NodeAnnouncementInfo, into buf: inout [UInt8]) { @@ -4224,6 +4612,7 @@ public struct FfiConverterTypeNodeAnnouncementInfo: FfiConverterRustBuffer { } } + public func FfiConverterTypeNodeAnnouncementInfo_lift(_ buf: RustBuffer) throws -> NodeAnnouncementInfo { return try FfiConverterTypeNodeAnnouncementInfo.lift(buf) } @@ -4232,6 +4621,7 @@ public func FfiConverterTypeNodeAnnouncementInfo_lower(_ value: NodeAnnouncement return FfiConverterTypeNodeAnnouncementInfo.lower(value) } + public struct NodeInfo { public var channels: [UInt64] public var announcementInfo: NodeAnnouncementInfo? @@ -4244,8 +4634,10 @@ public struct NodeInfo { } } + + extension NodeInfo: Equatable, Hashable { - public static func == (lhs: NodeInfo, rhs: NodeInfo) -> Bool { + public static func ==(lhs: NodeInfo, rhs: NodeInfo) -> Bool { if lhs.channels != rhs.channels { return false } @@ -4261,13 +4653,14 @@ extension NodeInfo: Equatable, Hashable { } } + public struct FfiConverterTypeNodeInfo: FfiConverterRustBuffer { public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> NodeInfo { return try NodeInfo( - channels: FfiConverterSequenceUInt64.read(from: &buf), + channels: FfiConverterSequenceUInt64.read(from: &buf), announcementInfo: FfiConverterOptionTypeNodeAnnouncementInfo.read(from: &buf) - ) + ) } public static func write(_ value: NodeInfo, into buf: inout [UInt8]) { @@ -4276,6 +4669,7 @@ public struct FfiConverterTypeNodeInfo: FfiConverterRustBuffer { } } + public func FfiConverterTypeNodeInfo_lift(_ buf: RustBuffer) throws -> NodeInfo { return try FfiConverterTypeNodeInfo.lift(buf) } @@ -4284,6 +4678,7 @@ public func FfiConverterTypeNodeInfo_lower(_ value: NodeInfo) -> RustBuffer { return FfiConverterTypeNodeInfo.lower(value) } + public struct NodeStatus { public var isRunning: Bool public var isListening: Bool @@ -4310,8 +4705,10 @@ public struct NodeStatus { } } + + extension NodeStatus: Equatable, Hashable { - public static func == (lhs: NodeStatus, rhs: NodeStatus) -> Bool { + public static func ==(lhs: NodeStatus, rhs: NodeStatus) -> Bool { if lhs.isRunning != rhs.isRunning { return false } @@ -4355,20 +4752,21 @@ extension NodeStatus: Equatable, Hashable { } } + public struct FfiConverterTypeNodeStatus: FfiConverterRustBuffer { public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> NodeStatus { return try NodeStatus( - isRunning: FfiConverterBool.read(from: &buf), - isListening: FfiConverterBool.read(from: &buf), - currentBestBlock: FfiConverterTypeBestBlock.read(from: &buf), - latestLightningWalletSyncTimestamp: FfiConverterOptionUInt64.read(from: &buf), - latestOnchainWalletSyncTimestamp: FfiConverterOptionUInt64.read(from: &buf), - latestFeeRateCacheUpdateTimestamp: FfiConverterOptionUInt64.read(from: &buf), - latestRgsSnapshotTimestamp: FfiConverterOptionUInt64.read(from: &buf), - latestNodeAnnouncementBroadcastTimestamp: FfiConverterOptionUInt64.read(from: &buf), + isRunning: FfiConverterBool.read(from: &buf), + isListening: FfiConverterBool.read(from: &buf), + currentBestBlock: FfiConverterTypeBestBlock.read(from: &buf), + latestLightningWalletSyncTimestamp: FfiConverterOptionUInt64.read(from: &buf), + latestOnchainWalletSyncTimestamp: FfiConverterOptionUInt64.read(from: &buf), + latestFeeRateCacheUpdateTimestamp: FfiConverterOptionUInt64.read(from: &buf), + latestRgsSnapshotTimestamp: FfiConverterOptionUInt64.read(from: &buf), + latestNodeAnnouncementBroadcastTimestamp: FfiConverterOptionUInt64.read(from: &buf), latestChannelMonitorArchivalHeight: FfiConverterOptionUInt32.read(from: &buf) - ) + ) } public static func write(_ value: NodeStatus, into buf: inout [UInt8]) { @@ -4384,6 +4782,7 @@ public struct FfiConverterTypeNodeStatus: FfiConverterRustBuffer { } } + public func FfiConverterTypeNodeStatus_lift(_ buf: RustBuffer) throws -> NodeStatus { return try FfiConverterTypeNodeStatus.lift(buf) } @@ -4392,6 +4791,7 @@ public func FfiConverterTypeNodeStatus_lower(_ value: NodeStatus) -> RustBuffer return FfiConverterTypeNodeStatus.lower(value) } + public struct OnchainPaymentInfo { public var state: PaymentState public var expiresAt: DateTime @@ -4416,19 +4816,21 @@ public struct OnchainPaymentInfo { } } + + public struct FfiConverterTypeOnchainPaymentInfo: FfiConverterRustBuffer { public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> OnchainPaymentInfo { return try OnchainPaymentInfo( - state: FfiConverterTypePaymentState.read(from: &buf), - expiresAt: FfiConverterTypeDateTime.read(from: &buf), - feeTotalSat: FfiConverterUInt64.read(from: &buf), - orderTotalSat: FfiConverterUInt64.read(from: &buf), - address: FfiConverterTypeAddress.read(from: &buf), - minOnchainPaymentConfirmations: FfiConverterOptionUInt16.read(from: &buf), - minFeeFor0conf: FfiConverterTypeFeeRate.read(from: &buf), + state: FfiConverterTypePaymentState.read(from: &buf), + expiresAt: FfiConverterTypeDateTime.read(from: &buf), + feeTotalSat: FfiConverterUInt64.read(from: &buf), + orderTotalSat: FfiConverterUInt64.read(from: &buf), + address: FfiConverterTypeAddress.read(from: &buf), + minOnchainPaymentConfirmations: FfiConverterOptionUInt16.read(from: &buf), + minFeeFor0conf: FfiConverterTypeFeeRate.read(from: &buf), refundOnchainAddress: FfiConverterOptionTypeAddress.read(from: &buf) - ) + ) } public static func write(_ value: OnchainPaymentInfo, into buf: inout [UInt8]) { @@ -4443,6 +4845,7 @@ public struct FfiConverterTypeOnchainPaymentInfo: FfiConverterRustBuffer { } } + public func FfiConverterTypeOnchainPaymentInfo_lift(_ buf: RustBuffer) throws -> OnchainPaymentInfo { return try FfiConverterTypeOnchainPaymentInfo.lift(buf) } @@ -4451,6 +4854,7 @@ public func FfiConverterTypeOnchainPaymentInfo_lower(_ value: OnchainPaymentInfo return FfiConverterTypeOnchainPaymentInfo.lower(value) } + public struct OrderParameters { public var lspBalanceSat: UInt64 public var clientBalanceSat: UInt64 @@ -4473,8 +4877,10 @@ public struct OrderParameters { } } + + extension OrderParameters: Equatable, Hashable { - public static func == (lhs: OrderParameters, rhs: OrderParameters) -> Bool { + public static func ==(lhs: OrderParameters, rhs: OrderParameters) -> Bool { if lhs.lspBalanceSat != rhs.lspBalanceSat { return false } @@ -4510,18 +4916,19 @@ extension OrderParameters: Equatable, Hashable { } } + public struct FfiConverterTypeOrderParameters: FfiConverterRustBuffer { public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> OrderParameters { return try OrderParameters( - lspBalanceSat: FfiConverterUInt64.read(from: &buf), - clientBalanceSat: FfiConverterUInt64.read(from: &buf), - requiredChannelConfirmations: FfiConverterUInt16.read(from: &buf), - fundingConfirmsWithinBlocks: FfiConverterUInt16.read(from: &buf), - channelExpiryBlocks: FfiConverterUInt32.read(from: &buf), - token: FfiConverterOptionString.read(from: &buf), + lspBalanceSat: FfiConverterUInt64.read(from: &buf), + clientBalanceSat: FfiConverterUInt64.read(from: &buf), + requiredChannelConfirmations: FfiConverterUInt16.read(from: &buf), + fundingConfirmsWithinBlocks: FfiConverterUInt16.read(from: &buf), + channelExpiryBlocks: FfiConverterUInt32.read(from: &buf), + token: FfiConverterOptionString.read(from: &buf), announceChannel: FfiConverterBool.read(from: &buf) - ) + ) } public static func write(_ value: OrderParameters, into buf: inout [UInt8]) { @@ -4535,6 +4942,7 @@ public struct FfiConverterTypeOrderParameters: FfiConverterRustBuffer { } } + public func FfiConverterTypeOrderParameters_lift(_ buf: RustBuffer) throws -> OrderParameters { return try FfiConverterTypeOrderParameters.lift(buf) } @@ -4543,6 +4951,7 @@ public func FfiConverterTypeOrderParameters_lower(_ value: OrderParameters) -> R return FfiConverterTypeOrderParameters.lower(value) } + public struct OutPoint { public var txid: Txid public var vout: UInt32 @@ -4555,8 +4964,10 @@ public struct OutPoint { } } + + extension OutPoint: Equatable, Hashable { - public static func == (lhs: OutPoint, rhs: OutPoint) -> Bool { + public static func ==(lhs: OutPoint, rhs: OutPoint) -> Bool { if lhs.txid != rhs.txid { return false } @@ -4572,13 +4983,14 @@ extension OutPoint: Equatable, Hashable { } } + public struct FfiConverterTypeOutPoint: FfiConverterRustBuffer { public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> OutPoint { return try OutPoint( - txid: FfiConverterTypeTxid.read(from: &buf), + txid: FfiConverterTypeTxid.read(from: &buf), vout: FfiConverterUInt32.read(from: &buf) - ) + ) } public static func write(_ value: OutPoint, into buf: inout [UInt8]) { @@ -4587,6 +4999,7 @@ public struct FfiConverterTypeOutPoint: FfiConverterRustBuffer { } } + public func FfiConverterTypeOutPoint_lift(_ buf: RustBuffer) throws -> OutPoint { return try FfiConverterTypeOutPoint.lift(buf) } @@ -4595,6 +5008,7 @@ public func FfiConverterTypeOutPoint_lower(_ value: OutPoint) -> RustBuffer { return FfiConverterTypeOutPoint.lower(value) } + public struct PaymentDetails { public var id: PaymentId public var kind: PaymentKind @@ -4617,8 +5031,10 @@ public struct PaymentDetails { } } + + extension PaymentDetails: Equatable, Hashable { - public static func == (lhs: PaymentDetails, rhs: PaymentDetails) -> Bool { + public static func ==(lhs: PaymentDetails, rhs: PaymentDetails) -> Bool { if lhs.id != rhs.id { return false } @@ -4654,18 +5070,19 @@ extension PaymentDetails: Equatable, Hashable { } } + public struct FfiConverterTypePaymentDetails: FfiConverterRustBuffer { public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> PaymentDetails { return try PaymentDetails( - id: FfiConverterTypePaymentId.read(from: &buf), - kind: FfiConverterTypePaymentKind.read(from: &buf), - amountMsat: FfiConverterOptionUInt64.read(from: &buf), - feePaidMsat: FfiConverterOptionUInt64.read(from: &buf), - direction: FfiConverterTypePaymentDirection.read(from: &buf), - status: FfiConverterTypePaymentStatus.read(from: &buf), + id: FfiConverterTypePaymentId.read(from: &buf), + kind: FfiConverterTypePaymentKind.read(from: &buf), + amountMsat: FfiConverterOptionUInt64.read(from: &buf), + feePaidMsat: FfiConverterOptionUInt64.read(from: &buf), + direction: FfiConverterTypePaymentDirection.read(from: &buf), + status: FfiConverterTypePaymentStatus.read(from: &buf), latestUpdateTimestamp: FfiConverterUInt64.read(from: &buf) - ) + ) } public static func write(_ value: PaymentDetails, into buf: inout [UInt8]) { @@ -4679,6 +5096,7 @@ public struct FfiConverterTypePaymentDetails: FfiConverterRustBuffer { } } + public func FfiConverterTypePaymentDetails_lift(_ buf: RustBuffer) throws -> PaymentDetails { return try FfiConverterTypePaymentDetails.lift(buf) } @@ -4687,6 +5105,7 @@ public func FfiConverterTypePaymentDetails_lower(_ value: PaymentDetails) -> Rus return FfiConverterTypePaymentDetails.lower(value) } + public struct PaymentInfo { public var bolt11: Bolt11PaymentInfo? public var onchain: OnchainPaymentInfo? @@ -4699,13 +5118,15 @@ public struct PaymentInfo { } } + + public struct FfiConverterTypePaymentInfo: FfiConverterRustBuffer { public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> PaymentInfo { return try PaymentInfo( - bolt11: FfiConverterOptionTypeBolt11PaymentInfo.read(from: &buf), + bolt11: FfiConverterOptionTypeBolt11PaymentInfo.read(from: &buf), onchain: FfiConverterOptionTypeOnchainPaymentInfo.read(from: &buf) - ) + ) } public static func write(_ value: PaymentInfo, into buf: inout [UInt8]) { @@ -4714,6 +5135,7 @@ public struct FfiConverterTypePaymentInfo: FfiConverterRustBuffer { } } + public func FfiConverterTypePaymentInfo_lift(_ buf: RustBuffer) throws -> PaymentInfo { return try FfiConverterTypePaymentInfo.lift(buf) } @@ -4722,6 +5144,7 @@ public func FfiConverterTypePaymentInfo_lower(_ value: PaymentInfo) -> RustBuffe return FfiConverterTypePaymentInfo.lower(value) } + public struct PeerDetails { public var nodeId: PublicKey public var address: SocketAddress @@ -4738,8 +5161,10 @@ public struct PeerDetails { } } + + extension PeerDetails: Equatable, Hashable { - public static func == (lhs: PeerDetails, rhs: PeerDetails) -> Bool { + public static func ==(lhs: PeerDetails, rhs: PeerDetails) -> Bool { if lhs.nodeId != rhs.nodeId { return false } @@ -4763,15 +5188,16 @@ extension PeerDetails: Equatable, Hashable { } } + public struct FfiConverterTypePeerDetails: FfiConverterRustBuffer { public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> PeerDetails { return try PeerDetails( - nodeId: FfiConverterTypePublicKey.read(from: &buf), - address: FfiConverterTypeSocketAddress.read(from: &buf), - isPersisted: FfiConverterBool.read(from: &buf), + nodeId: FfiConverterTypePublicKey.read(from: &buf), + address: FfiConverterTypeSocketAddress.read(from: &buf), + isPersisted: FfiConverterBool.read(from: &buf), isConnected: FfiConverterBool.read(from: &buf) - ) + ) } public static func write(_ value: PeerDetails, into buf: inout [UInt8]) { @@ -4782,6 +5208,7 @@ public struct FfiConverterTypePeerDetails: FfiConverterRustBuffer { } } + public func FfiConverterTypePeerDetails_lift(_ buf: RustBuffer) throws -> PeerDetails { return try FfiConverterTypePeerDetails.lift(buf) } @@ -4790,6 +5217,7 @@ public func FfiConverterTypePeerDetails_lower(_ value: PeerDetails) -> RustBuffe return FfiConverterTypePeerDetails.lower(value) } + public struct RouteHintHop { public var srcNodeId: PublicKey public var shortChannelId: UInt64 @@ -4810,8 +5238,10 @@ public struct RouteHintHop { } } + + extension RouteHintHop: Equatable, Hashable { - public static func == (lhs: RouteHintHop, rhs: RouteHintHop) -> Bool { + public static func ==(lhs: RouteHintHop, rhs: RouteHintHop) -> Bool { if lhs.srcNodeId != rhs.srcNodeId { return false } @@ -4843,17 +5273,18 @@ extension RouteHintHop: Equatable, Hashable { } } + public struct FfiConverterTypeRouteHintHop: FfiConverterRustBuffer { public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> RouteHintHop { return try RouteHintHop( - srcNodeId: FfiConverterTypePublicKey.read(from: &buf), - shortChannelId: FfiConverterUInt64.read(from: &buf), - cltvExpiryDelta: FfiConverterUInt16.read(from: &buf), - htlcMinimumMsat: FfiConverterOptionUInt64.read(from: &buf), - htlcMaximumMsat: FfiConverterOptionUInt64.read(from: &buf), + srcNodeId: FfiConverterTypePublicKey.read(from: &buf), + shortChannelId: FfiConverterUInt64.read(from: &buf), + cltvExpiryDelta: FfiConverterUInt16.read(from: &buf), + htlcMinimumMsat: FfiConverterOptionUInt64.read(from: &buf), + htlcMaximumMsat: FfiConverterOptionUInt64.read(from: &buf), fees: FfiConverterTypeRoutingFees.read(from: &buf) - ) + ) } public static func write(_ value: RouteHintHop, into buf: inout [UInt8]) { @@ -4866,6 +5297,7 @@ public struct FfiConverterTypeRouteHintHop: FfiConverterRustBuffer { } } + public func FfiConverterTypeRouteHintHop_lift(_ buf: RustBuffer) throws -> RouteHintHop { return try FfiConverterTypeRouteHintHop.lift(buf) } @@ -4874,6 +5306,7 @@ public func FfiConverterTypeRouteHintHop_lower(_ value: RouteHintHop) -> RustBuf return FfiConverterTypeRouteHintHop.lower(value) } + public struct RoutingFees { public var baseMsat: UInt32 public var proportionalMillionths: UInt32 @@ -4886,8 +5319,10 @@ public struct RoutingFees { } } + + extension RoutingFees: Equatable, Hashable { - public static func == (lhs: RoutingFees, rhs: RoutingFees) -> Bool { + public static func ==(lhs: RoutingFees, rhs: RoutingFees) -> Bool { if lhs.baseMsat != rhs.baseMsat { return false } @@ -4903,13 +5338,14 @@ extension RoutingFees: Equatable, Hashable { } } + public struct FfiConverterTypeRoutingFees: FfiConverterRustBuffer { public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> RoutingFees { return try RoutingFees( - baseMsat: FfiConverterUInt32.read(from: &buf), + baseMsat: FfiConverterUInt32.read(from: &buf), proportionalMillionths: FfiConverterUInt32.read(from: &buf) - ) + ) } public static func write(_ value: RoutingFees, into buf: inout [UInt8]) { @@ -4918,6 +5354,7 @@ public struct FfiConverterTypeRoutingFees: FfiConverterRustBuffer { } } + public func FfiConverterTypeRoutingFees_lift(_ buf: RustBuffer) throws -> RoutingFees { return try FfiConverterTypeRoutingFees.lift(buf) } @@ -4926,6 +5363,7 @@ public func FfiConverterTypeRoutingFees_lower(_ value: RoutingFees) -> RustBuffe return FfiConverterTypeRoutingFees.lower(value) } + public struct SendingParameters { public var maxTotalRoutingFeeMsat: MaxTotalRoutingFeeLimit? public var maxTotalCltvExpiryDelta: UInt32? @@ -4942,8 +5380,10 @@ public struct SendingParameters { } } + + extension SendingParameters: Equatable, Hashable { - public static func == (lhs: SendingParameters, rhs: SendingParameters) -> Bool { + public static func ==(lhs: SendingParameters, rhs: SendingParameters) -> Bool { if lhs.maxTotalRoutingFeeMsat != rhs.maxTotalRoutingFeeMsat { return false } @@ -4967,15 +5407,16 @@ extension SendingParameters: Equatable, Hashable { } } + public struct FfiConverterTypeSendingParameters: FfiConverterRustBuffer { public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SendingParameters { return try SendingParameters( - maxTotalRoutingFeeMsat: FfiConverterOptionTypeMaxTotalRoutingFeeLimit.read(from: &buf), - maxTotalCltvExpiryDelta: FfiConverterOptionUInt32.read(from: &buf), - maxPathCount: FfiConverterOptionUInt8.read(from: &buf), + maxTotalRoutingFeeMsat: FfiConverterOptionTypeMaxTotalRoutingFeeLimit.read(from: &buf), + maxTotalCltvExpiryDelta: FfiConverterOptionUInt32.read(from: &buf), + maxPathCount: FfiConverterOptionUInt8.read(from: &buf), maxChannelSaturationPowerOfHalf: FfiConverterOptionUInt8.read(from: &buf) - ) + ) } public static func write(_ value: SendingParameters, into buf: inout [UInt8]) { @@ -4986,6 +5427,7 @@ public struct FfiConverterTypeSendingParameters: FfiConverterRustBuffer { } } + public func FfiConverterTypeSendingParameters_lift(_ buf: RustBuffer) throws -> SendingParameters { return try FfiConverterTypeSendingParameters.lift(buf) } @@ -4994,6 +5436,7 @@ public func FfiConverterTypeSendingParameters_lower(_ value: SendingParameters) return FfiConverterTypeSendingParameters.lower(value) } + public struct SpendableUtxo { public var outpoint: OutPoint public var valueSats: UInt64 @@ -5006,8 +5449,10 @@ public struct SpendableUtxo { } } + + extension SpendableUtxo: Equatable, Hashable { - public static func == (lhs: SpendableUtxo, rhs: SpendableUtxo) -> Bool { + public static func ==(lhs: SpendableUtxo, rhs: SpendableUtxo) -> Bool { if lhs.outpoint != rhs.outpoint { return false } @@ -5023,13 +5468,14 @@ extension SpendableUtxo: Equatable, Hashable { } } + public struct FfiConverterTypeSpendableUtxo: FfiConverterRustBuffer { public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SpendableUtxo { return try SpendableUtxo( - outpoint: FfiConverterTypeOutPoint.read(from: &buf), + outpoint: FfiConverterTypeOutPoint.read(from: &buf), valueSats: FfiConverterUInt64.read(from: &buf) - ) + ) } public static func write(_ value: SpendableUtxo, into buf: inout [UInt8]) { @@ -5038,6 +5484,7 @@ public struct FfiConverterTypeSpendableUtxo: FfiConverterRustBuffer { } } + public func FfiConverterTypeSpendableUtxo_lift(_ buf: RustBuffer) throws -> SpendableUtxo { return try FfiConverterTypeSpendableUtxo.lift(buf) } @@ -5050,47 +5497,57 @@ public func FfiConverterTypeSpendableUtxo_lower(_ value: SpendableUtxo) -> RustB // See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion. public enum BalanceSource { + case holderForceClosed case counterpartyForceClosed case coopClose case htlc } + public struct FfiConverterTypeBalanceSource: FfiConverterRustBuffer { typealias SwiftType = BalanceSource public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> BalanceSource { let variant: Int32 = try readInt(&buf) switch variant { + case 1: return .holderForceClosed - + case 2: return .counterpartyForceClosed - + case 3: return .coopClose - + case 4: return .htlc - + default: throw UniffiInternalError.unexpectedEnumCase } } public static func write(_ value: BalanceSource, into buf: inout [UInt8]) { switch value { + + case .holderForceClosed: writeInt(&buf, Int32(1)) - + + case .counterpartyForceClosed: writeInt(&buf, Int32(2)) - + + case .coopClose: writeInt(&buf, Int32(3)) - + + case .htlc: writeInt(&buf, Int32(4)) + } } } + public func FfiConverterTypeBalanceSource_lift(_ buf: RustBuffer) throws -> BalanceSource { return try FfiConverterTypeBalanceSource.lift(buf) } @@ -5099,47 +5556,59 @@ public func FfiConverterTypeBalanceSource_lower(_ value: BalanceSource) -> RustB return FfiConverterTypeBalanceSource.lower(value) } + + extension BalanceSource: Equatable, Hashable {} + + // Note that we don't yet support `indirect` for enums. // See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion. public enum Bolt11InvoiceDescription { + case hash(hash: String ) case direct(description: String ) } + public struct FfiConverterTypeBolt11InvoiceDescription: FfiConverterRustBuffer { typealias SwiftType = Bolt11InvoiceDescription public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> Bolt11InvoiceDescription { let variant: Int32 = try readInt(&buf) switch variant { - case 1: return try .hash(hash: FfiConverterString.read(from: &buf) - ) - - case 2: return try .direct(description: FfiConverterString.read(from: &buf) - ) - + + case 1: return .hash(hash: try FfiConverterString.read(from: &buf) + ) + + case 2: return .direct(description: try FfiConverterString.read(from: &buf) + ) + default: throw UniffiInternalError.unexpectedEnumCase } } public static func write(_ value: Bolt11InvoiceDescription, into buf: inout [UInt8]) { switch value { + + case let .hash(hash): writeInt(&buf, Int32(1)) FfiConverterString.write(hash, into: &buf) - + + case let .direct(description): writeInt(&buf, Int32(2)) FfiConverterString.write(description, into: &buf) + } } } + public func FfiConverterTypeBolt11InvoiceDescription_lift(_ buf: RustBuffer) throws -> Bolt11InvoiceDescription { return try FfiConverterTypeBolt11InvoiceDescription.lift(buf) } @@ -5148,99 +5617,114 @@ public func FfiConverterTypeBolt11InvoiceDescription_lower(_ value: Bolt11Invoic return FfiConverterTypeBolt11InvoiceDescription.lower(value) } + + extension Bolt11InvoiceDescription: Equatable, Hashable {} + + + public enum BuildError { - case InvalidSeedBytes(message: String) + + + case InvalidSeedBytes(message: String) + case InvalidSeedFile(message: String) - + case InvalidSystemTime(message: String) - + case InvalidChannelMonitor(message: String) - + case InvalidListeningAddresses(message: String) - + case InvalidAnnouncementAddresses(message: String) - + case InvalidNodeAlias(message: String) - + case ReadFailed(message: String) - + case WriteFailed(message: String) - + case StoragePathAccessFailed(message: String) - + case KvStoreSetupFailed(message: String) - + case WalletSetupFailed(message: String) - + case LoggerSetupFailed(message: String) - + case NetworkMismatch(message: String) + } + public struct FfiConverterTypeBuildError: FfiConverterRustBuffer { typealias SwiftType = BuildError public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> BuildError { let variant: Int32 = try readInt(&buf) switch variant { - case 1: return try .InvalidSeedBytes( - message: FfiConverterString.read(from: &buf) - ) - - case 2: return try .InvalidSeedFile( - message: FfiConverterString.read(from: &buf) - ) - - case 3: return try .InvalidSystemTime( - message: FfiConverterString.read(from: &buf) - ) - - case 4: return try .InvalidChannelMonitor( - message: FfiConverterString.read(from: &buf) - ) - - case 5: return try .InvalidListeningAddresses( - message: FfiConverterString.read(from: &buf) - ) - - case 6: return try .InvalidAnnouncementAddresses( - message: FfiConverterString.read(from: &buf) - ) - - case 7: return try .InvalidNodeAlias( - message: FfiConverterString.read(from: &buf) - ) - - case 8: return try .ReadFailed( - message: FfiConverterString.read(from: &buf) - ) - - case 9: return try .WriteFailed( - message: FfiConverterString.read(from: &buf) - ) - - case 10: return try .StoragePathAccessFailed( - message: FfiConverterString.read(from: &buf) - ) - - case 11: return try .KvStoreSetupFailed( - message: FfiConverterString.read(from: &buf) - ) - - case 12: return try .WalletSetupFailed( - message: FfiConverterString.read(from: &buf) - ) - case 13: return try .LoggerSetupFailed( - message: FfiConverterString.read(from: &buf) - ) + - case 14: return try .NetworkMismatch( - message: FfiConverterString.read(from: &buf) - ) + + case 1: return .InvalidSeedBytes( + message: try FfiConverterString.read(from: &buf) + ) + + case 2: return .InvalidSeedFile( + message: try FfiConverterString.read(from: &buf) + ) + + case 3: return .InvalidSystemTime( + message: try FfiConverterString.read(from: &buf) + ) + + case 4: return .InvalidChannelMonitor( + message: try FfiConverterString.read(from: &buf) + ) + + case 5: return .InvalidListeningAddresses( + message: try FfiConverterString.read(from: &buf) + ) + + case 6: return .InvalidAnnouncementAddresses( + message: try FfiConverterString.read(from: &buf) + ) + + case 7: return .InvalidNodeAlias( + message: try FfiConverterString.read(from: &buf) + ) + + case 8: return .ReadFailed( + message: try FfiConverterString.read(from: &buf) + ) + + case 9: return .WriteFailed( + message: try FfiConverterString.read(from: &buf) + ) + + case 10: return .StoragePathAccessFailed( + message: try FfiConverterString.read(from: &buf) + ) + + case 11: return .KvStoreSetupFailed( + message: try FfiConverterString.read(from: &buf) + ) + + case 12: return .WalletSetupFailed( + message: try FfiConverterString.read(from: &buf) + ) + + case 13: return .LoggerSetupFailed( + message: try FfiConverterString.read(from: &buf) + ) + + case 14: return .NetworkMismatch( + message: try FfiConverterString.read(from: &buf) + ) + default: throw UniffiInternalError.unexpectedEnumCase } @@ -5248,46 +5732,54 @@ public struct FfiConverterTypeBuildError: FfiConverterRustBuffer { public static func write(_ value: BuildError, into buf: inout [UInt8]) { switch value { - case .InvalidSeedBytes(_ /* message is ignored*/ ): + + + + + case .InvalidSeedBytes(_ /* message is ignored*/): writeInt(&buf, Int32(1)) - case .InvalidSeedFile(_ /* message is ignored*/ ): + case .InvalidSeedFile(_ /* message is ignored*/): writeInt(&buf, Int32(2)) - case .InvalidSystemTime(_ /* message is ignored*/ ): + case .InvalidSystemTime(_ /* message is ignored*/): writeInt(&buf, Int32(3)) - case .InvalidChannelMonitor(_ /* message is ignored*/ ): + case .InvalidChannelMonitor(_ /* message is ignored*/): writeInt(&buf, Int32(4)) - case .InvalidListeningAddresses(_ /* message is ignored*/ ): + case .InvalidListeningAddresses(_ /* message is ignored*/): writeInt(&buf, Int32(5)) - case .InvalidAnnouncementAddresses(_ /* message is ignored*/ ): + case .InvalidAnnouncementAddresses(_ /* message is ignored*/): writeInt(&buf, Int32(6)) - case .InvalidNodeAlias(_ /* message is ignored*/ ): + case .InvalidNodeAlias(_ /* message is ignored*/): writeInt(&buf, Int32(7)) - case .ReadFailed(_ /* message is ignored*/ ): + case .ReadFailed(_ /* message is ignored*/): writeInt(&buf, Int32(8)) - case .WriteFailed(_ /* message is ignored*/ ): + case .WriteFailed(_ /* message is ignored*/): writeInt(&buf, Int32(9)) - case .StoragePathAccessFailed(_ /* message is ignored*/ ): + case .StoragePathAccessFailed(_ /* message is ignored*/): writeInt(&buf, Int32(10)) - case .KvStoreSetupFailed(_ /* message is ignored*/ ): + case .KvStoreSetupFailed(_ /* message is ignored*/): writeInt(&buf, Int32(11)) - case .WalletSetupFailed(_ /* message is ignored*/ ): + case .WalletSetupFailed(_ /* message is ignored*/): writeInt(&buf, Int32(12)) - case .LoggerSetupFailed(_ /* message is ignored*/ ): + case .LoggerSetupFailed(_ /* message is ignored*/): writeInt(&buf, Int32(13)) - case .NetworkMismatch(_ /* message is ignored*/ ): + case .NetworkMismatch(_ /* message is ignored*/): writeInt(&buf, Int32(14)) + + } } } + extension BuildError: Equatable, Hashable {} -extension BuildError: Error {} +extension BuildError: Error { } // Note that we don't yet support `indirect` for enums. // See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion. public enum ClosureReason { + case counterpartyForceClosed(peerMsg: UntrustedString ) case holderForceClosed(broadcastedLatestTxn: Bool? @@ -5304,102 +5796,123 @@ public enum ClosureReason { case counterpartyCoopClosedUnfundedChannel case fundingBatchClosure case htlCsTimedOut - case peerFeerateTooLow(peerFeerateSatPerKw: UInt32, requiredFeerateSatPerKw: UInt32) + case peerFeerateTooLow(peerFeerateSatPerKw: UInt32, requiredFeerateSatPerKw: UInt32 + ) } + public struct FfiConverterTypeClosureReason: FfiConverterRustBuffer { typealias SwiftType = ClosureReason public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> ClosureReason { let variant: Int32 = try readInt(&buf) switch variant { - case 1: return try .counterpartyForceClosed(peerMsg: FfiConverterTypeUntrustedString.read(from: &buf) - ) - - case 2: return try .holderForceClosed(broadcastedLatestTxn: FfiConverterOptionBool.read(from: &buf) - ) - + + case 1: return .counterpartyForceClosed(peerMsg: try FfiConverterTypeUntrustedString.read(from: &buf) + ) + + case 2: return .holderForceClosed(broadcastedLatestTxn: try FfiConverterOptionBool.read(from: &buf) + ) + case 3: return .legacyCooperativeClosure - + case 4: return .counterpartyInitiatedCooperativeClosure - + case 5: return .locallyInitiatedCooperativeClosure - + case 6: return .commitmentTxConfirmed - + case 7: return .fundingTimedOut - - case 8: return try .processingError(err: FfiConverterString.read(from: &buf) - ) - + + case 8: return .processingError(err: try FfiConverterString.read(from: &buf) + ) + case 9: return .disconnectedPeer - + case 10: return .outdatedChannelManager - + case 11: return .counterpartyCoopClosedUnfundedChannel - + case 12: return .fundingBatchClosure - + case 13: return .htlCsTimedOut - - case 14: return try .peerFeerateTooLow(peerFeerateSatPerKw: FfiConverterUInt32.read(from: &buf), requiredFeerateSatPerKw: FfiConverterUInt32.read(from: &buf)) - + + case 14: return .peerFeerateTooLow(peerFeerateSatPerKw: try FfiConverterUInt32.read(from: &buf), requiredFeerateSatPerKw: try FfiConverterUInt32.read(from: &buf) + ) + default: throw UniffiInternalError.unexpectedEnumCase } } public static func write(_ value: ClosureReason, into buf: inout [UInt8]) { switch value { + + case let .counterpartyForceClosed(peerMsg): writeInt(&buf, Int32(1)) FfiConverterTypeUntrustedString.write(peerMsg, into: &buf) - + + case let .holderForceClosed(broadcastedLatestTxn): writeInt(&buf, Int32(2)) FfiConverterOptionBool.write(broadcastedLatestTxn, into: &buf) - + + case .legacyCooperativeClosure: writeInt(&buf, Int32(3)) - + + case .counterpartyInitiatedCooperativeClosure: writeInt(&buf, Int32(4)) - + + case .locallyInitiatedCooperativeClosure: writeInt(&buf, Int32(5)) - + + case .commitmentTxConfirmed: writeInt(&buf, Int32(6)) - + + case .fundingTimedOut: writeInt(&buf, Int32(7)) - + + case let .processingError(err): writeInt(&buf, Int32(8)) FfiConverterString.write(err, into: &buf) - + + case .disconnectedPeer: writeInt(&buf, Int32(9)) - + + case .outdatedChannelManager: writeInt(&buf, Int32(10)) - + + case .counterpartyCoopClosedUnfundedChannel: writeInt(&buf, Int32(11)) - + + case .fundingBatchClosure: writeInt(&buf, Int32(12)) - + + case .htlCsTimedOut: writeInt(&buf, Int32(13)) - - case let .peerFeerateTooLow(peerFeerateSatPerKw, requiredFeerateSatPerKw): + + + case let .peerFeerateTooLow(peerFeerateSatPerKw,requiredFeerateSatPerKw): writeInt(&buf, Int32(14)) FfiConverterUInt32.write(peerFeerateSatPerKw, into: &buf) FfiConverterUInt32.write(requiredFeerateSatPerKw, into: &buf) + } } } + public func FfiConverterTypeClosureReason_lift(_ buf: RustBuffer) throws -> ClosureReason { return try FfiConverterTypeClosureReason.lift(buf) } @@ -5408,53 +5921,67 @@ public func FfiConverterTypeClosureReason_lower(_ value: ClosureReason) -> RustB return FfiConverterTypeClosureReason.lower(value) } + + extension ClosureReason: Equatable, Hashable {} + + // Note that we don't yet support `indirect` for enums. // See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion. public enum CoinSelectionAlgorithm { + case branchAndBound case largestFirst case oldestFirst case singleRandomDraw } + public struct FfiConverterTypeCoinSelectionAlgorithm: FfiConverterRustBuffer { typealias SwiftType = CoinSelectionAlgorithm public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> CoinSelectionAlgorithm { let variant: Int32 = try readInt(&buf) switch variant { + case 1: return .branchAndBound - + case 2: return .largestFirst - + case 3: return .oldestFirst - + case 4: return .singleRandomDraw - + default: throw UniffiInternalError.unexpectedEnumCase } } public static func write(_ value: CoinSelectionAlgorithm, into buf: inout [UInt8]) { switch value { + + case .branchAndBound: writeInt(&buf, Int32(1)) - + + case .largestFirst: writeInt(&buf, Int32(2)) - + + case .oldestFirst: writeInt(&buf, Int32(3)) - + + case .singleRandomDraw: writeInt(&buf, Int32(4)) + } } } + public func FfiConverterTypeCoinSelectionAlgorithm_lift(_ buf: RustBuffer) throws -> CoinSelectionAlgorithm { return try FfiConverterTypeCoinSelectionAlgorithm.lift(buf) } @@ -5463,44 +5990,58 @@ public func FfiConverterTypeCoinSelectionAlgorithm_lower(_ value: CoinSelectionA return FfiConverterTypeCoinSelectionAlgorithm.lower(value) } + + extension CoinSelectionAlgorithm: Equatable, Hashable {} + + // Note that we don't yet support `indirect` for enums. // See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion. public enum ConfirmationStatus { - case confirmed(blockHash: BlockHash, height: UInt32, timestamp: UInt64) + + case confirmed(blockHash: BlockHash, height: UInt32, timestamp: UInt64 + ) case unconfirmed } + public struct FfiConverterTypeConfirmationStatus: FfiConverterRustBuffer { typealias SwiftType = ConfirmationStatus public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> ConfirmationStatus { let variant: Int32 = try readInt(&buf) switch variant { - case 1: return try .confirmed(blockHash: FfiConverterTypeBlockHash.read(from: &buf), height: FfiConverterUInt32.read(from: &buf), timestamp: FfiConverterUInt64.read(from: &buf)) - + + case 1: return .confirmed(blockHash: try FfiConverterTypeBlockHash.read(from: &buf), height: try FfiConverterUInt32.read(from: &buf), timestamp: try FfiConverterUInt64.read(from: &buf) + ) + case 2: return .unconfirmed - + default: throw UniffiInternalError.unexpectedEnumCase } } public static func write(_ value: ConfirmationStatus, into buf: inout [UInt8]) { switch value { - case let .confirmed(blockHash, height, timestamp): + + + case let .confirmed(blockHash,height,timestamp): writeInt(&buf, Int32(1)) FfiConverterTypeBlockHash.write(blockHash, into: &buf) FfiConverterUInt32.write(height, into: &buf) FfiConverterUInt64.write(timestamp, into: &buf) - + + case .unconfirmed: writeInt(&buf, Int32(2)) + } } } + public func FfiConverterTypeConfirmationStatus_lift(_ buf: RustBuffer) throws -> ConfirmationStatus { return try FfiConverterTypeConfirmationStatus.lift(buf) } @@ -5509,12 +6050,17 @@ public func FfiConverterTypeConfirmationStatus_lower(_ value: ConfirmationStatus return FfiConverterTypeConfirmationStatus.lower(value) } + + extension ConfirmationStatus: Equatable, Hashable {} + + // Note that we don't yet support `indirect` for enums. // See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion. public enum Currency { + case bitcoin case bitcoinTestnet case regtest @@ -5522,46 +6068,56 @@ public enum Currency { case signet } + public struct FfiConverterTypeCurrency: FfiConverterRustBuffer { typealias SwiftType = Currency public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> Currency { let variant: Int32 = try readInt(&buf) switch variant { + case 1: return .bitcoin - + case 2: return .bitcoinTestnet - + case 3: return .regtest - + case 4: return .simnet - + case 5: return .signet - + default: throw UniffiInternalError.unexpectedEnumCase } } public static func write(_ value: Currency, into buf: inout [UInt8]) { switch value { + + case .bitcoin: writeInt(&buf, Int32(1)) - + + case .bitcoinTestnet: writeInt(&buf, Int32(2)) - + + case .regtest: writeInt(&buf, Int32(3)) - + + case .simnet: writeInt(&buf, Int32(4)) - + + case .signet: writeInt(&buf, Int32(5)) + } } } + public func FfiConverterTypeCurrency_lift(_ buf: RustBuffer) throws -> Currency { return try FfiConverterTypeCurrency.lift(buf) } @@ -5570,79 +6126,108 @@ public func FfiConverterTypeCurrency_lower(_ value: Currency) -> RustBuffer { return FfiConverterTypeCurrency.lower(value) } + + extension Currency: Equatable, Hashable {} + + // Note that we don't yet support `indirect` for enums. // See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion. public enum Event { - case paymentSuccessful(paymentId: PaymentId?, paymentHash: PaymentHash, paymentPreimage: PaymentPreimage?, feePaidMsat: UInt64?) - case paymentFailed(paymentId: PaymentId?, paymentHash: PaymentHash?, reason: PaymentFailureReason?) - case paymentReceived(paymentId: PaymentId?, paymentHash: PaymentHash, amountMsat: UInt64, customRecords: [CustomTlvRecord]) - case paymentClaimable(paymentId: PaymentId, paymentHash: PaymentHash, claimableAmountMsat: UInt64, claimDeadline: UInt32?, customRecords: [CustomTlvRecord]) - case paymentForwarded(prevChannelId: ChannelId, nextChannelId: ChannelId, prevUserChannelId: UserChannelId?, nextUserChannelId: UserChannelId?, prevNodeId: PublicKey?, nextNodeId: PublicKey?, totalFeeEarnedMsat: UInt64?, skimmedFeeMsat: UInt64?, claimFromOnchainTx: Bool, outboundAmountForwardedMsat: UInt64?) - case channelPending(channelId: ChannelId, userChannelId: UserChannelId, formerTemporaryChannelId: ChannelId, counterpartyNodeId: PublicKey, fundingTxo: OutPoint) - case channelReady(channelId: ChannelId, userChannelId: UserChannelId, counterpartyNodeId: PublicKey?) - case channelClosed(channelId: ChannelId, userChannelId: UserChannelId, counterpartyNodeId: PublicKey?, reason: ClosureReason?) + + case paymentSuccessful(paymentId: PaymentId?, paymentHash: PaymentHash, paymentPreimage: PaymentPreimage?, feePaidMsat: UInt64? + ) + case paymentFailed(paymentId: PaymentId?, paymentHash: PaymentHash?, reason: PaymentFailureReason? + ) + case paymentReceived(paymentId: PaymentId?, paymentHash: PaymentHash, amountMsat: UInt64, customRecords: [CustomTlvRecord] + ) + case paymentClaimable(paymentId: PaymentId, paymentHash: PaymentHash, claimableAmountMsat: UInt64, claimDeadline: UInt32?, customRecords: [CustomTlvRecord] + ) + case paymentForwarded(prevChannelId: ChannelId, nextChannelId: ChannelId, prevUserChannelId: UserChannelId?, nextUserChannelId: UserChannelId?, prevNodeId: PublicKey?, nextNodeId: PublicKey?, totalFeeEarnedMsat: UInt64?, skimmedFeeMsat: UInt64?, claimFromOnchainTx: Bool, outboundAmountForwardedMsat: UInt64? + ) + case channelPending(channelId: ChannelId, userChannelId: UserChannelId, formerTemporaryChannelId: ChannelId, counterpartyNodeId: PublicKey, fundingTxo: OutPoint + ) + case channelReady(channelId: ChannelId, userChannelId: UserChannelId, counterpartyNodeId: PublicKey? + ) + case channelClosed(channelId: ChannelId, userChannelId: UserChannelId, counterpartyNodeId: PublicKey?, reason: ClosureReason? + ) } + public struct FfiConverterTypeEvent: FfiConverterRustBuffer { typealias SwiftType = Event public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> Event { let variant: Int32 = try readInt(&buf) switch variant { - case 1: return try .paymentSuccessful(paymentId: FfiConverterOptionTypePaymentId.read(from: &buf), paymentHash: FfiConverterTypePaymentHash.read(from: &buf), paymentPreimage: FfiConverterOptionTypePaymentPreimage.read(from: &buf), feePaidMsat: FfiConverterOptionUInt64.read(from: &buf)) - - case 2: return try .paymentFailed(paymentId: FfiConverterOptionTypePaymentId.read(from: &buf), paymentHash: FfiConverterOptionTypePaymentHash.read(from: &buf), reason: FfiConverterOptionTypePaymentFailureReason.read(from: &buf)) - - case 3: return try .paymentReceived(paymentId: FfiConverterOptionTypePaymentId.read(from: &buf), paymentHash: FfiConverterTypePaymentHash.read(from: &buf), amountMsat: FfiConverterUInt64.read(from: &buf), customRecords: FfiConverterSequenceTypeCustomTlvRecord.read(from: &buf)) - - case 4: return try .paymentClaimable(paymentId: FfiConverterTypePaymentId.read(from: &buf), paymentHash: FfiConverterTypePaymentHash.read(from: &buf), claimableAmountMsat: FfiConverterUInt64.read(from: &buf), claimDeadline: FfiConverterOptionUInt32.read(from: &buf), customRecords: FfiConverterSequenceTypeCustomTlvRecord.read(from: &buf)) - - case 5: return try .paymentForwarded(prevChannelId: FfiConverterTypeChannelId.read(from: &buf), nextChannelId: FfiConverterTypeChannelId.read(from: &buf), prevUserChannelId: FfiConverterOptionTypeUserChannelId.read(from: &buf), nextUserChannelId: FfiConverterOptionTypeUserChannelId.read(from: &buf), prevNodeId: FfiConverterOptionTypePublicKey.read(from: &buf), nextNodeId: FfiConverterOptionTypePublicKey.read(from: &buf), totalFeeEarnedMsat: FfiConverterOptionUInt64.read(from: &buf), skimmedFeeMsat: FfiConverterOptionUInt64.read(from: &buf), claimFromOnchainTx: FfiConverterBool.read(from: &buf), outboundAmountForwardedMsat: FfiConverterOptionUInt64.read(from: &buf)) - - case 6: return try .channelPending(channelId: FfiConverterTypeChannelId.read(from: &buf), userChannelId: FfiConverterTypeUserChannelId.read(from: &buf), formerTemporaryChannelId: FfiConverterTypeChannelId.read(from: &buf), counterpartyNodeId: FfiConverterTypePublicKey.read(from: &buf), fundingTxo: FfiConverterTypeOutPoint.read(from: &buf)) - - case 7: return try .channelReady(channelId: FfiConverterTypeChannelId.read(from: &buf), userChannelId: FfiConverterTypeUserChannelId.read(from: &buf), counterpartyNodeId: FfiConverterOptionTypePublicKey.read(from: &buf)) - - case 8: return try .channelClosed(channelId: FfiConverterTypeChannelId.read(from: &buf), userChannelId: FfiConverterTypeUserChannelId.read(from: &buf), counterpartyNodeId: FfiConverterOptionTypePublicKey.read(from: &buf), reason: FfiConverterOptionTypeClosureReason.read(from: &buf)) - + + case 1: return .paymentSuccessful(paymentId: try FfiConverterOptionTypePaymentId.read(from: &buf), paymentHash: try FfiConverterTypePaymentHash.read(from: &buf), paymentPreimage: try FfiConverterOptionTypePaymentPreimage.read(from: &buf), feePaidMsat: try FfiConverterOptionUInt64.read(from: &buf) + ) + + case 2: return .paymentFailed(paymentId: try FfiConverterOptionTypePaymentId.read(from: &buf), paymentHash: try FfiConverterOptionTypePaymentHash.read(from: &buf), reason: try FfiConverterOptionTypePaymentFailureReason.read(from: &buf) + ) + + case 3: return .paymentReceived(paymentId: try FfiConverterOptionTypePaymentId.read(from: &buf), paymentHash: try FfiConverterTypePaymentHash.read(from: &buf), amountMsat: try FfiConverterUInt64.read(from: &buf), customRecords: try FfiConverterSequenceTypeCustomTlvRecord.read(from: &buf) + ) + + case 4: return .paymentClaimable(paymentId: try FfiConverterTypePaymentId.read(from: &buf), paymentHash: try FfiConverterTypePaymentHash.read(from: &buf), claimableAmountMsat: try FfiConverterUInt64.read(from: &buf), claimDeadline: try FfiConverterOptionUInt32.read(from: &buf), customRecords: try FfiConverterSequenceTypeCustomTlvRecord.read(from: &buf) + ) + + case 5: return .paymentForwarded(prevChannelId: try FfiConverterTypeChannelId.read(from: &buf), nextChannelId: try FfiConverterTypeChannelId.read(from: &buf), prevUserChannelId: try FfiConverterOptionTypeUserChannelId.read(from: &buf), nextUserChannelId: try FfiConverterOptionTypeUserChannelId.read(from: &buf), prevNodeId: try FfiConverterOptionTypePublicKey.read(from: &buf), nextNodeId: try FfiConverterOptionTypePublicKey.read(from: &buf), totalFeeEarnedMsat: try FfiConverterOptionUInt64.read(from: &buf), skimmedFeeMsat: try FfiConverterOptionUInt64.read(from: &buf), claimFromOnchainTx: try FfiConverterBool.read(from: &buf), outboundAmountForwardedMsat: try FfiConverterOptionUInt64.read(from: &buf) + ) + + case 6: return .channelPending(channelId: try FfiConverterTypeChannelId.read(from: &buf), userChannelId: try FfiConverterTypeUserChannelId.read(from: &buf), formerTemporaryChannelId: try FfiConverterTypeChannelId.read(from: &buf), counterpartyNodeId: try FfiConverterTypePublicKey.read(from: &buf), fundingTxo: try FfiConverterTypeOutPoint.read(from: &buf) + ) + + case 7: return .channelReady(channelId: try FfiConverterTypeChannelId.read(from: &buf), userChannelId: try FfiConverterTypeUserChannelId.read(from: &buf), counterpartyNodeId: try FfiConverterOptionTypePublicKey.read(from: &buf) + ) + + case 8: return .channelClosed(channelId: try FfiConverterTypeChannelId.read(from: &buf), userChannelId: try FfiConverterTypeUserChannelId.read(from: &buf), counterpartyNodeId: try FfiConverterOptionTypePublicKey.read(from: &buf), reason: try FfiConverterOptionTypeClosureReason.read(from: &buf) + ) + default: throw UniffiInternalError.unexpectedEnumCase } } public static func write(_ value: Event, into buf: inout [UInt8]) { switch value { - case let .paymentSuccessful(paymentId, paymentHash, paymentPreimage, feePaidMsat): + + + case let .paymentSuccessful(paymentId,paymentHash,paymentPreimage,feePaidMsat): writeInt(&buf, Int32(1)) FfiConverterOptionTypePaymentId.write(paymentId, into: &buf) FfiConverterTypePaymentHash.write(paymentHash, into: &buf) FfiConverterOptionTypePaymentPreimage.write(paymentPreimage, into: &buf) FfiConverterOptionUInt64.write(feePaidMsat, into: &buf) - - case let .paymentFailed(paymentId, paymentHash, reason): + + + case let .paymentFailed(paymentId,paymentHash,reason): writeInt(&buf, Int32(2)) FfiConverterOptionTypePaymentId.write(paymentId, into: &buf) FfiConverterOptionTypePaymentHash.write(paymentHash, into: &buf) FfiConverterOptionTypePaymentFailureReason.write(reason, into: &buf) - - case let .paymentReceived(paymentId, paymentHash, amountMsat, customRecords): + + + case let .paymentReceived(paymentId,paymentHash,amountMsat,customRecords): writeInt(&buf, Int32(3)) FfiConverterOptionTypePaymentId.write(paymentId, into: &buf) FfiConverterTypePaymentHash.write(paymentHash, into: &buf) FfiConverterUInt64.write(amountMsat, into: &buf) FfiConverterSequenceTypeCustomTlvRecord.write(customRecords, into: &buf) - - case let .paymentClaimable(paymentId, paymentHash, claimableAmountMsat, claimDeadline, customRecords): + + + case let .paymentClaimable(paymentId,paymentHash,claimableAmountMsat,claimDeadline,customRecords): writeInt(&buf, Int32(4)) FfiConverterTypePaymentId.write(paymentId, into: &buf) FfiConverterTypePaymentHash.write(paymentHash, into: &buf) FfiConverterUInt64.write(claimableAmountMsat, into: &buf) FfiConverterOptionUInt32.write(claimDeadline, into: &buf) FfiConverterSequenceTypeCustomTlvRecord.write(customRecords, into: &buf) - - case let .paymentForwarded(prevChannelId, nextChannelId, prevUserChannelId, nextUserChannelId, prevNodeId, nextNodeId, totalFeeEarnedMsat, skimmedFeeMsat, claimFromOnchainTx, outboundAmountForwardedMsat): + + + case let .paymentForwarded(prevChannelId,nextChannelId,prevUserChannelId,nextUserChannelId,prevNodeId,nextNodeId,totalFeeEarnedMsat,skimmedFeeMsat,claimFromOnchainTx,outboundAmountForwardedMsat): writeInt(&buf, Int32(5)) FfiConverterTypeChannelId.write(prevChannelId, into: &buf) FfiConverterTypeChannelId.write(nextChannelId, into: &buf) @@ -5654,31 +6239,36 @@ public struct FfiConverterTypeEvent: FfiConverterRustBuffer { FfiConverterOptionUInt64.write(skimmedFeeMsat, into: &buf) FfiConverterBool.write(claimFromOnchainTx, into: &buf) FfiConverterOptionUInt64.write(outboundAmountForwardedMsat, into: &buf) - - case let .channelPending(channelId, userChannelId, formerTemporaryChannelId, counterpartyNodeId, fundingTxo): + + + case let .channelPending(channelId,userChannelId,formerTemporaryChannelId,counterpartyNodeId,fundingTxo): writeInt(&buf, Int32(6)) FfiConverterTypeChannelId.write(channelId, into: &buf) FfiConverterTypeUserChannelId.write(userChannelId, into: &buf) FfiConverterTypeChannelId.write(formerTemporaryChannelId, into: &buf) FfiConverterTypePublicKey.write(counterpartyNodeId, into: &buf) FfiConverterTypeOutPoint.write(fundingTxo, into: &buf) - - case let .channelReady(channelId, userChannelId, counterpartyNodeId): + + + case let .channelReady(channelId,userChannelId,counterpartyNodeId): writeInt(&buf, Int32(7)) FfiConverterTypeChannelId.write(channelId, into: &buf) FfiConverterTypeUserChannelId.write(userChannelId, into: &buf) FfiConverterOptionTypePublicKey.write(counterpartyNodeId, into: &buf) - - case let .channelClosed(channelId, userChannelId, counterpartyNodeId, reason): + + + case let .channelClosed(channelId,userChannelId,counterpartyNodeId,reason): writeInt(&buf, Int32(8)) FfiConverterTypeChannelId.write(channelId, into: &buf) FfiConverterTypeUserChannelId.write(userChannelId, into: &buf) FfiConverterOptionTypePublicKey.write(counterpartyNodeId, into: &buf) FfiConverterOptionTypeClosureReason.write(reason, into: &buf) + } } } + public func FfiConverterTypeEvent_lift(_ buf: RustBuffer) throws -> Event { return try FfiConverterTypeEvent.lift(buf) } @@ -5687,45 +6277,66 @@ public func FfiConverterTypeEvent_lower(_ value: Event) -> RustBuffer { return FfiConverterTypeEvent.lower(value) } + + extension Event: Equatable, Hashable {} + + // Note that we don't yet support `indirect` for enums. // See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion. public enum LightningBalance { - case claimableOnChannelClose(channelId: ChannelId, counterpartyNodeId: PublicKey, amountSatoshis: UInt64, transactionFeeSatoshis: UInt64, outboundPaymentHtlcRoundedMsat: UInt64, outboundForwardedHtlcRoundedMsat: UInt64, inboundClaimingHtlcRoundedMsat: UInt64, inboundHtlcRoundedMsat: UInt64) - case claimableAwaitingConfirmations(channelId: ChannelId, counterpartyNodeId: PublicKey, amountSatoshis: UInt64, confirmationHeight: UInt32, source: BalanceSource) - case contentiousClaimable(channelId: ChannelId, counterpartyNodeId: PublicKey, amountSatoshis: UInt64, timeoutHeight: UInt32, paymentHash: PaymentHash, paymentPreimage: PaymentPreimage) - case maybeTimeoutClaimableHtlc(channelId: ChannelId, counterpartyNodeId: PublicKey, amountSatoshis: UInt64, claimableHeight: UInt32, paymentHash: PaymentHash, outboundPayment: Bool) - case maybePreimageClaimableHtlc(channelId: ChannelId, counterpartyNodeId: PublicKey, amountSatoshis: UInt64, expiryHeight: UInt32, paymentHash: PaymentHash) - case counterpartyRevokedOutputClaimable(channelId: ChannelId, counterpartyNodeId: PublicKey, amountSatoshis: UInt64) + + case claimableOnChannelClose(channelId: ChannelId, counterpartyNodeId: PublicKey, amountSatoshis: UInt64, transactionFeeSatoshis: UInt64, outboundPaymentHtlcRoundedMsat: UInt64, outboundForwardedHtlcRoundedMsat: UInt64, inboundClaimingHtlcRoundedMsat: UInt64, inboundHtlcRoundedMsat: UInt64 + ) + case claimableAwaitingConfirmations(channelId: ChannelId, counterpartyNodeId: PublicKey, amountSatoshis: UInt64, confirmationHeight: UInt32, source: BalanceSource + ) + case contentiousClaimable(channelId: ChannelId, counterpartyNodeId: PublicKey, amountSatoshis: UInt64, timeoutHeight: UInt32, paymentHash: PaymentHash, paymentPreimage: PaymentPreimage + ) + case maybeTimeoutClaimableHtlc(channelId: ChannelId, counterpartyNodeId: PublicKey, amountSatoshis: UInt64, claimableHeight: UInt32, paymentHash: PaymentHash, outboundPayment: Bool + ) + case maybePreimageClaimableHtlc(channelId: ChannelId, counterpartyNodeId: PublicKey, amountSatoshis: UInt64, expiryHeight: UInt32, paymentHash: PaymentHash + ) + case counterpartyRevokedOutputClaimable(channelId: ChannelId, counterpartyNodeId: PublicKey, amountSatoshis: UInt64 + ) } + public struct FfiConverterTypeLightningBalance: FfiConverterRustBuffer { typealias SwiftType = LightningBalance public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> LightningBalance { let variant: Int32 = try readInt(&buf) switch variant { - case 1: return try .claimableOnChannelClose(channelId: FfiConverterTypeChannelId.read(from: &buf), counterpartyNodeId: FfiConverterTypePublicKey.read(from: &buf), amountSatoshis: FfiConverterUInt64.read(from: &buf), transactionFeeSatoshis: FfiConverterUInt64.read(from: &buf), outboundPaymentHtlcRoundedMsat: FfiConverterUInt64.read(from: &buf), outboundForwardedHtlcRoundedMsat: FfiConverterUInt64.read(from: &buf), inboundClaimingHtlcRoundedMsat: FfiConverterUInt64.read(from: &buf), inboundHtlcRoundedMsat: FfiConverterUInt64.read(from: &buf)) - - case 2: return try .claimableAwaitingConfirmations(channelId: FfiConverterTypeChannelId.read(from: &buf), counterpartyNodeId: FfiConverterTypePublicKey.read(from: &buf), amountSatoshis: FfiConverterUInt64.read(from: &buf), confirmationHeight: FfiConverterUInt32.read(from: &buf), source: FfiConverterTypeBalanceSource.read(from: &buf)) - - case 3: return try .contentiousClaimable(channelId: FfiConverterTypeChannelId.read(from: &buf), counterpartyNodeId: FfiConverterTypePublicKey.read(from: &buf), amountSatoshis: FfiConverterUInt64.read(from: &buf), timeoutHeight: FfiConverterUInt32.read(from: &buf), paymentHash: FfiConverterTypePaymentHash.read(from: &buf), paymentPreimage: FfiConverterTypePaymentPreimage.read(from: &buf)) - - case 4: return try .maybeTimeoutClaimableHtlc(channelId: FfiConverterTypeChannelId.read(from: &buf), counterpartyNodeId: FfiConverterTypePublicKey.read(from: &buf), amountSatoshis: FfiConverterUInt64.read(from: &buf), claimableHeight: FfiConverterUInt32.read(from: &buf), paymentHash: FfiConverterTypePaymentHash.read(from: &buf), outboundPayment: FfiConverterBool.read(from: &buf)) - - case 5: return try .maybePreimageClaimableHtlc(channelId: FfiConverterTypeChannelId.read(from: &buf), counterpartyNodeId: FfiConverterTypePublicKey.read(from: &buf), amountSatoshis: FfiConverterUInt64.read(from: &buf), expiryHeight: FfiConverterUInt32.read(from: &buf), paymentHash: FfiConverterTypePaymentHash.read(from: &buf)) - - case 6: return try .counterpartyRevokedOutputClaimable(channelId: FfiConverterTypeChannelId.read(from: &buf), counterpartyNodeId: FfiConverterTypePublicKey.read(from: &buf), amountSatoshis: FfiConverterUInt64.read(from: &buf)) - + + case 1: return .claimableOnChannelClose(channelId: try FfiConverterTypeChannelId.read(from: &buf), counterpartyNodeId: try FfiConverterTypePublicKey.read(from: &buf), amountSatoshis: try FfiConverterUInt64.read(from: &buf), transactionFeeSatoshis: try FfiConverterUInt64.read(from: &buf), outboundPaymentHtlcRoundedMsat: try FfiConverterUInt64.read(from: &buf), outboundForwardedHtlcRoundedMsat: try FfiConverterUInt64.read(from: &buf), inboundClaimingHtlcRoundedMsat: try FfiConverterUInt64.read(from: &buf), inboundHtlcRoundedMsat: try FfiConverterUInt64.read(from: &buf) + ) + + case 2: return .claimableAwaitingConfirmations(channelId: try FfiConverterTypeChannelId.read(from: &buf), counterpartyNodeId: try FfiConverterTypePublicKey.read(from: &buf), amountSatoshis: try FfiConverterUInt64.read(from: &buf), confirmationHeight: try FfiConverterUInt32.read(from: &buf), source: try FfiConverterTypeBalanceSource.read(from: &buf) + ) + + case 3: return .contentiousClaimable(channelId: try FfiConverterTypeChannelId.read(from: &buf), counterpartyNodeId: try FfiConverterTypePublicKey.read(from: &buf), amountSatoshis: try FfiConverterUInt64.read(from: &buf), timeoutHeight: try FfiConverterUInt32.read(from: &buf), paymentHash: try FfiConverterTypePaymentHash.read(from: &buf), paymentPreimage: try FfiConverterTypePaymentPreimage.read(from: &buf) + ) + + case 4: return .maybeTimeoutClaimableHtlc(channelId: try FfiConverterTypeChannelId.read(from: &buf), counterpartyNodeId: try FfiConverterTypePublicKey.read(from: &buf), amountSatoshis: try FfiConverterUInt64.read(from: &buf), claimableHeight: try FfiConverterUInt32.read(from: &buf), paymentHash: try FfiConverterTypePaymentHash.read(from: &buf), outboundPayment: try FfiConverterBool.read(from: &buf) + ) + + case 5: return .maybePreimageClaimableHtlc(channelId: try FfiConverterTypeChannelId.read(from: &buf), counterpartyNodeId: try FfiConverterTypePublicKey.read(from: &buf), amountSatoshis: try FfiConverterUInt64.read(from: &buf), expiryHeight: try FfiConverterUInt32.read(from: &buf), paymentHash: try FfiConverterTypePaymentHash.read(from: &buf) + ) + + case 6: return .counterpartyRevokedOutputClaimable(channelId: try FfiConverterTypeChannelId.read(from: &buf), counterpartyNodeId: try FfiConverterTypePublicKey.read(from: &buf), amountSatoshis: try FfiConverterUInt64.read(from: &buf) + ) + default: throw UniffiInternalError.unexpectedEnumCase } } public static func write(_ value: LightningBalance, into buf: inout [UInt8]) { switch value { - case let .claimableOnChannelClose(channelId, counterpartyNodeId, amountSatoshis, transactionFeeSatoshis, outboundPaymentHtlcRoundedMsat, outboundForwardedHtlcRoundedMsat, inboundClaimingHtlcRoundedMsat, inboundHtlcRoundedMsat): + + + case let .claimableOnChannelClose(channelId,counterpartyNodeId,amountSatoshis,transactionFeeSatoshis,outboundPaymentHtlcRoundedMsat,outboundForwardedHtlcRoundedMsat,inboundClaimingHtlcRoundedMsat,inboundHtlcRoundedMsat): writeInt(&buf, Int32(1)) FfiConverterTypeChannelId.write(channelId, into: &buf) FfiConverterTypePublicKey.write(counterpartyNodeId, into: &buf) @@ -5735,16 +6346,18 @@ public struct FfiConverterTypeLightningBalance: FfiConverterRustBuffer { FfiConverterUInt64.write(outboundForwardedHtlcRoundedMsat, into: &buf) FfiConverterUInt64.write(inboundClaimingHtlcRoundedMsat, into: &buf) FfiConverterUInt64.write(inboundHtlcRoundedMsat, into: &buf) - - case let .claimableAwaitingConfirmations(channelId, counterpartyNodeId, amountSatoshis, confirmationHeight, source): + + + case let .claimableAwaitingConfirmations(channelId,counterpartyNodeId,amountSatoshis,confirmationHeight,source): writeInt(&buf, Int32(2)) FfiConverterTypeChannelId.write(channelId, into: &buf) FfiConverterTypePublicKey.write(counterpartyNodeId, into: &buf) FfiConverterUInt64.write(amountSatoshis, into: &buf) FfiConverterUInt32.write(confirmationHeight, into: &buf) FfiConverterTypeBalanceSource.write(source, into: &buf) - - case let .contentiousClaimable(channelId, counterpartyNodeId, amountSatoshis, timeoutHeight, paymentHash, paymentPreimage): + + + case let .contentiousClaimable(channelId,counterpartyNodeId,amountSatoshis,timeoutHeight,paymentHash,paymentPreimage): writeInt(&buf, Int32(3)) FfiConverterTypeChannelId.write(channelId, into: &buf) FfiConverterTypePublicKey.write(counterpartyNodeId, into: &buf) @@ -5752,8 +6365,9 @@ public struct FfiConverterTypeLightningBalance: FfiConverterRustBuffer { FfiConverterUInt32.write(timeoutHeight, into: &buf) FfiConverterTypePaymentHash.write(paymentHash, into: &buf) FfiConverterTypePaymentPreimage.write(paymentPreimage, into: &buf) - - case let .maybeTimeoutClaimableHtlc(channelId, counterpartyNodeId, amountSatoshis, claimableHeight, paymentHash, outboundPayment): + + + case let .maybeTimeoutClaimableHtlc(channelId,counterpartyNodeId,amountSatoshis,claimableHeight,paymentHash,outboundPayment): writeInt(&buf, Int32(4)) FfiConverterTypeChannelId.write(channelId, into: &buf) FfiConverterTypePublicKey.write(counterpartyNodeId, into: &buf) @@ -5761,24 +6375,28 @@ public struct FfiConverterTypeLightningBalance: FfiConverterRustBuffer { FfiConverterUInt32.write(claimableHeight, into: &buf) FfiConverterTypePaymentHash.write(paymentHash, into: &buf) FfiConverterBool.write(outboundPayment, into: &buf) - - case let .maybePreimageClaimableHtlc(channelId, counterpartyNodeId, amountSatoshis, expiryHeight, paymentHash): + + + case let .maybePreimageClaimableHtlc(channelId,counterpartyNodeId,amountSatoshis,expiryHeight,paymentHash): writeInt(&buf, Int32(5)) FfiConverterTypeChannelId.write(channelId, into: &buf) FfiConverterTypePublicKey.write(counterpartyNodeId, into: &buf) FfiConverterUInt64.write(amountSatoshis, into: &buf) FfiConverterUInt32.write(expiryHeight, into: &buf) FfiConverterTypePaymentHash.write(paymentHash, into: &buf) - - case let .counterpartyRevokedOutputClaimable(channelId, counterpartyNodeId, amountSatoshis): + + + case let .counterpartyRevokedOutputClaimable(channelId,counterpartyNodeId,amountSatoshis): writeInt(&buf, Int32(6)) FfiConverterTypeChannelId.write(channelId, into: &buf) FfiConverterTypePublicKey.write(counterpartyNodeId, into: &buf) FfiConverterUInt64.write(amountSatoshis, into: &buf) + } } } + public func FfiConverterTypeLightningBalance_lift(_ buf: RustBuffer) throws -> LightningBalance { return try FfiConverterTypeLightningBalance.lift(buf) } @@ -5787,12 +6405,17 @@ public func FfiConverterTypeLightningBalance_lower(_ value: LightningBalance) -> return FfiConverterTypeLightningBalance.lower(value) } + + extension LightningBalance: Equatable, Hashable {} + + // Note that we don't yet support `indirect` for enums. // See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion. public enum LogLevel { + case gossip case trace case debug @@ -5801,51 +6424,62 @@ public enum LogLevel { case error } + public struct FfiConverterTypeLogLevel: FfiConverterRustBuffer { typealias SwiftType = LogLevel public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> LogLevel { let variant: Int32 = try readInt(&buf) switch variant { + case 1: return .gossip - + case 2: return .trace - + case 3: return .debug - + case 4: return .info - + case 5: return .warn - + case 6: return .error - + default: throw UniffiInternalError.unexpectedEnumCase } } public static func write(_ value: LogLevel, into buf: inout [UInt8]) { switch value { + + case .gossip: writeInt(&buf, Int32(1)) - + + case .trace: writeInt(&buf, Int32(2)) - + + case .debug: writeInt(&buf, Int32(3)) - + + case .info: writeInt(&buf, Int32(4)) - + + case .warn: writeInt(&buf, Int32(5)) - + + case .error: writeInt(&buf, Int32(6)) + } } } + public func FfiConverterTypeLogLevel_lift(_ buf: RustBuffer) throws -> LogLevel { return try FfiConverterTypeLogLevel.lift(buf) } @@ -5854,47 +6488,59 @@ public func FfiConverterTypeLogLevel_lower(_ value: LogLevel) -> RustBuffer { return FfiConverterTypeLogLevel.lower(value) } + + extension LogLevel: Equatable, Hashable {} + + // Note that we don't yet support `indirect` for enums. // See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion. public enum MaxDustHtlcExposure { + case fixedLimit(limitMsat: UInt64 ) case feeRateMultiplier(multiplier: UInt64 ) } + public struct FfiConverterTypeMaxDustHTLCExposure: FfiConverterRustBuffer { typealias SwiftType = MaxDustHtlcExposure public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> MaxDustHtlcExposure { let variant: Int32 = try readInt(&buf) switch variant { - case 1: return try .fixedLimit(limitMsat: FfiConverterUInt64.read(from: &buf) - ) - - case 2: return try .feeRateMultiplier(multiplier: FfiConverterUInt64.read(from: &buf) - ) - + + case 1: return .fixedLimit(limitMsat: try FfiConverterUInt64.read(from: &buf) + ) + + case 2: return .feeRateMultiplier(multiplier: try FfiConverterUInt64.read(from: &buf) + ) + default: throw UniffiInternalError.unexpectedEnumCase } } public static func write(_ value: MaxDustHtlcExposure, into buf: inout [UInt8]) { switch value { + + case let .fixedLimit(limitMsat): writeInt(&buf, Int32(1)) FfiConverterUInt64.write(limitMsat, into: &buf) - + + case let .feeRateMultiplier(multiplier): writeInt(&buf, Int32(2)) FfiConverterUInt64.write(multiplier, into: &buf) + } } } + public func FfiConverterTypeMaxDustHTLCExposure_lift(_ buf: RustBuffer) throws -> MaxDustHtlcExposure { return try FfiConverterTypeMaxDustHTLCExposure.lift(buf) } @@ -5903,44 +6549,56 @@ public func FfiConverterTypeMaxDustHTLCExposure_lower(_ value: MaxDustHtlcExposu return FfiConverterTypeMaxDustHTLCExposure.lower(value) } + + extension MaxDustHtlcExposure: Equatable, Hashable {} + + // Note that we don't yet support `indirect` for enums. // See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion. public enum MaxTotalRoutingFeeLimit { + case none case some(amountMsat: UInt64 ) } + public struct FfiConverterTypeMaxTotalRoutingFeeLimit: FfiConverterRustBuffer { typealias SwiftType = MaxTotalRoutingFeeLimit public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> MaxTotalRoutingFeeLimit { let variant: Int32 = try readInt(&buf) switch variant { + case 1: return .none - - case 2: return try .some(amountMsat: FfiConverterUInt64.read(from: &buf) - ) - + + case 2: return .some(amountMsat: try FfiConverterUInt64.read(from: &buf) + ) + default: throw UniffiInternalError.unexpectedEnumCase } } public static func write(_ value: MaxTotalRoutingFeeLimit, into buf: inout [UInt8]) { switch value { + + case .none: writeInt(&buf, Int32(1)) - + + case let .some(amountMsat): writeInt(&buf, Int32(2)) FfiConverterUInt64.write(amountMsat, into: &buf) + } } } + public func FfiConverterTypeMaxTotalRoutingFeeLimit_lift(_ buf: RustBuffer) throws -> MaxTotalRoutingFeeLimit { return try FfiConverterTypeMaxTotalRoutingFeeLimit.lift(buf) } @@ -5949,53 +6607,67 @@ public func FfiConverterTypeMaxTotalRoutingFeeLimit_lower(_ value: MaxTotalRouti return FfiConverterTypeMaxTotalRoutingFeeLimit.lower(value) } + + extension MaxTotalRoutingFeeLimit: Equatable, Hashable {} + + // Note that we don't yet support `indirect` for enums. // See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion. public enum Network { + case bitcoin case testnet case signet case regtest } + public struct FfiConverterTypeNetwork: FfiConverterRustBuffer { typealias SwiftType = Network public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> Network { let variant: Int32 = try readInt(&buf) switch variant { + case 1: return .bitcoin - + case 2: return .testnet - + case 3: return .signet - + case 4: return .regtest - + default: throw UniffiInternalError.unexpectedEnumCase } } public static func write(_ value: Network, into buf: inout [UInt8]) { switch value { + + case .bitcoin: writeInt(&buf, Int32(1)) - + + case .testnet: writeInt(&buf, Int32(2)) - + + case .signet: writeInt(&buf, Int32(3)) - + + case .regtest: writeInt(&buf, Int32(4)) + } } } + public func FfiConverterTypeNetwork_lift(_ buf: RustBuffer) throws -> Network { return try FfiConverterTypeNetwork.lift(buf) } @@ -6004,357 +6676,378 @@ public func FfiConverterTypeNetwork_lower(_ value: Network) -> RustBuffer { return FfiConverterTypeNetwork.lower(value) } + + extension Network: Equatable, Hashable {} + + + public enum NodeError { - case AlreadyRunning(message: String) + + + case AlreadyRunning(message: String) + case NotRunning(message: String) - + case OnchainTxCreationFailed(message: String) - + case ConnectionFailed(message: String) - + case InvoiceCreationFailed(message: String) - + case InvoiceRequestCreationFailed(message: String) - + case OfferCreationFailed(message: String) - + case RefundCreationFailed(message: String) - + case PaymentSendingFailed(message: String) - + case InvalidCustomTlvs(message: String) - + case ProbeSendingFailed(message: String) - + + case RouteNotFound(message: String) + case ChannelCreationFailed(message: String) - + case ChannelClosingFailed(message: String) - + case ChannelConfigUpdateFailed(message: String) - + case PersistenceFailed(message: String) - + case FeerateEstimationUpdateFailed(message: String) - + case FeerateEstimationUpdateTimeout(message: String) - + case WalletOperationFailed(message: String) - + case WalletOperationTimeout(message: String) - + case OnchainTxSigningFailed(message: String) - + case TxSyncFailed(message: String) - + case TxSyncTimeout(message: String) - + case GossipUpdateFailed(message: String) - + case GossipUpdateTimeout(message: String) - + case LiquidityRequestFailed(message: String) - + case UriParameterParsingFailed(message: String) - + case InvalidAddress(message: String) - + case InvalidSocketAddress(message: String) - + case InvalidPublicKey(message: String) - + case InvalidSecretKey(message: String) - + case InvalidOfferId(message: String) - + case InvalidNodeId(message: String) - + case InvalidPaymentId(message: String) - + case InvalidPaymentHash(message: String) - + case InvalidPaymentPreimage(message: String) - + case InvalidPaymentSecret(message: String) - + case InvalidAmount(message: String) - + case InvalidInvoice(message: String) - + case InvalidOffer(message: String) - + case InvalidRefund(message: String) - + case InvalidChannelId(message: String) - + case InvalidNetwork(message: String) - + case InvalidUri(message: String) - + case InvalidQuantity(message: String) - + case InvalidNodeAlias(message: String) - + case InvalidDateTime(message: String) - + case InvalidFeeRate(message: String) - + case DuplicatePayment(message: String) - + case UnsupportedCurrency(message: String) - + case InsufficientFunds(message: String) - + case LiquiditySourceUnavailable(message: String) - + case LiquidityFeeTooHigh(message: String) - + case CannotRbfFundingTransaction(message: String) - + case TransactionNotFound(message: String) - + case TransactionAlreadyConfirmed(message: String) - + case NoSpendableOutputs(message: String) - + case CoinSelectionFailed(message: String) + } + public struct FfiConverterTypeNodeError: FfiConverterRustBuffer { typealias SwiftType = NodeError public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> NodeError { let variant: Int32 = try readInt(&buf) switch variant { - case 1: return try .AlreadyRunning( - message: FfiConverterString.read(from: &buf) - ) - - case 2: return try .NotRunning( - message: FfiConverterString.read(from: &buf) - ) - - case 3: return try .OnchainTxCreationFailed( - message: FfiConverterString.read(from: &buf) - ) - - case 4: return try .ConnectionFailed( - message: FfiConverterString.read(from: &buf) - ) - - case 5: return try .InvoiceCreationFailed( - message: FfiConverterString.read(from: &buf) - ) - - case 6: return try .InvoiceRequestCreationFailed( - message: FfiConverterString.read(from: &buf) - ) - - case 7: return try .OfferCreationFailed( - message: FfiConverterString.read(from: &buf) - ) - - case 8: return try .RefundCreationFailed( - message: FfiConverterString.read(from: &buf) - ) - - case 9: return try .PaymentSendingFailed( - message: FfiConverterString.read(from: &buf) - ) - - case 10: return try .InvalidCustomTlvs( - message: FfiConverterString.read(from: &buf) - ) - - case 11: return try .ProbeSendingFailed( - message: FfiConverterString.read(from: &buf) - ) - - case 12: return try .ChannelCreationFailed( - message: FfiConverterString.read(from: &buf) - ) - - case 13: return try .ChannelClosingFailed( - message: FfiConverterString.read(from: &buf) - ) - - case 14: return try .ChannelConfigUpdateFailed( - message: FfiConverterString.read(from: &buf) - ) - - case 15: return try .PersistenceFailed( - message: FfiConverterString.read(from: &buf) - ) - - case 16: return try .FeerateEstimationUpdateFailed( - message: FfiConverterString.read(from: &buf) - ) - - case 17: return try .FeerateEstimationUpdateTimeout( - message: FfiConverterString.read(from: &buf) - ) - - case 18: return try .WalletOperationFailed( - message: FfiConverterString.read(from: &buf) - ) - - case 19: return try .WalletOperationTimeout( - message: FfiConverterString.read(from: &buf) - ) - - case 20: return try .OnchainTxSigningFailed( - message: FfiConverterString.read(from: &buf) - ) - case 21: return try .TxSyncFailed( - message: FfiConverterString.read(from: &buf) - ) - - case 22: return try .TxSyncTimeout( - message: FfiConverterString.read(from: &buf) - ) - - case 23: return try .GossipUpdateFailed( - message: FfiConverterString.read(from: &buf) - ) - - case 24: return try .GossipUpdateTimeout( - message: FfiConverterString.read(from: &buf) - ) - - case 25: return try .LiquidityRequestFailed( - message: FfiConverterString.read(from: &buf) - ) - - case 26: return try .UriParameterParsingFailed( - message: FfiConverterString.read(from: &buf) - ) - - case 27: return try .InvalidAddress( - message: FfiConverterString.read(from: &buf) - ) - - case 28: return try .InvalidSocketAddress( - message: FfiConverterString.read(from: &buf) - ) - - case 29: return try .InvalidPublicKey( - message: FfiConverterString.read(from: &buf) - ) - - case 30: return try .InvalidSecretKey( - message: FfiConverterString.read(from: &buf) - ) - - case 31: return try .InvalidOfferId( - message: FfiConverterString.read(from: &buf) - ) - - case 32: return try .InvalidNodeId( - message: FfiConverterString.read(from: &buf) - ) - - case 33: return try .InvalidPaymentId( - message: FfiConverterString.read(from: &buf) - ) - - case 34: return try .InvalidPaymentHash( - message: FfiConverterString.read(from: &buf) - ) - - case 35: return try .InvalidPaymentPreimage( - message: FfiConverterString.read(from: &buf) - ) - - case 36: return try .InvalidPaymentSecret( - message: FfiConverterString.read(from: &buf) - ) - - case 37: return try .InvalidAmount( - message: FfiConverterString.read(from: &buf) - ) - - case 38: return try .InvalidInvoice( - message: FfiConverterString.read(from: &buf) - ) - - case 39: return try .InvalidOffer( - message: FfiConverterString.read(from: &buf) - ) - - case 40: return try .InvalidRefund( - message: FfiConverterString.read(from: &buf) - ) - - case 41: return try .InvalidChannelId( - message: FfiConverterString.read(from: &buf) - ) - - case 42: return try .InvalidNetwork( - message: FfiConverterString.read(from: &buf) - ) - - case 43: return try .InvalidUri( - message: FfiConverterString.read(from: &buf) - ) - - case 44: return try .InvalidQuantity( - message: FfiConverterString.read(from: &buf) - ) - - case 45: return try .InvalidNodeAlias( - message: FfiConverterString.read(from: &buf) - ) - - case 46: return try .InvalidDateTime( - message: FfiConverterString.read(from: &buf) - ) - - case 47: return try .InvalidFeeRate( - message: FfiConverterString.read(from: &buf) - ) - - case 48: return try .DuplicatePayment( - message: FfiConverterString.read(from: &buf) - ) - - case 49: return try .UnsupportedCurrency( - message: FfiConverterString.read(from: &buf) - ) - - case 50: return try .InsufficientFunds( - message: FfiConverterString.read(from: &buf) - ) - - case 51: return try .LiquiditySourceUnavailable( - message: FfiConverterString.read(from: &buf) - ) - - case 52: return try .LiquidityFeeTooHigh( - message: FfiConverterString.read(from: &buf) - ) - - case 53: return try .CannotRbfFundingTransaction( - message: FfiConverterString.read(from: &buf) - ) - - case 54: return try .TransactionNotFound( - message: FfiConverterString.read(from: &buf) - ) - - case 55: return try .TransactionAlreadyConfirmed( - message: FfiConverterString.read(from: &buf) - ) + - case 56: return try .NoSpendableOutputs( - message: FfiConverterString.read(from: &buf) - ) - - case 57: return try .CoinSelectionFailed( - message: FfiConverterString.read(from: &buf) - ) + + case 1: return .AlreadyRunning( + message: try FfiConverterString.read(from: &buf) + ) + + case 2: return .NotRunning( + message: try FfiConverterString.read(from: &buf) + ) + + case 3: return .OnchainTxCreationFailed( + message: try FfiConverterString.read(from: &buf) + ) + + case 4: return .ConnectionFailed( + message: try FfiConverterString.read(from: &buf) + ) + + case 5: return .InvoiceCreationFailed( + message: try FfiConverterString.read(from: &buf) + ) + + case 6: return .InvoiceRequestCreationFailed( + message: try FfiConverterString.read(from: &buf) + ) + + case 7: return .OfferCreationFailed( + message: try FfiConverterString.read(from: &buf) + ) + + case 8: return .RefundCreationFailed( + message: try FfiConverterString.read(from: &buf) + ) + + case 9: return .PaymentSendingFailed( + message: try FfiConverterString.read(from: &buf) + ) + + case 10: return .InvalidCustomTlvs( + message: try FfiConverterString.read(from: &buf) + ) + + case 11: return .ProbeSendingFailed( + message: try FfiConverterString.read(from: &buf) + ) + + case 12: return .RouteNotFound( + message: try FfiConverterString.read(from: &buf) + ) + + case 13: return .ChannelCreationFailed( + message: try FfiConverterString.read(from: &buf) + ) + + case 14: return .ChannelClosingFailed( + message: try FfiConverterString.read(from: &buf) + ) + + case 15: return .ChannelConfigUpdateFailed( + message: try FfiConverterString.read(from: &buf) + ) + + case 16: return .PersistenceFailed( + message: try FfiConverterString.read(from: &buf) + ) + + case 17: return .FeerateEstimationUpdateFailed( + message: try FfiConverterString.read(from: &buf) + ) + + case 18: return .FeerateEstimationUpdateTimeout( + message: try FfiConverterString.read(from: &buf) + ) + + case 19: return .WalletOperationFailed( + message: try FfiConverterString.read(from: &buf) + ) + + case 20: return .WalletOperationTimeout( + message: try FfiConverterString.read(from: &buf) + ) + + case 21: return .OnchainTxSigningFailed( + message: try FfiConverterString.read(from: &buf) + ) + + case 22: return .TxSyncFailed( + message: try FfiConverterString.read(from: &buf) + ) + + case 23: return .TxSyncTimeout( + message: try FfiConverterString.read(from: &buf) + ) + + case 24: return .GossipUpdateFailed( + message: try FfiConverterString.read(from: &buf) + ) + + case 25: return .GossipUpdateTimeout( + message: try FfiConverterString.read(from: &buf) + ) + + case 26: return .LiquidityRequestFailed( + message: try FfiConverterString.read(from: &buf) + ) + + case 27: return .UriParameterParsingFailed( + message: try FfiConverterString.read(from: &buf) + ) + + case 28: return .InvalidAddress( + message: try FfiConverterString.read(from: &buf) + ) + + case 29: return .InvalidSocketAddress( + message: try FfiConverterString.read(from: &buf) + ) + + case 30: return .InvalidPublicKey( + message: try FfiConverterString.read(from: &buf) + ) + + case 31: return .InvalidSecretKey( + message: try FfiConverterString.read(from: &buf) + ) + + case 32: return .InvalidOfferId( + message: try FfiConverterString.read(from: &buf) + ) + + case 33: return .InvalidNodeId( + message: try FfiConverterString.read(from: &buf) + ) + + case 34: return .InvalidPaymentId( + message: try FfiConverterString.read(from: &buf) + ) + + case 35: return .InvalidPaymentHash( + message: try FfiConverterString.read(from: &buf) + ) + + case 36: return .InvalidPaymentPreimage( + message: try FfiConverterString.read(from: &buf) + ) + + case 37: return .InvalidPaymentSecret( + message: try FfiConverterString.read(from: &buf) + ) + + case 38: return .InvalidAmount( + message: try FfiConverterString.read(from: &buf) + ) + + case 39: return .InvalidInvoice( + message: try FfiConverterString.read(from: &buf) + ) + + case 40: return .InvalidOffer( + message: try FfiConverterString.read(from: &buf) + ) + + case 41: return .InvalidRefund( + message: try FfiConverterString.read(from: &buf) + ) + + case 42: return .InvalidChannelId( + message: try FfiConverterString.read(from: &buf) + ) + + case 43: return .InvalidNetwork( + message: try FfiConverterString.read(from: &buf) + ) + + case 44: return .InvalidUri( + message: try FfiConverterString.read(from: &buf) + ) + + case 45: return .InvalidQuantity( + message: try FfiConverterString.read(from: &buf) + ) + + case 46: return .InvalidNodeAlias( + message: try FfiConverterString.read(from: &buf) + ) + + case 47: return .InvalidDateTime( + message: try FfiConverterString.read(from: &buf) + ) + + case 48: return .InvalidFeeRate( + message: try FfiConverterString.read(from: &buf) + ) + + case 49: return .DuplicatePayment( + message: try FfiConverterString.read(from: &buf) + ) + + case 50: return .UnsupportedCurrency( + message: try FfiConverterString.read(from: &buf) + ) + + case 51: return .InsufficientFunds( + message: try FfiConverterString.read(from: &buf) + ) + + case 52: return .LiquiditySourceUnavailable( + message: try FfiConverterString.read(from: &buf) + ) + + case 53: return .LiquidityFeeTooHigh( + message: try FfiConverterString.read(from: &buf) + ) + + case 54: return .CannotRbfFundingTransaction( + message: try FfiConverterString.read(from: &buf) + ) + + case 55: return .TransactionNotFound( + message: try FfiConverterString.read(from: &buf) + ) + + case 56: return .TransactionAlreadyConfirmed( + message: try FfiConverterString.read(from: &buf) + ) + + case 57: return .NoSpendableOutputs( + message: try FfiConverterString.read(from: &buf) + ) + + case 58: return .CoinSelectionFailed( + message: try FfiConverterString.read(from: &buf) + ) + default: throw UniffiInternalError.unexpectedEnumCase } @@ -6362,161 +7055,178 @@ public struct FfiConverterTypeNodeError: FfiConverterRustBuffer { public static func write(_ value: NodeError, into buf: inout [UInt8]) { switch value { - case .AlreadyRunning(_ /* message is ignored*/ ): + + + + + case .AlreadyRunning(_ /* message is ignored*/): writeInt(&buf, Int32(1)) - case .NotRunning(_ /* message is ignored*/ ): + case .NotRunning(_ /* message is ignored*/): writeInt(&buf, Int32(2)) - case .OnchainTxCreationFailed(_ /* message is ignored*/ ): + case .OnchainTxCreationFailed(_ /* message is ignored*/): writeInt(&buf, Int32(3)) - case .ConnectionFailed(_ /* message is ignored*/ ): + case .ConnectionFailed(_ /* message is ignored*/): writeInt(&buf, Int32(4)) - case .InvoiceCreationFailed(_ /* message is ignored*/ ): + case .InvoiceCreationFailed(_ /* message is ignored*/): writeInt(&buf, Int32(5)) - case .InvoiceRequestCreationFailed(_ /* message is ignored*/ ): + case .InvoiceRequestCreationFailed(_ /* message is ignored*/): writeInt(&buf, Int32(6)) - case .OfferCreationFailed(_ /* message is ignored*/ ): + case .OfferCreationFailed(_ /* message is ignored*/): writeInt(&buf, Int32(7)) - case .RefundCreationFailed(_ /* message is ignored*/ ): + case .RefundCreationFailed(_ /* message is ignored*/): writeInt(&buf, Int32(8)) - case .PaymentSendingFailed(_ /* message is ignored*/ ): + case .PaymentSendingFailed(_ /* message is ignored*/): writeInt(&buf, Int32(9)) - case .InvalidCustomTlvs(_ /* message is ignored*/ ): + case .InvalidCustomTlvs(_ /* message is ignored*/): writeInt(&buf, Int32(10)) - case .ProbeSendingFailed(_ /* message is ignored*/ ): + case .ProbeSendingFailed(_ /* message is ignored*/): writeInt(&buf, Int32(11)) - case .ChannelCreationFailed(_ /* message is ignored*/ ): + case .RouteNotFound(_ /* message is ignored*/): writeInt(&buf, Int32(12)) - case .ChannelClosingFailed(_ /* message is ignored*/ ): + case .ChannelCreationFailed(_ /* message is ignored*/): writeInt(&buf, Int32(13)) - case .ChannelConfigUpdateFailed(_ /* message is ignored*/ ): + case .ChannelClosingFailed(_ /* message is ignored*/): writeInt(&buf, Int32(14)) - case .PersistenceFailed(_ /* message is ignored*/ ): + case .ChannelConfigUpdateFailed(_ /* message is ignored*/): writeInt(&buf, Int32(15)) - case .FeerateEstimationUpdateFailed(_ /* message is ignored*/ ): + case .PersistenceFailed(_ /* message is ignored*/): writeInt(&buf, Int32(16)) - case .FeerateEstimationUpdateTimeout(_ /* message is ignored*/ ): + case .FeerateEstimationUpdateFailed(_ /* message is ignored*/): writeInt(&buf, Int32(17)) - case .WalletOperationFailed(_ /* message is ignored*/ ): + case .FeerateEstimationUpdateTimeout(_ /* message is ignored*/): writeInt(&buf, Int32(18)) - case .WalletOperationTimeout(_ /* message is ignored*/ ): + case .WalletOperationFailed(_ /* message is ignored*/): writeInt(&buf, Int32(19)) - case .OnchainTxSigningFailed(_ /* message is ignored*/ ): + case .WalletOperationTimeout(_ /* message is ignored*/): writeInt(&buf, Int32(20)) - case .TxSyncFailed(_ /* message is ignored*/ ): + case .OnchainTxSigningFailed(_ /* message is ignored*/): writeInt(&buf, Int32(21)) - case .TxSyncTimeout(_ /* message is ignored*/ ): + case .TxSyncFailed(_ /* message is ignored*/): writeInt(&buf, Int32(22)) - case .GossipUpdateFailed(_ /* message is ignored*/ ): + case .TxSyncTimeout(_ /* message is ignored*/): writeInt(&buf, Int32(23)) - case .GossipUpdateTimeout(_ /* message is ignored*/ ): + case .GossipUpdateFailed(_ /* message is ignored*/): writeInt(&buf, Int32(24)) - case .LiquidityRequestFailed(_ /* message is ignored*/ ): + case .GossipUpdateTimeout(_ /* message is ignored*/): writeInt(&buf, Int32(25)) - case .UriParameterParsingFailed(_ /* message is ignored*/ ): + case .LiquidityRequestFailed(_ /* message is ignored*/): writeInt(&buf, Int32(26)) - case .InvalidAddress(_ /* message is ignored*/ ): + case .UriParameterParsingFailed(_ /* message is ignored*/): writeInt(&buf, Int32(27)) - case .InvalidSocketAddress(_ /* message is ignored*/ ): + case .InvalidAddress(_ /* message is ignored*/): writeInt(&buf, Int32(28)) - case .InvalidPublicKey(_ /* message is ignored*/ ): + case .InvalidSocketAddress(_ /* message is ignored*/): writeInt(&buf, Int32(29)) - case .InvalidSecretKey(_ /* message is ignored*/ ): + case .InvalidPublicKey(_ /* message is ignored*/): writeInt(&buf, Int32(30)) - case .InvalidOfferId(_ /* message is ignored*/ ): + case .InvalidSecretKey(_ /* message is ignored*/): writeInt(&buf, Int32(31)) - case .InvalidNodeId(_ /* message is ignored*/ ): + case .InvalidOfferId(_ /* message is ignored*/): writeInt(&buf, Int32(32)) - case .InvalidPaymentId(_ /* message is ignored*/ ): + case .InvalidNodeId(_ /* message is ignored*/): writeInt(&buf, Int32(33)) - case .InvalidPaymentHash(_ /* message is ignored*/ ): + case .InvalidPaymentId(_ /* message is ignored*/): writeInt(&buf, Int32(34)) - case .InvalidPaymentPreimage(_ /* message is ignored*/ ): + case .InvalidPaymentHash(_ /* message is ignored*/): writeInt(&buf, Int32(35)) - case .InvalidPaymentSecret(_ /* message is ignored*/ ): + case .InvalidPaymentPreimage(_ /* message is ignored*/): writeInt(&buf, Int32(36)) - case .InvalidAmount(_ /* message is ignored*/ ): + case .InvalidPaymentSecret(_ /* message is ignored*/): writeInt(&buf, Int32(37)) - case .InvalidInvoice(_ /* message is ignored*/ ): + case .InvalidAmount(_ /* message is ignored*/): writeInt(&buf, Int32(38)) - case .InvalidOffer(_ /* message is ignored*/ ): + case .InvalidInvoice(_ /* message is ignored*/): writeInt(&buf, Int32(39)) - case .InvalidRefund(_ /* message is ignored*/ ): + case .InvalidOffer(_ /* message is ignored*/): writeInt(&buf, Int32(40)) - case .InvalidChannelId(_ /* message is ignored*/ ): + case .InvalidRefund(_ /* message is ignored*/): writeInt(&buf, Int32(41)) - case .InvalidNetwork(_ /* message is ignored*/ ): + case .InvalidChannelId(_ /* message is ignored*/): writeInt(&buf, Int32(42)) - case .InvalidUri(_ /* message is ignored*/ ): + case .InvalidNetwork(_ /* message is ignored*/): writeInt(&buf, Int32(43)) - case .InvalidQuantity(_ /* message is ignored*/ ): + case .InvalidUri(_ /* message is ignored*/): writeInt(&buf, Int32(44)) - case .InvalidNodeAlias(_ /* message is ignored*/ ): + case .InvalidQuantity(_ /* message is ignored*/): writeInt(&buf, Int32(45)) - case .InvalidDateTime(_ /* message is ignored*/ ): + case .InvalidNodeAlias(_ /* message is ignored*/): writeInt(&buf, Int32(46)) - case .InvalidFeeRate(_ /* message is ignored*/ ): + case .InvalidDateTime(_ /* message is ignored*/): writeInt(&buf, Int32(47)) - case .DuplicatePayment(_ /* message is ignored*/ ): + case .InvalidFeeRate(_ /* message is ignored*/): writeInt(&buf, Int32(48)) - case .UnsupportedCurrency(_ /* message is ignored*/ ): + case .DuplicatePayment(_ /* message is ignored*/): writeInt(&buf, Int32(49)) - case .InsufficientFunds(_ /* message is ignored*/ ): + case .UnsupportedCurrency(_ /* message is ignored*/): writeInt(&buf, Int32(50)) - case .LiquiditySourceUnavailable(_ /* message is ignored*/ ): + case .InsufficientFunds(_ /* message is ignored*/): writeInt(&buf, Int32(51)) - case .LiquidityFeeTooHigh(_ /* message is ignored*/ ): + case .LiquiditySourceUnavailable(_ /* message is ignored*/): writeInt(&buf, Int32(52)) - case .CannotRbfFundingTransaction(_ /* message is ignored*/ ): + case .LiquidityFeeTooHigh(_ /* message is ignored*/): writeInt(&buf, Int32(53)) - case .TransactionNotFound(_ /* message is ignored*/ ): + case .CannotRbfFundingTransaction(_ /* message is ignored*/): writeInt(&buf, Int32(54)) - case .TransactionAlreadyConfirmed(_ /* message is ignored*/ ): + case .TransactionNotFound(_ /* message is ignored*/): writeInt(&buf, Int32(55)) - case .NoSpendableOutputs(_ /* message is ignored*/ ): + case .TransactionAlreadyConfirmed(_ /* message is ignored*/): writeInt(&buf, Int32(56)) - case .CoinSelectionFailed(_ /* message is ignored*/ ): + case .NoSpendableOutputs(_ /* message is ignored*/): writeInt(&buf, Int32(57)) + case .CoinSelectionFailed(_ /* message is ignored*/): + writeInt(&buf, Int32(58)) + + } } } + extension NodeError: Equatable, Hashable {} -extension NodeError: Error {} +extension NodeError: Error { } // Note that we don't yet support `indirect` for enums. // See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion. public enum PaymentDirection { + case inbound case outbound } + public struct FfiConverterTypePaymentDirection: FfiConverterRustBuffer { typealias SwiftType = PaymentDirection public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> PaymentDirection { let variant: Int32 = try readInt(&buf) switch variant { + case 1: return .inbound - + case 2: return .outbound - + default: throw UniffiInternalError.unexpectedEnumCase } } public static func write(_ value: PaymentDirection, into buf: inout [UInt8]) { switch value { + + case .inbound: writeInt(&buf, Int32(1)) - + + case .outbound: writeInt(&buf, Int32(2)) + } } } + public func FfiConverterTypePaymentDirection_lift(_ buf: RustBuffer) throws -> PaymentDirection { return try FfiConverterTypePaymentDirection.lift(buf) } @@ -6525,12 +7235,17 @@ public func FfiConverterTypePaymentDirection_lower(_ value: PaymentDirection) -> return FfiConverterTypePaymentDirection.lower(value) } + + extension PaymentDirection: Equatable, Hashable {} + + // Note that we don't yet support `indirect` for enums. // See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion. public enum PaymentFailureReason { + case recipientRejected case userAbandoned case retriesExhausted @@ -6543,71 +7258,86 @@ public enum PaymentFailureReason { case blindedPathCreationFailed } + public struct FfiConverterTypePaymentFailureReason: FfiConverterRustBuffer { typealias SwiftType = PaymentFailureReason public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> PaymentFailureReason { let variant: Int32 = try readInt(&buf) switch variant { + case 1: return .recipientRejected - + case 2: return .userAbandoned - + case 3: return .retriesExhausted - + case 4: return .paymentExpired - + case 5: return .routeNotFound - + case 6: return .unexpectedError - + case 7: return .unknownRequiredFeatures - + case 8: return .invoiceRequestExpired - + case 9: return .invoiceRequestRejected - + case 10: return .blindedPathCreationFailed - + default: throw UniffiInternalError.unexpectedEnumCase } } public static func write(_ value: PaymentFailureReason, into buf: inout [UInt8]) { switch value { + + case .recipientRejected: writeInt(&buf, Int32(1)) - + + case .userAbandoned: writeInt(&buf, Int32(2)) - + + case .retriesExhausted: writeInt(&buf, Int32(3)) - + + case .paymentExpired: writeInt(&buf, Int32(4)) - + + case .routeNotFound: writeInt(&buf, Int32(5)) - + + case .unexpectedError: writeInt(&buf, Int32(6)) - + + case .unknownRequiredFeatures: writeInt(&buf, Int32(7)) - + + case .invoiceRequestExpired: writeInt(&buf, Int32(8)) - + + case .invoiceRequestRejected: writeInt(&buf, Int32(9)) - + + case .blindedPathCreationFailed: writeInt(&buf, Int32(10)) + } } } + public func FfiConverterTypePaymentFailureReason_lift(_ buf: RustBuffer) throws -> PaymentFailureReason { return try FfiConverterTypePaymentFailureReason.lift(buf) } @@ -6616,58 +7346,81 @@ public func FfiConverterTypePaymentFailureReason_lower(_ value: PaymentFailureRe return FfiConverterTypePaymentFailureReason.lower(value) } + + extension PaymentFailureReason: Equatable, Hashable {} + + // Note that we don't yet support `indirect` for enums. // See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion. public enum PaymentKind { - case onchain(txid: Txid, status: ConfirmationStatus) - case bolt11(hash: PaymentHash, preimage: PaymentPreimage?, secret: PaymentSecret?, description: String?, bolt11: String?) - case bolt11Jit(hash: PaymentHash, preimage: PaymentPreimage?, secret: PaymentSecret?, counterpartySkimmedFeeMsat: UInt64?, lspFeeLimits: LspFeeLimits, description: String?, bolt11: String?) - case bolt12Offer(hash: PaymentHash?, preimage: PaymentPreimage?, secret: PaymentSecret?, offerId: OfferId, payerNote: UntrustedString?, quantity: UInt64?) - case bolt12Refund(hash: PaymentHash?, preimage: PaymentPreimage?, secret: PaymentSecret?, payerNote: UntrustedString?, quantity: UInt64?) - case spontaneous(hash: PaymentHash, preimage: PaymentPreimage?) + + case onchain(txid: Txid, status: ConfirmationStatus + ) + case bolt11(hash: PaymentHash, preimage: PaymentPreimage?, secret: PaymentSecret?, description: String?, bolt11: String? + ) + case bolt11Jit(hash: PaymentHash, preimage: PaymentPreimage?, secret: PaymentSecret?, counterpartySkimmedFeeMsat: UInt64?, lspFeeLimits: LspFeeLimits, description: String?, bolt11: String? + ) + case bolt12Offer(hash: PaymentHash?, preimage: PaymentPreimage?, secret: PaymentSecret?, offerId: OfferId, payerNote: UntrustedString?, quantity: UInt64? + ) + case bolt12Refund(hash: PaymentHash?, preimage: PaymentPreimage?, secret: PaymentSecret?, payerNote: UntrustedString?, quantity: UInt64? + ) + case spontaneous(hash: PaymentHash, preimage: PaymentPreimage? + ) } + public struct FfiConverterTypePaymentKind: FfiConverterRustBuffer { typealias SwiftType = PaymentKind public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> PaymentKind { let variant: Int32 = try readInt(&buf) switch variant { - case 1: return try .onchain(txid: FfiConverterTypeTxid.read(from: &buf), status: FfiConverterTypeConfirmationStatus.read(from: &buf)) - - case 2: return try .bolt11(hash: FfiConverterTypePaymentHash.read(from: &buf), preimage: FfiConverterOptionTypePaymentPreimage.read(from: &buf), secret: FfiConverterOptionTypePaymentSecret.read(from: &buf), description: FfiConverterOptionString.read(from: &buf), bolt11: FfiConverterOptionString.read(from: &buf)) - - case 3: return try .bolt11Jit(hash: FfiConverterTypePaymentHash.read(from: &buf), preimage: FfiConverterOptionTypePaymentPreimage.read(from: &buf), secret: FfiConverterOptionTypePaymentSecret.read(from: &buf), counterpartySkimmedFeeMsat: FfiConverterOptionUInt64.read(from: &buf), lspFeeLimits: FfiConverterTypeLSPFeeLimits.read(from: &buf), description: FfiConverterOptionString.read(from: &buf), bolt11: FfiConverterOptionString.read(from: &buf)) - - case 4: return try .bolt12Offer(hash: FfiConverterOptionTypePaymentHash.read(from: &buf), preimage: FfiConverterOptionTypePaymentPreimage.read(from: &buf), secret: FfiConverterOptionTypePaymentSecret.read(from: &buf), offerId: FfiConverterTypeOfferId.read(from: &buf), payerNote: FfiConverterOptionTypeUntrustedString.read(from: &buf), quantity: FfiConverterOptionUInt64.read(from: &buf)) - - case 5: return try .bolt12Refund(hash: FfiConverterOptionTypePaymentHash.read(from: &buf), preimage: FfiConverterOptionTypePaymentPreimage.read(from: &buf), secret: FfiConverterOptionTypePaymentSecret.read(from: &buf), payerNote: FfiConverterOptionTypeUntrustedString.read(from: &buf), quantity: FfiConverterOptionUInt64.read(from: &buf)) - - case 6: return try .spontaneous(hash: FfiConverterTypePaymentHash.read(from: &buf), preimage: FfiConverterOptionTypePaymentPreimage.read(from: &buf)) - + + case 1: return .onchain(txid: try FfiConverterTypeTxid.read(from: &buf), status: try FfiConverterTypeConfirmationStatus.read(from: &buf) + ) + + case 2: return .bolt11(hash: try FfiConverterTypePaymentHash.read(from: &buf), preimage: try FfiConverterOptionTypePaymentPreimage.read(from: &buf), secret: try FfiConverterOptionTypePaymentSecret.read(from: &buf), description: try FfiConverterOptionString.read(from: &buf), bolt11: try FfiConverterOptionString.read(from: &buf) + ) + + case 3: return .bolt11Jit(hash: try FfiConverterTypePaymentHash.read(from: &buf), preimage: try FfiConverterOptionTypePaymentPreimage.read(from: &buf), secret: try FfiConverterOptionTypePaymentSecret.read(from: &buf), counterpartySkimmedFeeMsat: try FfiConverterOptionUInt64.read(from: &buf), lspFeeLimits: try FfiConverterTypeLSPFeeLimits.read(from: &buf), description: try FfiConverterOptionString.read(from: &buf), bolt11: try FfiConverterOptionString.read(from: &buf) + ) + + case 4: return .bolt12Offer(hash: try FfiConverterOptionTypePaymentHash.read(from: &buf), preimage: try FfiConverterOptionTypePaymentPreimage.read(from: &buf), secret: try FfiConverterOptionTypePaymentSecret.read(from: &buf), offerId: try FfiConverterTypeOfferId.read(from: &buf), payerNote: try FfiConverterOptionTypeUntrustedString.read(from: &buf), quantity: try FfiConverterOptionUInt64.read(from: &buf) + ) + + case 5: return .bolt12Refund(hash: try FfiConverterOptionTypePaymentHash.read(from: &buf), preimage: try FfiConverterOptionTypePaymentPreimage.read(from: &buf), secret: try FfiConverterOptionTypePaymentSecret.read(from: &buf), payerNote: try FfiConverterOptionTypeUntrustedString.read(from: &buf), quantity: try FfiConverterOptionUInt64.read(from: &buf) + ) + + case 6: return .spontaneous(hash: try FfiConverterTypePaymentHash.read(from: &buf), preimage: try FfiConverterOptionTypePaymentPreimage.read(from: &buf) + ) + default: throw UniffiInternalError.unexpectedEnumCase } } public static func write(_ value: PaymentKind, into buf: inout [UInt8]) { switch value { - case let .onchain(txid, status): + + + case let .onchain(txid,status): writeInt(&buf, Int32(1)) FfiConverterTypeTxid.write(txid, into: &buf) FfiConverterTypeConfirmationStatus.write(status, into: &buf) - - case let .bolt11(hash, preimage, secret, description, bolt11): + + + case let .bolt11(hash,preimage,secret,description,bolt11): writeInt(&buf, Int32(2)) FfiConverterTypePaymentHash.write(hash, into: &buf) FfiConverterOptionTypePaymentPreimage.write(preimage, into: &buf) FfiConverterOptionTypePaymentSecret.write(secret, into: &buf) FfiConverterOptionString.write(description, into: &buf) FfiConverterOptionString.write(bolt11, into: &buf) - - case let .bolt11Jit(hash, preimage, secret, counterpartySkimmedFeeMsat, lspFeeLimits, description, bolt11): + + + case let .bolt11Jit(hash,preimage,secret,counterpartySkimmedFeeMsat,lspFeeLimits,description,bolt11): writeInt(&buf, Int32(3)) FfiConverterTypePaymentHash.write(hash, into: &buf) FfiConverterOptionTypePaymentPreimage.write(preimage, into: &buf) @@ -6676,8 +7429,9 @@ public struct FfiConverterTypePaymentKind: FfiConverterRustBuffer { FfiConverterTypeLSPFeeLimits.write(lspFeeLimits, into: &buf) FfiConverterOptionString.write(description, into: &buf) FfiConverterOptionString.write(bolt11, into: &buf) - - case let .bolt12Offer(hash, preimage, secret, offerId, payerNote, quantity): + + + case let .bolt12Offer(hash,preimage,secret,offerId,payerNote,quantity): writeInt(&buf, Int32(4)) FfiConverterOptionTypePaymentHash.write(hash, into: &buf) FfiConverterOptionTypePaymentPreimage.write(preimage, into: &buf) @@ -6685,23 +7439,27 @@ public struct FfiConverterTypePaymentKind: FfiConverterRustBuffer { FfiConverterTypeOfferId.write(offerId, into: &buf) FfiConverterOptionTypeUntrustedString.write(payerNote, into: &buf) FfiConverterOptionUInt64.write(quantity, into: &buf) - - case let .bolt12Refund(hash, preimage, secret, payerNote, quantity): + + + case let .bolt12Refund(hash,preimage,secret,payerNote,quantity): writeInt(&buf, Int32(5)) FfiConverterOptionTypePaymentHash.write(hash, into: &buf) FfiConverterOptionTypePaymentPreimage.write(preimage, into: &buf) FfiConverterOptionTypePaymentSecret.write(secret, into: &buf) FfiConverterOptionTypeUntrustedString.write(payerNote, into: &buf) FfiConverterOptionUInt64.write(quantity, into: &buf) - - case let .spontaneous(hash, preimage): + + + case let .spontaneous(hash,preimage): writeInt(&buf, Int32(6)) FfiConverterTypePaymentHash.write(hash, into: &buf) FfiConverterOptionTypePaymentPreimage.write(preimage, into: &buf) + } } } + public func FfiConverterTypePaymentKind_lift(_ buf: RustBuffer) throws -> PaymentKind { return try FfiConverterTypePaymentKind.lift(buf) } @@ -6710,47 +7468,60 @@ public func FfiConverterTypePaymentKind_lower(_ value: PaymentKind) -> RustBuffe return FfiConverterTypePaymentKind.lower(value) } + + extension PaymentKind: Equatable, Hashable {} + + // Note that we don't yet support `indirect` for enums. // See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion. public enum PaymentState { + case expectPayment case paid case refunded } + public struct FfiConverterTypePaymentState: FfiConverterRustBuffer { typealias SwiftType = PaymentState public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> PaymentState { let variant: Int32 = try readInt(&buf) switch variant { + case 1: return .expectPayment - + case 2: return .paid - + case 3: return .refunded - + default: throw UniffiInternalError.unexpectedEnumCase } } public static func write(_ value: PaymentState, into buf: inout [UInt8]) { switch value { + + case .expectPayment: writeInt(&buf, Int32(1)) - + + case .paid: writeInt(&buf, Int32(2)) - + + case .refunded: writeInt(&buf, Int32(3)) + } } } + public func FfiConverterTypePaymentState_lift(_ buf: RustBuffer) throws -> PaymentState { return try FfiConverterTypePaymentState.lift(buf) } @@ -6759,47 +7530,60 @@ public func FfiConverterTypePaymentState_lower(_ value: PaymentState) -> RustBuf return FfiConverterTypePaymentState.lower(value) } + + extension PaymentState: Equatable, Hashable {} + + // Note that we don't yet support `indirect` for enums. // See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion. public enum PaymentStatus { + case pending case succeeded case failed } + public struct FfiConverterTypePaymentStatus: FfiConverterRustBuffer { typealias SwiftType = PaymentStatus public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> PaymentStatus { let variant: Int32 = try readInt(&buf) switch variant { + case 1: return .pending - + case 2: return .succeeded - + case 3: return .failed - + default: throw UniffiInternalError.unexpectedEnumCase } } public static func write(_ value: PaymentStatus, into buf: inout [UInt8]) { switch value { + + case .pending: writeInt(&buf, Int32(1)) - + + case .succeeded: writeInt(&buf, Int32(2)) - + + case .failed: writeInt(&buf, Int32(3)) + } } } + public func FfiConverterTypePaymentStatus_lift(_ buf: RustBuffer) throws -> PaymentStatus { return try FfiConverterTypePaymentStatus.lift(buf) } @@ -6808,58 +7592,77 @@ public func FfiConverterTypePaymentStatus_lower(_ value: PaymentStatus) -> RustB return FfiConverterTypePaymentStatus.lower(value) } + + extension PaymentStatus: Equatable, Hashable {} + + // Note that we don't yet support `indirect` for enums. // See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion. public enum PendingSweepBalance { - case pendingBroadcast(channelId: ChannelId?, amountSatoshis: UInt64) - case broadcastAwaitingConfirmation(channelId: ChannelId?, latestBroadcastHeight: UInt32, latestSpendingTxid: Txid, amountSatoshis: UInt64) - case awaitingThresholdConfirmations(channelId: ChannelId?, latestSpendingTxid: Txid, confirmationHash: BlockHash, confirmationHeight: UInt32, amountSatoshis: UInt64) + + case pendingBroadcast(channelId: ChannelId?, amountSatoshis: UInt64 + ) + case broadcastAwaitingConfirmation(channelId: ChannelId?, latestBroadcastHeight: UInt32, latestSpendingTxid: Txid, amountSatoshis: UInt64 + ) + case awaitingThresholdConfirmations(channelId: ChannelId?, latestSpendingTxid: Txid, confirmationHash: BlockHash, confirmationHeight: UInt32, amountSatoshis: UInt64 + ) } + public struct FfiConverterTypePendingSweepBalance: FfiConverterRustBuffer { typealias SwiftType = PendingSweepBalance public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> PendingSweepBalance { let variant: Int32 = try readInt(&buf) switch variant { - case 1: return try .pendingBroadcast(channelId: FfiConverterOptionTypeChannelId.read(from: &buf), amountSatoshis: FfiConverterUInt64.read(from: &buf)) - - case 2: return try .broadcastAwaitingConfirmation(channelId: FfiConverterOptionTypeChannelId.read(from: &buf), latestBroadcastHeight: FfiConverterUInt32.read(from: &buf), latestSpendingTxid: FfiConverterTypeTxid.read(from: &buf), amountSatoshis: FfiConverterUInt64.read(from: &buf)) - - case 3: return try .awaitingThresholdConfirmations(channelId: FfiConverterOptionTypeChannelId.read(from: &buf), latestSpendingTxid: FfiConverterTypeTxid.read(from: &buf), confirmationHash: FfiConverterTypeBlockHash.read(from: &buf), confirmationHeight: FfiConverterUInt32.read(from: &buf), amountSatoshis: FfiConverterUInt64.read(from: &buf)) - + + case 1: return .pendingBroadcast(channelId: try FfiConverterOptionTypeChannelId.read(from: &buf), amountSatoshis: try FfiConverterUInt64.read(from: &buf) + ) + + case 2: return .broadcastAwaitingConfirmation(channelId: try FfiConverterOptionTypeChannelId.read(from: &buf), latestBroadcastHeight: try FfiConverterUInt32.read(from: &buf), latestSpendingTxid: try FfiConverterTypeTxid.read(from: &buf), amountSatoshis: try FfiConverterUInt64.read(from: &buf) + ) + + case 3: return .awaitingThresholdConfirmations(channelId: try FfiConverterOptionTypeChannelId.read(from: &buf), latestSpendingTxid: try FfiConverterTypeTxid.read(from: &buf), confirmationHash: try FfiConverterTypeBlockHash.read(from: &buf), confirmationHeight: try FfiConverterUInt32.read(from: &buf), amountSatoshis: try FfiConverterUInt64.read(from: &buf) + ) + default: throw UniffiInternalError.unexpectedEnumCase } } public static func write(_ value: PendingSweepBalance, into buf: inout [UInt8]) { switch value { - case let .pendingBroadcast(channelId, amountSatoshis): + + + case let .pendingBroadcast(channelId,amountSatoshis): writeInt(&buf, Int32(1)) FfiConverterOptionTypeChannelId.write(channelId, into: &buf) FfiConverterUInt64.write(amountSatoshis, into: &buf) - - case let .broadcastAwaitingConfirmation(channelId, latestBroadcastHeight, latestSpendingTxid, amountSatoshis): + + + case let .broadcastAwaitingConfirmation(channelId,latestBroadcastHeight,latestSpendingTxid,amountSatoshis): writeInt(&buf, Int32(2)) FfiConverterOptionTypeChannelId.write(channelId, into: &buf) FfiConverterUInt32.write(latestBroadcastHeight, into: &buf) FfiConverterTypeTxid.write(latestSpendingTxid, into: &buf) FfiConverterUInt64.write(amountSatoshis, into: &buf) - - case let .awaitingThresholdConfirmations(channelId, latestSpendingTxid, confirmationHash, confirmationHeight, amountSatoshis): + + + case let .awaitingThresholdConfirmations(channelId,latestSpendingTxid,confirmationHash,confirmationHeight,amountSatoshis): writeInt(&buf, Int32(3)) FfiConverterOptionTypeChannelId.write(channelId, into: &buf) FfiConverterTypeTxid.write(latestSpendingTxid, into: &buf) FfiConverterTypeBlockHash.write(confirmationHash, into: &buf) FfiConverterUInt32.write(confirmationHeight, into: &buf) FfiConverterUInt64.write(amountSatoshis, into: &buf) + } } } + public func FfiConverterTypePendingSweepBalance_lift(_ buf: RustBuffer) throws -> PendingSweepBalance { return try FfiConverterTypePendingSweepBalance.lift(buf) } @@ -6868,12 +7671,17 @@ public func FfiConverterTypePendingSweepBalance_lower(_ value: PendingSweepBalan return FfiConverterTypePendingSweepBalance.lower(value) } + + extension PendingSweepBalance: Equatable, Hashable {} + + // Note that we don't yet support `indirect` for enums. // See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion. public enum QrPaymentResult { + case onchain(txid: Txid ) case bolt11(paymentId: PaymentId @@ -6882,42 +7690,50 @@ public enum QrPaymentResult { ) } + public struct FfiConverterTypeQrPaymentResult: FfiConverterRustBuffer { typealias SwiftType = QrPaymentResult public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> QrPaymentResult { let variant: Int32 = try readInt(&buf) switch variant { - case 1: return try .onchain(txid: FfiConverterTypeTxid.read(from: &buf) - ) - - case 2: return try .bolt11(paymentId: FfiConverterTypePaymentId.read(from: &buf) - ) - - case 3: return try .bolt12(paymentId: FfiConverterTypePaymentId.read(from: &buf) - ) - + + case 1: return .onchain(txid: try FfiConverterTypeTxid.read(from: &buf) + ) + + case 2: return .bolt11(paymentId: try FfiConverterTypePaymentId.read(from: &buf) + ) + + case 3: return .bolt12(paymentId: try FfiConverterTypePaymentId.read(from: &buf) + ) + default: throw UniffiInternalError.unexpectedEnumCase } } public static func write(_ value: QrPaymentResult, into buf: inout [UInt8]) { switch value { + + case let .onchain(txid): writeInt(&buf, Int32(1)) FfiConverterTypeTxid.write(txid, into: &buf) - + + case let .bolt11(paymentId): writeInt(&buf, Int32(2)) FfiConverterTypePaymentId.write(paymentId, into: &buf) - + + case let .bolt12(paymentId): writeInt(&buf, Int32(3)) FfiConverterTypePaymentId.write(paymentId, into: &buf) + } } } + public func FfiConverterTypeQrPaymentResult_lift(_ buf: RustBuffer) throws -> QrPaymentResult { return try FfiConverterTypeQrPaymentResult.lift(buf) } @@ -6926,39 +7742,54 @@ public func FfiConverterTypeQrPaymentResult_lower(_ value: QrPaymentResult) -> R return FfiConverterTypeQrPaymentResult.lower(value) } + + extension QrPaymentResult: Equatable, Hashable {} + + + public enum VssHeaderProviderError { - case InvalidData(message: String) + + + case InvalidData(message: String) + case RequestError(message: String) - + case AuthorizationError(message: String) - + case InternalError(message: String) + } + public struct FfiConverterTypeVssHeaderProviderError: FfiConverterRustBuffer { typealias SwiftType = VssHeaderProviderError public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> VssHeaderProviderError { let variant: Int32 = try readInt(&buf) switch variant { - case 1: return try .InvalidData( - message: FfiConverterString.read(from: &buf) - ) - case 2: return try .RequestError( - message: FfiConverterString.read(from: &buf) - ) - - case 3: return try .AuthorizationError( - message: FfiConverterString.read(from: &buf) - ) + - case 4: return try .InternalError( - message: FfiConverterString.read(from: &buf) - ) + + case 1: return .InvalidData( + message: try FfiConverterString.read(from: &buf) + ) + + case 2: return .RequestError( + message: try FfiConverterString.read(from: &buf) + ) + + case 3: return .AuthorizationError( + message: try FfiConverterString.read(from: &buf) + ) + + case 4: return .InternalError( + message: try FfiConverterString.read(from: &buf) + ) + default: throw UniffiInternalError.unexpectedEnumCase } @@ -6966,23 +7797,30 @@ public struct FfiConverterTypeVssHeaderProviderError: FfiConverterRustBuffer { public static func write(_ value: VssHeaderProviderError, into buf: inout [UInt8]) { switch value { - case .InvalidData(_ /* message is ignored*/ ): + + + + + case .InvalidData(_ /* message is ignored*/): writeInt(&buf, Int32(1)) - case .RequestError(_ /* message is ignored*/ ): + case .RequestError(_ /* message is ignored*/): writeInt(&buf, Int32(2)) - case .AuthorizationError(_ /* message is ignored*/ ): + case .AuthorizationError(_ /* message is ignored*/): writeInt(&buf, Int32(3)) - case .InternalError(_ /* message is ignored*/ ): + case .InternalError(_ /* message is ignored*/): writeInt(&buf, Int32(4)) + + } } } + extension VssHeaderProviderError: Equatable, Hashable {} -extension VssHeaderProviderError: Error {} +extension VssHeaderProviderError: Error { } -private struct FfiConverterOptionUInt8: FfiConverterRustBuffer { +fileprivate struct FfiConverterOptionUInt8: FfiConverterRustBuffer { typealias SwiftType = UInt8? public static func write(_ value: SwiftType, into buf: inout [UInt8]) { @@ -7003,7 +7841,7 @@ private struct FfiConverterOptionUInt8: FfiConverterRustBuffer { } } -private struct FfiConverterOptionUInt16: FfiConverterRustBuffer { +fileprivate struct FfiConverterOptionUInt16: FfiConverterRustBuffer { typealias SwiftType = UInt16? public static func write(_ value: SwiftType, into buf: inout [UInt8]) { @@ -7024,7 +7862,7 @@ private struct FfiConverterOptionUInt16: FfiConverterRustBuffer { } } -private struct FfiConverterOptionUInt32: FfiConverterRustBuffer { +fileprivate struct FfiConverterOptionUInt32: FfiConverterRustBuffer { typealias SwiftType = UInt32? public static func write(_ value: SwiftType, into buf: inout [UInt8]) { @@ -7045,7 +7883,7 @@ private struct FfiConverterOptionUInt32: FfiConverterRustBuffer { } } -private struct FfiConverterOptionUInt64: FfiConverterRustBuffer { +fileprivate struct FfiConverterOptionUInt64: FfiConverterRustBuffer { typealias SwiftType = UInt64? public static func write(_ value: SwiftType, into buf: inout [UInt8]) { @@ -7066,7 +7904,7 @@ private struct FfiConverterOptionUInt64: FfiConverterRustBuffer { } } -private struct FfiConverterOptionBool: FfiConverterRustBuffer { +fileprivate struct FfiConverterOptionBool: FfiConverterRustBuffer { typealias SwiftType = Bool? public static func write(_ value: SwiftType, into buf: inout [UInt8]) { @@ -7087,7 +7925,7 @@ private struct FfiConverterOptionBool: FfiConverterRustBuffer { } } -private struct FfiConverterOptionString: FfiConverterRustBuffer { +fileprivate struct FfiConverterOptionString: FfiConverterRustBuffer { typealias SwiftType = String? public static func write(_ value: SwiftType, into buf: inout [UInt8]) { @@ -7108,7 +7946,7 @@ private struct FfiConverterOptionString: FfiConverterRustBuffer { } } -private struct FfiConverterOptionTypeFeeRate: FfiConverterRustBuffer { +fileprivate struct FfiConverterOptionTypeFeeRate: FfiConverterRustBuffer { typealias SwiftType = FeeRate? public static func write(_ value: SwiftType, into buf: inout [UInt8]) { @@ -7129,7 +7967,7 @@ private struct FfiConverterOptionTypeFeeRate: FfiConverterRustBuffer { } } -private struct FfiConverterOptionTypeAnchorChannelsConfig: FfiConverterRustBuffer { +fileprivate struct FfiConverterOptionTypeAnchorChannelsConfig: FfiConverterRustBuffer { typealias SwiftType = AnchorChannelsConfig? public static func write(_ value: SwiftType, into buf: inout [UInt8]) { @@ -7150,7 +7988,7 @@ private struct FfiConverterOptionTypeAnchorChannelsConfig: FfiConverterRustBuffe } } -private struct FfiConverterOptionTypeBackgroundSyncConfig: FfiConverterRustBuffer { +fileprivate struct FfiConverterOptionTypeBackgroundSyncConfig: FfiConverterRustBuffer { typealias SwiftType = BackgroundSyncConfig? public static func write(_ value: SwiftType, into buf: inout [UInt8]) { @@ -7171,7 +8009,7 @@ private struct FfiConverterOptionTypeBackgroundSyncConfig: FfiConverterRustBuffe } } -private struct FfiConverterOptionTypeBolt11PaymentInfo: FfiConverterRustBuffer { +fileprivate struct FfiConverterOptionTypeBolt11PaymentInfo: FfiConverterRustBuffer { typealias SwiftType = Bolt11PaymentInfo? public static func write(_ value: SwiftType, into buf: inout [UInt8]) { @@ -7192,7 +8030,7 @@ private struct FfiConverterOptionTypeBolt11PaymentInfo: FfiConverterRustBuffer { } } -private struct FfiConverterOptionTypeChannelConfig: FfiConverterRustBuffer { +fileprivate struct FfiConverterOptionTypeChannelConfig: FfiConverterRustBuffer { typealias SwiftType = ChannelConfig? public static func write(_ value: SwiftType, into buf: inout [UInt8]) { @@ -7213,7 +8051,7 @@ private struct FfiConverterOptionTypeChannelConfig: FfiConverterRustBuffer { } } -private struct FfiConverterOptionTypeChannelInfo: FfiConverterRustBuffer { +fileprivate struct FfiConverterOptionTypeChannelInfo: FfiConverterRustBuffer { typealias SwiftType = ChannelInfo? public static func write(_ value: SwiftType, into buf: inout [UInt8]) { @@ -7234,7 +8072,7 @@ private struct FfiConverterOptionTypeChannelInfo: FfiConverterRustBuffer { } } -private struct FfiConverterOptionTypeChannelOrderInfo: FfiConverterRustBuffer { +fileprivate struct FfiConverterOptionTypeChannelOrderInfo: FfiConverterRustBuffer { typealias SwiftType = ChannelOrderInfo? public static func write(_ value: SwiftType, into buf: inout [UInt8]) { @@ -7255,7 +8093,7 @@ private struct FfiConverterOptionTypeChannelOrderInfo: FfiConverterRustBuffer { } } -private struct FfiConverterOptionTypeChannelUpdateInfo: FfiConverterRustBuffer { +fileprivate struct FfiConverterOptionTypeChannelUpdateInfo: FfiConverterRustBuffer { typealias SwiftType = ChannelUpdateInfo? public static func write(_ value: SwiftType, into buf: inout [UInt8]) { @@ -7276,7 +8114,7 @@ private struct FfiConverterOptionTypeChannelUpdateInfo: FfiConverterRustBuffer { } } -private struct FfiConverterOptionTypeElectrumSyncConfig: FfiConverterRustBuffer { +fileprivate struct FfiConverterOptionTypeElectrumSyncConfig: FfiConverterRustBuffer { typealias SwiftType = ElectrumSyncConfig? public static func write(_ value: SwiftType, into buf: inout [UInt8]) { @@ -7297,7 +8135,7 @@ private struct FfiConverterOptionTypeElectrumSyncConfig: FfiConverterRustBuffer } } -private struct FfiConverterOptionTypeEsploraSyncConfig: FfiConverterRustBuffer { +fileprivate struct FfiConverterOptionTypeEsploraSyncConfig: FfiConverterRustBuffer { typealias SwiftType = EsploraSyncConfig? public static func write(_ value: SwiftType, into buf: inout [UInt8]) { @@ -7318,7 +8156,7 @@ private struct FfiConverterOptionTypeEsploraSyncConfig: FfiConverterRustBuffer { } } -private struct FfiConverterOptionTypeNodeAnnouncementInfo: FfiConverterRustBuffer { +fileprivate struct FfiConverterOptionTypeNodeAnnouncementInfo: FfiConverterRustBuffer { typealias SwiftType = NodeAnnouncementInfo? public static func write(_ value: SwiftType, into buf: inout [UInt8]) { @@ -7339,7 +8177,7 @@ private struct FfiConverterOptionTypeNodeAnnouncementInfo: FfiConverterRustBuffe } } -private struct FfiConverterOptionTypeNodeInfo: FfiConverterRustBuffer { +fileprivate struct FfiConverterOptionTypeNodeInfo: FfiConverterRustBuffer { typealias SwiftType = NodeInfo? public static func write(_ value: SwiftType, into buf: inout [UInt8]) { @@ -7360,7 +8198,7 @@ private struct FfiConverterOptionTypeNodeInfo: FfiConverterRustBuffer { } } -private struct FfiConverterOptionTypeOnchainPaymentInfo: FfiConverterRustBuffer { +fileprivate struct FfiConverterOptionTypeOnchainPaymentInfo: FfiConverterRustBuffer { typealias SwiftType = OnchainPaymentInfo? public static func write(_ value: SwiftType, into buf: inout [UInt8]) { @@ -7381,7 +8219,7 @@ private struct FfiConverterOptionTypeOnchainPaymentInfo: FfiConverterRustBuffer } } -private struct FfiConverterOptionTypeOutPoint: FfiConverterRustBuffer { +fileprivate struct FfiConverterOptionTypeOutPoint: FfiConverterRustBuffer { typealias SwiftType = OutPoint? public static func write(_ value: SwiftType, into buf: inout [UInt8]) { @@ -7402,7 +8240,7 @@ private struct FfiConverterOptionTypeOutPoint: FfiConverterRustBuffer { } } -private struct FfiConverterOptionTypePaymentDetails: FfiConverterRustBuffer { +fileprivate struct FfiConverterOptionTypePaymentDetails: FfiConverterRustBuffer { typealias SwiftType = PaymentDetails? public static func write(_ value: SwiftType, into buf: inout [UInt8]) { @@ -7423,7 +8261,7 @@ private struct FfiConverterOptionTypePaymentDetails: FfiConverterRustBuffer { } } -private struct FfiConverterOptionTypeSendingParameters: FfiConverterRustBuffer { +fileprivate struct FfiConverterOptionTypeSendingParameters: FfiConverterRustBuffer { typealias SwiftType = SendingParameters? public static func write(_ value: SwiftType, into buf: inout [UInt8]) { @@ -7444,7 +8282,7 @@ private struct FfiConverterOptionTypeSendingParameters: FfiConverterRustBuffer { } } -private struct FfiConverterOptionTypeClosureReason: FfiConverterRustBuffer { +fileprivate struct FfiConverterOptionTypeClosureReason: FfiConverterRustBuffer { typealias SwiftType = ClosureReason? public static func write(_ value: SwiftType, into buf: inout [UInt8]) { @@ -7465,7 +8303,7 @@ private struct FfiConverterOptionTypeClosureReason: FfiConverterRustBuffer { } } -private struct FfiConverterOptionTypeEvent: FfiConverterRustBuffer { +fileprivate struct FfiConverterOptionTypeEvent: FfiConverterRustBuffer { typealias SwiftType = Event? public static func write(_ value: SwiftType, into buf: inout [UInt8]) { @@ -7486,7 +8324,7 @@ private struct FfiConverterOptionTypeEvent: FfiConverterRustBuffer { } } -private struct FfiConverterOptionTypeLogLevel: FfiConverterRustBuffer { +fileprivate struct FfiConverterOptionTypeLogLevel: FfiConverterRustBuffer { typealias SwiftType = LogLevel? public static func write(_ value: SwiftType, into buf: inout [UInt8]) { @@ -7507,7 +8345,7 @@ private struct FfiConverterOptionTypeLogLevel: FfiConverterRustBuffer { } } -private struct FfiConverterOptionTypeMaxTotalRoutingFeeLimit: FfiConverterRustBuffer { +fileprivate struct FfiConverterOptionTypeMaxTotalRoutingFeeLimit: FfiConverterRustBuffer { typealias SwiftType = MaxTotalRoutingFeeLimit? public static func write(_ value: SwiftType, into buf: inout [UInt8]) { @@ -7528,7 +8366,7 @@ private struct FfiConverterOptionTypeMaxTotalRoutingFeeLimit: FfiConverterRustBu } } -private struct FfiConverterOptionTypePaymentFailureReason: FfiConverterRustBuffer { +fileprivate struct FfiConverterOptionTypePaymentFailureReason: FfiConverterRustBuffer { typealias SwiftType = PaymentFailureReason? public static func write(_ value: SwiftType, into buf: inout [UInt8]) { @@ -7549,7 +8387,7 @@ private struct FfiConverterOptionTypePaymentFailureReason: FfiConverterRustBuffe } } -private struct FfiConverterOptionSequenceTypeSpendableUtxo: FfiConverterRustBuffer { +fileprivate struct FfiConverterOptionSequenceTypeSpendableUtxo: FfiConverterRustBuffer { typealias SwiftType = [SpendableUtxo]? public static func write(_ value: SwiftType, into buf: inout [UInt8]) { @@ -7570,7 +8408,7 @@ private struct FfiConverterOptionSequenceTypeSpendableUtxo: FfiConverterRustBuff } } -private struct FfiConverterOptionSequenceTypeSocketAddress: FfiConverterRustBuffer { +fileprivate struct FfiConverterOptionSequenceTypeSocketAddress: FfiConverterRustBuffer { typealias SwiftType = [SocketAddress]? public static func write(_ value: SwiftType, into buf: inout [UInt8]) { @@ -7591,7 +8429,7 @@ private struct FfiConverterOptionSequenceTypeSocketAddress: FfiConverterRustBuff } } -private struct FfiConverterOptionTypeAddress: FfiConverterRustBuffer { +fileprivate struct FfiConverterOptionTypeAddress: FfiConverterRustBuffer { typealias SwiftType = Address? public static func write(_ value: SwiftType, into buf: inout [UInt8]) { @@ -7612,7 +8450,7 @@ private struct FfiConverterOptionTypeAddress: FfiConverterRustBuffer { } } -private struct FfiConverterOptionTypeChannelId: FfiConverterRustBuffer { +fileprivate struct FfiConverterOptionTypeChannelId: FfiConverterRustBuffer { typealias SwiftType = ChannelId? public static func write(_ value: SwiftType, into buf: inout [UInt8]) { @@ -7633,7 +8471,7 @@ private struct FfiConverterOptionTypeChannelId: FfiConverterRustBuffer { } } -private struct FfiConverterOptionTypeNodeAlias: FfiConverterRustBuffer { +fileprivate struct FfiConverterOptionTypeNodeAlias: FfiConverterRustBuffer { typealias SwiftType = NodeAlias? public static func write(_ value: SwiftType, into buf: inout [UInt8]) { @@ -7654,7 +8492,7 @@ private struct FfiConverterOptionTypeNodeAlias: FfiConverterRustBuffer { } } -private struct FfiConverterOptionTypePaymentHash: FfiConverterRustBuffer { +fileprivate struct FfiConverterOptionTypePaymentHash: FfiConverterRustBuffer { typealias SwiftType = PaymentHash? public static func write(_ value: SwiftType, into buf: inout [UInt8]) { @@ -7675,7 +8513,7 @@ private struct FfiConverterOptionTypePaymentHash: FfiConverterRustBuffer { } } -private struct FfiConverterOptionTypePaymentId: FfiConverterRustBuffer { +fileprivate struct FfiConverterOptionTypePaymentId: FfiConverterRustBuffer { typealias SwiftType = PaymentId? public static func write(_ value: SwiftType, into buf: inout [UInt8]) { @@ -7696,7 +8534,7 @@ private struct FfiConverterOptionTypePaymentId: FfiConverterRustBuffer { } } -private struct FfiConverterOptionTypePaymentPreimage: FfiConverterRustBuffer { +fileprivate struct FfiConverterOptionTypePaymentPreimage: FfiConverterRustBuffer { typealias SwiftType = PaymentPreimage? public static func write(_ value: SwiftType, into buf: inout [UInt8]) { @@ -7717,7 +8555,7 @@ private struct FfiConverterOptionTypePaymentPreimage: FfiConverterRustBuffer { } } -private struct FfiConverterOptionTypePaymentSecret: FfiConverterRustBuffer { +fileprivate struct FfiConverterOptionTypePaymentSecret: FfiConverterRustBuffer { typealias SwiftType = PaymentSecret? public static func write(_ value: SwiftType, into buf: inout [UInt8]) { @@ -7738,7 +8576,7 @@ private struct FfiConverterOptionTypePaymentSecret: FfiConverterRustBuffer { } } -private struct FfiConverterOptionTypePublicKey: FfiConverterRustBuffer { +fileprivate struct FfiConverterOptionTypePublicKey: FfiConverterRustBuffer { typealias SwiftType = PublicKey? public static func write(_ value: SwiftType, into buf: inout [UInt8]) { @@ -7759,7 +8597,7 @@ private struct FfiConverterOptionTypePublicKey: FfiConverterRustBuffer { } } -private struct FfiConverterOptionTypeUntrustedString: FfiConverterRustBuffer { +fileprivate struct FfiConverterOptionTypeUntrustedString: FfiConverterRustBuffer { typealias SwiftType = UntrustedString? public static func write(_ value: SwiftType, into buf: inout [UInt8]) { @@ -7780,7 +8618,7 @@ private struct FfiConverterOptionTypeUntrustedString: FfiConverterRustBuffer { } } -private struct FfiConverterOptionTypeUserChannelId: FfiConverterRustBuffer { +fileprivate struct FfiConverterOptionTypeUserChannelId: FfiConverterRustBuffer { typealias SwiftType = UserChannelId? public static func write(_ value: SwiftType, into buf: inout [UInt8]) { @@ -7801,7 +8639,7 @@ private struct FfiConverterOptionTypeUserChannelId: FfiConverterRustBuffer { } } -private struct FfiConverterSequenceUInt8: FfiConverterRustBuffer { +fileprivate struct FfiConverterSequenceUInt8: FfiConverterRustBuffer { typealias SwiftType = [UInt8] public static func write(_ value: [UInt8], into buf: inout [UInt8]) { @@ -7817,13 +8655,13 @@ private struct FfiConverterSequenceUInt8: FfiConverterRustBuffer { var seq = [UInt8]() seq.reserveCapacity(Int(len)) for _ in 0 ..< len { - try seq.append(FfiConverterUInt8.read(from: &buf)) + seq.append(try FfiConverterUInt8.read(from: &buf)) } return seq } } -private struct FfiConverterSequenceUInt64: FfiConverterRustBuffer { +fileprivate struct FfiConverterSequenceUInt64: FfiConverterRustBuffer { typealias SwiftType = [UInt64] public static func write(_ value: [UInt64], into buf: inout [UInt8]) { @@ -7839,13 +8677,13 @@ private struct FfiConverterSequenceUInt64: FfiConverterRustBuffer { var seq = [UInt64]() seq.reserveCapacity(Int(len)) for _ in 0 ..< len { - try seq.append(FfiConverterUInt64.read(from: &buf)) + seq.append(try FfiConverterUInt64.read(from: &buf)) } return seq } } -private struct FfiConverterSequenceTypeChannelDetails: FfiConverterRustBuffer { +fileprivate struct FfiConverterSequenceTypeChannelDetails: FfiConverterRustBuffer { typealias SwiftType = [ChannelDetails] public static func write(_ value: [ChannelDetails], into buf: inout [UInt8]) { @@ -7861,13 +8699,13 @@ private struct FfiConverterSequenceTypeChannelDetails: FfiConverterRustBuffer { var seq = [ChannelDetails]() seq.reserveCapacity(Int(len)) for _ in 0 ..< len { - try seq.append(FfiConverterTypeChannelDetails.read(from: &buf)) + seq.append(try FfiConverterTypeChannelDetails.read(from: &buf)) } return seq } } -private struct FfiConverterSequenceTypeCustomTlvRecord: FfiConverterRustBuffer { +fileprivate struct FfiConverterSequenceTypeCustomTlvRecord: FfiConverterRustBuffer { typealias SwiftType = [CustomTlvRecord] public static func write(_ value: [CustomTlvRecord], into buf: inout [UInt8]) { @@ -7883,13 +8721,13 @@ private struct FfiConverterSequenceTypeCustomTlvRecord: FfiConverterRustBuffer { var seq = [CustomTlvRecord]() seq.reserveCapacity(Int(len)) for _ in 0 ..< len { - try seq.append(FfiConverterTypeCustomTlvRecord.read(from: &buf)) + seq.append(try FfiConverterTypeCustomTlvRecord.read(from: &buf)) } return seq } } -private struct FfiConverterSequenceTypePaymentDetails: FfiConverterRustBuffer { +fileprivate struct FfiConverterSequenceTypePaymentDetails: FfiConverterRustBuffer { typealias SwiftType = [PaymentDetails] public static func write(_ value: [PaymentDetails], into buf: inout [UInt8]) { @@ -7905,13 +8743,13 @@ private struct FfiConverterSequenceTypePaymentDetails: FfiConverterRustBuffer { var seq = [PaymentDetails]() seq.reserveCapacity(Int(len)) for _ in 0 ..< len { - try seq.append(FfiConverterTypePaymentDetails.read(from: &buf)) + seq.append(try FfiConverterTypePaymentDetails.read(from: &buf)) } return seq } } -private struct FfiConverterSequenceTypePeerDetails: FfiConverterRustBuffer { +fileprivate struct FfiConverterSequenceTypePeerDetails: FfiConverterRustBuffer { typealias SwiftType = [PeerDetails] public static func write(_ value: [PeerDetails], into buf: inout [UInt8]) { @@ -7927,13 +8765,13 @@ private struct FfiConverterSequenceTypePeerDetails: FfiConverterRustBuffer { var seq = [PeerDetails]() seq.reserveCapacity(Int(len)) for _ in 0 ..< len { - try seq.append(FfiConverterTypePeerDetails.read(from: &buf)) + seq.append(try FfiConverterTypePeerDetails.read(from: &buf)) } return seq } } -private struct FfiConverterSequenceTypeRouteHintHop: FfiConverterRustBuffer { +fileprivate struct FfiConverterSequenceTypeRouteHintHop: FfiConverterRustBuffer { typealias SwiftType = [RouteHintHop] public static func write(_ value: [RouteHintHop], into buf: inout [UInt8]) { @@ -7949,13 +8787,13 @@ private struct FfiConverterSequenceTypeRouteHintHop: FfiConverterRustBuffer { var seq = [RouteHintHop]() seq.reserveCapacity(Int(len)) for _ in 0 ..< len { - try seq.append(FfiConverterTypeRouteHintHop.read(from: &buf)) + seq.append(try FfiConverterTypeRouteHintHop.read(from: &buf)) } return seq } } -private struct FfiConverterSequenceTypeSpendableUtxo: FfiConverterRustBuffer { +fileprivate struct FfiConverterSequenceTypeSpendableUtxo: FfiConverterRustBuffer { typealias SwiftType = [SpendableUtxo] public static func write(_ value: [SpendableUtxo], into buf: inout [UInt8]) { @@ -7971,13 +8809,13 @@ private struct FfiConverterSequenceTypeSpendableUtxo: FfiConverterRustBuffer { var seq = [SpendableUtxo]() seq.reserveCapacity(Int(len)) for _ in 0 ..< len { - try seq.append(FfiConverterTypeSpendableUtxo.read(from: &buf)) + seq.append(try FfiConverterTypeSpendableUtxo.read(from: &buf)) } return seq } } -private struct FfiConverterSequenceTypeLightningBalance: FfiConverterRustBuffer { +fileprivate struct FfiConverterSequenceTypeLightningBalance: FfiConverterRustBuffer { typealias SwiftType = [LightningBalance] public static func write(_ value: [LightningBalance], into buf: inout [UInt8]) { @@ -7993,13 +8831,13 @@ private struct FfiConverterSequenceTypeLightningBalance: FfiConverterRustBuffer var seq = [LightningBalance]() seq.reserveCapacity(Int(len)) for _ in 0 ..< len { - try seq.append(FfiConverterTypeLightningBalance.read(from: &buf)) + seq.append(try FfiConverterTypeLightningBalance.read(from: &buf)) } return seq } } -private struct FfiConverterSequenceTypePendingSweepBalance: FfiConverterRustBuffer { +fileprivate struct FfiConverterSequenceTypePendingSweepBalance: FfiConverterRustBuffer { typealias SwiftType = [PendingSweepBalance] public static func write(_ value: [PendingSweepBalance], into buf: inout [UInt8]) { @@ -8015,13 +8853,13 @@ private struct FfiConverterSequenceTypePendingSweepBalance: FfiConverterRustBuff var seq = [PendingSweepBalance]() seq.reserveCapacity(Int(len)) for _ in 0 ..< len { - try seq.append(FfiConverterTypePendingSweepBalance.read(from: &buf)) + seq.append(try FfiConverterTypePendingSweepBalance.read(from: &buf)) } return seq } } -private struct FfiConverterSequenceSequenceTypeRouteHintHop: FfiConverterRustBuffer { +fileprivate struct FfiConverterSequenceSequenceTypeRouteHintHop: FfiConverterRustBuffer { typealias SwiftType = [[RouteHintHop]] public static func write(_ value: [[RouteHintHop]], into buf: inout [UInt8]) { @@ -8037,13 +8875,13 @@ private struct FfiConverterSequenceSequenceTypeRouteHintHop: FfiConverterRustBuf var seq = [[RouteHintHop]]() seq.reserveCapacity(Int(len)) for _ in 0 ..< len { - try seq.append(FfiConverterSequenceTypeRouteHintHop.read(from: &buf)) + seq.append(try FfiConverterSequenceTypeRouteHintHop.read(from: &buf)) } return seq } } -private struct FfiConverterSequenceTypeAddress: FfiConverterRustBuffer { +fileprivate struct FfiConverterSequenceTypeAddress: FfiConverterRustBuffer { typealias SwiftType = [Address] public static func write(_ value: [Address], into buf: inout [UInt8]) { @@ -8059,13 +8897,13 @@ private struct FfiConverterSequenceTypeAddress: FfiConverterRustBuffer { var seq = [Address]() seq.reserveCapacity(Int(len)) for _ in 0 ..< len { - try seq.append(FfiConverterTypeAddress.read(from: &buf)) + seq.append(try FfiConverterTypeAddress.read(from: &buf)) } return seq } } -private struct FfiConverterSequenceTypeNodeId: FfiConverterRustBuffer { +fileprivate struct FfiConverterSequenceTypeNodeId: FfiConverterRustBuffer { typealias SwiftType = [NodeId] public static func write(_ value: [NodeId], into buf: inout [UInt8]) { @@ -8081,13 +8919,13 @@ private struct FfiConverterSequenceTypeNodeId: FfiConverterRustBuffer { var seq = [NodeId]() seq.reserveCapacity(Int(len)) for _ in 0 ..< len { - try seq.append(FfiConverterTypeNodeId.read(from: &buf)) + seq.append(try FfiConverterTypeNodeId.read(from: &buf)) } return seq } } -private struct FfiConverterSequenceTypePublicKey: FfiConverterRustBuffer { +fileprivate struct FfiConverterSequenceTypePublicKey: FfiConverterRustBuffer { typealias SwiftType = [PublicKey] public static func write(_ value: [PublicKey], into buf: inout [UInt8]) { @@ -8103,13 +8941,13 @@ private struct FfiConverterSequenceTypePublicKey: FfiConverterRustBuffer { var seq = [PublicKey]() seq.reserveCapacity(Int(len)) for _ in 0 ..< len { - try seq.append(FfiConverterTypePublicKey.read(from: &buf)) + seq.append(try FfiConverterTypePublicKey.read(from: &buf)) } return seq } } -private struct FfiConverterSequenceTypeSocketAddress: FfiConverterRustBuffer { +fileprivate struct FfiConverterSequenceTypeSocketAddress: FfiConverterRustBuffer { typealias SwiftType = [SocketAddress] public static func write(_ value: [SocketAddress], into buf: inout [UInt8]) { @@ -8125,13 +8963,13 @@ private struct FfiConverterSequenceTypeSocketAddress: FfiConverterRustBuffer { var seq = [SocketAddress]() seq.reserveCapacity(Int(len)) for _ in 0 ..< len { - try seq.append(FfiConverterTypeSocketAddress.read(from: &buf)) + seq.append(try FfiConverterTypeSocketAddress.read(from: &buf)) } return seq } } -private struct FfiConverterDictionaryStringString: FfiConverterRustBuffer { +fileprivate struct FfiConverterDictionaryStringString: FfiConverterRustBuffer { public static func write(_ value: [String: String], into buf: inout [UInt8]) { let len = Int32(value.count) writeInt(&buf, len) @@ -8145,7 +8983,7 @@ private struct FfiConverterDictionaryStringString: FfiConverterRustBuffer { let len: Int32 = try readInt(&buf) var dict = [String: String]() dict.reserveCapacity(Int(len)) - for _ in 0 ..< len { + for _ in 0.. Address { return try FfiConverterTypeAddress.lift(value) } @@ -8185,6 +9025,8 @@ public func FfiConverterTypeAddress_lower(_ value: Address) -> RustBuffer { return FfiConverterTypeAddress.lower(value) } + + /** * Typealias from the type name used in the UDL file to the builtin type. This * is needed because the UDL type name is used in function/method signatures. @@ -8208,6 +9050,7 @@ public struct FfiConverterTypeBlockHash: FfiConverter { } } + public func FfiConverterTypeBlockHash_lift(_ value: RustBuffer) throws -> BlockHash { return try FfiConverterTypeBlockHash.lift(value) } @@ -8216,6 +9059,8 @@ public func FfiConverterTypeBlockHash_lower(_ value: BlockHash) -> RustBuffer { return FfiConverterTypeBlockHash.lower(value) } + + /** * Typealias from the type name used in the UDL file to the builtin type. This * is needed because the UDL type name is used in function/method signatures. @@ -8239,6 +9084,7 @@ public struct FfiConverterTypeBolt12Invoice: FfiConverter { } } + public func FfiConverterTypeBolt12Invoice_lift(_ value: RustBuffer) throws -> Bolt12Invoice { return try FfiConverterTypeBolt12Invoice.lift(value) } @@ -8247,6 +9093,8 @@ public func FfiConverterTypeBolt12Invoice_lower(_ value: Bolt12Invoice) -> RustB return FfiConverterTypeBolt12Invoice.lower(value) } + + /** * Typealias from the type name used in the UDL file to the builtin type. This * is needed because the UDL type name is used in function/method signatures. @@ -8270,6 +9118,7 @@ public struct FfiConverterTypeChannelId: FfiConverter { } } + public func FfiConverterTypeChannelId_lift(_ value: RustBuffer) throws -> ChannelId { return try FfiConverterTypeChannelId.lift(value) } @@ -8278,6 +9127,8 @@ public func FfiConverterTypeChannelId_lower(_ value: ChannelId) -> RustBuffer { return FfiConverterTypeChannelId.lower(value) } + + /** * Typealias from the type name used in the UDL file to the builtin type. This * is needed because the UDL type name is used in function/method signatures. @@ -8301,6 +9152,7 @@ public struct FfiConverterTypeDateTime: FfiConverter { } } + public func FfiConverterTypeDateTime_lift(_ value: RustBuffer) throws -> DateTime { return try FfiConverterTypeDateTime.lift(value) } @@ -8309,6 +9161,8 @@ public func FfiConverterTypeDateTime_lower(_ value: DateTime) -> RustBuffer { return FfiConverterTypeDateTime.lower(value) } + + /** * Typealias from the type name used in the UDL file to the builtin type. This * is needed because the UDL type name is used in function/method signatures. @@ -8332,6 +9186,7 @@ public struct FfiConverterTypeMnemonic: FfiConverter { } } + public func FfiConverterTypeMnemonic_lift(_ value: RustBuffer) throws -> Mnemonic { return try FfiConverterTypeMnemonic.lift(value) } @@ -8340,6 +9195,8 @@ public func FfiConverterTypeMnemonic_lower(_ value: Mnemonic) -> RustBuffer { return FfiConverterTypeMnemonic.lower(value) } + + /** * Typealias from the type name used in the UDL file to the builtin type. This * is needed because the UDL type name is used in function/method signatures. @@ -8363,6 +9220,7 @@ public struct FfiConverterTypeNodeAlias: FfiConverter { } } + public func FfiConverterTypeNodeAlias_lift(_ value: RustBuffer) throws -> NodeAlias { return try FfiConverterTypeNodeAlias.lift(value) } @@ -8371,6 +9229,8 @@ public func FfiConverterTypeNodeAlias_lower(_ value: NodeAlias) -> RustBuffer { return FfiConverterTypeNodeAlias.lower(value) } + + /** * Typealias from the type name used in the UDL file to the builtin type. This * is needed because the UDL type name is used in function/method signatures. @@ -8394,6 +9254,7 @@ public struct FfiConverterTypeNodeId: FfiConverter { } } + public func FfiConverterTypeNodeId_lift(_ value: RustBuffer) throws -> NodeId { return try FfiConverterTypeNodeId.lift(value) } @@ -8402,6 +9263,8 @@ public func FfiConverterTypeNodeId_lower(_ value: NodeId) -> RustBuffer { return FfiConverterTypeNodeId.lower(value) } + + /** * Typealias from the type name used in the UDL file to the builtin type. This * is needed because the UDL type name is used in function/method signatures. @@ -8425,6 +9288,7 @@ public struct FfiConverterTypeOffer: FfiConverter { } } + public func FfiConverterTypeOffer_lift(_ value: RustBuffer) throws -> Offer { return try FfiConverterTypeOffer.lift(value) } @@ -8433,6 +9297,8 @@ public func FfiConverterTypeOffer_lower(_ value: Offer) -> RustBuffer { return FfiConverterTypeOffer.lower(value) } + + /** * Typealias from the type name used in the UDL file to the builtin type. This * is needed because the UDL type name is used in function/method signatures. @@ -8456,6 +9322,7 @@ public struct FfiConverterTypeOfferId: FfiConverter { } } + public func FfiConverterTypeOfferId_lift(_ value: RustBuffer) throws -> OfferId { return try FfiConverterTypeOfferId.lift(value) } @@ -8464,6 +9331,8 @@ public func FfiConverterTypeOfferId_lower(_ value: OfferId) -> RustBuffer { return FfiConverterTypeOfferId.lower(value) } + + /** * Typealias from the type name used in the UDL file to the builtin type. This * is needed because the UDL type name is used in function/method signatures. @@ -8487,6 +9356,7 @@ public struct FfiConverterTypeOrderId: FfiConverter { } } + public func FfiConverterTypeOrderId_lift(_ value: RustBuffer) throws -> OrderId { return try FfiConverterTypeOrderId.lift(value) } @@ -8495,6 +9365,8 @@ public func FfiConverterTypeOrderId_lower(_ value: OrderId) -> RustBuffer { return FfiConverterTypeOrderId.lower(value) } + + /** * Typealias from the type name used in the UDL file to the builtin type. This * is needed because the UDL type name is used in function/method signatures. @@ -8518,6 +9390,7 @@ public struct FfiConverterTypePaymentHash: FfiConverter { } } + public func FfiConverterTypePaymentHash_lift(_ value: RustBuffer) throws -> PaymentHash { return try FfiConverterTypePaymentHash.lift(value) } @@ -8526,6 +9399,8 @@ public func FfiConverterTypePaymentHash_lower(_ value: PaymentHash) -> RustBuffe return FfiConverterTypePaymentHash.lower(value) } + + /** * Typealias from the type name used in the UDL file to the builtin type. This * is needed because the UDL type name is used in function/method signatures. @@ -8549,6 +9424,7 @@ public struct FfiConverterTypePaymentId: FfiConverter { } } + public func FfiConverterTypePaymentId_lift(_ value: RustBuffer) throws -> PaymentId { return try FfiConverterTypePaymentId.lift(value) } @@ -8557,6 +9433,8 @@ public func FfiConverterTypePaymentId_lower(_ value: PaymentId) -> RustBuffer { return FfiConverterTypePaymentId.lower(value) } + + /** * Typealias from the type name used in the UDL file to the builtin type. This * is needed because the UDL type name is used in function/method signatures. @@ -8580,6 +9458,7 @@ public struct FfiConverterTypePaymentPreimage: FfiConverter { } } + public func FfiConverterTypePaymentPreimage_lift(_ value: RustBuffer) throws -> PaymentPreimage { return try FfiConverterTypePaymentPreimage.lift(value) } @@ -8588,6 +9467,8 @@ public func FfiConverterTypePaymentPreimage_lower(_ value: PaymentPreimage) -> R return FfiConverterTypePaymentPreimage.lower(value) } + + /** * Typealias from the type name used in the UDL file to the builtin type. This * is needed because the UDL type name is used in function/method signatures. @@ -8611,6 +9492,7 @@ public struct FfiConverterTypePaymentSecret: FfiConverter { } } + public func FfiConverterTypePaymentSecret_lift(_ value: RustBuffer) throws -> PaymentSecret { return try FfiConverterTypePaymentSecret.lift(value) } @@ -8619,6 +9501,8 @@ public func FfiConverterTypePaymentSecret_lower(_ value: PaymentSecret) -> RustB return FfiConverterTypePaymentSecret.lower(value) } + + /** * Typealias from the type name used in the UDL file to the builtin type. This * is needed because the UDL type name is used in function/method signatures. @@ -8642,6 +9526,7 @@ public struct FfiConverterTypePublicKey: FfiConverter { } } + public func FfiConverterTypePublicKey_lift(_ value: RustBuffer) throws -> PublicKey { return try FfiConverterTypePublicKey.lift(value) } @@ -8650,6 +9535,8 @@ public func FfiConverterTypePublicKey_lower(_ value: PublicKey) -> RustBuffer { return FfiConverterTypePublicKey.lower(value) } + + /** * Typealias from the type name used in the UDL file to the builtin type. This * is needed because the UDL type name is used in function/method signatures. @@ -8673,6 +9560,7 @@ public struct FfiConverterTypeRefund: FfiConverter { } } + public func FfiConverterTypeRefund_lift(_ value: RustBuffer) throws -> Refund { return try FfiConverterTypeRefund.lift(value) } @@ -8681,6 +9569,8 @@ public func FfiConverterTypeRefund_lower(_ value: Refund) -> RustBuffer { return FfiConverterTypeRefund.lower(value) } + + /** * Typealias from the type name used in the UDL file to the builtin type. This * is needed because the UDL type name is used in function/method signatures. @@ -8704,6 +9594,7 @@ public struct FfiConverterTypeSocketAddress: FfiConverter { } } + public func FfiConverterTypeSocketAddress_lift(_ value: RustBuffer) throws -> SocketAddress { return try FfiConverterTypeSocketAddress.lift(value) } @@ -8712,6 +9603,8 @@ public func FfiConverterTypeSocketAddress_lower(_ value: SocketAddress) -> RustB return FfiConverterTypeSocketAddress.lower(value) } + + /** * Typealias from the type name used in the UDL file to the builtin type. This * is needed because the UDL type name is used in function/method signatures. @@ -8735,6 +9628,7 @@ public struct FfiConverterTypeTxid: FfiConverter { } } + public func FfiConverterTypeTxid_lift(_ value: RustBuffer) throws -> Txid { return try FfiConverterTypeTxid.lift(value) } @@ -8743,6 +9637,8 @@ public func FfiConverterTypeTxid_lower(_ value: Txid) -> RustBuffer { return FfiConverterTypeTxid.lower(value) } + + /** * Typealias from the type name used in the UDL file to the builtin type. This * is needed because the UDL type name is used in function/method signatures. @@ -8766,6 +9662,7 @@ public struct FfiConverterTypeUntrustedString: FfiConverter { } } + public func FfiConverterTypeUntrustedString_lift(_ value: RustBuffer) throws -> UntrustedString { return try FfiConverterTypeUntrustedString.lift(value) } @@ -8774,6 +9671,8 @@ public func FfiConverterTypeUntrustedString_lower(_ value: UntrustedString) -> R return FfiConverterTypeUntrustedString.lower(value) } + + /** * Typealias from the type name used in the UDL file to the builtin type. This * is needed because the UDL type name is used in function/method signatures. @@ -8797,6 +9696,7 @@ public struct FfiConverterTypeUserChannelId: FfiConverter { } } + public func FfiConverterTypeUserChannelId_lift(_ value: RustBuffer) throws -> UserChannelId { return try FfiConverterTypeUserChannelId.lift(value) } @@ -8808,13 +9708,13 @@ public func FfiConverterTypeUserChannelId_lower(_ value: UserChannelId) -> RustB private let UNIFFI_RUST_FUTURE_POLL_READY: Int8 = 0 private let UNIFFI_RUST_FUTURE_POLL_MAYBE_READY: Int8 = 1 -private let uniffiContinuationHandleMap = UniffiHandleMap>() +fileprivate let uniffiContinuationHandleMap = UniffiHandleMap>() -private func uniffiRustCallAsync( +fileprivate func uniffiRustCallAsync( rustFutureFunc: () -> UInt64, - pollFunc: (UInt64, @escaping UniffiRustFutureContinuationCallback, UInt64) -> Void, + pollFunc: (UInt64, @escaping UniffiRustFutureContinuationCallback, UInt64) -> (), completeFunc: (UInt64, UnsafeMutablePointer) -> F, - freeFunc: (UInt64) -> Void, + freeFunc: (UInt64) -> (), liftFunc: (F) throws -> T, errorHandler: ((RustBuffer) throws -> Error)? ) async throws -> T { @@ -8825,7 +9725,7 @@ private func uniffiRustCallAsync( defer { freeFunc(rustFuture) } - var pollResult: Int8 + var pollResult: Int8; repeat { pollResult = await withUnsafeContinuation { pollFunc( @@ -8844,26 +9744,24 @@ private func uniffiRustCallAsync( // Callback handlers for an async calls. These are invoked by Rust when the future is ready. They // lift the return value or error and resume the suspended function. -private func uniffiFutureContinuationCallback(handle: UInt64, pollResult: Int8) { +fileprivate func uniffiFutureContinuationCallback(handle: UInt64, pollResult: Int8) { if let continuation = try? uniffiContinuationHandleMap.remove(handle: handle) { continuation.resume(returning: pollResult) } else { print("uniffiFutureContinuationCallback invalid handle") } } - public func defaultConfig() -> Config { - return try! FfiConverterTypeConfig.lift(try! rustCall { - uniffi_ldk_node_fn_func_default_config($0 - ) - }) + return try! FfiConverterTypeConfig.lift(try! rustCall() { + uniffi_ldk_node_fn_func_default_config($0 + ) +}) } - public func generateEntropyMnemonic() -> Mnemonic { - return try! FfiConverterTypeMnemonic.lift(try! rustCall { - uniffi_ldk_node_fn_func_generate_entropy_mnemonic($0 - ) - }) + return try! FfiConverterTypeMnemonic.lift(try! rustCall() { + uniffi_ldk_node_fn_func_generate_entropy_mnemonic($0 + ) +}) } private enum InitializationResult { @@ -8871,7 +9769,6 @@ private enum InitializationResult { case contractVersionMismatch case apiChecksumMismatch } - // Use a global variables to perform the versioning checks. Swift ensures that // the code inside is only computed once. private var initializationResult: InitializationResult { @@ -8882,379 +9779,385 @@ private var initializationResult: InitializationResult { if bindings_contract_version != scaffolding_contract_version { return InitializationResult.contractVersionMismatch } - if uniffi_ldk_node_checksum_func_default_config() != 55381 { + if (uniffi_ldk_node_checksum_func_default_config() != 55381) { + return InitializationResult.apiChecksumMismatch + } + if (uniffi_ldk_node_checksum_func_generate_entropy_mnemonic() != 59926) { + return InitializationResult.apiChecksumMismatch + } + if (uniffi_ldk_node_checksum_method_bolt11invoice_amount_milli_satoshis() != 50823) { return InitializationResult.apiChecksumMismatch } - if uniffi_ldk_node_checksum_func_generate_entropy_mnemonic() != 59926 { + if (uniffi_ldk_node_checksum_method_bolt11invoice_currency() != 32179) { return InitializationResult.apiChecksumMismatch } - if uniffi_ldk_node_checksum_method_bolt11invoice_amount_milli_satoshis() != 50823 { + if (uniffi_ldk_node_checksum_method_bolt11invoice_expiry_time_seconds() != 23625) { return InitializationResult.apiChecksumMismatch } - if uniffi_ldk_node_checksum_method_bolt11invoice_currency() != 32179 { + if (uniffi_ldk_node_checksum_method_bolt11invoice_fallback_addresses() != 55276) { return InitializationResult.apiChecksumMismatch } - if uniffi_ldk_node_checksum_method_bolt11invoice_expiry_time_seconds() != 23625 { + if (uniffi_ldk_node_checksum_method_bolt11invoice_invoice_description() != 395) { return InitializationResult.apiChecksumMismatch } - if uniffi_ldk_node_checksum_method_bolt11invoice_fallback_addresses() != 55276 { + if (uniffi_ldk_node_checksum_method_bolt11invoice_is_expired() != 15932) { return InitializationResult.apiChecksumMismatch } - if uniffi_ldk_node_checksum_method_bolt11invoice_invoice_description() != 395 { + if (uniffi_ldk_node_checksum_method_bolt11invoice_min_final_cltv_expiry_delta() != 8855) { return InitializationResult.apiChecksumMismatch } - if uniffi_ldk_node_checksum_method_bolt11invoice_is_expired() != 15932 { + if (uniffi_ldk_node_checksum_method_bolt11invoice_network() != 10420) { return InitializationResult.apiChecksumMismatch } - if uniffi_ldk_node_checksum_method_bolt11invoice_min_final_cltv_expiry_delta() != 8855 { + if (uniffi_ldk_node_checksum_method_bolt11invoice_payment_hash() != 42571) { return InitializationResult.apiChecksumMismatch } - if uniffi_ldk_node_checksum_method_bolt11invoice_network() != 10420 { + if (uniffi_ldk_node_checksum_method_bolt11invoice_payment_secret() != 26081) { return InitializationResult.apiChecksumMismatch } - if uniffi_ldk_node_checksum_method_bolt11invoice_payment_hash() != 42571 { + if (uniffi_ldk_node_checksum_method_bolt11invoice_recover_payee_pub_key() != 18874) { return InitializationResult.apiChecksumMismatch } - if uniffi_ldk_node_checksum_method_bolt11invoice_payment_secret() != 26081 { + if (uniffi_ldk_node_checksum_method_bolt11invoice_route_hints() != 63051) { return InitializationResult.apiChecksumMismatch } - if uniffi_ldk_node_checksum_method_bolt11invoice_recover_payee_pub_key() != 18874 { + if (uniffi_ldk_node_checksum_method_bolt11invoice_seconds_since_epoch() != 53979) { return InitializationResult.apiChecksumMismatch } - if uniffi_ldk_node_checksum_method_bolt11invoice_route_hints() != 63051 { + if (uniffi_ldk_node_checksum_method_bolt11invoice_seconds_until_expiry() != 64193) { return InitializationResult.apiChecksumMismatch } - if uniffi_ldk_node_checksum_method_bolt11invoice_seconds_since_epoch() != 53979 { + if (uniffi_ldk_node_checksum_method_bolt11invoice_signable_hash() != 30910) { return InitializationResult.apiChecksumMismatch } - if uniffi_ldk_node_checksum_method_bolt11invoice_seconds_until_expiry() != 64193 { + if (uniffi_ldk_node_checksum_method_bolt11invoice_would_expire() != 30331) { return InitializationResult.apiChecksumMismatch } - if uniffi_ldk_node_checksum_method_bolt11invoice_signable_hash() != 30910 { + if (uniffi_ldk_node_checksum_method_bolt11payment_claim_for_hash() != 52848) { return InitializationResult.apiChecksumMismatch } - if uniffi_ldk_node_checksum_method_bolt11invoice_would_expire() != 30331 { + if (uniffi_ldk_node_checksum_method_bolt11payment_estimate_routing_fees() != 5123) { return InitializationResult.apiChecksumMismatch } - if uniffi_ldk_node_checksum_method_bolt11payment_claim_for_hash() != 52848 { + if (uniffi_ldk_node_checksum_method_bolt11payment_estimate_routing_fees_using_amount() != 46411) { return InitializationResult.apiChecksumMismatch } - if uniffi_ldk_node_checksum_method_bolt11payment_fail_for_hash() != 24516 { + if (uniffi_ldk_node_checksum_method_bolt11payment_fail_for_hash() != 24516) { return InitializationResult.apiChecksumMismatch } - if uniffi_ldk_node_checksum_method_bolt11payment_receive() != 6073 { + if (uniffi_ldk_node_checksum_method_bolt11payment_receive() != 6073) { return InitializationResult.apiChecksumMismatch } - if uniffi_ldk_node_checksum_method_bolt11payment_receive_for_hash() != 27050 { + if (uniffi_ldk_node_checksum_method_bolt11payment_receive_for_hash() != 27050) { return InitializationResult.apiChecksumMismatch } - if uniffi_ldk_node_checksum_method_bolt11payment_receive_variable_amount() != 4893 { + if (uniffi_ldk_node_checksum_method_bolt11payment_receive_variable_amount() != 4893) { return InitializationResult.apiChecksumMismatch } - if uniffi_ldk_node_checksum_method_bolt11payment_receive_variable_amount_for_hash() != 1402 { + if (uniffi_ldk_node_checksum_method_bolt11payment_receive_variable_amount_for_hash() != 1402) { return InitializationResult.apiChecksumMismatch } - if uniffi_ldk_node_checksum_method_bolt11payment_receive_variable_amount_via_jit_channel() != 24506 { + if (uniffi_ldk_node_checksum_method_bolt11payment_receive_variable_amount_via_jit_channel() != 24506) { return InitializationResult.apiChecksumMismatch } - if uniffi_ldk_node_checksum_method_bolt11payment_receive_via_jit_channel() != 16532 { + if (uniffi_ldk_node_checksum_method_bolt11payment_receive_via_jit_channel() != 16532) { return InitializationResult.apiChecksumMismatch } - if uniffi_ldk_node_checksum_method_bolt11payment_send() != 63952 { + if (uniffi_ldk_node_checksum_method_bolt11payment_send() != 63952) { return InitializationResult.apiChecksumMismatch } - if uniffi_ldk_node_checksum_method_bolt11payment_send_probes() != 969 { + if (uniffi_ldk_node_checksum_method_bolt11payment_send_probes() != 969) { return InitializationResult.apiChecksumMismatch } - if uniffi_ldk_node_checksum_method_bolt11payment_send_probes_using_amount() != 50136 { + if (uniffi_ldk_node_checksum_method_bolt11payment_send_probes_using_amount() != 50136) { return InitializationResult.apiChecksumMismatch } - if uniffi_ldk_node_checksum_method_bolt11payment_send_using_amount() != 36530 { + if (uniffi_ldk_node_checksum_method_bolt11payment_send_using_amount() != 36530) { return InitializationResult.apiChecksumMismatch } - if uniffi_ldk_node_checksum_method_bolt12payment_initiate_refund() != 38039 { + if (uniffi_ldk_node_checksum_method_bolt12payment_initiate_refund() != 38039) { return InitializationResult.apiChecksumMismatch } - if uniffi_ldk_node_checksum_method_bolt12payment_receive() != 15049 { + if (uniffi_ldk_node_checksum_method_bolt12payment_receive() != 15049) { return InitializationResult.apiChecksumMismatch } - if uniffi_ldk_node_checksum_method_bolt12payment_receive_variable_amount() != 7279 { + if (uniffi_ldk_node_checksum_method_bolt12payment_receive_variable_amount() != 7279) { return InitializationResult.apiChecksumMismatch } - if uniffi_ldk_node_checksum_method_bolt12payment_request_refund_payment() != 61945 { + if (uniffi_ldk_node_checksum_method_bolt12payment_request_refund_payment() != 61945) { return InitializationResult.apiChecksumMismatch } - if uniffi_ldk_node_checksum_method_bolt12payment_send() != 56449 { + if (uniffi_ldk_node_checksum_method_bolt12payment_send() != 56449) { return InitializationResult.apiChecksumMismatch } - if uniffi_ldk_node_checksum_method_bolt12payment_send_using_amount() != 26006 { + if (uniffi_ldk_node_checksum_method_bolt12payment_send_using_amount() != 26006) { return InitializationResult.apiChecksumMismatch } - if uniffi_ldk_node_checksum_method_builder_build() != 785 { + if (uniffi_ldk_node_checksum_method_builder_build() != 785) { return InitializationResult.apiChecksumMismatch } - if uniffi_ldk_node_checksum_method_builder_build_with_fs_store() != 61304 { + if (uniffi_ldk_node_checksum_method_builder_build_with_fs_store() != 61304) { return InitializationResult.apiChecksumMismatch } - if uniffi_ldk_node_checksum_method_builder_build_with_vss_store() != 2871 { + if (uniffi_ldk_node_checksum_method_builder_build_with_vss_store() != 2871) { return InitializationResult.apiChecksumMismatch } - if uniffi_ldk_node_checksum_method_builder_build_with_vss_store_and_fixed_headers() != 24910 { + if (uniffi_ldk_node_checksum_method_builder_build_with_vss_store_and_fixed_headers() != 24910) { return InitializationResult.apiChecksumMismatch } - if uniffi_ldk_node_checksum_method_builder_build_with_vss_store_and_header_provider() != 9090 { + if (uniffi_ldk_node_checksum_method_builder_build_with_vss_store_and_header_provider() != 9090) { return InitializationResult.apiChecksumMismatch } - if uniffi_ldk_node_checksum_method_builder_set_announcement_addresses() != 39271 { + if (uniffi_ldk_node_checksum_method_builder_set_announcement_addresses() != 39271) { return InitializationResult.apiChecksumMismatch } - if uniffi_ldk_node_checksum_method_builder_set_chain_source_bitcoind_rpc() != 2111 { + if (uniffi_ldk_node_checksum_method_builder_set_chain_source_bitcoind_rpc() != 2111) { return InitializationResult.apiChecksumMismatch } - if uniffi_ldk_node_checksum_method_builder_set_chain_source_electrum() != 55552 { + if (uniffi_ldk_node_checksum_method_builder_set_chain_source_electrum() != 55552) { return InitializationResult.apiChecksumMismatch } - if uniffi_ldk_node_checksum_method_builder_set_chain_source_esplora() != 1781 { + if (uniffi_ldk_node_checksum_method_builder_set_chain_source_esplora() != 1781) { return InitializationResult.apiChecksumMismatch } - if uniffi_ldk_node_checksum_method_builder_set_custom_logger() != 51232 { + if (uniffi_ldk_node_checksum_method_builder_set_custom_logger() != 51232) { return InitializationResult.apiChecksumMismatch } - if uniffi_ldk_node_checksum_method_builder_set_entropy_bip39_mnemonic() != 827 { + if (uniffi_ldk_node_checksum_method_builder_set_entropy_bip39_mnemonic() != 827) { return InitializationResult.apiChecksumMismatch } - if uniffi_ldk_node_checksum_method_builder_set_entropy_seed_bytes() != 44799 { + if (uniffi_ldk_node_checksum_method_builder_set_entropy_seed_bytes() != 44799) { return InitializationResult.apiChecksumMismatch } - if uniffi_ldk_node_checksum_method_builder_set_entropy_seed_path() != 64056 { + if (uniffi_ldk_node_checksum_method_builder_set_entropy_seed_path() != 64056) { return InitializationResult.apiChecksumMismatch } - if uniffi_ldk_node_checksum_method_builder_set_filesystem_logger() != 10249 { + if (uniffi_ldk_node_checksum_method_builder_set_filesystem_logger() != 10249) { return InitializationResult.apiChecksumMismatch } - if uniffi_ldk_node_checksum_method_builder_set_gossip_source_p2p() != 9279 { + if (uniffi_ldk_node_checksum_method_builder_set_gossip_source_p2p() != 9279) { return InitializationResult.apiChecksumMismatch } - if uniffi_ldk_node_checksum_method_builder_set_gossip_source_rgs() != 64312 { + if (uniffi_ldk_node_checksum_method_builder_set_gossip_source_rgs() != 64312) { return InitializationResult.apiChecksumMismatch } - if uniffi_ldk_node_checksum_method_builder_set_liquidity_source_lsps1() != 51527 { + if (uniffi_ldk_node_checksum_method_builder_set_liquidity_source_lsps1() != 51527) { return InitializationResult.apiChecksumMismatch } - if uniffi_ldk_node_checksum_method_builder_set_liquidity_source_lsps2() != 14430 { + if (uniffi_ldk_node_checksum_method_builder_set_liquidity_source_lsps2() != 14430) { return InitializationResult.apiChecksumMismatch } - if uniffi_ldk_node_checksum_method_builder_set_listening_addresses() != 14051 { + if (uniffi_ldk_node_checksum_method_builder_set_listening_addresses() != 14051) { return InitializationResult.apiChecksumMismatch } - if uniffi_ldk_node_checksum_method_builder_set_log_facade_logger() != 58410 { + if (uniffi_ldk_node_checksum_method_builder_set_log_facade_logger() != 58410) { return InitializationResult.apiChecksumMismatch } - if uniffi_ldk_node_checksum_method_builder_set_network() != 27539 { + if (uniffi_ldk_node_checksum_method_builder_set_network() != 27539) { return InitializationResult.apiChecksumMismatch } - if uniffi_ldk_node_checksum_method_builder_set_node_alias() != 18342 { + if (uniffi_ldk_node_checksum_method_builder_set_node_alias() != 18342) { return InitializationResult.apiChecksumMismatch } - if uniffi_ldk_node_checksum_method_builder_set_storage_dir_path() != 59019 { + if (uniffi_ldk_node_checksum_method_builder_set_storage_dir_path() != 59019) { return InitializationResult.apiChecksumMismatch } - if uniffi_ldk_node_checksum_method_feerate_to_sat_per_kwu() != 58911 { + if (uniffi_ldk_node_checksum_method_feerate_to_sat_per_kwu() != 58911) { return InitializationResult.apiChecksumMismatch } - if uniffi_ldk_node_checksum_method_feerate_to_sat_per_vb_ceil() != 58575 { + if (uniffi_ldk_node_checksum_method_feerate_to_sat_per_vb_ceil() != 58575) { return InitializationResult.apiChecksumMismatch } - if uniffi_ldk_node_checksum_method_feerate_to_sat_per_vb_floor() != 59617 { + if (uniffi_ldk_node_checksum_method_feerate_to_sat_per_vb_floor() != 59617) { return InitializationResult.apiChecksumMismatch } - if uniffi_ldk_node_checksum_method_lsps1liquidity_check_order_status() != 64731 { + if (uniffi_ldk_node_checksum_method_lsps1liquidity_check_order_status() != 64731) { return InitializationResult.apiChecksumMismatch } - if uniffi_ldk_node_checksum_method_lsps1liquidity_request_channel() != 18153 { + if (uniffi_ldk_node_checksum_method_lsps1liquidity_request_channel() != 18153) { return InitializationResult.apiChecksumMismatch } - if uniffi_ldk_node_checksum_method_logwriter_log() != 3299 { + if (uniffi_ldk_node_checksum_method_logwriter_log() != 3299) { return InitializationResult.apiChecksumMismatch } - if uniffi_ldk_node_checksum_method_networkgraph_channel() != 38070 { + if (uniffi_ldk_node_checksum_method_networkgraph_channel() != 38070) { return InitializationResult.apiChecksumMismatch } - if uniffi_ldk_node_checksum_method_networkgraph_list_channels() != 4693 { + if (uniffi_ldk_node_checksum_method_networkgraph_list_channels() != 4693) { return InitializationResult.apiChecksumMismatch } - if uniffi_ldk_node_checksum_method_networkgraph_list_nodes() != 36715 { + if (uniffi_ldk_node_checksum_method_networkgraph_list_nodes() != 36715) { return InitializationResult.apiChecksumMismatch } - if uniffi_ldk_node_checksum_method_networkgraph_node() != 48925 { + if (uniffi_ldk_node_checksum_method_networkgraph_node() != 48925) { return InitializationResult.apiChecksumMismatch } - if uniffi_ldk_node_checksum_method_node_announcement_addresses() != 61426 { + if (uniffi_ldk_node_checksum_method_node_announcement_addresses() != 61426) { return InitializationResult.apiChecksumMismatch } - if uniffi_ldk_node_checksum_method_node_bolt11_payment() != 41402 { + if (uniffi_ldk_node_checksum_method_node_bolt11_payment() != 41402) { return InitializationResult.apiChecksumMismatch } - if uniffi_ldk_node_checksum_method_node_bolt12_payment() != 49254 { + if (uniffi_ldk_node_checksum_method_node_bolt12_payment() != 49254) { return InitializationResult.apiChecksumMismatch } - if uniffi_ldk_node_checksum_method_node_close_channel() != 62479 { + if (uniffi_ldk_node_checksum_method_node_close_channel() != 62479) { return InitializationResult.apiChecksumMismatch } - if uniffi_ldk_node_checksum_method_node_config() != 7511 { + if (uniffi_ldk_node_checksum_method_node_config() != 7511) { return InitializationResult.apiChecksumMismatch } - if uniffi_ldk_node_checksum_method_node_connect() != 34120 { + if (uniffi_ldk_node_checksum_method_node_connect() != 34120) { return InitializationResult.apiChecksumMismatch } - if uniffi_ldk_node_checksum_method_node_disconnect() != 43538 { + if (uniffi_ldk_node_checksum_method_node_disconnect() != 43538) { return InitializationResult.apiChecksumMismatch } - if uniffi_ldk_node_checksum_method_node_event_handled() != 38712 { + if (uniffi_ldk_node_checksum_method_node_event_handled() != 38712) { return InitializationResult.apiChecksumMismatch } - if uniffi_ldk_node_checksum_method_node_export_pathfinding_scores() != 62331 { + if (uniffi_ldk_node_checksum_method_node_export_pathfinding_scores() != 62331) { return InitializationResult.apiChecksumMismatch } - if uniffi_ldk_node_checksum_method_node_force_close_channel() != 48831 { + if (uniffi_ldk_node_checksum_method_node_force_close_channel() != 48831) { return InitializationResult.apiChecksumMismatch } - if uniffi_ldk_node_checksum_method_node_list_balances() != 57528 { + if (uniffi_ldk_node_checksum_method_node_list_balances() != 57528) { return InitializationResult.apiChecksumMismatch } - if uniffi_ldk_node_checksum_method_node_list_channels() != 7954 { + if (uniffi_ldk_node_checksum_method_node_list_channels() != 7954) { return InitializationResult.apiChecksumMismatch } - if uniffi_ldk_node_checksum_method_node_list_payments() != 35002 { + if (uniffi_ldk_node_checksum_method_node_list_payments() != 35002) { return InitializationResult.apiChecksumMismatch } - if uniffi_ldk_node_checksum_method_node_list_peers() != 14889 { + if (uniffi_ldk_node_checksum_method_node_list_peers() != 14889) { return InitializationResult.apiChecksumMismatch } - if uniffi_ldk_node_checksum_method_node_listening_addresses() != 2665 { + if (uniffi_ldk_node_checksum_method_node_listening_addresses() != 2665) { return InitializationResult.apiChecksumMismatch } - if uniffi_ldk_node_checksum_method_node_lsps1_liquidity() != 38201 { + if (uniffi_ldk_node_checksum_method_node_lsps1_liquidity() != 38201) { return InitializationResult.apiChecksumMismatch } - if uniffi_ldk_node_checksum_method_node_network_graph() != 2695 { + if (uniffi_ldk_node_checksum_method_node_network_graph() != 2695) { return InitializationResult.apiChecksumMismatch } - if uniffi_ldk_node_checksum_method_node_next_event() != 7682 { + if (uniffi_ldk_node_checksum_method_node_next_event() != 7682) { return InitializationResult.apiChecksumMismatch } - if uniffi_ldk_node_checksum_method_node_next_event_async() != 25426 { + if (uniffi_ldk_node_checksum_method_node_next_event_async() != 25426) { return InitializationResult.apiChecksumMismatch } - if uniffi_ldk_node_checksum_method_node_node_alias() != 29526 { + if (uniffi_ldk_node_checksum_method_node_node_alias() != 29526) { return InitializationResult.apiChecksumMismatch } - if uniffi_ldk_node_checksum_method_node_node_id() != 51489 { + if (uniffi_ldk_node_checksum_method_node_node_id() != 51489) { return InitializationResult.apiChecksumMismatch } - if uniffi_ldk_node_checksum_method_node_onchain_payment() != 6092 { + if (uniffi_ldk_node_checksum_method_node_onchain_payment() != 6092) { return InitializationResult.apiChecksumMismatch } - if uniffi_ldk_node_checksum_method_node_open_announced_channel() != 36623 { + if (uniffi_ldk_node_checksum_method_node_open_announced_channel() != 36623) { return InitializationResult.apiChecksumMismatch } - if uniffi_ldk_node_checksum_method_node_open_channel() != 40283 { + if (uniffi_ldk_node_checksum_method_node_open_channel() != 40283) { return InitializationResult.apiChecksumMismatch } - if uniffi_ldk_node_checksum_method_node_payment() != 60296 { + if (uniffi_ldk_node_checksum_method_node_payment() != 60296) { return InitializationResult.apiChecksumMismatch } - if uniffi_ldk_node_checksum_method_node_remove_payment() != 47952 { + if (uniffi_ldk_node_checksum_method_node_remove_payment() != 47952) { return InitializationResult.apiChecksumMismatch } - if uniffi_ldk_node_checksum_method_node_sign_message() != 49319 { + if (uniffi_ldk_node_checksum_method_node_sign_message() != 49319) { return InitializationResult.apiChecksumMismatch } - if uniffi_ldk_node_checksum_method_node_spontaneous_payment() != 37403 { + if (uniffi_ldk_node_checksum_method_node_spontaneous_payment() != 37403) { return InitializationResult.apiChecksumMismatch } - if uniffi_ldk_node_checksum_method_node_start() != 58480 { + if (uniffi_ldk_node_checksum_method_node_start() != 58480) { return InitializationResult.apiChecksumMismatch } - if uniffi_ldk_node_checksum_method_node_status() != 55952 { + if (uniffi_ldk_node_checksum_method_node_status() != 55952) { return InitializationResult.apiChecksumMismatch } - if uniffi_ldk_node_checksum_method_node_stop() != 42188 { + if (uniffi_ldk_node_checksum_method_node_stop() != 42188) { return InitializationResult.apiChecksumMismatch } - if uniffi_ldk_node_checksum_method_node_sync_wallets() != 32474 { + if (uniffi_ldk_node_checksum_method_node_sync_wallets() != 32474) { return InitializationResult.apiChecksumMismatch } - if uniffi_ldk_node_checksum_method_node_unified_qr_payment() != 9837 { + if (uniffi_ldk_node_checksum_method_node_unified_qr_payment() != 9837) { return InitializationResult.apiChecksumMismatch } - if uniffi_ldk_node_checksum_method_node_update_channel_config() != 37852 { + if (uniffi_ldk_node_checksum_method_node_update_channel_config() != 37852) { return InitializationResult.apiChecksumMismatch } - if uniffi_ldk_node_checksum_method_node_verify_signature() != 20486 { + if (uniffi_ldk_node_checksum_method_node_verify_signature() != 20486) { return InitializationResult.apiChecksumMismatch } - if uniffi_ldk_node_checksum_method_node_wait_next_event() != 55101 { + if (uniffi_ldk_node_checksum_method_node_wait_next_event() != 55101) { return InitializationResult.apiChecksumMismatch } - if uniffi_ldk_node_checksum_method_onchainpayment_accelerate_by_cpfp() != 31954 { + if (uniffi_ldk_node_checksum_method_onchainpayment_accelerate_by_cpfp() != 31954) { return InitializationResult.apiChecksumMismatch } - if uniffi_ldk_node_checksum_method_onchainpayment_bump_fee_by_rbf() != 53877 { + if (uniffi_ldk_node_checksum_method_onchainpayment_bump_fee_by_rbf() != 53877) { return InitializationResult.apiChecksumMismatch } - if uniffi_ldk_node_checksum_method_onchainpayment_calculate_cpfp_fee_rate() != 32879 { + if (uniffi_ldk_node_checksum_method_onchainpayment_calculate_cpfp_fee_rate() != 32879) { return InitializationResult.apiChecksumMismatch } - if uniffi_ldk_node_checksum_method_onchainpayment_calculate_total_fee() != 57218 { + if (uniffi_ldk_node_checksum_method_onchainpayment_calculate_total_fee() != 57218) { return InitializationResult.apiChecksumMismatch } - if uniffi_ldk_node_checksum_method_onchainpayment_list_spendable_outputs() != 19144 { + if (uniffi_ldk_node_checksum_method_onchainpayment_list_spendable_outputs() != 19144) { return InitializationResult.apiChecksumMismatch } - if uniffi_ldk_node_checksum_method_onchainpayment_new_address() != 37251 { + if (uniffi_ldk_node_checksum_method_onchainpayment_new_address() != 37251) { return InitializationResult.apiChecksumMismatch } - if uniffi_ldk_node_checksum_method_onchainpayment_select_utxos_with_algorithm() != 14084 { + if (uniffi_ldk_node_checksum_method_onchainpayment_select_utxos_with_algorithm() != 14084) { return InitializationResult.apiChecksumMismatch } - if uniffi_ldk_node_checksum_method_onchainpayment_send_all_to_address() != 37748 { + if (uniffi_ldk_node_checksum_method_onchainpayment_send_all_to_address() != 37748) { return InitializationResult.apiChecksumMismatch } - if uniffi_ldk_node_checksum_method_onchainpayment_send_to_address() != 28826 { + if (uniffi_ldk_node_checksum_method_onchainpayment_send_to_address() != 28826) { return InitializationResult.apiChecksumMismatch } - if uniffi_ldk_node_checksum_method_spontaneouspayment_send() != 48210 { + if (uniffi_ldk_node_checksum_method_spontaneouspayment_send() != 48210) { return InitializationResult.apiChecksumMismatch } - if uniffi_ldk_node_checksum_method_spontaneouspayment_send_probes() != 25937 { + if (uniffi_ldk_node_checksum_method_spontaneouspayment_send_probes() != 25937) { return InitializationResult.apiChecksumMismatch } - if uniffi_ldk_node_checksum_method_spontaneouspayment_send_with_custom_tlvs() != 2376 { + if (uniffi_ldk_node_checksum_method_spontaneouspayment_send_with_custom_tlvs() != 2376) { return InitializationResult.apiChecksumMismatch } - if uniffi_ldk_node_checksum_method_unifiedqrpayment_receive() != 913 { + if (uniffi_ldk_node_checksum_method_unifiedqrpayment_receive() != 913) { return InitializationResult.apiChecksumMismatch } - if uniffi_ldk_node_checksum_method_unifiedqrpayment_send() != 53900 { + if (uniffi_ldk_node_checksum_method_unifiedqrpayment_send() != 53900) { return InitializationResult.apiChecksumMismatch } - if uniffi_ldk_node_checksum_method_vssheaderprovider_get_headers() != 7788 { + if (uniffi_ldk_node_checksum_method_vssheaderprovider_get_headers() != 7788) { return InitializationResult.apiChecksumMismatch } - if uniffi_ldk_node_checksum_constructor_bolt11invoice_from_str() != 349 { + if (uniffi_ldk_node_checksum_constructor_bolt11invoice_from_str() != 349) { return InitializationResult.apiChecksumMismatch } - if uniffi_ldk_node_checksum_constructor_builder_from_config() != 994 { + if (uniffi_ldk_node_checksum_constructor_builder_from_config() != 994) { return InitializationResult.apiChecksumMismatch } - if uniffi_ldk_node_checksum_constructor_builder_new() != 40499 { + if (uniffi_ldk_node_checksum_constructor_builder_new() != 40499) { return InitializationResult.apiChecksumMismatch } - if uniffi_ldk_node_checksum_constructor_feerate_from_sat_per_kwu() != 50548 { + if (uniffi_ldk_node_checksum_constructor_feerate_from_sat_per_kwu() != 50548) { return InitializationResult.apiChecksumMismatch } - if uniffi_ldk_node_checksum_constructor_feerate_from_sat_per_vb_unchecked() != 41808 { + if (uniffi_ldk_node_checksum_constructor_feerate_from_sat_per_vb_unchecked() != 41808) { return InitializationResult.apiChecksumMismatch } @@ -9273,4 +10176,4 @@ private func uniffiEnsureInitialized() { } } -// swiftlint:enable all +// swiftlint:enable all \ No newline at end of file diff --git a/src/error.rs b/src/error.rs index 953af3df2..0e87ffdbc 100644 --- a/src/error.rs +++ b/src/error.rs @@ -38,6 +38,8 @@ pub enum Error { InvalidCustomTlvs, /// Sending a payment probe has failed. ProbeSendingFailed, + /// A route could not be found for fee estimation. + RouteNotFound, /// A channel could not be opened. ChannelCreationFailed, /// A channel could not be closed. @@ -148,6 +150,7 @@ impl fmt::Display for Error { Self::PaymentSendingFailed => write!(f, "Failed to send the given payment."), Self::InvalidCustomTlvs => write!(f, "Failed to construct payment with custom TLVs."), Self::ProbeSendingFailed => write!(f, "Failed to send the given payment probe."), + Self::RouteNotFound => write!(f, "Failed to find a route for fee estimation."), Self::ChannelCreationFailed => write!(f, "Failed to create channel."), Self::ChannelClosingFailed => write!(f, "Failed to close channel."), Self::ChannelConfigUpdateFailed => write!(f, "Failed to update channel config."), diff --git a/src/lib.rs b/src/lib.rs index 85a51ef3c..9b90e74f9 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -911,6 +911,7 @@ impl Node { Arc::clone(&self.peer_store), Arc::clone(&self.config), Arc::clone(&self.logger), + Arc::clone(&self._router), ) } @@ -928,6 +929,7 @@ impl Node { Arc::clone(&self.peer_store), Arc::clone(&self.config), Arc::clone(&self.logger), + Arc::clone(&self._router), )) } diff --git a/src/payment/bolt11.rs b/src/payment/bolt11.rs index 17c790d45..1527c71ed 100644 --- a/src/payment/bolt11.rs +++ b/src/payment/bolt11.rs @@ -21,13 +21,13 @@ use crate::payment::store::{ }; use crate::payment::SendingParameters; use crate::peer_store::{PeerInfo, PeerStore}; -use crate::types::{ChannelManager, PaymentStore}; +use crate::types::{ChannelManager, PaymentStore, Router}; use lightning::ln::bolt11_payment; use lightning::ln::channelmanager::{ Bolt11InvoiceParameters, PaymentId, RecipientOnionFields, Retry, RetryableSendFailure, }; -use lightning::routing::router::{PaymentParameters, RouteParameters}; +use lightning::routing::router::{PaymentParameters, RouteParameters, Router as LdkRouter}; use lightning_types::payment::{PaymentHash, PaymentPreimage}; @@ -95,6 +95,7 @@ pub struct Bolt11Payment { peer_store: Arc>>, config: Arc, logger: Arc, + router: Arc, } impl Bolt11Payment { @@ -105,6 +106,7 @@ impl Bolt11Payment { liquidity_source: Option>>>, payment_store: Arc, peer_store: Arc>>, config: Arc, logger: Arc, + router: Arc, ) -> Self { Self { runtime, @@ -115,6 +117,7 @@ impl Bolt11Payment { peer_store, config, logger, + router, } } @@ -875,4 +878,102 @@ impl Bolt11Payment { Ok(()) } + + /// Estimates the routing fees for a given invoice. + /// + /// This method calculates the routing fees that would be charged for paying the given invoice + /// without actually sending the payment. It uses the same routing logic as the actual payment + /// to provide an accurate estimation. + /// + /// Returns the estimated total routing fees in millisatoshis. + pub fn estimate_routing_fees(&self, invoice: &Bolt11Invoice) -> Result { + let invoice = maybe_convert_invoice(invoice); + let rt_lock = self.runtime.read().unwrap(); + if rt_lock.is_none() { + return Err(Error::NotRunning); + } + + let (_payment_hash, _recipient_onion, route_params) = + bolt11_payment::payment_parameters_from_invoice(&invoice).map_err(|_| { + log_error!(self.logger, "Failed to estimate routing fees due to invalid invoice."); + Error::InvalidInvoice + })?; + + let router = Arc::clone(&self.router); + let first_hops = self.channel_manager.list_usable_channels(); + let inflight_htlcs = self.channel_manager.compute_inflight_htlcs(); + + let route = router.find_route( + &self.channel_manager.get_our_node_id(), + &route_params, + Some(&first_hops.iter().collect::>()), + inflight_htlcs, + ).map_err(|e| { + log_error!(self.logger, "Failed to find route for fee estimation: {:?}", e); + Error::RouteNotFound + })?; + + let total_fees = route.paths.iter() + .map(|path| path.fee_msat()) + .sum::(); + + Ok(total_fees) + } + + /// Estimates the routing fees for a given zero-amount invoice with a specific amount. + /// + /// This method calculates the routing fees that would be charged for paying the given + /// zero-amount invoice with the specified amount without actually sending the payment. + /// + /// Returns the estimated total routing fees in millisatoshis. + pub fn estimate_routing_fees_using_amount( + &self, invoice: &Bolt11Invoice, amount_msat: u64, + ) -> Result { + let invoice = maybe_convert_invoice(invoice); + let rt_lock = self.runtime.read().unwrap(); + if rt_lock.is_none() { + return Err(Error::NotRunning); + } + + let (_payment_hash, _recipient_onion, route_params) = if let Some(invoice_amount_msat) = + invoice.amount_milli_satoshis() + { + if amount_msat < invoice_amount_msat { + log_error!( + self.logger, + "Failed to estimate routing fees as the given amount needs to be at least the invoice amount: required {}msat, gave {}msat.", invoice_amount_msat, amount_msat); + return Err(Error::InvalidAmount); + } + + bolt11_payment::payment_parameters_from_invoice(&invoice).map_err(|_| { + log_error!(self.logger, "Failed to estimate routing fees due to the given invoice unexpectedly being \"zero-amount\"."); + Error::InvalidInvoice + })? + } else { + bolt11_payment::payment_parameters_from_variable_amount_invoice(&invoice, amount_msat).map_err(|_| { + log_error!(self.logger, "Failed to estimate routing fees due to the given invoice unexpectedly being not \"zero-amount\"."); + Error::InvalidInvoice + })? + }; + + let router = Arc::clone(&self.router); + let first_hops = self.channel_manager.list_usable_channels(); + let inflight_htlcs = self.channel_manager.compute_inflight_htlcs(); + + let route = router.find_route( + &self.channel_manager.get_our_node_id(), + &route_params, + Some(&first_hops.iter().collect::>()), + inflight_htlcs, + ).map_err(|e| { + log_error!(self.logger, "Failed to find route for fee estimation: {:?}", e); + Error::RouteNotFound + })?; + + let total_fees = route.paths.iter() + .map(|path| path.fee_msat()) + .sum::(); + + Ok(total_fees) + } }