From cfb85651ecc84ffcee6cb968d94c23027028eddd Mon Sep 17 00:00:00 2001 From: Elias Rohrer Date: Thu, 17 Oct 2024 12:45:52 +0200 Subject: [PATCH 1/3] Bump version number to 0.4.0 --- Cargo.toml | 2 +- Package.swift | 2 +- bindings/kotlin/ldk-node-android/gradle.properties | 2 +- bindings/kotlin/ldk-node-jvm/gradle.properties | 2 +- bindings/python/pyproject.toml | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index df68c49a5..9602b1016 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "ldk-node" -version = "0.3.0" +version = "0.4.0" authors = ["Elias Rohrer "] homepage = "https://lightningdevkit.org/" license = "MIT OR Apache-2.0" diff --git a/Package.swift b/Package.swift index 67c02dd8b..7adf1e158 100644 --- a/Package.swift +++ b/Package.swift @@ -3,7 +3,7 @@ import PackageDescription -let tag = "v0.3.0" +let tag = "v0.4.0" let checksum = "07c8741768956bf1a51d1c25f751b5e29d1ae9ee2fd786c4282031c9a8a92f0c" let url = "https://github.com/lightningdevkit/ldk-node/releases/download/\(tag)/LDKNodeFFI.xcframework.zip" diff --git a/bindings/kotlin/ldk-node-android/gradle.properties b/bindings/kotlin/ldk-node-android/gradle.properties index 70f5823b6..c84f2c46c 100644 --- a/bindings/kotlin/ldk-node-android/gradle.properties +++ b/bindings/kotlin/ldk-node-android/gradle.properties @@ -2,4 +2,4 @@ org.gradle.jvmargs=-Xmx1536m android.useAndroidX=true android.enableJetifier=true kotlin.code.style=official -libraryVersion=0.3.0 +libraryVersion=0.4.0 diff --git a/bindings/kotlin/ldk-node-jvm/gradle.properties b/bindings/kotlin/ldk-node-jvm/gradle.properties index 4ed588117..a84d6e412 100644 --- a/bindings/kotlin/ldk-node-jvm/gradle.properties +++ b/bindings/kotlin/ldk-node-jvm/gradle.properties @@ -1,3 +1,3 @@ org.gradle.jvmargs=-Xmx1536m kotlin.code.style=official -libraryVersion=0.3.0 +libraryVersion=0.4.0 diff --git a/bindings/python/pyproject.toml b/bindings/python/pyproject.toml index c8ff0a79d..7d24d7884 100644 --- a/bindings/python/pyproject.toml +++ b/bindings/python/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "ldk_node" -version = "0.3.0" +version = "0.4.0" authors = [ { name="Elias Rohrer", email="dev@tnull.de" }, ] From ff47a976a15528c1121e1793f6bdef28195ca606 Mon Sep 17 00:00:00 2001 From: Elias Rohrer Date: Thu, 17 Oct 2024 13:41:36 +0200 Subject: [PATCH 2/3] Update CHANGELOG for v0.4 --- CHANGELOG.md | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3a3894899..7597ce36f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,45 @@ +# 0.4.0 - Oct 17, 2024 + +Besides numerous API improvements and bugfixes this this fourth minor release notably adds support for sourcing chain and fee rate data from a Bitcoin Core RPC backend, as well as experimental support for the [VSS] remote storage backend. + +## Feature and API updates +- Support for multiple chain sources has been added. To this end, Esplora-specific configuration options can now be given via `EsploraSyncConfig` to `Builder::set_chain_source_esplora`. Furthermore, all configuration objects (including the main `Config`) is now exposed via the `config` sub-module (#365). +- Support for sourcing chain and fee estimation data from a Bitcoin Core RPC backed has been added (#370). +- Initial experimental support for an encrypted [VSS] remote storage backend has been added (#369, #376, #378). + - **Caution**: VSS support is in **alpha** and is considered experimental. Using VSS (or any remote persistence) may cause LDK to panic if persistence failures are unrecoverable, i.e., if they remain unresolved after internal retries are exhausted. +- Support for setting the `NodeAlias` in public node announcements as been added. We now ensure that announced channels can only be opened and accepted when the required configuration options to operate as a public forwarding node are set (listening addresses and node alias). As part of this `Node::connect_open_channel` was split into `open_channel` and `open_announced_channel` API methods. (#330, #366). +- The `Node` can now be started via a new `Node::start_with_runtime` call that allows to reuse an outer `tokio` runtime context, avoiding runtime stacking when run in `async` environments (#319). +- Support for generating and paying unified QR codes has been added (#302). +- Support for `quantity` and `payer_note` fields when sending or receiving BOLT12 payments has been added (#327). +- Support for setting additional parameters when sending BOLT11 payments has been added (#336, #351). + +## Bug Fixes +- The `ChannelConfig` object has been refactored, now allowing to query the currently applied `MaxDustHTLCExposure` limit (#350). +- A bug potentially leading to panicking on shutdown when stacking `tokio` runtime contexts has been fixed (#373). +- We now no longer panic when hitting a persistence failure during event handling. Instead, events will be replayed until successful (#374). +, +## Compatibility Notes +- The LDK dependency has been updated to version 0.0.125 (#358, #375). +- The BDK dependency has been updated to version 1.0-beta.4 (#358). + - Going forward, the BDK state will be persisted in the configured `KVStore` backend. + - **Note**: The old descriptor state will *not* be automatically migrated on upgrade, potentially leading to address reuse. Privacy-concious users might want to manually advance the descriptor by requesting new addresses until it reaches the previously observed height. + - After the node as been successfully upgraded users may safely delete `bdk_wallet_*.sqlite` from the storage path. +- The `rust-bitcoin` dependency has been updated to version 0.32.2 (#358). +- The UniFFI dependency has been updated to version 0.27.3 (#379). +- The `bip21` dependency has been updated to version 0.5 (#358). +- The `rust-esplora-client` has been updated to version 0.9 (#358). + +In total, this release features 55 files changed, 6134 insertions, 2184 deletions in 166 commits from 6 authors, in alphabetical order: + +- G8XSU +- Ian Slane +- jbesraa +- Elias Rohrer +- elnosh +- Enigbe Ochekliye + +[VSS]: https://github.com/lightningdevkit/vss-server/blob/main/README.md + # 0.3.0 - June 21, 2024 This third minor release notably adds support for BOLT12 payments, Anchor From 86b22ef9ce5a12debe7b48f38350d2921f617744 Mon Sep 17 00:00:00 2001 From: Elias Rohrer Date: Thu, 17 Oct 2024 14:14:29 +0200 Subject: [PATCH 3/3] Update Swift files for v0.4.0 --- Package.swift | 2 +- bindings/swift/Sources/LDKNode/LDKNode.swift | 3615 +++++++++++------- 2 files changed, 2269 insertions(+), 1348 deletions(-) diff --git a/Package.swift b/Package.swift index 7adf1e158..253db6e68 100644 --- a/Package.swift +++ b/Package.swift @@ -4,7 +4,7 @@ import PackageDescription let tag = "v0.4.0" -let checksum = "07c8741768956bf1a51d1c25f751b5e29d1ae9ee2fd786c4282031c9a8a92f0c" +let checksum = "5dcdfdd6e3331062d649786fa6e758487227f6037d9881353fe0c293a3a4c7e0" let url = "https://github.com/lightningdevkit/ldk-node/releases/download/\(tag)/LDKNodeFFI.xcframework.zip" let package = Package( diff --git a/bindings/swift/Sources/LDKNode/LDKNode.swift b/bindings/swift/Sources/LDKNode/LDKNode.swift index 5937c9050..835816b9f 100644 --- a/bindings/swift/Sources/LDKNode/LDKNode.swift +++ b/bindings/swift/Sources/LDKNode/LDKNode.swift @@ -1,7 +1,9 @@ // This file was autogenerated by some hot garbage in the `uniffi` crate. // Trust me, you don't want to mess with it! -import Foundation + import SystemConfiguration +// swiftlint:disable all +import Foundation // Depending on the consumer's build setup, the low-level FFI code // might be in a separate module, or it might be compiled inline into @@ -19,6 +21,10 @@ fileprivate extension RustBuffer { self.init(capacity: rbuf.capacity, len: rbuf.len, data: rbuf.data) } + static func empty() -> RustBuffer { + RustBuffer(capacity: 0, len:0, data: nil) + } + static func from(_ ptr: UnsafeBufferPointer) -> RustBuffer { try! rustCall { ffi_ldk_node_rustbuffer_from_bytes(ForeignBytes(bufferPointer: ptr), $0) } } @@ -221,9 +227,17 @@ fileprivate enum UniffiInternalError: LocalizedError { } } +fileprivate extension NSLock { + func withLock(f: () throws -> T) rethrows -> T { + self.lock() + defer { self.unlock() } + return try f() + } +} + fileprivate let CALL_SUCCESS: Int8 = 0 fileprivate let CALL_ERROR: Int8 = 1 -fileprivate let CALL_PANIC: Int8 = 2 +fileprivate let CALL_UNEXPECTED_ERROR: Int8 = 2 fileprivate let CALL_CANCELLED: Int8 = 3 fileprivate extension RustCallStatus { @@ -276,7 +290,7 @@ private func uniffiCheckCallStatus( throw UniffiInternalError.unexpectedRustCallError } - case CALL_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. @@ -295,6 +309,76 @@ private func uniffiCheckCallStatus( } } +private func uniffiTraitInterfaceCall( + callStatus: UnsafeMutablePointer, + makeCall: () throws -> T, + writeReturn: (T) -> () +) { + do { + try writeReturn(makeCall()) + } catch let error { + callStatus.pointee.code = CALL_UNEXPECTED_ERROR + callStatus.pointee.errorBuf = FfiConverterString.lower(String(describing: error)) + } +} + +private func uniffiTraitInterfaceCallWithError( + callStatus: UnsafeMutablePointer, + makeCall: () throws -> T, + writeReturn: (T) -> (), + lowerError: (E) -> RustBuffer +) { + do { + try writeReturn(makeCall()) + } catch let error as E { + callStatus.pointee.code = CALL_ERROR + callStatus.pointee.errorBuf = lowerError(error) + } catch { + callStatus.pointee.code = CALL_UNEXPECTED_ERROR + callStatus.pointee.errorBuf = FfiConverterString.lower(String(describing: error)) + } +} +fileprivate class UniffiHandleMap { + private var map: [UInt64: T] = [:] + private let lock = NSLock() + private var currentHandle: UInt64 = 1 + + func insert(obj: T) -> UInt64 { + lock.withLock { + let handle = currentHandle + currentHandle += 1 + map[handle] = obj + return handle + } + } + + func get(handle: UInt64) throws -> T { + try lock.withLock { + guard let obj = map[handle] else { + throw UniffiInternalError.unexpectedStaleHandle + } + return obj + } + } + + @discardableResult + func remove(handle: UInt64) throws -> T { + try lock.withLock { + guard let obj = map.removeValue(forKey: handle) else { + throw UniffiInternalError.unexpectedStaleHandle + } + return obj + } + } + + var count: Int { + get { + map.count + } + } +} + + // Public interface members begin here. @@ -430,168 +514,168 @@ public protocol Bolt11PaymentProtocol : AnyObject { func receiveViaJitChannel(amountMsat: UInt64, description: String, expirySecs: UInt32, maxLspFeeLimitMsat: UInt64?) throws -> Bolt11Invoice - func send(invoice: Bolt11Invoice) throws -> PaymentId + 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) throws -> PaymentId + func sendUsingAmount(invoice: Bolt11Invoice, amountMsat: UInt64, sendingParameters: SendingParameters?) throws -> PaymentId } -public class Bolt11Payment: +open class Bolt11Payment: Bolt11PaymentProtocol { - fileprivate let pointer: UnsafeMutableRawPointer + fileprivate let pointer: UnsafeMutableRawPointer! + + /// Used to instantiate a [FFIObject] without an actual pointer, for fakes in tests, mostly. + public struct NoPointer { + public init() {} + } // 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`. - required init(unsafeFromRawPointer pointer: UnsafeMutableRawPointer) { + required public init(unsafeFromRawPointer pointer: UnsafeMutableRawPointer) { self.pointer = pointer } + /// This constructor can be used to instantiate a fake object. + /// - Parameter noPointer: Placeholder value so we can have a constructor separate from the default empty one that may be implemented for classes extending [FFIObject]. + /// + /// - 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) { + 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 { + guard let pointer = pointer else { + return + } + try! rustCall { uniffi_ldk_node_fn_free_bolt11payment(pointer, $0) } } - - public func claimForHash(paymentHash: PaymentHash, claimableAmountMsat: UInt64, preimage: PaymentPreimage) throws { - try - rustCallWithError(FfiConverterTypeNodeError.lift) { - uniffi_ldk_node_fn_method_bolt11payment_claim_for_hash(self.uniffiClonePointer(), +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 ) } - } - public func failForHash(paymentHash: PaymentHash) throws { - try - rustCallWithError(FfiConverterTypeNodeError.lift) { - uniffi_ldk_node_fn_method_bolt11payment_fail_for_hash(self.uniffiClonePointer(), +} + +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 ) } - } - public func receive(amountMsat: UInt64, description: String, expirySecs: UInt32) throws -> Bolt11Invoice { - return try FfiConverterTypeBolt11Invoice.lift( - try - rustCallWithError(FfiConverterTypeNodeError.lift) { - uniffi_ldk_node_fn_method_bolt11payment_receive(self.uniffiClonePointer(), +} + +open func receive(amountMsat: UInt64, description: String, expirySecs: UInt32)throws -> Bolt11Invoice { + return try FfiConverterTypeBolt11Invoice.lift(try rustCallWithError(FfiConverterTypeNodeError.lift) { + uniffi_ldk_node_fn_method_bolt11payment_receive(self.uniffiClonePointer(), FfiConverterUInt64.lower(amountMsat), FfiConverterString.lower(description), FfiConverterUInt32.lower(expirySecs),$0 ) +}) } - ) - } - public func receiveForHash(amountMsat: UInt64, description: String, 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(), + +open func receiveForHash(amountMsat: UInt64, description: String, 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), FfiConverterString.lower(description), FfiConverterUInt32.lower(expirySecs), FfiConverterTypePaymentHash.lower(paymentHash),$0 ) +}) } - ) - } - public func receiveVariableAmount(description: String, expirySecs: UInt32) throws -> Bolt11Invoice { - return try FfiConverterTypeBolt11Invoice.lift( - try - rustCallWithError(FfiConverterTypeNodeError.lift) { - uniffi_ldk_node_fn_method_bolt11payment_receive_variable_amount(self.uniffiClonePointer(), + +open func receiveVariableAmount(description: String, expirySecs: UInt32)throws -> Bolt11Invoice { + return try FfiConverterTypeBolt11Invoice.lift(try rustCallWithError(FfiConverterTypeNodeError.lift) { + uniffi_ldk_node_fn_method_bolt11payment_receive_variable_amount(self.uniffiClonePointer(), FfiConverterString.lower(description), FfiConverterUInt32.lower(expirySecs),$0 ) +}) } - ) - } - public func receiveVariableAmountForHash(description: String, 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(), + +open func receiveVariableAmountForHash(description: String, 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(), FfiConverterString.lower(description), FfiConverterUInt32.lower(expirySecs), FfiConverterTypePaymentHash.lower(paymentHash),$0 ) +}) } - ) - } - public func receiveVariableAmountViaJitChannel(description: String, 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(), + +open func receiveVariableAmountViaJitChannel(description: String, 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(), FfiConverterString.lower(description), FfiConverterUInt32.lower(expirySecs), FfiConverterOptionUInt64.lower(maxProportionalLspFeeLimitPpmMsat),$0 ) +}) } - ) - } - public func receiveViaJitChannel(amountMsat: UInt64, description: String, 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(), + +open func receiveViaJitChannel(amountMsat: UInt64, description: String, 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), FfiConverterString.lower(description), FfiConverterUInt32.lower(expirySecs), FfiConverterOptionUInt64.lower(maxLspFeeLimitMsat),$0 ) +}) } - ) - } - public func send(invoice: Bolt11Invoice) throws -> PaymentId { - return try FfiConverterTypePaymentId.lift( - try - rustCallWithError(FfiConverterTypeNodeError.lift) { - uniffi_ldk_node_fn_method_bolt11payment_send(self.uniffiClonePointer(), - FfiConverterTypeBolt11Invoice.lower(invoice),$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 ) +}) } - ) - } - public func sendProbes(invoice: Bolt11Invoice) throws { - try - rustCallWithError(FfiConverterTypeNodeError.lift) { - uniffi_ldk_node_fn_method_bolt11payment_send_probes(self.uniffiClonePointer(), + +open func sendProbes(invoice: Bolt11Invoice)throws {try rustCallWithError(FfiConverterTypeNodeError.lift) { + uniffi_ldk_node_fn_method_bolt11payment_send_probes(self.uniffiClonePointer(), FfiConverterTypeBolt11Invoice.lower(invoice),$0 ) } - } - public func sendProbesUsingAmount(invoice: Bolt11Invoice, amountMsat: UInt64) throws { - try - rustCallWithError(FfiConverterTypeNodeError.lift) { - uniffi_ldk_node_fn_method_bolt11payment_send_probes_using_amount(self.uniffiClonePointer(), +} + +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 ) } - } - public func sendUsingAmount(invoice: Bolt11Invoice, amountMsat: UInt64) throws -> PaymentId { - return try FfiConverterTypePaymentId.lift( - try - rustCallWithError(FfiConverterTypeNodeError.lift) { - uniffi_ldk_node_fn_method_bolt11payment_send_using_amount(self.uniffiClonePointer(), +} + +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),$0 + FfiConverterUInt64.lower(amountMsat), + FfiConverterOptionTypeSendingParameters.lower(sendingParameters),$0 ) +}) } - ) - } + } @@ -627,6 +711,8 @@ public struct FfiConverterTypeBolt11Payment: FfiConverter { } + + public func FfiConverterTypeBolt11Payment_lift(_ pointer: UnsafeMutableRawPointer) throws -> Bolt11Payment { return try FfiConverterTypeBolt11Payment.lift(pointer) } @@ -640,108 +726,121 @@ public func FfiConverterTypeBolt11Payment_lower(_ value: Bolt11Payment) -> Unsaf public protocol Bolt12PaymentProtocol : AnyObject { - func initiateRefund(amountMsat: UInt64, expirySecs: UInt32) throws -> Refund + func initiateRefund(amountMsat: UInt64, expirySecs: UInt32, quantity: UInt64?, payerNote: String?) throws -> Refund - func receive(amountMsat: UInt64, description: String) throws -> Offer + func receive(amountMsat: UInt64, description: String, expirySecs: UInt32?, quantity: UInt64?) throws -> Offer - func receiveVariableAmount(description: String) throws -> Offer + func receiveVariableAmount(description: String, expirySecs: UInt32?) throws -> Offer func requestRefundPayment(refund: Refund) throws -> Bolt12Invoice - func send(offer: Offer, payerNote: String?) throws -> PaymentId + func send(offer: Offer, quantity: UInt64?, payerNote: String?) throws -> PaymentId - func sendUsingAmount(offer: Offer, payerNote: String?, amountMsat: UInt64) throws -> PaymentId + func sendUsingAmount(offer: Offer, amountMsat: UInt64, quantity: UInt64?, payerNote: String?) throws -> PaymentId } -public class Bolt12Payment: +open class Bolt12Payment: Bolt12PaymentProtocol { - fileprivate let pointer: UnsafeMutableRawPointer + fileprivate let pointer: UnsafeMutableRawPointer! + + /// Used to instantiate a [FFIObject] without an actual pointer, for fakes in tests, mostly. + public struct NoPointer { + public init() {} + } // 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`. - required init(unsafeFromRawPointer pointer: UnsafeMutableRawPointer) { + required public init(unsafeFromRawPointer pointer: UnsafeMutableRawPointer) { self.pointer = pointer } + /// This constructor can be used to instantiate a fake object. + /// - Parameter noPointer: Placeholder value so we can have a constructor separate from the default empty one that may be implemented for classes extending [FFIObject]. + /// + /// - 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) { + 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 { + guard let pointer = pointer else { + return + } + try! rustCall { uniffi_ldk_node_fn_free_bolt12payment(pointer, $0) } } - - public func initiateRefund(amountMsat: UInt64, expirySecs: UInt32) throws -> Refund { - return try FfiConverterTypeRefund.lift( - try - rustCallWithError(FfiConverterTypeNodeError.lift) { - uniffi_ldk_node_fn_method_bolt12payment_initiate_refund(self.uniffiClonePointer(), +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),$0 + FfiConverterUInt32.lower(expirySecs), + FfiConverterOptionUInt64.lower(quantity), + FfiConverterOptionString.lower(payerNote),$0 ) +}) } - ) - } - public func receive(amountMsat: UInt64, description: String) throws -> Offer { - return try FfiConverterTypeOffer.lift( - try - rustCallWithError(FfiConverterTypeNodeError.lift) { - uniffi_ldk_node_fn_method_bolt12payment_receive(self.uniffiClonePointer(), + +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),$0 + FfiConverterString.lower(description), + FfiConverterOptionUInt32.lower(expirySecs), + FfiConverterOptionUInt64.lower(quantity),$0 ) +}) } - ) - } - public func receiveVariableAmount(description: String) throws -> Offer { - return try FfiConverterTypeOffer.lift( - try - rustCallWithError(FfiConverterTypeNodeError.lift) { - uniffi_ldk_node_fn_method_bolt12payment_receive_variable_amount(self.uniffiClonePointer(), - FfiConverterString.lower(description),$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 ) +}) } - ) - } - public 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(), + +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 ) +}) } - ) - } - public func send(offer: Offer, payerNote: String?) throws -> PaymentId { - return try FfiConverterTypePaymentId.lift( - try - rustCallWithError(FfiConverterTypeNodeError.lift) { - uniffi_ldk_node_fn_method_bolt12payment_send(self.uniffiClonePointer(), + +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 ) +}) } - ) - } - public func sendUsingAmount(offer: Offer, payerNote: String?, amountMsat: UInt64) throws -> PaymentId { - return try FfiConverterTypePaymentId.lift( - try - rustCallWithError(FfiConverterTypeNodeError.lift) { - uniffi_ldk_node_fn_method_bolt12payment_send_using_amount(self.uniffiClonePointer(), + +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), - FfiConverterOptionString.lower(payerNote), - FfiConverterUInt64.lower(amountMsat),$0 + FfiConverterUInt64.lower(amountMsat), + FfiConverterOptionUInt64.lower(quantity), + FfiConverterOptionString.lower(payerNote),$0 ) +}) } - ) - } + } @@ -777,6 +876,8 @@ public struct FfiConverterTypeBolt12Payment: FfiConverter { } + + public func FfiConverterTypeBolt12Payment_lift(_ pointer: UnsafeMutableRawPointer) throws -> Bolt12Payment { return try FfiConverterTypeBolt12Payment.lift(pointer) } @@ -794,14 +895,22 @@ public protocol BuilderProtocol : AnyObject { 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 setChainSourceBitcoindRpc(rpcHost: String, rpcPort: UInt16, rpcUser: String, rpcPassword: String) + + func setChainSourceEsplora(serverUrl: String, config: EsploraSyncConfig?) + func setEntropyBip39Mnemonic(mnemonic: Mnemonic, passphrase: String?) func setEntropySeedBytes(seedBytes: [UInt8]) throws func setEntropySeedPath(seedPath: String) - func setEsploraServer(esploraServerUrl: String) - func setGossipSourceP2p() func setGossipSourceRgs(rgsServerUrl: String) @@ -812,154 +921,203 @@ public protocol BuilderProtocol : AnyObject { func setNetwork(network: Network) + func setNodeAlias(nodeAlias: String) throws + func setStorageDirPath(storageDirPath: String) } -public class Builder: +open class Builder: BuilderProtocol { - fileprivate let pointer: UnsafeMutableRawPointer + fileprivate let pointer: UnsafeMutableRawPointer! + + /// Used to instantiate a [FFIObject] without an actual pointer, for fakes in tests, mostly. + public struct NoPointer { + public init() {} + } // 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`. - required init(unsafeFromRawPointer pointer: UnsafeMutableRawPointer) { + required public init(unsafeFromRawPointer pointer: UnsafeMutableRawPointer) { self.pointer = pointer } + /// This constructor can be used to instantiate a fake object. + /// - Parameter noPointer: Placeholder value so we can have a constructor separate from the default empty one that may be implemented for classes extending [FFIObject]. + /// + /// - 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) { + self.pointer = nil + } + public func uniffiClonePointer() -> UnsafeMutableRawPointer { return try! rustCall { uniffi_ldk_node_fn_clone_builder(self.pointer, $0) } } - public convenience init() { - self.init(unsafeFromRawPointer: try! rustCall() { - uniffi_ldk_node_fn_constructor_builder_new($0) -}) - } +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 { + return + } + try! rustCall { uniffi_ldk_node_fn_free_builder(pointer, $0) } } - public static func fromConfig(config: Config) -> Builder { - return Builder(unsafeFromRawPointer: try! rustCall() { +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) + FfiConverterTypeConfig.lower(config),$0 + ) }) - } - +} +open func build()throws -> Node { + return try FfiConverterTypeNode.lift(try rustCallWithError(FfiConverterTypeBuildError.lift) { + uniffi_ldk_node_fn_method_builder_build(self.uniffiClonePointer(),$0 + ) +}) +} - public 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 ) +}) } - ) - } - public 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 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 + ) +} } - ) - } - public func setEntropyBip39Mnemonic(mnemonic: Mnemonic, passphrase: String?) { - try! - rustCall() { - uniffi_ldk_node_fn_method_builder_set_entropy_bip39_mnemonic(self.uniffiClonePointer(), +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 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 ) } - } - public func setEntropySeedBytes(seedBytes: [UInt8]) throws { - try - rustCallWithError(FfiConverterTypeBuildError.lift) { - uniffi_ldk_node_fn_method_builder_set_entropy_seed_bytes(self.uniffiClonePointer(), +} + +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 ) } - } - public func setEntropySeedPath(seedPath: String) { - try! - rustCall() { +} - uniffi_ldk_node_fn_method_builder_set_entropy_seed_path(self.uniffiClonePointer(), +open func setEntropySeedPath(seedPath: String) {try! rustCall() { + uniffi_ldk_node_fn_method_builder_set_entropy_seed_path(self.uniffiClonePointer(), FfiConverterString.lower(seedPath),$0 ) } - } - public func setEsploraServer(esploraServerUrl: String) { - try! - rustCall() { - - uniffi_ldk_node_fn_method_builder_set_esplora_server(self.uniffiClonePointer(), - FfiConverterString.lower(esploraServerUrl),$0 - ) } - } - public func setGossipSourceP2p() { - try! - rustCall() { - uniffi_ldk_node_fn_method_builder_set_gossip_source_p2p(self.uniffiClonePointer(), $0 +open func setGossipSourceP2p() {try! rustCall() { + uniffi_ldk_node_fn_method_builder_set_gossip_source_p2p(self.uniffiClonePointer(),$0 ) } - } - public func setGossipSourceRgs(rgsServerUrl: String) { - try! - rustCall() { +} - uniffi_ldk_node_fn_method_builder_set_gossip_source_rgs(self.uniffiClonePointer(), +open func setGossipSourceRgs(rgsServerUrl: String) {try! rustCall() { + uniffi_ldk_node_fn_method_builder_set_gossip_source_rgs(self.uniffiClonePointer(), FfiConverterString.lower(rgsServerUrl),$0 ) } - } - public func setLiquiditySourceLsps2(address: SocketAddress, nodeId: PublicKey, token: String?) { - try! - rustCall() { +} - uniffi_ldk_node_fn_method_builder_set_liquidity_source_lsps2(self.uniffiClonePointer(), +open func setLiquiditySourceLsps2(address: SocketAddress, nodeId: PublicKey, token: String?) {try! rustCall() { + uniffi_ldk_node_fn_method_builder_set_liquidity_source_lsps2(self.uniffiClonePointer(), FfiConverterTypeSocketAddress.lower(address), FfiConverterTypePublicKey.lower(nodeId), FfiConverterOptionString.lower(token),$0 ) } - } - public func setListeningAddresses(listeningAddresses: [SocketAddress]) throws { - try - rustCallWithError(FfiConverterTypeBuildError.lift) { - uniffi_ldk_node_fn_method_builder_set_listening_addresses(self.uniffiClonePointer(), +} + +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 ) } - } - public func setNetwork(network: Network) { - try! - rustCall() { +} - uniffi_ldk_node_fn_method_builder_set_network(self.uniffiClonePointer(), +open func setNetwork(network: Network) {try! rustCall() { + uniffi_ldk_node_fn_method_builder_set_network(self.uniffiClonePointer(), FfiConverterTypeNetwork.lower(network),$0 ) } - } - public func setStorageDirPath(storageDirPath: String) { - try! - rustCall() { +} - uniffi_ldk_node_fn_method_builder_set_storage_dir_path(self.uniffiClonePointer(), +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 ) } - } +} + } @@ -995,6 +1153,8 @@ public struct FfiConverterTypeBuilder: FfiConverter { } + + public func FfiConverterTypeBuilder_lift(_ pointer: UnsafeMutableRawPointer) throws -> Builder { return try FfiConverterTypeBuilder.lift(pointer) } @@ -1006,299 +1166,90 @@ public func FfiConverterTypeBuilder_lower(_ value: Builder) -> UnsafeMutableRawP -public protocol ChannelConfigProtocol : AnyObject { - - func acceptUnderpayingHtlcs() -> Bool - - func cltvExpiryDelta() -> UInt16 - - func forceCloseAvoidanceMaxFeeSatoshis() -> UInt64 - - func forwardingFeeBaseMsat() -> UInt32 - - func forwardingFeeProportionalMillionths() -> UInt32 - - func setAcceptUnderpayingHtlcs(value: Bool) - - func setCltvExpiryDelta(value: UInt16) - - func setForceCloseAvoidanceMaxFeeSatoshis(valueSat: UInt64) +public protocol NetworkGraphProtocol : AnyObject { - func setForwardingFeeBaseMsat(feeMsat: UInt32) + func channel(shortChannelId: UInt64) -> ChannelInfo? - func setForwardingFeeProportionalMillionths(value: UInt32) + func listChannels() -> [UInt64] - func setMaxDustHtlcExposureFromFeeRateMultiplier(multiplier: UInt64) + func listNodes() -> [NodeId] - func setMaxDustHtlcExposureFromFixedLimit(limitMsat: UInt64) + func node(nodeId: NodeId) -> NodeInfo? } -public class ChannelConfig: - ChannelConfigProtocol { - fileprivate let pointer: UnsafeMutableRawPointer +open class NetworkGraph: + NetworkGraphProtocol { + fileprivate let pointer: UnsafeMutableRawPointer! + + /// Used to instantiate a [FFIObject] without an actual pointer, for fakes in tests, mostly. + public struct NoPointer { + public init() {} + } // 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`. - required init(unsafeFromRawPointer pointer: UnsafeMutableRawPointer) { + required public init(unsafeFromRawPointer pointer: UnsafeMutableRawPointer) { self.pointer = pointer } - public func uniffiClonePointer() -> UnsafeMutableRawPointer { - return try! rustCall { uniffi_ldk_node_fn_clone_channelconfig(self.pointer, $0) } + /// This constructor can be used to instantiate a fake object. + /// - Parameter noPointer: Placeholder value so we can have a constructor separate from the default empty one that may be implemented for classes extending [FFIObject]. + /// + /// - 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) { + self.pointer = nil } - public convenience init() { - self.init(unsafeFromRawPointer: try! rustCall() { - uniffi_ldk_node_fn_constructor_channelconfig_new($0) -}) + + public func uniffiClonePointer() -> UnsafeMutableRawPointer { + return try! rustCall { uniffi_ldk_node_fn_clone_networkgraph(self.pointer, $0) } } + // No primary constructor declared for this class. deinit { - try! rustCall { uniffi_ldk_node_fn_free_channelconfig(pointer, $0) } + guard let pointer = pointer else { + return + } + + try! rustCall { uniffi_ldk_node_fn_free_networkgraph(pointer, $0) } } - - public func acceptUnderpayingHtlcs() -> Bool { - return try! FfiConverterBool.lift( - try! - rustCall() { - - uniffi_ldk_node_fn_method_channelconfig_accept_underpaying_htlcs(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 ) +}) } - ) - } - public func cltvExpiryDelta() -> UInt16 { - return try! FfiConverterUInt16.lift( - try! - rustCall() { - uniffi_ldk_node_fn_method_channelconfig_cltv_expiry_delta(self.uniffiClonePointer(), $0 +open func listChannels() -> [UInt64] { + return try! FfiConverterSequenceUInt64.lift(try! rustCall() { + uniffi_ldk_node_fn_method_networkgraph_list_channels(self.uniffiClonePointer(),$0 ) +}) } - ) - } - public func forceCloseAvoidanceMaxFeeSatoshis() -> UInt64 { - return try! FfiConverterUInt64.lift( - try! - rustCall() { - uniffi_ldk_node_fn_method_channelconfig_force_close_avoidance_max_fee_satoshis(self.uniffiClonePointer(), $0 +open func listNodes() -> [NodeId] { + return try! FfiConverterSequenceTypeNodeId.lift(try! rustCall() { + uniffi_ldk_node_fn_method_networkgraph_list_nodes(self.uniffiClonePointer(),$0 ) +}) } - ) - } - public func forwardingFeeBaseMsat() -> UInt32 { - return try! FfiConverterUInt32.lift( - try! - rustCall() { - uniffi_ldk_node_fn_method_channelconfig_forwarding_fee_base_msat(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 ) +}) } - ) - } - public func forwardingFeeProportionalMillionths() -> UInt32 { - return try! FfiConverterUInt32.lift( - try! - rustCall() { - uniffi_ldk_node_fn_method_channelconfig_forwarding_fee_proportional_millionths(self.uniffiClonePointer(), $0 - ) -} - ) - } - public func setAcceptUnderpayingHtlcs(value: Bool) { - try! - rustCall() { - - uniffi_ldk_node_fn_method_channelconfig_set_accept_underpaying_htlcs(self.uniffiClonePointer(), - FfiConverterBool.lower(value),$0 - ) -} - } - public func setCltvExpiryDelta(value: UInt16) { - try! - rustCall() { - - uniffi_ldk_node_fn_method_channelconfig_set_cltv_expiry_delta(self.uniffiClonePointer(), - FfiConverterUInt16.lower(value),$0 - ) -} - } - public func setForceCloseAvoidanceMaxFeeSatoshis(valueSat: UInt64) { - try! - rustCall() { - - uniffi_ldk_node_fn_method_channelconfig_set_force_close_avoidance_max_fee_satoshis(self.uniffiClonePointer(), - FfiConverterUInt64.lower(valueSat),$0 - ) -} - } - public func setForwardingFeeBaseMsat(feeMsat: UInt32) { - try! - rustCall() { - - uniffi_ldk_node_fn_method_channelconfig_set_forwarding_fee_base_msat(self.uniffiClonePointer(), - FfiConverterUInt32.lower(feeMsat),$0 - ) -} - } - public func setForwardingFeeProportionalMillionths(value: UInt32) { - try! - rustCall() { - - uniffi_ldk_node_fn_method_channelconfig_set_forwarding_fee_proportional_millionths(self.uniffiClonePointer(), - FfiConverterUInt32.lower(value),$0 - ) -} - } - public func setMaxDustHtlcExposureFromFeeRateMultiplier(multiplier: UInt64) { - try! - rustCall() { - - uniffi_ldk_node_fn_method_channelconfig_set_max_dust_htlc_exposure_from_fee_rate_multiplier(self.uniffiClonePointer(), - FfiConverterUInt64.lower(multiplier),$0 - ) -} - } - public func setMaxDustHtlcExposureFromFixedLimit(limitMsat: UInt64) { - try! - rustCall() { - - uniffi_ldk_node_fn_method_channelconfig_set_max_dust_htlc_exposure_from_fixed_limit(self.uniffiClonePointer(), - FfiConverterUInt64.lower(limitMsat),$0 - ) -} - } - -} - -public struct FfiConverterTypeChannelConfig: FfiConverter { - - typealias FfiType = UnsafeMutableRawPointer - typealias SwiftType = ChannelConfig - - public static func lift(_ pointer: UnsafeMutableRawPointer) throws -> ChannelConfig { - return ChannelConfig(unsafeFromRawPointer: pointer) - } - - public static func lower(_ value: ChannelConfig) -> UnsafeMutableRawPointer { - return value.uniffiClonePointer() - } - - public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> ChannelConfig { - let v: UInt64 = try readInt(&buf) - // 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) { - throw UniffiInternalError.unexpectedNullPointer - } - return try lift(ptr!) - } - - public static func write(_ value: ChannelConfig, into buf: inout [UInt8]) { - // This fiddling is because `Int` is the thing that's the same size as a pointer. - // The Rust code won't compile if a pointer won't fit in a `UInt64`. - writeInt(&buf, UInt64(bitPattern: Int64(Int(bitPattern: lower(value))))) - } -} - - -public func FfiConverterTypeChannelConfig_lift(_ pointer: UnsafeMutableRawPointer) throws -> ChannelConfig { - return try FfiConverterTypeChannelConfig.lift(pointer) -} - -public func FfiConverterTypeChannelConfig_lower(_ value: ChannelConfig) -> UnsafeMutableRawPointer { - return FfiConverterTypeChannelConfig.lower(value) -} - - - - -public protocol NetworkGraphProtocol : AnyObject { - - func channel(shortChannelId: UInt64) -> ChannelInfo? - - func listChannels() -> [UInt64] - - func listNodes() -> [NodeId] - - func node(nodeId: NodeId) -> NodeInfo? - -} - -public class NetworkGraph: - NetworkGraphProtocol { - fileprivate let pointer: UnsafeMutableRawPointer - - // 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`. - required init(unsafeFromRawPointer pointer: UnsafeMutableRawPointer) { - self.pointer = pointer - } - - public func uniffiClonePointer() -> UnsafeMutableRawPointer { - return try! rustCall { uniffi_ldk_node_fn_clone_networkgraph(self.pointer, $0) } - } - - deinit { - try! rustCall { uniffi_ldk_node_fn_free_networkgraph(pointer, $0) } - } - - - - - - public func channel(shortChannelId: UInt64) -> ChannelInfo? { - return try! FfiConverterOptionTypeChannelInfo.lift( - try! - rustCall() { - - uniffi_ldk_node_fn_method_networkgraph_channel(self.uniffiClonePointer(), - FfiConverterUInt64.lower(shortChannelId),$0 - ) -} - ) - } - public func listChannels() -> [UInt64] { - return try! FfiConverterSequenceUInt64.lift( - try! - rustCall() { - - uniffi_ldk_node_fn_method_networkgraph_list_channels(self.uniffiClonePointer(), $0 - ) -} - ) - } - public func listNodes() -> [NodeId] { - return try! FfiConverterSequenceTypeNodeId.lift( - try! - rustCall() { - - uniffi_ldk_node_fn_method_networkgraph_list_nodes(self.uniffiClonePointer(), $0 - ) -} - ) - } - public 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 { @@ -1333,6 +1284,8 @@ public struct FfiConverterTypeNetworkGraph: FfiConverter { } + + public func FfiConverterTypeNetworkGraph_lift(_ pointer: UnsafeMutableRawPointer) throws -> NetworkGraph { return try FfiConverterTypeNetworkGraph.lift(pointer) } @@ -1356,13 +1309,11 @@ public protocol NodeProtocol : AnyObject { func connect(nodeId: PublicKey, address: SocketAddress, persist: Bool) throws - func connectOpenChannel(nodeId: PublicKey, address: SocketAddress, channelAmountSats: UInt64, pushToCounterpartyMsat: UInt64?, channelConfig: ChannelConfig?, announceChannel: Bool) throws -> UserChannelId - func disconnect(nodeId: PublicKey) throws func eventHandled() - func forceCloseChannel(userChannelId: UserChannelId, counterpartyNodeId: PublicKey) throws + func forceCloseChannel(userChannelId: UserChannelId, counterpartyNodeId: PublicKey, reason: String?) throws func listBalances() -> BalanceDetails @@ -1380,15 +1331,21 @@ public protocol NodeProtocol : AnyObject { 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]) throws -> String + func signMessage(msg: [UInt8]) -> String func spontaneousPayment() -> SpontaneousPayment @@ -1400,6 +1357,8 @@ public protocol NodeProtocol : AnyObject { func syncWallets() throws + func unifiedQrPayment() -> UnifiedQrPayment + func updateChannelConfig(userChannelId: UserChannelId, counterpartyNodeId: PublicKey, channelConfig: ChannelConfig) throws func verifySignature(msg: [UInt8], sig: String, pkey: PublicKey) -> Bool @@ -1408,193 +1367,163 @@ public protocol NodeProtocol : AnyObject { } -public class Node: +open class Node: NodeProtocol { - fileprivate let pointer: UnsafeMutableRawPointer + fileprivate let pointer: UnsafeMutableRawPointer! + + /// Used to instantiate a [FFIObject] without an actual pointer, for fakes in tests, mostly. + public struct NoPointer { + public init() {} + } // 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`. - required init(unsafeFromRawPointer pointer: UnsafeMutableRawPointer) { + required public init(unsafeFromRawPointer pointer: UnsafeMutableRawPointer) { self.pointer = pointer } + /// This constructor can be used to instantiate a fake object. + /// - Parameter noPointer: Placeholder value so we can have a constructor separate from the default empty one that may be implemented for classes extending [FFIObject]. + /// + /// - 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) { + 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 { + guard let pointer = pointer else { + return + } + try! rustCall { uniffi_ldk_node_fn_free_node(pointer, $0) } } - - public func bolt11Payment() -> Bolt11Payment { - return try! FfiConverterTypeBolt11Payment.lift( - try! - rustCall() { - - uniffi_ldk_node_fn_method_node_bolt11_payment(self.uniffiClonePointer(), $0 +open func bolt11Payment() -> Bolt11Payment { + return try! FfiConverterTypeBolt11Payment.lift(try! rustCall() { + uniffi_ldk_node_fn_method_node_bolt11_payment(self.uniffiClonePointer(),$0 ) +}) } - ) - } - public func bolt12Payment() -> Bolt12Payment { - return try! FfiConverterTypeBolt12Payment.lift( - try! - rustCall() { - uniffi_ldk_node_fn_method_node_bolt12_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 ) +}) } - ) - } - public func closeChannel(userChannelId: UserChannelId, counterpartyNodeId: PublicKey) throws { - try - rustCallWithError(FfiConverterTypeNodeError.lift) { - uniffi_ldk_node_fn_method_node_close_channel(self.uniffiClonePointer(), + +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 ) } - } - public func config() -> Config { - return try! FfiConverterTypeConfig.lift( - try! - rustCall() { +} - uniffi_ldk_node_fn_method_node_config(self.uniffiClonePointer(), $0 +open func config() -> Config { + return try! FfiConverterTypeConfig.lift(try! rustCall() { + uniffi_ldk_node_fn_method_node_config(self.uniffiClonePointer(),$0 ) +}) } - ) - } - public func connect(nodeId: PublicKey, address: SocketAddress, persist: Bool) throws { - try - rustCallWithError(FfiConverterTypeNodeError.lift) { - uniffi_ldk_node_fn_method_node_connect(self.uniffiClonePointer(), + +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 ) } - } - public func connectOpenChannel(nodeId: PublicKey, address: SocketAddress, channelAmountSats: UInt64, pushToCounterpartyMsat: UInt64?, channelConfig: ChannelConfig?, announceChannel: Bool) throws -> UserChannelId { - return try FfiConverterTypeUserChannelId.lift( - try - rustCallWithError(FfiConverterTypeNodeError.lift) { - uniffi_ldk_node_fn_method_node_connect_open_channel(self.uniffiClonePointer(), - FfiConverterTypePublicKey.lower(nodeId), - FfiConverterTypeSocketAddress.lower(address), - FfiConverterUInt64.lower(channelAmountSats), - FfiConverterOptionUInt64.lower(pushToCounterpartyMsat), - FfiConverterOptionTypeChannelConfig.lower(channelConfig), - FfiConverterBool.lower(announceChannel),$0 - ) } - ) - } - public func disconnect(nodeId: PublicKey) throws { - try - rustCallWithError(FfiConverterTypeNodeError.lift) { - uniffi_ldk_node_fn_method_node_disconnect(self.uniffiClonePointer(), + +open func disconnect(nodeId: PublicKey)throws {try rustCallWithError(FfiConverterTypeNodeError.lift) { + uniffi_ldk_node_fn_method_node_disconnect(self.uniffiClonePointer(), FfiConverterTypePublicKey.lower(nodeId),$0 ) } - } - public func eventHandled() { - try! - rustCall() { +} - uniffi_ldk_node_fn_method_node_event_handled(self.uniffiClonePointer(), $0 +open func eventHandled() {try! rustCall() { + uniffi_ldk_node_fn_method_node_event_handled(self.uniffiClonePointer(),$0 ) } - } - public func forceCloseChannel(userChannelId: UserChannelId, counterpartyNodeId: PublicKey) throws { - try - rustCallWithError(FfiConverterTypeNodeError.lift) { - uniffi_ldk_node_fn_method_node_force_close_channel(self.uniffiClonePointer(), +} + +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),$0 + FfiConverterTypePublicKey.lower(counterpartyNodeId), + FfiConverterOptionString.lower(reason),$0 ) } - } - public func listBalances() -> BalanceDetails { - return try! FfiConverterTypeBalanceDetails.lift( - try! - rustCall() { +} - uniffi_ldk_node_fn_method_node_list_balances(self.uniffiClonePointer(), $0 +open func listBalances() -> BalanceDetails { + return try! FfiConverterTypeBalanceDetails.lift(try! rustCall() { + uniffi_ldk_node_fn_method_node_list_balances(self.uniffiClonePointer(),$0 ) +}) } - ) - } - public func listChannels() -> [ChannelDetails] { - return try! FfiConverterSequenceTypeChannelDetails.lift( - try! - rustCall() { - uniffi_ldk_node_fn_method_node_list_channels(self.uniffiClonePointer(), $0 +open func listChannels() -> [ChannelDetails] { + return try! FfiConverterSequenceTypeChannelDetails.lift(try! rustCall() { + uniffi_ldk_node_fn_method_node_list_channels(self.uniffiClonePointer(),$0 ) +}) } - ) - } - public func listPayments() -> [PaymentDetails] { - return try! FfiConverterSequenceTypePaymentDetails.lift( - try! - rustCall() { - uniffi_ldk_node_fn_method_node_list_payments(self.uniffiClonePointer(), $0 +open func listPayments() -> [PaymentDetails] { + return try! FfiConverterSequenceTypePaymentDetails.lift(try! rustCall() { + uniffi_ldk_node_fn_method_node_list_payments(self.uniffiClonePointer(),$0 ) +}) } - ) - } - public func listPeers() -> [PeerDetails] { - return try! FfiConverterSequenceTypePeerDetails.lift( - try! - rustCall() { - uniffi_ldk_node_fn_method_node_list_peers(self.uniffiClonePointer(), $0 +open func listPeers() -> [PeerDetails] { + return try! FfiConverterSequenceTypePeerDetails.lift(try! rustCall() { + uniffi_ldk_node_fn_method_node_list_peers(self.uniffiClonePointer(),$0 ) +}) } - ) - } - public func listeningAddresses() -> [SocketAddress]? { - return try! FfiConverterOptionSequenceTypeSocketAddress.lift( - try! - rustCall() { - uniffi_ldk_node_fn_method_node_listening_addresses(self.uniffiClonePointer(), $0 +open func listeningAddresses() -> [SocketAddress]? { + return try! FfiConverterOptionSequenceTypeSocketAddress.lift(try! rustCall() { + uniffi_ldk_node_fn_method_node_listening_addresses(self.uniffiClonePointer(),$0 ) +}) } - ) - } - public func networkGraph() -> NetworkGraph { - return try! FfiConverterTypeNetworkGraph.lift( - try! - rustCall() { - uniffi_ldk_node_fn_method_node_network_graph(self.uniffiClonePointer(), $0 +open func networkGraph() -> NetworkGraph { + return try! FfiConverterTypeNetworkGraph.lift(try! rustCall() { + uniffi_ldk_node_fn_method_node_network_graph(self.uniffiClonePointer(),$0 ) +}) } - ) - } - public func nextEvent() -> Event? { - return try! FfiConverterOptionTypeEvent.lift( - try! - rustCall() { - uniffi_ldk_node_fn_method_node_next_event(self.uniffiClonePointer(), $0 +open func nextEvent() -> Event? { + return try! FfiConverterOptionTypeEvent.lift(try! rustCall() { + uniffi_ldk_node_fn_method_node_next_event(self.uniffiClonePointer(),$0 ) +}) } - ) - } - public func nextEventAsync() async -> Event { - return try! await uniffiRustCallAsync( + +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, @@ -1604,132 +1533,141 @@ public class Node: errorHandler: nil ) - } - +} - public func nodeId() -> PublicKey { - return try! FfiConverterTypePublicKey.lift( - try! - rustCall() { +open func nodeAlias() -> NodeAlias? { + return try! FfiConverterOptionTypeNodeAlias.lift(try! rustCall() { + uniffi_ldk_node_fn_method_node_node_alias(self.uniffiClonePointer(),$0 + ) +}) +} - uniffi_ldk_node_fn_method_node_node_id(self.uniffiClonePointer(), $0 +open func nodeId() -> PublicKey { + return try! FfiConverterTypePublicKey.lift(try! rustCall() { + uniffi_ldk_node_fn_method_node_node_id(self.uniffiClonePointer(),$0 ) +}) } - ) - } - public func onchainPayment() -> OnchainPayment { - return try! FfiConverterTypeOnchainPayment.lift( - try! - rustCall() { - uniffi_ldk_node_fn_method_node_onchain_payment(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 + ) +}) } - ) - } - public func payment(paymentId: PaymentId) -> PaymentDetails? { - return try! FfiConverterOptionTypePaymentDetails.lift( - try! - rustCall() { - uniffi_ldk_node_fn_method_node_payment(self.uniffiClonePointer(), +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 ) +}) } - ) - } - public func removePayment(paymentId: PaymentId) throws { - try - rustCallWithError(FfiConverterTypeNodeError.lift) { - uniffi_ldk_node_fn_method_node_remove_payment(self.uniffiClonePointer(), + +open func removePayment(paymentId: PaymentId)throws {try rustCallWithError(FfiConverterTypeNodeError.lift) { + uniffi_ldk_node_fn_method_node_remove_payment(self.uniffiClonePointer(), FfiConverterTypePaymentId.lower(paymentId),$0 ) } - } - public func signMessage(msg: [UInt8]) throws -> String { - return try FfiConverterString.lift( - try - rustCallWithError(FfiConverterTypeNodeError.lift) { - uniffi_ldk_node_fn_method_node_sign_message(self.uniffiClonePointer(), +} + +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 + ) +}) } - ) - } - public 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 ) } - ) - } - public 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 ) +}) } - } - public 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 ) } - ) - } - public 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 ) } - } - public 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 ) +}) } - } - public func updateChannelConfig(userChannelId: UserChannelId, counterpartyNodeId: PublicKey, channelConfig: ChannelConfig) throws { - try - rustCallWithError(FfiConverterTypeNodeError.lift) { - uniffi_ldk_node_fn_method_node_update_channel_config(self.uniffiClonePointer(), + +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 ) } - } - public 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(), +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 ) +}) } - ) - } - public 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 ) +}) } - ) - } + } @@ -1765,6 +1703,8 @@ public struct FfiConverterTypeNode: FfiConverter { } + + public func FfiConverterTypeNode_lift(_ pointer: UnsafeMutableRawPointer) throws -> Node { return try FfiConverterTypeNode.lift(pointer) } @@ -1782,63 +1722,75 @@ public protocol OnchainPaymentProtocol : AnyObject { func sendAllToAddress(address: Address) throws -> Txid - func sendToAddress(address: Address, amountMsat: UInt64) throws -> Txid + func sendToAddress(address: Address, amountSats: UInt64) throws -> Txid } -public class OnchainPayment: +open class OnchainPayment: OnchainPaymentProtocol { - fileprivate let pointer: UnsafeMutableRawPointer + fileprivate let pointer: UnsafeMutableRawPointer! + + /// Used to instantiate a [FFIObject] without an actual pointer, for fakes in tests, mostly. + public struct NoPointer { + public init() {} + } // 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`. - required init(unsafeFromRawPointer pointer: UnsafeMutableRawPointer) { + required public init(unsafeFromRawPointer pointer: UnsafeMutableRawPointer) { self.pointer = pointer } + /// This constructor can be used to instantiate a fake object. + /// - Parameter noPointer: Placeholder value so we can have a constructor separate from the default empty one that may be implemented for classes extending [FFIObject]. + /// + /// - 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) { + 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 { + guard let pointer = pointer else { + return + } + try! rustCall { uniffi_ldk_node_fn_free_onchainpayment(pointer, $0) } } - - public 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 newAddress()throws -> Address { + return try FfiConverterTypeAddress.lift(try rustCallWithError(FfiConverterTypeNodeError.lift) { + uniffi_ldk_node_fn_method_onchainpayment_new_address(self.uniffiClonePointer(),$0 ) +}) } - ) - } - public func sendAllToAddress(address: Address) throws -> Txid { - return try FfiConverterTypeTxid.lift( - try - rustCallWithError(FfiConverterTypeNodeError.lift) { - uniffi_ldk_node_fn_method_onchainpayment_send_all_to_address(self.uniffiClonePointer(), + +open func sendAllToAddress(address: Address)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),$0 ) +}) } - ) - } - public func sendToAddress(address: Address, amountMsat: UInt64) throws -> Txid { - return try FfiConverterTypeTxid.lift( - try - rustCallWithError(FfiConverterTypeNodeError.lift) { - uniffi_ldk_node_fn_method_onchainpayment_send_to_address(self.uniffiClonePointer(), + +open func sendToAddress(address: Address, amountSats: UInt64)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(amountMsat),$0 + FfiConverterUInt64.lower(amountSats),$0 ) +}) } - ) - } + } @@ -1874,6 +1826,8 @@ public struct FfiConverterTypeOnchainPayment: FfiConverter { } + + public func FfiConverterTypeOnchainPayment_lift(_ pointer: UnsafeMutableRawPointer) throws -> OnchainPayment { return try FfiConverterTypeOnchainPayment.lift(pointer) } @@ -1887,55 +1841,71 @@ public func FfiConverterTypeOnchainPayment_lower(_ value: OnchainPayment) -> Uns public protocol SpontaneousPaymentProtocol : AnyObject { - func send(amountMsat: UInt64, nodeId: PublicKey) throws -> PaymentId + func send(amountMsat: UInt64, nodeId: PublicKey, sendingParameters: SendingParameters?) throws -> PaymentId func sendProbes(amountMsat: UInt64, nodeId: PublicKey) throws } -public class SpontaneousPayment: +open class SpontaneousPayment: SpontaneousPaymentProtocol { - fileprivate let pointer: UnsafeMutableRawPointer + fileprivate let pointer: UnsafeMutableRawPointer! + + /// Used to instantiate a [FFIObject] without an actual pointer, for fakes in tests, mostly. + public struct NoPointer { + public init() {} + } // 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`. - required init(unsafeFromRawPointer pointer: UnsafeMutableRawPointer) { + required public init(unsafeFromRawPointer pointer: UnsafeMutableRawPointer) { self.pointer = pointer } + /// This constructor can be used to instantiate a fake object. + /// - Parameter noPointer: Placeholder value so we can have a constructor separate from the default empty one that may be implemented for classes extending [FFIObject]. + /// + /// - 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) { + 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 { + guard let pointer = pointer else { + return + } + try! rustCall { uniffi_ldk_node_fn_free_spontaneouspayment(pointer, $0) } } - - public func send(amountMsat: UInt64, nodeId: PublicKey) throws -> PaymentId { - return try FfiConverterTypePaymentId.lift( - try - rustCallWithError(FfiConverterTypeNodeError.lift) { - uniffi_ldk_node_fn_method_spontaneouspayment_send(self.uniffiClonePointer(), +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),$0 + FfiConverterTypePublicKey.lower(nodeId), + FfiConverterOptionTypeSendingParameters.lower(sendingParameters),$0 ) +}) } - ) - } - public func sendProbes(amountMsat: UInt64, nodeId: PublicKey) throws { - try - rustCallWithError(FfiConverterTypeNodeError.lift) { - uniffi_ldk_node_fn_method_spontaneouspayment_send_probes(self.uniffiClonePointer(), + +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 ) } - } +} + } @@ -1971,12 +1941,241 @@ public struct FfiConverterTypeSpontaneousPayment: FfiConverter { } -public func FfiConverterTypeSpontaneousPayment_lift(_ pointer: UnsafeMutableRawPointer) throws -> SpontaneousPayment { - return try FfiConverterTypeSpontaneousPayment.lift(pointer) + + +public func FfiConverterTypeSpontaneousPayment_lift(_ pointer: UnsafeMutableRawPointer) throws -> SpontaneousPayment { + return try FfiConverterTypeSpontaneousPayment.lift(pointer) +} + +public func FfiConverterTypeSpontaneousPayment_lower(_ value: SpontaneousPayment) -> UnsafeMutableRawPointer { + return FfiConverterTypeSpontaneousPayment.lower(value) +} + + + + +public protocol UnifiedQrPaymentProtocol : AnyObject { + + func receive(amountSats: UInt64, message: String, expirySec: UInt32) throws -> String + + func send(uriStr: String) throws -> QrPaymentResult + +} + +open class UnifiedQrPayment: + UnifiedQrPaymentProtocol { + fileprivate let pointer: UnsafeMutableRawPointer! + + /// Used to instantiate a [FFIObject] without an actual pointer, for fakes in tests, mostly. + public struct NoPointer { + public init() {} + } + + // 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`. + required public init(unsafeFromRawPointer pointer: UnsafeMutableRawPointer) { + self.pointer = pointer + } + + /// This constructor can be used to instantiate a fake object. + /// - Parameter noPointer: Placeholder value so we can have a constructor separate from the default empty one that may be implemented for classes extending [FFIObject]. + /// + /// - 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) { + 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 { + guard let pointer = pointer else { + return + } + + 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(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 + ) +}) +} + + +} + +public struct FfiConverterTypeUnifiedQrPayment: FfiConverter { + + typealias FfiType = UnsafeMutableRawPointer + typealias SwiftType = UnifiedQrPayment + + public static func lift(_ pointer: UnsafeMutableRawPointer) throws -> UnifiedQrPayment { + return UnifiedQrPayment(unsafeFromRawPointer: pointer) + } + + public static func lower(_ value: UnifiedQrPayment) -> UnsafeMutableRawPointer { + return value.uniffiClonePointer() + } + + public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> UnifiedQrPayment { + let v: UInt64 = try readInt(&buf) + // 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) { + throw UniffiInternalError.unexpectedNullPointer + } + return try lift(ptr!) + } + + public static func write(_ value: UnifiedQrPayment, into buf: inout [UInt8]) { + // This fiddling is because `Int` is the thing that's the same size as a pointer. + // The Rust code won't compile if a pointer won't fit in a `UInt64`. + writeInt(&buf, UInt64(bitPattern: Int64(Int(bitPattern: lower(value))))) + } +} + + + + +public func FfiConverterTypeUnifiedQrPayment_lift(_ pointer: UnsafeMutableRawPointer) throws -> UnifiedQrPayment { + return try FfiConverterTypeUnifiedQrPayment.lift(pointer) +} + +public func FfiConverterTypeUnifiedQrPayment_lower(_ value: UnifiedQrPayment) -> UnsafeMutableRawPointer { + return FfiConverterTypeUnifiedQrPayment.lower(value) +} + + + + +public protocol VssHeaderProviderProtocol : AnyObject { + + func getHeaders(request: [UInt8]) async throws -> [String: String] + +} + +open class VssHeaderProvider: + VssHeaderProviderProtocol { + fileprivate let pointer: UnsafeMutableRawPointer! + + /// Used to instantiate a [FFIObject] without an actual pointer, for fakes in tests, mostly. + public struct NoPointer { + public init() {} + } + + // 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`. + required public init(unsafeFromRawPointer pointer: UnsafeMutableRawPointer) { + self.pointer = pointer + } + + /// This constructor can be used to instantiate a fake object. + /// - Parameter noPointer: Placeholder value so we can have a constructor separate from the default empty one that may be implemented for classes extending [FFIObject]. + /// + /// - 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) { + 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 { + guard let pointer = pointer else { + return + } + + 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 + ) +} + + +} + +public struct FfiConverterTypeVssHeaderProvider: FfiConverter { + + typealias FfiType = UnsafeMutableRawPointer + typealias SwiftType = VssHeaderProvider + + public static func lift(_ pointer: UnsafeMutableRawPointer) throws -> VssHeaderProvider { + return VssHeaderProvider(unsafeFromRawPointer: pointer) + } + + public static func lower(_ value: VssHeaderProvider) -> UnsafeMutableRawPointer { + return value.uniffiClonePointer() + } + + public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> VssHeaderProvider { + let v: UInt64 = try readInt(&buf) + // 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) { + throw UniffiInternalError.unexpectedNullPointer + } + return try lift(ptr!) + } + + public static func write(_ value: VssHeaderProvider, into buf: inout [UInt8]) { + // This fiddling is because `Int` is the thing that's the same size as a pointer. + // The Rust code won't compile if a pointer won't fit in a `UInt64`. + writeInt(&buf, UInt64(bitPattern: Int64(Int(bitPattern: lower(value))))) + } +} + + + + +public func FfiConverterTypeVssHeaderProvider_lift(_ pointer: UnsafeMutableRawPointer) throws -> VssHeaderProvider { + return try FfiConverterTypeVssHeaderProvider.lift(pointer) } -public func FfiConverterTypeSpontaneousPayment_lower(_ value: SpontaneousPayment) -> UnsafeMutableRawPointer { - return FfiConverterTypeSpontaneousPayment.lower(value) +public func FfiConverterTypeVssHeaderProvider_lower(_ value: VssHeaderProvider) -> UnsafeMutableRawPointer { + return FfiConverterTypeVssHeaderProvider.lower(value) } @@ -1986,15 +2185,14 @@ public struct AnchorChannelsConfig { // Default memberwise initializers are never public by default, so we // declare one manually. - public init( - trustedPeersNoReserve: [PublicKey], - perChannelReserveSats: UInt64) { + public init(trustedPeersNoReserve: [PublicKey], perChannelReserveSats: UInt64) { self.trustedPeersNoReserve = trustedPeersNoReserve self.perChannelReserveSats = perChannelReserveSats } } + extension AnchorChannelsConfig: Equatable, Hashable { public static func ==(lhs: AnchorChannelsConfig, rhs: AnchorChannelsConfig) -> Bool { if lhs.trustedPeersNoReserve != rhs.trustedPeersNoReserve { @@ -2048,13 +2246,7 @@ public struct BalanceDetails { // Default memberwise initializers are never public by default, so we // declare one manually. - public init( - totalOnchainBalanceSats: UInt64, - spendableOnchainBalanceSats: UInt64, - totalAnchorChannelsReserveSats: UInt64, - totalLightningBalanceSats: UInt64, - lightningBalances: [LightningBalance], - pendingBalancesFromChannelClosures: [PendingSweepBalance]) { + public init(totalOnchainBalanceSats: UInt64, spendableOnchainBalanceSats: UInt64, totalAnchorChannelsReserveSats: UInt64, totalLightningBalanceSats: UInt64, lightningBalances: [LightningBalance], pendingBalancesFromChannelClosures: [PendingSweepBalance]) { self.totalOnchainBalanceSats = totalOnchainBalanceSats self.spendableOnchainBalanceSats = spendableOnchainBalanceSats self.totalAnchorChannelsReserveSats = totalAnchorChannelsReserveSats @@ -2065,6 +2257,7 @@ public struct BalanceDetails { } + extension BalanceDetails: Equatable, Hashable { public static func ==(lhs: BalanceDetails, rhs: BalanceDetails) -> Bool { if lhs.totalOnchainBalanceSats != rhs.totalOnchainBalanceSats { @@ -2138,15 +2331,14 @@ public struct BestBlock { // Default memberwise initializers are never public by default, so we // declare one manually. - public init( - blockHash: BlockHash, - height: UInt32) { + public init(blockHash: BlockHash, height: UInt32) { self.blockHash = blockHash self.height = height } } + extension BestBlock: Equatable, Hashable { public static func ==(lhs: BestBlock, rhs: BestBlock) -> Bool { if lhs.blockHash != rhs.blockHash { @@ -2190,6 +2382,95 @@ public func FfiConverterTypeBestBlock_lower(_ value: BestBlock) -> RustBuffer { } +public struct ChannelConfig { + public var forwardingFeeProportionalMillionths: UInt32 + public var forwardingFeeBaseMsat: UInt32 + public var cltvExpiryDelta: UInt16 + public var maxDustHtlcExposure: MaxDustHtlcExposure + public var forceCloseAvoidanceMaxFeeSatoshis: UInt64 + public var acceptUnderpayingHtlcs: Bool + + // Default memberwise initializers are never public by default, so we + // declare one manually. + public init(forwardingFeeProportionalMillionths: UInt32, forwardingFeeBaseMsat: UInt32, cltvExpiryDelta: UInt16, maxDustHtlcExposure: MaxDustHtlcExposure, forceCloseAvoidanceMaxFeeSatoshis: UInt64, acceptUnderpayingHtlcs: Bool) { + self.forwardingFeeProportionalMillionths = forwardingFeeProportionalMillionths + self.forwardingFeeBaseMsat = forwardingFeeBaseMsat + self.cltvExpiryDelta = cltvExpiryDelta + self.maxDustHtlcExposure = maxDustHtlcExposure + self.forceCloseAvoidanceMaxFeeSatoshis = forceCloseAvoidanceMaxFeeSatoshis + self.acceptUnderpayingHtlcs = acceptUnderpayingHtlcs + } +} + + + +extension ChannelConfig: Equatable, Hashable { + public static func ==(lhs: ChannelConfig, rhs: ChannelConfig) -> Bool { + if lhs.forwardingFeeProportionalMillionths != rhs.forwardingFeeProportionalMillionths { + return false + } + if lhs.forwardingFeeBaseMsat != rhs.forwardingFeeBaseMsat { + return false + } + if lhs.cltvExpiryDelta != rhs.cltvExpiryDelta { + return false + } + if lhs.maxDustHtlcExposure != rhs.maxDustHtlcExposure { + return false + } + if lhs.forceCloseAvoidanceMaxFeeSatoshis != rhs.forceCloseAvoidanceMaxFeeSatoshis { + return false + } + if lhs.acceptUnderpayingHtlcs != rhs.acceptUnderpayingHtlcs { + return false + } + return true + } + + public func hash(into hasher: inout Hasher) { + hasher.combine(forwardingFeeProportionalMillionths) + hasher.combine(forwardingFeeBaseMsat) + hasher.combine(cltvExpiryDelta) + hasher.combine(maxDustHtlcExposure) + hasher.combine(forceCloseAvoidanceMaxFeeSatoshis) + hasher.combine(acceptUnderpayingHtlcs) + } +} + + +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), + acceptUnderpayingHtlcs: FfiConverterBool.read(from: &buf) + ) + } + + public static func write(_ value: ChannelConfig, into buf: inout [UInt8]) { + FfiConverterUInt32.write(value.forwardingFeeProportionalMillionths, into: &buf) + FfiConverterUInt32.write(value.forwardingFeeBaseMsat, into: &buf) + FfiConverterUInt16.write(value.cltvExpiryDelta, into: &buf) + FfiConverterTypeMaxDustHTLCExposure.write(value.maxDustHtlcExposure, into: &buf) + FfiConverterUInt64.write(value.forceCloseAvoidanceMaxFeeSatoshis, into: &buf) + FfiConverterBool.write(value.acceptUnderpayingHtlcs, into: &buf) + } +} + + +public func FfiConverterTypeChannelConfig_lift(_ buf: RustBuffer) throws -> ChannelConfig { + return try FfiConverterTypeChannelConfig.lift(buf) +} + +public func FfiConverterTypeChannelConfig_lower(_ value: ChannelConfig) -> RustBuffer { + return FfiConverterTypeChannelConfig.lower(value) +} + + public struct ChannelDetails { public var channelId: ChannelId public var counterpartyNodeId: PublicKey @@ -2205,7 +2486,7 @@ public struct ChannelDetails { public var isOutbound: Bool public var isChannelReady: Bool public var isUsable: Bool - public var isPublic: Bool + public var isAnnounced: Bool public var cltvExpiryDelta: UInt16? public var counterpartyUnspendablePunishmentReserve: UInt64 public var counterpartyOutboundHtlcMinimumMsat: UInt64? @@ -2222,35 +2503,7 @@ public struct ChannelDetails { // Default memberwise initializers are never public by default, so we // declare one manually. - public init( - channelId: ChannelId, - counterpartyNodeId: PublicKey, - fundingTxo: OutPoint?, - channelValueSats: UInt64, - unspendablePunishmentReserve: UInt64?, - userChannelId: UserChannelId, - feerateSatPer1000Weight: UInt32, - outboundCapacityMsat: UInt64, - inboundCapacityMsat: UInt64, - confirmationsRequired: UInt32?, - confirmations: UInt32?, - isOutbound: Bool, - isChannelReady: Bool, - isUsable: Bool, - isPublic: Bool, - cltvExpiryDelta: UInt16?, - counterpartyUnspendablePunishmentReserve: UInt64, - counterpartyOutboundHtlcMinimumMsat: UInt64?, - counterpartyOutboundHtlcMaximumMsat: UInt64?, - counterpartyForwardingInfoFeeBaseMsat: UInt32?, - counterpartyForwardingInfoFeeProportionalMillionths: UInt32?, - counterpartyForwardingInfoCltvExpiryDelta: UInt16?, - nextOutboundHtlcLimitMsat: UInt64, - nextOutboundHtlcMinimumMsat: UInt64, - forceCloseSpendDelay: UInt16?, - inboundHtlcMinimumMsat: UInt64, - inboundHtlcMaximumMsat: UInt64?, - config: ChannelConfig) { + public init(channelId: ChannelId, counterpartyNodeId: PublicKey, fundingTxo: OutPoint?, channelValueSats: UInt64, unspendablePunishmentReserve: UInt64?, userChannelId: UserChannelId, feerateSatPer1000Weight: UInt32, outboundCapacityMsat: UInt64, inboundCapacityMsat: UInt64, confirmationsRequired: UInt32?, confirmations: UInt32?, isOutbound: Bool, isChannelReady: Bool, isUsable: Bool, isAnnounced: Bool, cltvExpiryDelta: UInt16?, counterpartyUnspendablePunishmentReserve: UInt64, counterpartyOutboundHtlcMinimumMsat: UInt64?, counterpartyOutboundHtlcMaximumMsat: UInt64?, counterpartyForwardingInfoFeeBaseMsat: UInt32?, counterpartyForwardingInfoFeeProportionalMillionths: UInt32?, counterpartyForwardingInfoCltvExpiryDelta: UInt16?, nextOutboundHtlcLimitMsat: UInt64, nextOutboundHtlcMinimumMsat: UInt64, forceCloseSpendDelay: UInt16?, inboundHtlcMinimumMsat: UInt64, inboundHtlcMaximumMsat: UInt64?, config: ChannelConfig) { self.channelId = channelId self.counterpartyNodeId = counterpartyNodeId self.fundingTxo = fundingTxo @@ -2265,7 +2518,7 @@ public struct ChannelDetails { self.isOutbound = isOutbound self.isChannelReady = isChannelReady self.isUsable = isUsable - self.isPublic = isPublic + self.isAnnounced = isAnnounced self.cltvExpiryDelta = cltvExpiryDelta self.counterpartyUnspendablePunishmentReserve = counterpartyUnspendablePunishmentReserve self.counterpartyOutboundHtlcMinimumMsat = counterpartyOutboundHtlcMinimumMsat @@ -2284,6 +2537,128 @@ public struct ChannelDetails { +extension ChannelDetails: Equatable, Hashable { + public static func ==(lhs: ChannelDetails, rhs: ChannelDetails) -> Bool { + if lhs.channelId != rhs.channelId { + return false + } + if lhs.counterpartyNodeId != rhs.counterpartyNodeId { + return false + } + if lhs.fundingTxo != rhs.fundingTxo { + return false + } + if lhs.channelValueSats != rhs.channelValueSats { + return false + } + if lhs.unspendablePunishmentReserve != rhs.unspendablePunishmentReserve { + return false + } + if lhs.userChannelId != rhs.userChannelId { + return false + } + if lhs.feerateSatPer1000Weight != rhs.feerateSatPer1000Weight { + return false + } + if lhs.outboundCapacityMsat != rhs.outboundCapacityMsat { + return false + } + if lhs.inboundCapacityMsat != rhs.inboundCapacityMsat { + return false + } + if lhs.confirmationsRequired != rhs.confirmationsRequired { + return false + } + if lhs.confirmations != rhs.confirmations { + return false + } + if lhs.isOutbound != rhs.isOutbound { + return false + } + if lhs.isChannelReady != rhs.isChannelReady { + return false + } + if lhs.isUsable != rhs.isUsable { + return false + } + if lhs.isAnnounced != rhs.isAnnounced { + return false + } + if lhs.cltvExpiryDelta != rhs.cltvExpiryDelta { + return false + } + if lhs.counterpartyUnspendablePunishmentReserve != rhs.counterpartyUnspendablePunishmentReserve { + return false + } + if lhs.counterpartyOutboundHtlcMinimumMsat != rhs.counterpartyOutboundHtlcMinimumMsat { + return false + } + if lhs.counterpartyOutboundHtlcMaximumMsat != rhs.counterpartyOutboundHtlcMaximumMsat { + return false + } + if lhs.counterpartyForwardingInfoFeeBaseMsat != rhs.counterpartyForwardingInfoFeeBaseMsat { + return false + } + if lhs.counterpartyForwardingInfoFeeProportionalMillionths != rhs.counterpartyForwardingInfoFeeProportionalMillionths { + return false + } + if lhs.counterpartyForwardingInfoCltvExpiryDelta != rhs.counterpartyForwardingInfoCltvExpiryDelta { + return false + } + if lhs.nextOutboundHtlcLimitMsat != rhs.nextOutboundHtlcLimitMsat { + return false + } + if lhs.nextOutboundHtlcMinimumMsat != rhs.nextOutboundHtlcMinimumMsat { + return false + } + if lhs.forceCloseSpendDelay != rhs.forceCloseSpendDelay { + return false + } + if lhs.inboundHtlcMinimumMsat != rhs.inboundHtlcMinimumMsat { + return false + } + if lhs.inboundHtlcMaximumMsat != rhs.inboundHtlcMaximumMsat { + return false + } + if lhs.config != rhs.config { + return false + } + return true + } + + public func hash(into hasher: inout Hasher) { + hasher.combine(channelId) + hasher.combine(counterpartyNodeId) + hasher.combine(fundingTxo) + hasher.combine(channelValueSats) + hasher.combine(unspendablePunishmentReserve) + hasher.combine(userChannelId) + hasher.combine(feerateSatPer1000Weight) + hasher.combine(outboundCapacityMsat) + hasher.combine(inboundCapacityMsat) + hasher.combine(confirmationsRequired) + hasher.combine(confirmations) + hasher.combine(isOutbound) + hasher.combine(isChannelReady) + hasher.combine(isUsable) + hasher.combine(isAnnounced) + hasher.combine(cltvExpiryDelta) + hasher.combine(counterpartyUnspendablePunishmentReserve) + hasher.combine(counterpartyOutboundHtlcMinimumMsat) + hasher.combine(counterpartyOutboundHtlcMaximumMsat) + hasher.combine(counterpartyForwardingInfoFeeBaseMsat) + hasher.combine(counterpartyForwardingInfoFeeProportionalMillionths) + hasher.combine(counterpartyForwardingInfoCltvExpiryDelta) + hasher.combine(nextOutboundHtlcLimitMsat) + hasher.combine(nextOutboundHtlcMinimumMsat) + hasher.combine(forceCloseSpendDelay) + hasher.combine(inboundHtlcMinimumMsat) + hasher.combine(inboundHtlcMaximumMsat) + hasher.combine(config) + } +} + + public struct FfiConverterTypeChannelDetails: FfiConverterRustBuffer { public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> ChannelDetails { return @@ -2302,7 +2677,7 @@ public struct FfiConverterTypeChannelDetails: FfiConverterRustBuffer { isOutbound: FfiConverterBool.read(from: &buf), isChannelReady: FfiConverterBool.read(from: &buf), isUsable: FfiConverterBool.read(from: &buf), - isPublic: FfiConverterBool.read(from: &buf), + isAnnounced: FfiConverterBool.read(from: &buf), cltvExpiryDelta: FfiConverterOptionUInt16.read(from: &buf), counterpartyUnspendablePunishmentReserve: FfiConverterUInt64.read(from: &buf), counterpartyOutboundHtlcMinimumMsat: FfiConverterOptionUInt64.read(from: &buf), @@ -2334,7 +2709,7 @@ public struct FfiConverterTypeChannelDetails: FfiConverterRustBuffer { FfiConverterBool.write(value.isOutbound, into: &buf) FfiConverterBool.write(value.isChannelReady, into: &buf) FfiConverterBool.write(value.isUsable, into: &buf) - FfiConverterBool.write(value.isPublic, into: &buf) + FfiConverterBool.write(value.isAnnounced, into: &buf) FfiConverterOptionUInt16.write(value.cltvExpiryDelta, into: &buf) FfiConverterUInt64.write(value.counterpartyUnspendablePunishmentReserve, into: &buf) FfiConverterOptionUInt64.write(value.counterpartyOutboundHtlcMinimumMsat, into: &buf) @@ -2370,12 +2745,7 @@ public struct ChannelInfo { // Default memberwise initializers are never public by default, so we // declare one manually. - public init( - nodeOne: NodeId, - oneToTwo: ChannelUpdateInfo?, - nodeTwo: NodeId, - twoToOne: ChannelUpdateInfo?, - capacitySats: UInt64?) { + public init(nodeOne: NodeId, oneToTwo: ChannelUpdateInfo?, nodeTwo: NodeId, twoToOne: ChannelUpdateInfo?, capacitySats: UInt64?) { self.nodeOne = nodeOne self.oneToTwo = oneToTwo self.nodeTwo = nodeTwo @@ -2385,6 +2755,7 @@ public struct ChannelInfo { } + extension ChannelInfo: Equatable, Hashable { public static func ==(lhs: ChannelInfo, rhs: ChannelInfo) -> Bool { if lhs.nodeOne != rhs.nodeOne { @@ -2456,13 +2827,7 @@ public struct ChannelUpdateInfo { // Default memberwise initializers are never public by default, so we // declare one manually. - public init( - lastUpdate: UInt32, - enabled: Bool, - cltvExpiryDelta: UInt16, - htlcMinimumMsat: UInt64, - htlcMaximumMsat: UInt64, - fees: RoutingFees) { + public init(lastUpdate: UInt32, enabled: Bool, cltvExpiryDelta: UInt16, htlcMinimumMsat: UInt64, htlcMaximumMsat: UInt64, fees: RoutingFees) { self.lastUpdate = lastUpdate self.enabled = enabled self.cltvExpiryDelta = cltvExpiryDelta @@ -2473,6 +2838,7 @@ public struct ChannelUpdateInfo { } + extension ChannelUpdateInfo: Equatable, Hashable { public static func ==(lhs: ChannelUpdateInfo, rhs: ChannelUpdateInfo) -> Bool { if lhs.lastUpdate != rhs.lastUpdate { @@ -2545,46 +2911,31 @@ public struct Config { public var logDirPath: String? public var network: Network public var listeningAddresses: [SocketAddress]? - public var defaultCltvExpiryDelta: UInt32 - public var onchainWalletSyncIntervalSecs: UInt64 - public var walletSyncIntervalSecs: UInt64 - public var feeRateCacheUpdateIntervalSecs: UInt64 + public var nodeAlias: NodeAlias? public var trustedPeers0conf: [PublicKey] public var probingLiquidityLimitMultiplier: UInt64 public var logLevel: LogLevel public var anchorChannelsConfig: AnchorChannelsConfig? + public var sendingParameters: SendingParameters? // Default memberwise initializers are never public by default, so we // declare one manually. - public init( - storageDirPath: String, - logDirPath: String?, - network: Network, - listeningAddresses: [SocketAddress]?, - defaultCltvExpiryDelta: UInt32, - onchainWalletSyncIntervalSecs: UInt64, - walletSyncIntervalSecs: UInt64, - feeRateCacheUpdateIntervalSecs: UInt64, - trustedPeers0conf: [PublicKey], - probingLiquidityLimitMultiplier: UInt64, - logLevel: LogLevel, - anchorChannelsConfig: AnchorChannelsConfig?) { + public init(storageDirPath: String, logDirPath: String?, network: Network, listeningAddresses: [SocketAddress]?, nodeAlias: NodeAlias?, trustedPeers0conf: [PublicKey], probingLiquidityLimitMultiplier: UInt64, logLevel: LogLevel, anchorChannelsConfig: AnchorChannelsConfig?, sendingParameters: SendingParameters?) { self.storageDirPath = storageDirPath self.logDirPath = logDirPath self.network = network self.listeningAddresses = listeningAddresses - self.defaultCltvExpiryDelta = defaultCltvExpiryDelta - self.onchainWalletSyncIntervalSecs = onchainWalletSyncIntervalSecs - self.walletSyncIntervalSecs = walletSyncIntervalSecs - self.feeRateCacheUpdateIntervalSecs = feeRateCacheUpdateIntervalSecs + self.nodeAlias = nodeAlias self.trustedPeers0conf = trustedPeers0conf self.probingLiquidityLimitMultiplier = probingLiquidityLimitMultiplier self.logLevel = logLevel self.anchorChannelsConfig = anchorChannelsConfig + self.sendingParameters = sendingParameters } } + extension Config: Equatable, Hashable { public static func ==(lhs: Config, rhs: Config) -> Bool { if lhs.storageDirPath != rhs.storageDirPath { @@ -2599,16 +2950,7 @@ extension Config: Equatable, Hashable { if lhs.listeningAddresses != rhs.listeningAddresses { return false } - if lhs.defaultCltvExpiryDelta != rhs.defaultCltvExpiryDelta { - return false - } - if lhs.onchainWalletSyncIntervalSecs != rhs.onchainWalletSyncIntervalSecs { - return false - } - if lhs.walletSyncIntervalSecs != rhs.walletSyncIntervalSecs { - return false - } - if lhs.feeRateCacheUpdateIntervalSecs != rhs.feeRateCacheUpdateIntervalSecs { + if lhs.nodeAlias != rhs.nodeAlias { return false } if lhs.trustedPeers0conf != rhs.trustedPeers0conf { @@ -2623,6 +2965,9 @@ extension Config: Equatable, Hashable { if lhs.anchorChannelsConfig != rhs.anchorChannelsConfig { return false } + if lhs.sendingParameters != rhs.sendingParameters { + return false + } return true } @@ -2631,14 +2976,12 @@ extension Config: Equatable, Hashable { hasher.combine(logDirPath) hasher.combine(network) hasher.combine(listeningAddresses) - hasher.combine(defaultCltvExpiryDelta) - hasher.combine(onchainWalletSyncIntervalSecs) - hasher.combine(walletSyncIntervalSecs) - hasher.combine(feeRateCacheUpdateIntervalSecs) + hasher.combine(nodeAlias) hasher.combine(trustedPeers0conf) hasher.combine(probingLiquidityLimitMultiplier) hasher.combine(logLevel) hasher.combine(anchorChannelsConfig) + hasher.combine(sendingParameters) } } @@ -2651,14 +2994,12 @@ public struct FfiConverterTypeConfig: FfiConverterRustBuffer { logDirPath: FfiConverterOptionString.read(from: &buf), network: FfiConverterTypeNetwork.read(from: &buf), listeningAddresses: FfiConverterOptionSequenceTypeSocketAddress.read(from: &buf), - defaultCltvExpiryDelta: FfiConverterUInt32.read(from: &buf), - onchainWalletSyncIntervalSecs: FfiConverterUInt64.read(from: &buf), - walletSyncIntervalSecs: FfiConverterUInt64.read(from: &buf), - feeRateCacheUpdateIntervalSecs: FfiConverterUInt64.read(from: &buf), + nodeAlias: FfiConverterOptionTypeNodeAlias.read(from: &buf), trustedPeers0conf: FfiConverterSequenceTypePublicKey.read(from: &buf), probingLiquidityLimitMultiplier: FfiConverterUInt64.read(from: &buf), logLevel: FfiConverterTypeLogLevel.read(from: &buf), - anchorChannelsConfig: FfiConverterOptionTypeAnchorChannelsConfig.read(from: &buf) + anchorChannelsConfig: FfiConverterOptionTypeAnchorChannelsConfig.read(from: &buf), + sendingParameters: FfiConverterOptionTypeSendingParameters.read(from: &buf) ) } @@ -2667,14 +3008,12 @@ public struct FfiConverterTypeConfig: FfiConverterRustBuffer { FfiConverterOptionString.write(value.logDirPath, into: &buf) FfiConverterTypeNetwork.write(value.network, into: &buf) FfiConverterOptionSequenceTypeSocketAddress.write(value.listeningAddresses, into: &buf) - FfiConverterUInt32.write(value.defaultCltvExpiryDelta, into: &buf) - FfiConverterUInt64.write(value.onchainWalletSyncIntervalSecs, into: &buf) - FfiConverterUInt64.write(value.walletSyncIntervalSecs, into: &buf) - FfiConverterUInt64.write(value.feeRateCacheUpdateIntervalSecs, into: &buf) + FfiConverterOptionTypeNodeAlias.write(value.nodeAlias, into: &buf) FfiConverterSequenceTypePublicKey.write(value.trustedPeers0conf, into: &buf) FfiConverterUInt64.write(value.probingLiquidityLimitMultiplier, into: &buf) FfiConverterTypeLogLevel.write(value.logLevel, into: &buf) FfiConverterOptionTypeAnchorChannelsConfig.write(value.anchorChannelsConfig, into: &buf) + FfiConverterOptionTypeSendingParameters.write(value.sendingParameters, into: &buf) } } @@ -2688,21 +3027,85 @@ public func FfiConverterTypeConfig_lower(_ value: Config) -> RustBuffer { } +public struct EsploraSyncConfig { + public var onchainWalletSyncIntervalSecs: UInt64 + public var lightningWalletSyncIntervalSecs: UInt64 + public var feeRateCacheUpdateIntervalSecs: UInt64 + + // Default memberwise initializers are never public by default, so we + // declare one manually. + public init(onchainWalletSyncIntervalSecs: UInt64, lightningWalletSyncIntervalSecs: UInt64, feeRateCacheUpdateIntervalSecs: UInt64) { + self.onchainWalletSyncIntervalSecs = onchainWalletSyncIntervalSecs + self.lightningWalletSyncIntervalSecs = lightningWalletSyncIntervalSecs + self.feeRateCacheUpdateIntervalSecs = feeRateCacheUpdateIntervalSecs + } +} + + + +extension EsploraSyncConfig: Equatable, Hashable { + public static func ==(lhs: EsploraSyncConfig, rhs: EsploraSyncConfig) -> Bool { + if lhs.onchainWalletSyncIntervalSecs != rhs.onchainWalletSyncIntervalSecs { + return false + } + if lhs.lightningWalletSyncIntervalSecs != rhs.lightningWalletSyncIntervalSecs { + return false + } + if lhs.feeRateCacheUpdateIntervalSecs != rhs.feeRateCacheUpdateIntervalSecs { + return false + } + return true + } + + public func hash(into hasher: inout Hasher) { + hasher.combine(onchainWalletSyncIntervalSecs) + hasher.combine(lightningWalletSyncIntervalSecs) + hasher.combine(feeRateCacheUpdateIntervalSecs) + } +} + + +public struct FfiConverterTypeEsploraSyncConfig: FfiConverterRustBuffer { + public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> EsploraSyncConfig { + return + try EsploraSyncConfig( + onchainWalletSyncIntervalSecs: FfiConverterUInt64.read(from: &buf), + lightningWalletSyncIntervalSecs: FfiConverterUInt64.read(from: &buf), + feeRateCacheUpdateIntervalSecs: FfiConverterUInt64.read(from: &buf) + ) + } + + public static func write(_ value: EsploraSyncConfig, into buf: inout [UInt8]) { + FfiConverterUInt64.write(value.onchainWalletSyncIntervalSecs, into: &buf) + FfiConverterUInt64.write(value.lightningWalletSyncIntervalSecs, into: &buf) + FfiConverterUInt64.write(value.feeRateCacheUpdateIntervalSecs, into: &buf) + } +} + + +public func FfiConverterTypeEsploraSyncConfig_lift(_ buf: RustBuffer) throws -> EsploraSyncConfig { + return try FfiConverterTypeEsploraSyncConfig.lift(buf) +} + +public func FfiConverterTypeEsploraSyncConfig_lower(_ value: EsploraSyncConfig) -> RustBuffer { + return FfiConverterTypeEsploraSyncConfig.lower(value) +} + + public struct LspFeeLimits { public var maxTotalOpeningFeeMsat: UInt64? public var maxProportionalOpeningFeePpmMsat: UInt64? // Default memberwise initializers are never public by default, so we // declare one manually. - public init( - maxTotalOpeningFeeMsat: UInt64?, - maxProportionalOpeningFeePpmMsat: UInt64?) { + public init(maxTotalOpeningFeeMsat: UInt64?, maxProportionalOpeningFeePpmMsat: UInt64?) { self.maxTotalOpeningFeeMsat = maxTotalOpeningFeeMsat self.maxProportionalOpeningFeePpmMsat = maxProportionalOpeningFeePpmMsat } } + extension LspFeeLimits: Equatable, Hashable { public static func ==(lhs: LspFeeLimits, rhs: LspFeeLimits) -> Bool { if lhs.maxTotalOpeningFeeMsat != rhs.maxTotalOpeningFeeMsat { @@ -2753,10 +3156,7 @@ public struct NodeAnnouncementInfo { // Default memberwise initializers are never public by default, so we // declare one manually. - public init( - lastUpdate: UInt32, - alias: String, - addresses: [SocketAddress]) { + public init(lastUpdate: UInt32, alias: String, addresses: [SocketAddress]) { self.lastUpdate = lastUpdate self.alias = alias self.addresses = addresses @@ -2764,6 +3164,7 @@ public struct NodeAnnouncementInfo { } + extension NodeAnnouncementInfo: Equatable, Hashable { public static func ==(lhs: NodeAnnouncementInfo, rhs: NodeAnnouncementInfo) -> Bool { if lhs.lastUpdate != rhs.lastUpdate { @@ -2819,15 +3220,14 @@ public struct NodeInfo { // Default memberwise initializers are never public by default, so we // declare one manually. - public init( - channels: [UInt64], - announcementInfo: NodeAnnouncementInfo?) { + public init(channels: [UInt64], announcementInfo: NodeAnnouncementInfo?) { self.channels = channels self.announcementInfo = announcementInfo } } + extension NodeInfo: Equatable, Hashable { public static func ==(lhs: NodeInfo, rhs: NodeInfo) -> Bool { if lhs.channels != rhs.channels { @@ -2875,35 +3275,30 @@ public struct NodeStatus { public var isRunning: Bool public var isListening: Bool public var currentBestBlock: BestBlock - public var latestWalletSyncTimestamp: UInt64? + public var latestLightningWalletSyncTimestamp: UInt64? public var latestOnchainWalletSyncTimestamp: UInt64? public var latestFeeRateCacheUpdateTimestamp: UInt64? public var latestRgsSnapshotTimestamp: UInt64? public var latestNodeAnnouncementBroadcastTimestamp: UInt64? + public var latestChannelMonitorArchivalHeight: UInt32? // Default memberwise initializers are never public by default, so we // declare one manually. - public init( - isRunning: Bool, - isListening: Bool, - currentBestBlock: BestBlock, - latestWalletSyncTimestamp: UInt64?, - latestOnchainWalletSyncTimestamp: UInt64?, - latestFeeRateCacheUpdateTimestamp: UInt64?, - latestRgsSnapshotTimestamp: UInt64?, - latestNodeAnnouncementBroadcastTimestamp: UInt64?) { + public init(isRunning: Bool, isListening: Bool, currentBestBlock: BestBlock, latestLightningWalletSyncTimestamp: UInt64?, latestOnchainWalletSyncTimestamp: UInt64?, latestFeeRateCacheUpdateTimestamp: UInt64?, latestRgsSnapshotTimestamp: UInt64?, latestNodeAnnouncementBroadcastTimestamp: UInt64?, latestChannelMonitorArchivalHeight: UInt32?) { self.isRunning = isRunning self.isListening = isListening self.currentBestBlock = currentBestBlock - self.latestWalletSyncTimestamp = latestWalletSyncTimestamp + self.latestLightningWalletSyncTimestamp = latestLightningWalletSyncTimestamp self.latestOnchainWalletSyncTimestamp = latestOnchainWalletSyncTimestamp self.latestFeeRateCacheUpdateTimestamp = latestFeeRateCacheUpdateTimestamp self.latestRgsSnapshotTimestamp = latestRgsSnapshotTimestamp self.latestNodeAnnouncementBroadcastTimestamp = latestNodeAnnouncementBroadcastTimestamp + self.latestChannelMonitorArchivalHeight = latestChannelMonitorArchivalHeight } } + extension NodeStatus: Equatable, Hashable { public static func ==(lhs: NodeStatus, rhs: NodeStatus) -> Bool { if lhs.isRunning != rhs.isRunning { @@ -2915,7 +3310,7 @@ extension NodeStatus: Equatable, Hashable { if lhs.currentBestBlock != rhs.currentBestBlock { return false } - if lhs.latestWalletSyncTimestamp != rhs.latestWalletSyncTimestamp { + if lhs.latestLightningWalletSyncTimestamp != rhs.latestLightningWalletSyncTimestamp { return false } if lhs.latestOnchainWalletSyncTimestamp != rhs.latestOnchainWalletSyncTimestamp { @@ -2930,6 +3325,9 @@ extension NodeStatus: Equatable, Hashable { if lhs.latestNodeAnnouncementBroadcastTimestamp != rhs.latestNodeAnnouncementBroadcastTimestamp { return false } + if lhs.latestChannelMonitorArchivalHeight != rhs.latestChannelMonitorArchivalHeight { + return false + } return true } @@ -2937,11 +3335,12 @@ extension NodeStatus: Equatable, Hashable { hasher.combine(isRunning) hasher.combine(isListening) hasher.combine(currentBestBlock) - hasher.combine(latestWalletSyncTimestamp) + hasher.combine(latestLightningWalletSyncTimestamp) hasher.combine(latestOnchainWalletSyncTimestamp) hasher.combine(latestFeeRateCacheUpdateTimestamp) hasher.combine(latestRgsSnapshotTimestamp) hasher.combine(latestNodeAnnouncementBroadcastTimestamp) + hasher.combine(latestChannelMonitorArchivalHeight) } } @@ -2953,11 +3352,12 @@ public struct FfiConverterTypeNodeStatus: FfiConverterRustBuffer { isRunning: FfiConverterBool.read(from: &buf), isListening: FfiConverterBool.read(from: &buf), currentBestBlock: FfiConverterTypeBestBlock.read(from: &buf), - latestWalletSyncTimestamp: FfiConverterOptionUInt64.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) + latestNodeAnnouncementBroadcastTimestamp: FfiConverterOptionUInt64.read(from: &buf), + latestChannelMonitorArchivalHeight: FfiConverterOptionUInt32.read(from: &buf) ) } @@ -2965,11 +3365,12 @@ public struct FfiConverterTypeNodeStatus: FfiConverterRustBuffer { FfiConverterBool.write(value.isRunning, into: &buf) FfiConverterBool.write(value.isListening, into: &buf) FfiConverterTypeBestBlock.write(value.currentBestBlock, into: &buf) - FfiConverterOptionUInt64.write(value.latestWalletSyncTimestamp, into: &buf) + FfiConverterOptionUInt64.write(value.latestLightningWalletSyncTimestamp, into: &buf) FfiConverterOptionUInt64.write(value.latestOnchainWalletSyncTimestamp, into: &buf) FfiConverterOptionUInt64.write(value.latestFeeRateCacheUpdateTimestamp, into: &buf) FfiConverterOptionUInt64.write(value.latestRgsSnapshotTimestamp, into: &buf) FfiConverterOptionUInt64.write(value.latestNodeAnnouncementBroadcastTimestamp, into: &buf) + FfiConverterOptionUInt32.write(value.latestChannelMonitorArchivalHeight, into: &buf) } } @@ -2989,15 +3390,14 @@ public struct OutPoint { // Default memberwise initializers are never public by default, so we // declare one manually. - public init( - txid: Txid, - vout: UInt32) { + public init(txid: Txid, vout: UInt32) { self.txid = txid self.vout = vout } } + extension OutPoint: Equatable, Hashable { public static func ==(lhs: OutPoint, rhs: OutPoint) -> Bool { if lhs.txid != rhs.txid { @@ -3051,13 +3451,7 @@ public struct PaymentDetails { // Default memberwise initializers are never public by default, so we // declare one manually. - public init( - id: PaymentId, - kind: PaymentKind, - amountMsat: UInt64?, - direction: PaymentDirection, - status: PaymentStatus, - latestUpdateTimestamp: UInt64) { + public init(id: PaymentId, kind: PaymentKind, amountMsat: UInt64?, direction: PaymentDirection, status: PaymentStatus, latestUpdateTimestamp: UInt64) { self.id = id self.kind = kind self.amountMsat = amountMsat @@ -3068,6 +3462,7 @@ public struct PaymentDetails { } + extension PaymentDetails: Equatable, Hashable { public static func ==(lhs: PaymentDetails, rhs: PaymentDetails) -> Bool { if lhs.id != rhs.id { @@ -3143,11 +3538,7 @@ public struct PeerDetails { // Default memberwise initializers are never public by default, so we // declare one manually. - public init( - nodeId: PublicKey, - address: SocketAddress, - isPersisted: Bool, - isConnected: Bool) { + public init(nodeId: PublicKey, address: SocketAddress, isPersisted: Bool, isConnected: Bool) { self.nodeId = nodeId self.address = address self.isPersisted = isPersisted @@ -3156,6 +3547,7 @@ public struct PeerDetails { } + extension PeerDetails: Equatable, Hashable { public static func ==(lhs: PeerDetails, rhs: PeerDetails) -> Bool { if lhs.nodeId != rhs.nodeId { @@ -3206,69 +3598,210 @@ public func FfiConverterTypePeerDetails_lift(_ buf: RustBuffer) throws -> PeerDe return try FfiConverterTypePeerDetails.lift(buf) } -public func FfiConverterTypePeerDetails_lower(_ value: PeerDetails) -> RustBuffer { - return FfiConverterTypePeerDetails.lower(value) +public func FfiConverterTypePeerDetails_lower(_ value: PeerDetails) -> RustBuffer { + return FfiConverterTypePeerDetails.lower(value) +} + + +public struct RoutingFees { + public var baseMsat: UInt32 + public var proportionalMillionths: UInt32 + + // Default memberwise initializers are never public by default, so we + // declare one manually. + public init(baseMsat: UInt32, proportionalMillionths: UInt32) { + self.baseMsat = baseMsat + self.proportionalMillionths = proportionalMillionths + } +} + + + +extension RoutingFees: Equatable, Hashable { + public static func ==(lhs: RoutingFees, rhs: RoutingFees) -> Bool { + if lhs.baseMsat != rhs.baseMsat { + return false + } + if lhs.proportionalMillionths != rhs.proportionalMillionths { + return false + } + return true + } + + public func hash(into hasher: inout Hasher) { + hasher.combine(baseMsat) + hasher.combine(proportionalMillionths) + } +} + + +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), + proportionalMillionths: FfiConverterUInt32.read(from: &buf) + ) + } + + public static func write(_ value: RoutingFees, into buf: inout [UInt8]) { + FfiConverterUInt32.write(value.baseMsat, into: &buf) + FfiConverterUInt32.write(value.proportionalMillionths, into: &buf) + } +} + + +public func FfiConverterTypeRoutingFees_lift(_ buf: RustBuffer) throws -> RoutingFees { + return try FfiConverterTypeRoutingFees.lift(buf) +} + +public func FfiConverterTypeRoutingFees_lower(_ value: RoutingFees) -> RustBuffer { + return FfiConverterTypeRoutingFees.lower(value) } -public struct RoutingFees { - public var baseMsat: UInt32 - public var proportionalMillionths: UInt32 +public struct SendingParameters { + public var maxTotalRoutingFeeMsat: MaxTotalRoutingFeeLimit? + public var maxTotalCltvExpiryDelta: UInt32? + public var maxPathCount: UInt8? + public var maxChannelSaturationPowerOfHalf: UInt8? // Default memberwise initializers are never public by default, so we // declare one manually. - public init( - baseMsat: UInt32, - proportionalMillionths: UInt32) { - self.baseMsat = baseMsat - self.proportionalMillionths = proportionalMillionths + public init(maxTotalRoutingFeeMsat: MaxTotalRoutingFeeLimit?, maxTotalCltvExpiryDelta: UInt32?, maxPathCount: UInt8?, maxChannelSaturationPowerOfHalf: UInt8?) { + self.maxTotalRoutingFeeMsat = maxTotalRoutingFeeMsat + self.maxTotalCltvExpiryDelta = maxTotalCltvExpiryDelta + self.maxPathCount = maxPathCount + self.maxChannelSaturationPowerOfHalf = maxChannelSaturationPowerOfHalf } } -extension RoutingFees: Equatable, Hashable { - public static func ==(lhs: RoutingFees, rhs: RoutingFees) -> Bool { - if lhs.baseMsat != rhs.baseMsat { + +extension SendingParameters: Equatable, Hashable { + public static func ==(lhs: SendingParameters, rhs: SendingParameters) -> Bool { + if lhs.maxTotalRoutingFeeMsat != rhs.maxTotalRoutingFeeMsat { return false } - if lhs.proportionalMillionths != rhs.proportionalMillionths { + if lhs.maxTotalCltvExpiryDelta != rhs.maxTotalCltvExpiryDelta { + return false + } + if lhs.maxPathCount != rhs.maxPathCount { + return false + } + if lhs.maxChannelSaturationPowerOfHalf != rhs.maxChannelSaturationPowerOfHalf { return false } return true } public func hash(into hasher: inout Hasher) { - hasher.combine(baseMsat) - hasher.combine(proportionalMillionths) + hasher.combine(maxTotalRoutingFeeMsat) + hasher.combine(maxTotalCltvExpiryDelta) + hasher.combine(maxPathCount) + hasher.combine(maxChannelSaturationPowerOfHalf) } } -public struct FfiConverterTypeRoutingFees: FfiConverterRustBuffer { - public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> RoutingFees { +public struct FfiConverterTypeSendingParameters: FfiConverterRustBuffer { + public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SendingParameters { return - try RoutingFees( - baseMsat: FfiConverterUInt32.read(from: &buf), - proportionalMillionths: FfiConverterUInt32.read(from: &buf) + try SendingParameters( + 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: RoutingFees, into buf: inout [UInt8]) { - FfiConverterUInt32.write(value.baseMsat, into: &buf) - FfiConverterUInt32.write(value.proportionalMillionths, into: &buf) + public static func write(_ value: SendingParameters, into buf: inout [UInt8]) { + FfiConverterOptionTypeMaxTotalRoutingFeeLimit.write(value.maxTotalRoutingFeeMsat, into: &buf) + FfiConverterOptionUInt32.write(value.maxTotalCltvExpiryDelta, into: &buf) + FfiConverterOptionUInt8.write(value.maxPathCount, into: &buf) + FfiConverterOptionUInt8.write(value.maxChannelSaturationPowerOfHalf, into: &buf) } } -public func FfiConverterTypeRoutingFees_lift(_ buf: RustBuffer) throws -> RoutingFees { - return try FfiConverterTypeRoutingFees.lift(buf) +public func FfiConverterTypeSendingParameters_lift(_ buf: RustBuffer) throws -> SendingParameters { + return try FfiConverterTypeSendingParameters.lift(buf) } -public func FfiConverterTypeRoutingFees_lower(_ value: RoutingFees) -> RustBuffer { - return FfiConverterTypeRoutingFees.lower(value) +public func FfiConverterTypeSendingParameters_lower(_ value: SendingParameters) -> RustBuffer { + return FfiConverterTypeSendingParameters.lower(value) +} + +// Note that we don't yet support `indirect` for enums. +// 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) +} + +public func FfiConverterTypeBalanceSource_lower(_ value: BalanceSource) -> RustBuffer { + return FfiConverterTypeBalanceSource.lower(value) } + +extension BalanceSource: Equatable, Hashable {} + + + + public enum BuildError { @@ -3283,6 +3816,8 @@ public enum BuildError { case InvalidListeningAddresses(message: String) + case InvalidNodeAlias(message: String) + case ReadFailed(message: String) case WriteFailed(message: String) @@ -3295,10 +3830,6 @@ public enum BuildError { case LoggerSetupFailed(message: String) - - fileprivate static func uniffiErrorHandler(_ error: RustBuffer) throws -> Error { - return try FfiConverterTypeBuildError.lift(error) - } } @@ -3332,27 +3863,31 @@ public struct FfiConverterTypeBuildError: FfiConverterRustBuffer { message: try FfiConverterString.read(from: &buf) ) - case 6: return .ReadFailed( + case 6: return .InvalidNodeAlias( message: try FfiConverterString.read(from: &buf) ) - case 7: return .WriteFailed( + case 7: return .ReadFailed( message: try FfiConverterString.read(from: &buf) ) - case 8: return .StoragePathAccessFailed( + case 8: return .WriteFailed( message: try FfiConverterString.read(from: &buf) ) - case 9: return .KvStoreSetupFailed( + case 9: return .StoragePathAccessFailed( message: try FfiConverterString.read(from: &buf) ) - case 10: return .WalletSetupFailed( + case 10: return .KvStoreSetupFailed( message: try FfiConverterString.read(from: &buf) ) - case 11: return .LoggerSetupFailed( + case 11: return .WalletSetupFailed( + message: try FfiConverterString.read(from: &buf) + ) + + case 12: return .LoggerSetupFailed( message: try FfiConverterString.read(from: &buf) ) @@ -3377,18 +3912,20 @@ public struct FfiConverterTypeBuildError: FfiConverterRustBuffer { writeInt(&buf, Int32(4)) case .InvalidListeningAddresses(_ /* message is ignored*/): writeInt(&buf, Int32(5)) - case .ReadFailed(_ /* message is ignored*/): + case .InvalidNodeAlias(_ /* message is ignored*/): writeInt(&buf, Int32(6)) - case .WriteFailed(_ /* message is ignored*/): + case .ReadFailed(_ /* message is ignored*/): writeInt(&buf, Int32(7)) - case .StoragePathAccessFailed(_ /* message is ignored*/): + case .WriteFailed(_ /* message is ignored*/): writeInt(&buf, Int32(8)) - case .KvStoreSetupFailed(_ /* message is ignored*/): + case .StoragePathAccessFailed(_ /* message is ignored*/): writeInt(&buf, Int32(9)) - case .WalletSetupFailed(_ /* message is ignored*/): + case .KvStoreSetupFailed(_ /* message is ignored*/): writeInt(&buf, Int32(10)) - case .LoggerSetupFailed(_ /* message is ignored*/): + case .WalletSetupFailed(_ /* message is ignored*/): writeInt(&buf, Int32(11)) + case .LoggerSetupFailed(_ /* message is ignored*/): + writeInt(&buf, Int32(12)) } @@ -3402,27 +3939,30 @@ 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 counterpartyForceClosed(peerMsg: UntrustedString + ) + case holderForceClosed(broadcastedLatestTxn: Bool? ) - case holderForceClosed case legacyCooperativeClosure case counterpartyInitiatedCooperativeClosure case locallyInitiatedCooperativeClosure case commitmentTxConfirmed case fundingTimedOut - case processingError( - err: String + case processingError(err: String ) case disconnectedPeer case outdatedChannelManager case counterpartyCoopClosedUnfundedChannel case fundingBatchClosure case htlCsTimedOut + case peerFeerateTooLow(peerFeerateSatPerKw: UInt32, requiredFeerateSatPerKw: UInt32 + ) } + public struct FfiConverterTypeClosureReason: FfiConverterRustBuffer { typealias SwiftType = ClosureReason @@ -3430,11 +3970,11 @@ public struct FfiConverterTypeClosureReason: FfiConverterRustBuffer { let variant: Int32 = try readInt(&buf) switch variant { - case 1: return .counterpartyForceClosed( - peerMsg: try FfiConverterTypeUntrustedString.read(from: &buf) + case 1: return .counterpartyForceClosed(peerMsg: try FfiConverterTypeUntrustedString.read(from: &buf) ) - case 2: return .holderForceClosed + case 2: return .holderForceClosed(broadcastedLatestTxn: try FfiConverterOptionBool.read(from: &buf) + ) case 3: return .legacyCooperativeClosure @@ -3446,8 +3986,7 @@ public struct FfiConverterTypeClosureReason: FfiConverterRustBuffer { case 7: return .fundingTimedOut - case 8: return .processingError( - err: try FfiConverterString.read(from: &buf) + case 8: return .processingError(err: try FfiConverterString.read(from: &buf) ) case 9: return .disconnectedPeer @@ -3460,6 +3999,9 @@ public struct FfiConverterTypeClosureReason: FfiConverterRustBuffer { case 13: return .htlCsTimedOut + case 14: return .peerFeerateTooLow(peerFeerateSatPerKw: try FfiConverterUInt32.read(from: &buf), requiredFeerateSatPerKw: try FfiConverterUInt32.read(from: &buf) + ) + default: throw UniffiInternalError.unexpectedEnumCase } } @@ -3473,9 +4015,10 @@ public struct FfiConverterTypeClosureReason: FfiConverterRustBuffer { FfiConverterTypeUntrustedString.write(peerMsg, into: &buf) - case .holderForceClosed: + case let .holderForceClosed(broadcastedLatestTxn): writeInt(&buf, Int32(2)) - + FfiConverterOptionBool.write(broadcastedLatestTxn, into: &buf) + case .legacyCooperativeClosure: writeInt(&buf, Int32(3)) @@ -3521,6 +4064,12 @@ public struct FfiConverterTypeClosureReason: FfiConverterRustBuffer { case .htlCsTimedOut: writeInt(&buf, Int32(13)) + + case let .peerFeerateTooLow(peerFeerateSatPerKw,requiredFeerateSatPerKw): + writeInt(&buf, Int32(14)) + FfiConverterUInt32.write(peerFeerateSatPerKw, into: &buf) + FfiConverterUInt32.write(requiredFeerateSatPerKw, into: &buf) + } } } @@ -3535,55 +4084,33 @@ public func FfiConverterTypeClosureReason_lower(_ value: ClosureReason) -> RustB } + 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 Event { - case paymentSuccessful( - paymentId: PaymentId?, - paymentHash: PaymentHash, - feePaidMsat: UInt64? + case paymentSuccessful(paymentId: PaymentId?, paymentHash: PaymentHash, feePaidMsat: UInt64? ) - case paymentFailed( - paymentId: PaymentId?, - paymentHash: PaymentHash, - reason: PaymentFailureReason? + case paymentFailed(paymentId: PaymentId?, paymentHash: PaymentHash?, reason: PaymentFailureReason? ) - case paymentReceived( - paymentId: PaymentId?, - paymentHash: PaymentHash, - amountMsat: UInt64 + case paymentReceived(paymentId: PaymentId?, paymentHash: PaymentHash, amountMsat: UInt64 ) - case paymentClaimable( - paymentId: PaymentId, - paymentHash: PaymentHash, - claimableAmountMsat: UInt64, - claimDeadline: UInt32? + case paymentClaimable(paymentId: PaymentId, paymentHash: PaymentHash, claimableAmountMsat: UInt64, claimDeadline: UInt32? ) - case channelPending( - channelId: ChannelId, - userChannelId: UserChannelId, - formerTemporaryChannelId: ChannelId, - counterpartyNodeId: PublicKey, - fundingTxo: OutPoint + case channelPending(channelId: ChannelId, userChannelId: UserChannelId, formerTemporaryChannelId: ChannelId, counterpartyNodeId: PublicKey, fundingTxo: OutPoint ) - case channelReady( - channelId: ChannelId, - userChannelId: UserChannelId, - counterpartyNodeId: PublicKey? + case channelReady(channelId: ChannelId, userChannelId: UserChannelId, counterpartyNodeId: PublicKey? ) - case channelClosed( - channelId: ChannelId, - userChannelId: UserChannelId, - counterpartyNodeId: PublicKey?, - reason: ClosureReason? + case channelClosed(channelId: ChannelId, userChannelId: UserChannelId, counterpartyNodeId: PublicKey?, reason: ClosureReason? ) } + public struct FfiConverterTypeEvent: FfiConverterRustBuffer { typealias SwiftType = Event @@ -3591,50 +4118,25 @@ public struct FfiConverterTypeEvent: FfiConverterRustBuffer { let variant: Int32 = try readInt(&buf) switch variant { - case 1: return .paymentSuccessful( - paymentId: try FfiConverterOptionTypePaymentId.read(from: &buf), - paymentHash: try FfiConverterTypePaymentHash.read(from: &buf), - feePaidMsat: try FfiConverterOptionUInt64.read(from: &buf) + case 1: return .paymentSuccessful(paymentId: try FfiConverterOptionTypePaymentId.read(from: &buf), paymentHash: try FfiConverterTypePaymentHash.read(from: &buf), feePaidMsat: try FfiConverterOptionUInt64.read(from: &buf) ) - case 2: return .paymentFailed( - paymentId: try FfiConverterOptionTypePaymentId.read(from: &buf), - paymentHash: try FfiConverterTypePaymentHash.read(from: &buf), - reason: try FfiConverterOptionTypePaymentFailureReason.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) + case 3: return .paymentReceived(paymentId: try FfiConverterOptionTypePaymentId.read(from: &buf), paymentHash: try FfiConverterTypePaymentHash.read(from: &buf), amountMsat: try FfiConverterUInt64.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) + 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) ) - case 5: 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 5: 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 6: return .channelReady( - channelId: try FfiConverterTypeChannelId.read(from: &buf), - userChannelId: try FfiConverterTypeUserChannelId.read(from: &buf), - counterpartyNodeId: try FfiConverterOptionTypePublicKey.read(from: &buf) + case 6: return .channelReady(channelId: try FfiConverterTypeChannelId.read(from: &buf), userChannelId: try FfiConverterTypeUserChannelId.read(from: &buf), counterpartyNodeId: try FfiConverterOptionTypePublicKey.read(from: &buf) ) - case 7: 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) + case 7: 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 @@ -3655,7 +4157,7 @@ public struct FfiConverterTypeEvent: FfiConverterRustBuffer { case let .paymentFailed(paymentId,paymentHash,reason): writeInt(&buf, Int32(2)) FfiConverterOptionTypePaymentId.write(paymentId, into: &buf) - FfiConverterTypePaymentHash.write(paymentHash, into: &buf) + FfiConverterOptionTypePaymentHash.write(paymentHash, into: &buf) FfiConverterOptionTypePaymentFailureReason.write(reason, into: &buf) @@ -3711,54 +4213,31 @@ public func FfiConverterTypeEvent_lower(_ value: Event) -> RustBuffer { } + 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 + 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 + 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 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 + 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 maybePreimageClaimableHtlc(channelId: ChannelId, counterpartyNodeId: PublicKey, amountSatoshis: UInt64, expiryHeight: UInt32, paymentHash: PaymentHash ) - case counterpartyRevokedOutputClaimable( - channelId: ChannelId, - counterpartyNodeId: PublicKey, - amountSatoshis: UInt64 + case counterpartyRevokedOutputClaimable(channelId: ChannelId, counterpartyNodeId: PublicKey, amountSatoshis: UInt64 ) } + public struct FfiConverterTypeLightningBalance: FfiConverterRustBuffer { typealias SwiftType = LightningBalance @@ -3766,48 +4245,22 @@ public struct FfiConverterTypeLightningBalance: FfiConverterRustBuffer { let variant: Int32 = try readInt(&buf) switch variant { - case 1: return .claimableOnChannelClose( - channelId: try FfiConverterTypeChannelId.read(from: &buf), - counterpartyNodeId: try FfiConverterTypePublicKey.read(from: &buf), - amountSatoshis: try 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) + 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 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) + 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 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) + 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 @@ -3818,19 +4271,25 @@ public struct FfiConverterTypeLightningBalance: FfiConverterRustBuffer { switch value { - case let .claimableOnChannelClose(channelId,counterpartyNodeId,amountSatoshis): + 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) FfiConverterUInt64.write(amountSatoshis, into: &buf) + FfiConverterUInt64.write(transactionFeeSatoshis, into: &buf) + FfiConverterUInt64.write(outboundPaymentHtlcRoundedMsat, into: &buf) + FfiConverterUInt64.write(outboundForwardedHtlcRoundedMsat, into: &buf) + FfiConverterUInt64.write(inboundClaimingHtlcRoundedMsat, into: &buf) + FfiConverterUInt64.write(inboundHtlcRoundedMsat, into: &buf) - case let .claimableAwaitingConfirmations(channelId,counterpartyNodeId,amountSatoshis,confirmationHeight): + 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): @@ -3843,130 +4302,255 @@ public struct FfiConverterTypeLightningBalance: FfiConverterRustBuffer { FfiConverterTypePaymentPreimage.write(paymentPreimage, into: &buf) - case let .maybeTimeoutClaimableHtlc(channelId,counterpartyNodeId,amountSatoshis,claimableHeight,paymentHash): + case let .maybeTimeoutClaimableHtlc(channelId,counterpartyNodeId,amountSatoshis,claimableHeight,paymentHash,outboundPayment): writeInt(&buf, Int32(4)) FfiConverterTypeChannelId.write(channelId, into: &buf) FfiConverterTypePublicKey.write(counterpartyNodeId, into: &buf) FfiConverterUInt64.write(amountSatoshis, into: &buf) FfiConverterUInt32.write(claimableHeight, into: &buf) FfiConverterTypePaymentHash.write(paymentHash, into: &buf) + FfiConverterBool.write(outboundPayment, into: &buf) + + + 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): + 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) +} + +public func FfiConverterTypeLightningBalance_lower(_ value: LightningBalance) -> RustBuffer { + 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 + case info + case warn + 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) +} + +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 .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 .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 .fixedLimit(limitMsat): + writeInt(&buf, Int32(1)) + FfiConverterUInt64.write(limitMsat, into: &buf) - 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) + case let .feeRateMultiplier(multiplier): + writeInt(&buf, Int32(2)) + FfiConverterUInt64.write(multiplier, into: &buf) } } } -public func FfiConverterTypeLightningBalance_lift(_ buf: RustBuffer) throws -> LightningBalance { - return try FfiConverterTypeLightningBalance.lift(buf) +public func FfiConverterTypeMaxDustHTLCExposure_lift(_ buf: RustBuffer) throws -> MaxDustHtlcExposure { + return try FfiConverterTypeMaxDustHTLCExposure.lift(buf) } -public func FfiConverterTypeLightningBalance_lower(_ value: LightningBalance) -> RustBuffer { - return FfiConverterTypeLightningBalance.lower(value) +public func FfiConverterTypeMaxDustHTLCExposure_lower(_ value: MaxDustHtlcExposure) -> RustBuffer { + return FfiConverterTypeMaxDustHTLCExposure.lower(value) } -extension LightningBalance: Equatable, Hashable {} + +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 LogLevel { + +public enum MaxTotalRoutingFeeLimit { - case gossip - case trace - case debug - case info - case warn - case error + case none + case some(amountMsat: UInt64 + ) } -public struct FfiConverterTypeLogLevel: FfiConverterRustBuffer { - typealias SwiftType = LogLevel - public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> LogLevel { +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 .gossip - - case 2: return .trace - - case 3: return .debug - - case 4: return .info - - case 5: return .warn + case 1: return .none - case 6: return .error + case 2: return .some(amountMsat: try FfiConverterUInt64.read(from: &buf) + ) default: throw UniffiInternalError.unexpectedEnumCase } } - public static func write(_ value: LogLevel, into buf: inout [UInt8]) { + public static func write(_ value: MaxTotalRoutingFeeLimit, into buf: inout [UInt8]) { switch value { - case .gossip: + case .none: writeInt(&buf, Int32(1)) - case .trace: + case let .some(amountMsat): 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)) - + FfiConverterUInt64.write(amountMsat, into: &buf) + } } } -public func FfiConverterTypeLogLevel_lift(_ buf: RustBuffer) throws -> LogLevel { - return try FfiConverterTypeLogLevel.lift(buf) +public func FfiConverterTypeMaxTotalRoutingFeeLimit_lift(_ buf: RustBuffer) throws -> MaxTotalRoutingFeeLimit { + return try FfiConverterTypeMaxTotalRoutingFeeLimit.lift(buf) } -public func FfiConverterTypeLogLevel_lower(_ value: LogLevel) -> RustBuffer { - return FfiConverterTypeLogLevel.lower(value) +public func FfiConverterTypeMaxTotalRoutingFeeLimit_lower(_ value: MaxTotalRoutingFeeLimit) -> RustBuffer { + return FfiConverterTypeMaxTotalRoutingFeeLimit.lower(value) } -extension LogLevel: Equatable, Hashable {} + +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 @@ -3975,6 +4559,7 @@ public enum Network { case regtest } + public struct FfiConverterTypeNetwork: FfiConverterRustBuffer { typealias SwiftType = Network @@ -4027,6 +4612,7 @@ public func FfiConverterTypeNetwork_lower(_ value: Network) -> RustBuffer { } + extension Network: Equatable, Hashable {} @@ -4074,8 +4660,6 @@ public enum NodeError { case OnchainTxSigningFailed(message: String) - case MessageSigningFailed(message: String) - case TxSyncFailed(message: String) case TxSyncTimeout(message: String) @@ -4086,6 +4670,8 @@ public enum NodeError { case LiquidityRequestFailed(message: String) + case UriParameterParsingFailed(message: String) + case InvalidAddress(message: String) case InvalidSocketAddress(message: String) @@ -4118,6 +4704,12 @@ public enum NodeError { case InvalidNetwork(message: String) + case InvalidUri(message: String) + + case InvalidQuantity(message: String) + + case InvalidNodeAlias(message: String) + case DuplicatePayment(message: String) case UnsupportedCurrency(message: String) @@ -4128,10 +4720,6 @@ public enum NodeError { case LiquidityFeeTooHigh(message: String) - - fileprivate static func uniffiErrorHandler(_ error: RustBuffer) throws -> Error { - return try FfiConverterTypeNodeError.lift(error) - } } @@ -4221,27 +4809,27 @@ public struct FfiConverterTypeNodeError: FfiConverterRustBuffer { message: try FfiConverterString.read(from: &buf) ) - case 20: return .MessageSigningFailed( + case 20: return .TxSyncFailed( message: try FfiConverterString.read(from: &buf) ) - case 21: return .TxSyncFailed( + case 21: return .TxSyncTimeout( message: try FfiConverterString.read(from: &buf) ) - case 22: return .TxSyncTimeout( + case 22: return .GossipUpdateFailed( message: try FfiConverterString.read(from: &buf) ) - case 23: return .GossipUpdateFailed( + case 23: return .GossipUpdateTimeout( message: try FfiConverterString.read(from: &buf) ) - case 24: return .GossipUpdateTimeout( + case 24: return .LiquidityRequestFailed( message: try FfiConverterString.read(from: &buf) ) - case 25: return .LiquidityRequestFailed( + case 25: return .UriParameterParsingFailed( message: try FfiConverterString.read(from: &buf) ) @@ -4309,23 +4897,35 @@ public struct FfiConverterTypeNodeError: FfiConverterRustBuffer { message: try FfiConverterString.read(from: &buf) ) - case 42: return .DuplicatePayment( + case 42: return .InvalidUri( + message: try FfiConverterString.read(from: &buf) + ) + + case 43: return .InvalidQuantity( + message: try FfiConverterString.read(from: &buf) + ) + + case 44: return .InvalidNodeAlias( + message: try FfiConverterString.read(from: &buf) + ) + + case 45: return .DuplicatePayment( message: try FfiConverterString.read(from: &buf) ) - case 43: return .UnsupportedCurrency( + case 46: return .UnsupportedCurrency( message: try FfiConverterString.read(from: &buf) ) - case 44: return .InsufficientFunds( + case 47: return .InsufficientFunds( message: try FfiConverterString.read(from: &buf) ) - case 45: return .LiquiditySourceUnavailable( + case 48: return .LiquiditySourceUnavailable( message: try FfiConverterString.read(from: &buf) ) - case 46: return .LiquidityFeeTooHigh( + case 49: return .LiquidityFeeTooHigh( message: try FfiConverterString.read(from: &buf) ) @@ -4378,17 +4978,17 @@ public struct FfiConverterTypeNodeError: FfiConverterRustBuffer { writeInt(&buf, Int32(18)) case .OnchainTxSigningFailed(_ /* message is ignored*/): writeInt(&buf, Int32(19)) - case .MessageSigningFailed(_ /* message is ignored*/): - writeInt(&buf, Int32(20)) case .TxSyncFailed(_ /* message is ignored*/): - writeInt(&buf, Int32(21)) + writeInt(&buf, Int32(20)) case .TxSyncTimeout(_ /* message is ignored*/): - writeInt(&buf, Int32(22)) + writeInt(&buf, Int32(21)) case .GossipUpdateFailed(_ /* message is ignored*/): - writeInt(&buf, Int32(23)) + writeInt(&buf, Int32(22)) case .GossipUpdateTimeout(_ /* message is ignored*/): - writeInt(&buf, Int32(24)) + writeInt(&buf, Int32(23)) case .LiquidityRequestFailed(_ /* message is ignored*/): + writeInt(&buf, Int32(24)) + case .UriParameterParsingFailed(_ /* message is ignored*/): writeInt(&buf, Int32(25)) case .InvalidAddress(_ /* message is ignored*/): writeInt(&buf, Int32(26)) @@ -4422,16 +5022,22 @@ public struct FfiConverterTypeNodeError: FfiConverterRustBuffer { writeInt(&buf, Int32(40)) case .InvalidNetwork(_ /* message is ignored*/): writeInt(&buf, Int32(41)) - case .DuplicatePayment(_ /* message is ignored*/): + case .InvalidUri(_ /* message is ignored*/): writeInt(&buf, Int32(42)) - case .UnsupportedCurrency(_ /* message is ignored*/): + case .InvalidQuantity(_ /* message is ignored*/): writeInt(&buf, Int32(43)) - case .InsufficientFunds(_ /* message is ignored*/): + case .InvalidNodeAlias(_ /* message is ignored*/): writeInt(&buf, Int32(44)) - case .LiquiditySourceUnavailable(_ /* message is ignored*/): + case .DuplicatePayment(_ /* message is ignored*/): writeInt(&buf, Int32(45)) - case .LiquidityFeeTooHigh(_ /* message is ignored*/): + case .UnsupportedCurrency(_ /* message is ignored*/): writeInt(&buf, Int32(46)) + case .InsufficientFunds(_ /* message is ignored*/): + writeInt(&buf, Int32(47)) + case .LiquiditySourceUnavailable(_ /* message is ignored*/): + writeInt(&buf, Int32(48)) + case .LiquidityFeeTooHigh(_ /* message is ignored*/): + writeInt(&buf, Int32(49)) } @@ -4445,12 +5051,14 @@ 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 @@ -4491,12 +5099,14 @@ public func FfiConverterTypePaymentDirection_lower(_ value: PaymentDirection) -> } + 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 @@ -4505,8 +5115,12 @@ public enum PaymentFailureReason { case paymentExpired case routeNotFound case unexpectedError + case unknownRequiredFeatures + case invoiceRequestExpired + case invoiceRequestRejected } + public struct FfiConverterTypePaymentFailureReason: FfiConverterRustBuffer { typealias SwiftType = PaymentFailureReason @@ -4526,6 +5140,12 @@ public struct FfiConverterTypePaymentFailureReason: FfiConverterRustBuffer { case 6: return .unexpectedError + case 7: return .unknownRequiredFeatures + + case 8: return .invoiceRequestExpired + + case 9: return .invoiceRequestRejected + default: throw UniffiInternalError.unexpectedEnumCase } } @@ -4557,6 +5177,18 @@ public struct FfiConverterTypePaymentFailureReason: FfiConverterRustBuffer { case .unexpectedError: writeInt(&buf, Int32(6)) + + case .unknownRequiredFeatures: + writeInt(&buf, Int32(7)) + + + case .invoiceRequestExpired: + writeInt(&buf, Int32(8)) + + + case .invoiceRequestRejected: + writeInt(&buf, Int32(9)) + } } } @@ -4571,43 +5203,30 @@ public func FfiConverterTypePaymentFailureReason_lower(_ value: PaymentFailureRe } + 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 - case bolt11( - hash: PaymentHash, - preimage: PaymentPreimage?, - secret: PaymentSecret? + case bolt11(hash: PaymentHash, preimage: PaymentPreimage?, secret: PaymentSecret? ) - case bolt11Jit( - hash: PaymentHash, - preimage: PaymentPreimage?, - secret: PaymentSecret?, - lspFeeLimits: LspFeeLimits + case bolt11Jit(hash: PaymentHash, preimage: PaymentPreimage?, secret: PaymentSecret?, lspFeeLimits: LspFeeLimits ) - case bolt12Offer( - hash: PaymentHash?, - preimage: PaymentPreimage?, - secret: PaymentSecret?, - offerId: OfferId + case bolt12Offer(hash: PaymentHash?, preimage: PaymentPreimage?, secret: PaymentSecret?, offerId: OfferId, payerNote: UntrustedString?, quantity: UInt64? ) - case bolt12Refund( - hash: PaymentHash?, - preimage: PaymentPreimage?, - secret: PaymentSecret? + case bolt12Refund(hash: PaymentHash?, preimage: PaymentPreimage?, secret: PaymentSecret?, payerNote: UntrustedString?, quantity: UInt64? ) - case spontaneous( - hash: PaymentHash, - preimage: PaymentPreimage? + case spontaneous(hash: PaymentHash, preimage: PaymentPreimage? ) } + public struct FfiConverterTypePaymentKind: FfiConverterRustBuffer { typealias SwiftType = PaymentKind @@ -4617,35 +5236,19 @@ public struct FfiConverterTypePaymentKind: FfiConverterRustBuffer { case 1: return .onchain - case 2: return .bolt11( - hash: try FfiConverterTypePaymentHash.read(from: &buf), - preimage: try FfiConverterOptionTypePaymentPreimage.read(from: &buf), - secret: try FfiConverterOptionTypePaymentSecret.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) ) - case 3: return .bolt11Jit( - hash: try FfiConverterTypePaymentHash.read(from: &buf), - preimage: try FfiConverterOptionTypePaymentPreimage.read(from: &buf), - secret: try FfiConverterOptionTypePaymentSecret.read(from: &buf), - lspFeeLimits: try FfiConverterTypeLSPFeeLimits.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), lspFeeLimits: try FfiConverterTypeLSPFeeLimits.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) + 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) + 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) + case 6: return .spontaneous(hash: try FfiConverterTypePaymentHash.read(from: &buf), preimage: try FfiConverterOptionTypePaymentPreimage.read(from: &buf) ) default: throw UniffiInternalError.unexpectedEnumCase @@ -4675,19 +5278,23 @@ public struct FfiConverterTypePaymentKind: FfiConverterRustBuffer { FfiConverterTypeLSPFeeLimits.write(lspFeeLimits, into: &buf) - case let .bolt12Offer(hash,preimage,secret,offerId): + case let .bolt12Offer(hash,preimage,secret,offerId,payerNote,quantity): writeInt(&buf, Int32(4)) FfiConverterOptionTypePaymentHash.write(hash, into: &buf) FfiConverterOptionTypePaymentPreimage.write(preimage, into: &buf) FfiConverterOptionTypePaymentSecret.write(secret, into: &buf) FfiConverterTypeOfferId.write(offerId, into: &buf) + FfiConverterOptionTypeUntrustedString.write(payerNote, into: &buf) + FfiConverterOptionUInt64.write(quantity, into: &buf) - case let .bolt12Refund(hash,preimage,secret): + 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): @@ -4709,12 +5316,14 @@ public func FfiConverterTypePaymentKind_lower(_ value: PaymentKind) -> RustBuffe } + 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 PaymentStatus { case pending @@ -4722,6 +5331,7 @@ public enum PaymentStatus { case failed } + public struct FfiConverterTypePaymentStatus: FfiConverterRustBuffer { typealias SwiftType = PaymentStatus @@ -4768,33 +5378,25 @@ public func FfiConverterTypePaymentStatus_lower(_ value: PaymentStatus) -> RustB } + 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 pendingBroadcast(channelId: ChannelId?, amountSatoshis: UInt64 ) - case broadcastAwaitingConfirmation( - channelId: ChannelId?, - latestBroadcastHeight: UInt32, - latestSpendingTxid: Txid, - 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 awaitingThresholdConfirmations(channelId: ChannelId?, latestSpendingTxid: Txid, confirmationHash: BlockHash, confirmationHeight: UInt32, amountSatoshis: UInt64 ) } + public struct FfiConverterTypePendingSweepBalance: FfiConverterRustBuffer { typealias SwiftType = PendingSweepBalance @@ -4802,24 +5404,13 @@ public struct FfiConverterTypePendingSweepBalance: FfiConverterRustBuffer { let variant: Int32 = try readInt(&buf) switch variant { - case 1: return .pendingBroadcast( - channelId: try FfiConverterOptionTypeChannelId.read(from: &buf), - amountSatoshis: try 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 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) + 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 @@ -4844,31 +5435,196 @@ public struct FfiConverterTypePendingSweepBalance: FfiConverterRustBuffer { 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) +} + +public func FfiConverterTypePendingSweepBalance_lower(_ value: PendingSweepBalance) -> RustBuffer { + 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 + ) + case bolt12(paymentId: PaymentId + ) +} + + +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 .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) +} + +public func FfiConverterTypeQrPaymentResult_lower(_ value: QrPaymentResult) -> RustBuffer { + return FfiConverterTypeQrPaymentResult.lower(value) +} + + + +extension QrPaymentResult: Equatable, Hashable {} + + + + +public enum VssHeaderProviderError { + + + + 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 .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 + } + } + + public static func write(_ value: VssHeaderProviderError, into buf: inout [UInt8]) { + switch value { + + + + + case .InvalidData(_ /* message is ignored*/): + writeInt(&buf, Int32(1)) + case .RequestError(_ /* message is ignored*/): + writeInt(&buf, Int32(2)) + case .AuthorizationError(_ /* message is ignored*/): 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) - + case .InternalError(_ /* message is ignored*/): + writeInt(&buf, Int32(4)) + + } } } -public func FfiConverterTypePendingSweepBalance_lift(_ buf: RustBuffer) throws -> PendingSweepBalance { - return try FfiConverterTypePendingSweepBalance.lift(buf) -} - -public func FfiConverterTypePendingSweepBalance_lower(_ value: PendingSweepBalance) -> RustBuffer { - return FfiConverterTypePendingSweepBalance.lower(value) -} +extension VssHeaderProviderError: Equatable, Hashable {} +extension VssHeaderProviderError: Error { } -extension PendingSweepBalance: Equatable, Hashable {} +fileprivate struct FfiConverterOptionUInt8: FfiConverterRustBuffer { + typealias SwiftType = UInt8? + public static func write(_ value: SwiftType, into buf: inout [UInt8]) { + guard let value = value else { + writeInt(&buf, Int8(0)) + return + } + writeInt(&buf, Int8(1)) + FfiConverterUInt8.write(value, into: &buf) + } + public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType { + switch try readInt(&buf) as Int8 { + case 0: return nil + case 1: return try FfiConverterUInt8.read(from: &buf) + default: throw UniffiInternalError.unexpectedOptionalTag + } + } +} fileprivate struct FfiConverterOptionUInt16: FfiConverterRustBuffer { typealias SwiftType = UInt16? @@ -4933,8 +5689,8 @@ fileprivate struct FfiConverterOptionUInt64: FfiConverterRustBuffer { } } -fileprivate struct FfiConverterOptionString: FfiConverterRustBuffer { - typealias SwiftType = String? +fileprivate struct FfiConverterOptionBool: FfiConverterRustBuffer { + typealias SwiftType = Bool? public static func write(_ value: SwiftType, into buf: inout [UInt8]) { guard let value = value else { @@ -4942,20 +5698,20 @@ fileprivate struct FfiConverterOptionString: FfiConverterRustBuffer { return } writeInt(&buf, Int8(1)) - FfiConverterString.write(value, into: &buf) + FfiConverterBool.write(value, into: &buf) } public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType { switch try readInt(&buf) as Int8 { case 0: return nil - case 1: return try FfiConverterString.read(from: &buf) + case 1: return try FfiConverterBool.read(from: &buf) default: throw UniffiInternalError.unexpectedOptionalTag } } } -fileprivate struct FfiConverterOptionTypeChannelConfig: FfiConverterRustBuffer { - typealias SwiftType = ChannelConfig? +fileprivate struct FfiConverterOptionString: FfiConverterRustBuffer { + typealias SwiftType = String? public static func write(_ value: SwiftType, into buf: inout [UInt8]) { guard let value = value else { @@ -4963,13 +5719,13 @@ fileprivate struct FfiConverterOptionTypeChannelConfig: FfiConverterRustBuffer { return } writeInt(&buf, Int8(1)) - FfiConverterTypeChannelConfig.write(value, into: &buf) + FfiConverterString.write(value, into: &buf) } public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType { switch try readInt(&buf) as Int8 { case 0: return nil - case 1: return try FfiConverterTypeChannelConfig.read(from: &buf) + case 1: return try FfiConverterString.read(from: &buf) default: throw UniffiInternalError.unexpectedOptionalTag } } @@ -4996,6 +5752,27 @@ fileprivate struct FfiConverterOptionTypeAnchorChannelsConfig: FfiConverterRustB } } +fileprivate struct FfiConverterOptionTypeChannelConfig: FfiConverterRustBuffer { + typealias SwiftType = ChannelConfig? + + public static func write(_ value: SwiftType, into buf: inout [UInt8]) { + guard let value = value else { + writeInt(&buf, Int8(0)) + return + } + writeInt(&buf, Int8(1)) + FfiConverterTypeChannelConfig.write(value, into: &buf) + } + + public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType { + switch try readInt(&buf) as Int8 { + case 0: return nil + case 1: return try FfiConverterTypeChannelConfig.read(from: &buf) + default: throw UniffiInternalError.unexpectedOptionalTag + } + } +} + fileprivate struct FfiConverterOptionTypeChannelInfo: FfiConverterRustBuffer { typealias SwiftType = ChannelInfo? @@ -5038,6 +5815,27 @@ fileprivate struct FfiConverterOptionTypeChannelUpdateInfo: FfiConverterRustBuff } } +fileprivate struct FfiConverterOptionTypeEsploraSyncConfig: FfiConverterRustBuffer { + typealias SwiftType = EsploraSyncConfig? + + public static func write(_ value: SwiftType, into buf: inout [UInt8]) { + guard let value = value else { + writeInt(&buf, Int8(0)) + return + } + writeInt(&buf, Int8(1)) + FfiConverterTypeEsploraSyncConfig.write(value, into: &buf) + } + + public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType { + switch try readInt(&buf) as Int8 { + case 0: return nil + case 1: return try FfiConverterTypeEsploraSyncConfig.read(from: &buf) + default: throw UniffiInternalError.unexpectedOptionalTag + } + } +} + fileprivate struct FfiConverterOptionTypeNodeAnnouncementInfo: FfiConverterRustBuffer { typealias SwiftType = NodeAnnouncementInfo? @@ -5122,6 +5920,27 @@ fileprivate struct FfiConverterOptionTypePaymentDetails: FfiConverterRustBuffer } } +fileprivate struct FfiConverterOptionTypeSendingParameters: FfiConverterRustBuffer { + typealias SwiftType = SendingParameters? + + public static func write(_ value: SwiftType, into buf: inout [UInt8]) { + guard let value = value else { + writeInt(&buf, Int8(0)) + return + } + writeInt(&buf, Int8(1)) + FfiConverterTypeSendingParameters.write(value, into: &buf) + } + + public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType { + switch try readInt(&buf) as Int8 { + case 0: return nil + case 1: return try FfiConverterTypeSendingParameters.read(from: &buf) + default: throw UniffiInternalError.unexpectedOptionalTag + } + } +} + fileprivate struct FfiConverterOptionTypeClosureReason: FfiConverterRustBuffer { typealias SwiftType = ClosureReason? @@ -5164,6 +5983,27 @@ fileprivate struct FfiConverterOptionTypeEvent: FfiConverterRustBuffer { } } +fileprivate struct FfiConverterOptionTypeMaxTotalRoutingFeeLimit: FfiConverterRustBuffer { + typealias SwiftType = MaxTotalRoutingFeeLimit? + + public static func write(_ value: SwiftType, into buf: inout [UInt8]) { + guard let value = value else { + writeInt(&buf, Int8(0)) + return + } + writeInt(&buf, Int8(1)) + FfiConverterTypeMaxTotalRoutingFeeLimit.write(value, into: &buf) + } + + public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType { + switch try readInt(&buf) as Int8 { + case 0: return nil + case 1: return try FfiConverterTypeMaxTotalRoutingFeeLimit.read(from: &buf) + default: throw UniffiInternalError.unexpectedOptionalTag + } + } +} + fileprivate struct FfiConverterOptionTypePaymentFailureReason: FfiConverterRustBuffer { typealias SwiftType = PaymentFailureReason? @@ -5227,6 +6067,27 @@ fileprivate struct FfiConverterOptionTypeChannelId: FfiConverterRustBuffer { } } +fileprivate struct FfiConverterOptionTypeNodeAlias: FfiConverterRustBuffer { + typealias SwiftType = NodeAlias? + + public static func write(_ value: SwiftType, into buf: inout [UInt8]) { + guard let value = value else { + writeInt(&buf, Int8(0)) + return + } + writeInt(&buf, Int8(1)) + FfiConverterTypeNodeAlias.write(value, into: &buf) + } + + public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType { + switch try readInt(&buf) as Int8 { + case 0: return nil + case 1: return try FfiConverterTypeNodeAlias.read(from: &buf) + default: throw UniffiInternalError.unexpectedOptionalTag + } + } +} + fileprivate struct FfiConverterOptionTypePaymentHash: FfiConverterRustBuffer { typealias SwiftType = PaymentHash? @@ -5332,6 +6193,27 @@ fileprivate struct FfiConverterOptionTypePublicKey: FfiConverterRustBuffer { } } +fileprivate struct FfiConverterOptionTypeUntrustedString: FfiConverterRustBuffer { + typealias SwiftType = UntrustedString? + + public static func write(_ value: SwiftType, into buf: inout [UInt8]) { + guard let value = value else { + writeInt(&buf, Int8(0)) + return + } + writeInt(&buf, Int8(1)) + FfiConverterTypeUntrustedString.write(value, into: &buf) + } + + public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType { + switch try readInt(&buf) as Int8 { + case 0: return nil + case 1: return try FfiConverterTypeUntrustedString.read(from: &buf) + default: throw UniffiInternalError.unexpectedOptionalTag + } + } +} + fileprivate struct FfiConverterSequenceUInt8: FfiConverterRustBuffer { typealias SwiftType = [UInt8] @@ -5552,6 +6434,29 @@ fileprivate struct FfiConverterSequenceTypeSocketAddress: FfiConverterRustBuffer } } +fileprivate struct FfiConverterDictionaryStringString: FfiConverterRustBuffer { + public static func write(_ value: [String: String], into buf: inout [UInt8]) { + let len = Int32(value.count) + writeInt(&buf, len) + for (key, value) in value { + FfiConverterString.write(key, into: &buf) + FfiConverterString.write(value, into: &buf) + } + } + + public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> [String: String] { + let len: Int32 = try readInt(&buf) + var dict = [String: String]() + dict.reserveCapacity(Int(len)) + for _ in 0.. RustBuffer { +/** + * 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. + */ +public typealias NodeAlias = String +public struct FfiConverterTypeNodeAlias: FfiConverter { + public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> NodeAlias { + return try FfiConverterString.read(from: &buf) + } + + public static func write(_ value: NodeAlias, into buf: inout [UInt8]) { + return FfiConverterString.write(value, into: &buf) + } + + public static func lift(_ value: RustBuffer) throws -> NodeAlias { + return try FfiConverterString.lift(value) + } + + public static func lower(_ value: NodeAlias) -> RustBuffer { + return FfiConverterString.lower(value) + } +} + + +public func FfiConverterTypeNodeAlias_lift(_ value: RustBuffer) throws -> NodeAlias { + return try FfiConverterTypeNodeAlias.lift(value) +} + +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. @@ -6200,11 +7139,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 +fileprivate let uniffiContinuationHandleMap = UniffiHandleMap>() + fileprivate func uniffiRustCallAsync( - rustFutureFunc: () -> UnsafeMutableRawPointer, - pollFunc: (UnsafeMutableRawPointer, @escaping UniFfiRustFutureContinuation, UnsafeMutableRawPointer) -> (), - completeFunc: (UnsafeMutableRawPointer, UnsafeMutablePointer) -> F, - freeFunc: (UnsafeMutableRawPointer) -> (), + rustFutureFunc: () -> UInt64, + pollFunc: (UInt64, @escaping UniffiRustFutureContinuationCallback, UInt64) -> (), + completeFunc: (UInt64, UnsafeMutablePointer) -> F, + freeFunc: (UInt64) -> (), liftFunc: (F) throws -> T, errorHandler: ((RustBuffer) throws -> Error)? ) async throws -> T { @@ -6218,7 +7159,11 @@ fileprivate func uniffiRustCallAsync( var pollResult: Int8; repeat { pollResult = await withUnsafeContinuation { - pollFunc(rustFuture, uniffiFutureContinuationCallback, ContinuationHolder($0).toOpaque()) + pollFunc( + rustFuture, + uniffiFutureContinuationCallback, + uniffiContinuationHandleMap.insert(obj: $0) + ) } } while pollResult != UNIFFI_RUST_FUTURE_POLL_READY @@ -6230,44 +7175,24 @@ fileprivate 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. -fileprivate func uniffiFutureContinuationCallback(ptr: UnsafeMutableRawPointer, pollResult: Int8) { - ContinuationHolder.fromOpaque(ptr).resume(pollResult) -} - -// Wraps UnsafeContinuation in a class so that we can use reference counting when passing it across -// the FFI -fileprivate class ContinuationHolder { - let continuation: UnsafeContinuation - - init(_ continuation: UnsafeContinuation) { - self.continuation = continuation - } - - func resume(_ pollResult: Int8) { - self.continuation.resume(returning: pollResult) - } - - func toOpaque() -> UnsafeMutableRawPointer { - return Unmanaged.passRetained(self).toOpaque() +fileprivate func uniffiFutureContinuationCallback(handle: UInt64, pollResult: Int8) { + if let continuation = try? uniffiContinuationHandleMap.remove(handle: handle) { + continuation.resume(returning: pollResult) + } else { + print("uniffiFutureContinuationCallback invalid handle") } - - static func fromOpaque(_ ptr: UnsafeRawPointer) -> ContinuationHolder { - return Unmanaged.fromOpaque(ptr).takeRetainedValue() - } -} -public func defaultConfig() -> Config { - return try! FfiConverterTypeConfig.lift( - try! rustCall() { - uniffi_ldk_node_fn_func_default_config($0) } +public func defaultConfig() -> Config { + 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) -} +public func generateEntropyMnemonic() -> Mnemonic { + return try! FfiConverterTypeMnemonic.lift(try! rustCall() { + uniffi_ldk_node_fn_func_generate_entropy_mnemonic($0 ) +}) } private enum InitializationResult { @@ -6279,7 +7204,7 @@ private enum InitializationResult { // the code inside is only computed once. private var initializationResult: InitializationResult { // Get the bindings contract version from our ComponentInterface - let bindings_contract_version = 25 + let bindings_contract_version = 26 // Get the scaffolding contract version by calling the into the dylib let scaffolding_contract_version = ffi_ldk_node_uniffi_contract_version() if bindings_contract_version != scaffolding_contract_version { @@ -6315,7 +7240,7 @@ private var initializationResult: InitializationResult { if (uniffi_ldk_node_checksum_method_bolt11payment_receive_via_jit_channel() != 50555) { return InitializationResult.apiChecksumMismatch } - if (uniffi_ldk_node_checksum_method_bolt11payment_send() != 35346) { + if (uniffi_ldk_node_checksum_method_bolt11payment_send() != 39133) { return InitializationResult.apiChecksumMismatch } if (uniffi_ldk_node_checksum_method_bolt11payment_send_probes() != 39625) { @@ -6324,25 +7249,25 @@ private var initializationResult: InitializationResult { if (uniffi_ldk_node_checksum_method_bolt11payment_send_probes_using_amount() != 25010) { return InitializationResult.apiChecksumMismatch } - if (uniffi_ldk_node_checksum_method_bolt11payment_send_using_amount() != 15471) { + if (uniffi_ldk_node_checksum_method_bolt11payment_send_using_amount() != 19557) { return InitializationResult.apiChecksumMismatch } - if (uniffi_ldk_node_checksum_method_bolt12payment_initiate_refund() != 15379) { + if (uniffi_ldk_node_checksum_method_bolt12payment_initiate_refund() != 38039) { return InitializationResult.apiChecksumMismatch } - if (uniffi_ldk_node_checksum_method_bolt12payment_receive() != 20864) { + if (uniffi_ldk_node_checksum_method_bolt12payment_receive() != 15049) { return InitializationResult.apiChecksumMismatch } - if (uniffi_ldk_node_checksum_method_bolt12payment_receive_variable_amount() != 10863) { + 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) { return InitializationResult.apiChecksumMismatch } - if (uniffi_ldk_node_checksum_method_bolt12payment_send() != 15282) { + if (uniffi_ldk_node_checksum_method_bolt12payment_send() != 56449) { return InitializationResult.apiChecksumMismatch } - if (uniffi_ldk_node_checksum_method_bolt12payment_send_using_amount() != 21384) { + if (uniffi_ldk_node_checksum_method_bolt12payment_send_using_amount() != 26006) { return InitializationResult.apiChecksumMismatch } if (uniffi_ldk_node_checksum_method_builder_build() != 785) { @@ -6351,70 +7276,49 @@ private var initializationResult: InitializationResult { if (uniffi_ldk_node_checksum_method_builder_build_with_fs_store() != 61304) { return InitializationResult.apiChecksumMismatch } - 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) { - return InitializationResult.apiChecksumMismatch - } - if (uniffi_ldk_node_checksum_method_builder_set_entropy_seed_path() != 64056) { - return InitializationResult.apiChecksumMismatch - } - if (uniffi_ldk_node_checksum_method_builder_set_esplora_server() != 7044) { - return InitializationResult.apiChecksumMismatch - } - 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) { - return InitializationResult.apiChecksumMismatch - } - if (uniffi_ldk_node_checksum_method_builder_set_liquidity_source_lsps2() != 2667) { - return InitializationResult.apiChecksumMismatch - } - if (uniffi_ldk_node_checksum_method_builder_set_listening_addresses() != 14051) { + if (uniffi_ldk_node_checksum_method_builder_build_with_vss_store() != 2871) { return InitializationResult.apiChecksumMismatch } - if (uniffi_ldk_node_checksum_method_builder_set_network() != 27539) { + 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_set_storage_dir_path() != 59019) { + if (uniffi_ldk_node_checksum_method_builder_build_with_vss_store_and_header_provider() != 9090) { return InitializationResult.apiChecksumMismatch } - if (uniffi_ldk_node_checksum_method_channelconfig_accept_underpaying_htlcs() != 45655) { + if (uniffi_ldk_node_checksum_method_builder_set_chain_source_bitcoind_rpc() != 2111) { return InitializationResult.apiChecksumMismatch } - if (uniffi_ldk_node_checksum_method_channelconfig_cltv_expiry_delta() != 19044) { + if (uniffi_ldk_node_checksum_method_builder_set_chain_source_esplora() != 1781) { return InitializationResult.apiChecksumMismatch } - if (uniffi_ldk_node_checksum_method_channelconfig_force_close_avoidance_max_fee_satoshis() != 69) { + if (uniffi_ldk_node_checksum_method_builder_set_entropy_bip39_mnemonic() != 827) { return InitializationResult.apiChecksumMismatch } - if (uniffi_ldk_node_checksum_method_channelconfig_forwarding_fee_base_msat() != 3400) { + if (uniffi_ldk_node_checksum_method_builder_set_entropy_seed_bytes() != 44799) { return InitializationResult.apiChecksumMismatch } - if (uniffi_ldk_node_checksum_method_channelconfig_forwarding_fee_proportional_millionths() != 31794) { + if (uniffi_ldk_node_checksum_method_builder_set_entropy_seed_path() != 64056) { return InitializationResult.apiChecksumMismatch } - if (uniffi_ldk_node_checksum_method_channelconfig_set_accept_underpaying_htlcs() != 27275) { + if (uniffi_ldk_node_checksum_method_builder_set_gossip_source_p2p() != 9279) { return InitializationResult.apiChecksumMismatch } - if (uniffi_ldk_node_checksum_method_channelconfig_set_cltv_expiry_delta() != 40735) { + if (uniffi_ldk_node_checksum_method_builder_set_gossip_source_rgs() != 64312) { return InitializationResult.apiChecksumMismatch } - if (uniffi_ldk_node_checksum_method_channelconfig_set_force_close_avoidance_max_fee_satoshis() != 48479) { + if (uniffi_ldk_node_checksum_method_builder_set_liquidity_source_lsps2() != 2667) { return InitializationResult.apiChecksumMismatch } - if (uniffi_ldk_node_checksum_method_channelconfig_set_forwarding_fee_base_msat() != 29831) { + if (uniffi_ldk_node_checksum_method_builder_set_listening_addresses() != 14051) { return InitializationResult.apiChecksumMismatch } - if (uniffi_ldk_node_checksum_method_channelconfig_set_forwarding_fee_proportional_millionths() != 65060) { + if (uniffi_ldk_node_checksum_method_builder_set_network() != 27539) { return InitializationResult.apiChecksumMismatch } - if (uniffi_ldk_node_checksum_method_channelconfig_set_max_dust_htlc_exposure_from_fee_rate_multiplier() != 4707) { + if (uniffi_ldk_node_checksum_method_builder_set_node_alias() != 18342) { return InitializationResult.apiChecksumMismatch } - if (uniffi_ldk_node_checksum_method_channelconfig_set_max_dust_htlc_exposure_from_fixed_limit() != 16864) { + if (uniffi_ldk_node_checksum_method_builder_set_storage_dir_path() != 59019) { return InitializationResult.apiChecksumMismatch } if (uniffi_ldk_node_checksum_method_networkgraph_channel() != 38070) { @@ -6444,16 +7348,13 @@ private var initializationResult: InitializationResult { if (uniffi_ldk_node_checksum_method_node_connect() != 34120) { return InitializationResult.apiChecksumMismatch } - if (uniffi_ldk_node_checksum_method_node_connect_open_channel() != 64763) { - return InitializationResult.apiChecksumMismatch - } if (uniffi_ldk_node_checksum_method_node_disconnect() != 43538) { return InitializationResult.apiChecksumMismatch } if (uniffi_ldk_node_checksum_method_node_event_handled() != 47939) { return InitializationResult.apiChecksumMismatch } - if (uniffi_ldk_node_checksum_method_node_force_close_channel() != 44813) { + if (uniffi_ldk_node_checksum_method_node_force_close_channel() != 48831) { return InitializationResult.apiChecksumMismatch } if (uniffi_ldk_node_checksum_method_node_list_balances() != 57528) { @@ -6480,19 +7381,28 @@ private var initializationResult: InitializationResult { if (uniffi_ldk_node_checksum_method_node_next_event_async() != 25426) { return InitializationResult.apiChecksumMismatch } + if (uniffi_ldk_node_checksum_method_node_node_alias() != 29526) { + return InitializationResult.apiChecksumMismatch + } if (uniffi_ldk_node_checksum_method_node_node_id() != 51489) { return InitializationResult.apiChecksumMismatch } if (uniffi_ldk_node_checksum_method_node_onchain_payment() != 6092) { return InitializationResult.apiChecksumMismatch } + if (uniffi_ldk_node_checksum_method_node_open_announced_channel() != 36623) { + return InitializationResult.apiChecksumMismatch + } + if (uniffi_ldk_node_checksum_method_node_open_channel() != 40283) { + return InitializationResult.apiChecksumMismatch + } if (uniffi_ldk_node_checksum_method_node_payment() != 60296) { return InitializationResult.apiChecksumMismatch } if (uniffi_ldk_node_checksum_method_node_remove_payment() != 47952) { return InitializationResult.apiChecksumMismatch } - if (uniffi_ldk_node_checksum_method_node_sign_message() != 51392) { + if (uniffi_ldk_node_checksum_method_node_sign_message() != 49319) { return InitializationResult.apiChecksumMismatch } if (uniffi_ldk_node_checksum_method_node_spontaneous_payment() != 37403) { @@ -6510,7 +7420,10 @@ private var initializationResult: InitializationResult { if (uniffi_ldk_node_checksum_method_node_sync_wallets() != 32474) { return InitializationResult.apiChecksumMismatch } - if (uniffi_ldk_node_checksum_method_node_update_channel_config() != 38109) { + 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) { return InitializationResult.apiChecksumMismatch } if (uniffi_ldk_node_checksum_method_node_verify_signature() != 20486) { @@ -6525,22 +7438,28 @@ private var initializationResult: InitializationResult { if (uniffi_ldk_node_checksum_method_onchainpayment_send_all_to_address() != 20046) { return InitializationResult.apiChecksumMismatch } - if (uniffi_ldk_node_checksum_method_onchainpayment_send_to_address() != 34782) { + if (uniffi_ldk_node_checksum_method_onchainpayment_send_to_address() != 55731) { return InitializationResult.apiChecksumMismatch } - if (uniffi_ldk_node_checksum_method_spontaneouspayment_send() != 16613) { + if (uniffi_ldk_node_checksum_method_spontaneouspayment_send() != 48210) { return InitializationResult.apiChecksumMismatch } if (uniffi_ldk_node_checksum_method_spontaneouspayment_send_probes() != 25937) { return InitializationResult.apiChecksumMismatch } - if (uniffi_ldk_node_checksum_constructor_builder_from_config() != 64393) { + if (uniffi_ldk_node_checksum_method_unifiedqrpayment_receive() != 913) { + return InitializationResult.apiChecksumMismatch + } + if (uniffi_ldk_node_checksum_method_unifiedqrpayment_send() != 53900) { return InitializationResult.apiChecksumMismatch } - if (uniffi_ldk_node_checksum_constructor_builder_new() != 48442) { + if (uniffi_ldk_node_checksum_method_vssheaderprovider_get_headers() != 7788) { return InitializationResult.apiChecksumMismatch } - if (uniffi_ldk_node_checksum_constructor_channelconfig_new() != 24987) { + if (uniffi_ldk_node_checksum_constructor_builder_from_config() != 994) { + return InitializationResult.apiChecksumMismatch + } + if (uniffi_ldk_node_checksum_constructor_builder_new() != 40499) { return InitializationResult.apiChecksumMismatch } @@ -6556,4 +7475,6 @@ private func uniffiEnsureInitialized() { case .apiChecksumMismatch: fatalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") } -} \ No newline at end of file +} + +// swiftlint:enable all \ No newline at end of file