diff --git a/CHANGELOG.md b/CHANGELOG.md index 668c8fde24..058593c02a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,4 @@ -# 0.7.0-rc.37 (Synonym Fork) +# 0.7.0-rc.39 (Synonym Fork) ## Bug Fixes @@ -58,6 +58,12 @@ ## Synonym Fork Additions +- Added `AddressInfo` (`index`, `address`, `keychain`) and `KeychainKind`. +- Added `OnchainPayment` methods `new_address_info`, `new_address_info_for_type`, + `address_info_for_type_at_index`, `address_infos_for_type`, and + `reveal_receive_addresses_to`. Address peek APIs support external receive and + internal change keychains without advancing wallet cursors. Batch address peek + requests are capped at 10,000 addresses per call. - Added pre-flight probe correlation: `Event::ProbeSuccessful` and `Event::ProbeFailed` (from LDK probe lifecycle), plus `ProbeHandle` (`payment_id`, synthetic `payment_hash`) values returned for probes actually dispatched by `Bolt11Payment::send_probes`, `send_probes_using_amount`, and diff --git a/Cargo.toml b/Cargo.toml index 5a44e37e93..a6df125158 100755 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,7 +4,7 @@ exclude = ["bindings/uniffi-bindgen"] [package] name = "ldk-node" -version = "0.7.0-rc.37" +version = "0.7.0-rc.39" authors = ["Elias Rohrer "] homepage = "https://lightningdevkit.org/" license = "MIT OR Apache-2.0" diff --git a/Package.swift b/Package.swift index 569d04f129..4e2eb80ea8 100644 --- a/Package.swift +++ b/Package.swift @@ -3,8 +3,8 @@ import PackageDescription -let tag = "v0.7.0-rc.37" -let checksum = "31ca289fb94221bf1a0077532a868d1e19912f19760735697023066b1160eea7" +let tag = "v0.7.0-rc.39" +let checksum = "67fae23a802b1ab48833c29c95cb62a9167024be9dbbe54e6745d6c108f70308" let url = "https://github.com/synonymdev/ldk-node/releases/download/\(tag)/LDKNodeFFI.xcframework.zip" let package = Package( diff --git a/bindings/kotlin/ldk-node-android/gradle.properties b/bindings/kotlin/ldk-node-android/gradle.properties index 8bcf01514a..aca9fb76ed 100644 --- a/bindings/kotlin/ldk-node-android/gradle.properties +++ b/bindings/kotlin/ldk-node-android/gradle.properties @@ -3,4 +3,4 @@ android.useAndroidX=true android.enableJetifier=true kotlin.code.style=official group=com.synonym -version=0.7.0-rc.37 +version=0.7.0-rc.39 diff --git a/bindings/kotlin/ldk-node-android/lib/src/main/jniLibs/arm64-v8a/libldk_node.so b/bindings/kotlin/ldk-node-android/lib/src/main/jniLibs/arm64-v8a/libldk_node.so index 03f45ecdfb..e3f585686f 100755 Binary files a/bindings/kotlin/ldk-node-android/lib/src/main/jniLibs/arm64-v8a/libldk_node.so and b/bindings/kotlin/ldk-node-android/lib/src/main/jniLibs/arm64-v8a/libldk_node.so differ diff --git a/bindings/kotlin/ldk-node-android/lib/src/main/jniLibs/armeabi-v7a/libldk_node.so b/bindings/kotlin/ldk-node-android/lib/src/main/jniLibs/armeabi-v7a/libldk_node.so index 3b31e07fee..8ce45fffc6 100755 Binary files a/bindings/kotlin/ldk-node-android/lib/src/main/jniLibs/armeabi-v7a/libldk_node.so and b/bindings/kotlin/ldk-node-android/lib/src/main/jniLibs/armeabi-v7a/libldk_node.so differ diff --git a/bindings/kotlin/ldk-node-android/lib/src/main/jniLibs/x86_64/libldk_node.so b/bindings/kotlin/ldk-node-android/lib/src/main/jniLibs/x86_64/libldk_node.so index c37f4acc10..d62aa6e732 100755 Binary files a/bindings/kotlin/ldk-node-android/lib/src/main/jniLibs/x86_64/libldk_node.so and b/bindings/kotlin/ldk-node-android/lib/src/main/jniLibs/x86_64/libldk_node.so differ diff --git a/bindings/kotlin/ldk-node-android/lib/src/main/kotlin/org/lightningdevkit/ldknode/ldk_node.android.kt b/bindings/kotlin/ldk-node-android/lib/src/main/kotlin/org/lightningdevkit/ldknode/ldk_node.android.kt index 3a5be7f9d5..29e01ae29e 100644 --- a/bindings/kotlin/ldk-node-android/lib/src/main/kotlin/org/lightningdevkit/ldknode/ldk_node.android.kt +++ b/bindings/kotlin/ldk-node-android/lib/src/main/kotlin/org/lightningdevkit/ldknode/ldk_node.android.kt @@ -1511,6 +1511,16 @@ internal typealias UniffiVTableCallbackInterfaceVssHeaderProviderUniffiByValue = + + + + + + + + + + @@ -2551,6 +2561,21 @@ internal interface UniffiLib : Library { `destinationAddress`: RustBufferByValue, uniffiCallStatus: UniffiRustCallStatus, ): RustBufferByValue + fun uniffi_ldk_node_fn_method_onchainpayment_address_info_for_type_at_index( + `ptr`: Pointer?, + `addressType`: RustBufferByValue, + `keychain`: RustBufferByValue, + `index`: Int, + uniffiCallStatus: UniffiRustCallStatus, + ): RustBufferByValue + fun uniffi_ldk_node_fn_method_onchainpayment_address_infos_for_type( + `ptr`: Pointer?, + `addressType`: RustBufferByValue, + `keychain`: RustBufferByValue, + `startIndex`: Int, + `count`: Int, + uniffiCallStatus: UniffiRustCallStatus, + ): RustBufferByValue fun uniffi_ldk_node_fn_method_onchainpayment_bump_fee_by_rbf( `ptr`: Pointer?, `txid`: RustBufferByValue, @@ -2591,6 +2616,21 @@ internal interface UniffiLib : Library { `addressType`: RustBufferByValue, uniffiCallStatus: UniffiRustCallStatus, ): RustBufferByValue + fun uniffi_ldk_node_fn_method_onchainpayment_new_address_info( + `ptr`: Pointer?, + uniffiCallStatus: UniffiRustCallStatus, + ): RustBufferByValue + fun uniffi_ldk_node_fn_method_onchainpayment_new_address_info_for_type( + `ptr`: Pointer?, + `addressType`: RustBufferByValue, + uniffiCallStatus: UniffiRustCallStatus, + ): RustBufferByValue + fun uniffi_ldk_node_fn_method_onchainpayment_reveal_receive_addresses_to( + `ptr`: Pointer?, + `addressType`: RustBufferByValue, + `index`: Int, + uniffiCallStatus: UniffiRustCallStatus, + ): Unit fun uniffi_ldk_node_fn_method_onchainpayment_select_utxos_with_algorithm( `ptr`: Pointer?, `targetAmountSats`: Long, @@ -3324,6 +3364,10 @@ internal interface UniffiLib : Library { ): Short fun uniffi_ldk_node_checksum_method_onchainpayment_accelerate_by_cpfp( ): Short + fun uniffi_ldk_node_checksum_method_onchainpayment_address_info_for_type_at_index( + ): Short + fun uniffi_ldk_node_checksum_method_onchainpayment_address_infos_for_type( + ): Short fun uniffi_ldk_node_checksum_method_onchainpayment_bump_fee_by_rbf( ): Short fun uniffi_ldk_node_checksum_method_onchainpayment_calculate_cpfp_fee_rate( @@ -3338,6 +3382,12 @@ internal interface UniffiLib : Library { ): Short fun uniffi_ldk_node_checksum_method_onchainpayment_new_address_for_type( ): Short + fun uniffi_ldk_node_checksum_method_onchainpayment_new_address_info( + ): Short + fun uniffi_ldk_node_checksum_method_onchainpayment_new_address_info_for_type( + ): Short + fun uniffi_ldk_node_checksum_method_onchainpayment_reveal_receive_addresses_to( + ): Short fun uniffi_ldk_node_checksum_method_onchainpayment_select_utxos_with_algorithm( ): Short fun uniffi_ldk_node_checksum_method_onchainpayment_send_all_to_address( @@ -3914,6 +3964,12 @@ private fun uniffiCheckApiChecksums(lib: UniffiLib) { if (lib.uniffi_ldk_node_checksum_method_onchainpayment_accelerate_by_cpfp() != 31954.toShort()) { throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") } + if (lib.uniffi_ldk_node_checksum_method_onchainpayment_address_info_for_type_at_index() != 42692.toShort()) { + throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + } + if (lib.uniffi_ldk_node_checksum_method_onchainpayment_address_infos_for_type() != 3701.toShort()) { + throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + } if (lib.uniffi_ldk_node_checksum_method_onchainpayment_bump_fee_by_rbf() != 53877.toShort()) { throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") } @@ -3935,6 +3991,15 @@ private fun uniffiCheckApiChecksums(lib: UniffiLib) { if (lib.uniffi_ldk_node_checksum_method_onchainpayment_new_address_for_type() != 9083.toShort()) { throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") } + if (lib.uniffi_ldk_node_checksum_method_onchainpayment_new_address_info() != 9889.toShort()) { + throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + } + if (lib.uniffi_ldk_node_checksum_method_onchainpayment_new_address_info_for_type() != 62171.toShort()) { + throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + } + if (lib.uniffi_ldk_node_checksum_method_onchainpayment_reveal_receive_addresses_to() != 44189.toShort()) { + throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + } if (lib.uniffi_ldk_node_checksum_method_onchainpayment_select_utxos_with_algorithm() != 14084.toShort()) { throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") } @@ -8060,6 +8125,37 @@ open class OnchainPayment: Disposable, OnchainPaymentInterface { }) } + @Throws(NodeException::class) + override fun `addressInfoForTypeAtIndex`(`addressType`: AddressType, `keychain`: KeychainKind, `index`: kotlin.UInt): AddressInfo { + return FfiConverterTypeAddressInfo.lift(callWithPointer { + uniffiRustCallWithError(NodeExceptionErrorHandler) { uniffiRustCallStatus -> + UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_onchainpayment_address_info_for_type_at_index( + it, + FfiConverterTypeAddressType.lower(`addressType`), + FfiConverterTypeKeychainKind.lower(`keychain`), + FfiConverterUInt.lower(`index`), + uniffiRustCallStatus, + ) + } + }) + } + + @Throws(NodeException::class) + override fun `addressInfosForType`(`addressType`: AddressType, `keychain`: KeychainKind, `startIndex`: kotlin.UInt, `count`: kotlin.UInt): List { + return FfiConverterSequenceTypeAddressInfo.lift(callWithPointer { + uniffiRustCallWithError(NodeExceptionErrorHandler) { uniffiRustCallStatus -> + UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_onchainpayment_address_infos_for_type( + it, + FfiConverterTypeAddressType.lower(`addressType`), + FfiConverterTypeKeychainKind.lower(`keychain`), + FfiConverterUInt.lower(`startIndex`), + FfiConverterUInt.lower(`count`), + uniffiRustCallStatus, + ) + } + }) + } + @Throws(NodeException::class) override fun `bumpFeeByRbf`(`txid`: Txid, `feeRate`: FeeRate): Txid { return FfiConverterTypeTxid.lift(callWithPointer { @@ -8156,6 +8252,45 @@ open class OnchainPayment: Disposable, OnchainPaymentInterface { }) } + @Throws(NodeException::class) + override fun `newAddressInfo`(): AddressInfo { + return FfiConverterTypeAddressInfo.lift(callWithPointer { + uniffiRustCallWithError(NodeExceptionErrorHandler) { uniffiRustCallStatus -> + UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_onchainpayment_new_address_info( + it, + uniffiRustCallStatus, + ) + } + }) + } + + @Throws(NodeException::class) + override fun `newAddressInfoForType`(`addressType`: AddressType): AddressInfo { + return FfiConverterTypeAddressInfo.lift(callWithPointer { + uniffiRustCallWithError(NodeExceptionErrorHandler) { uniffiRustCallStatus -> + UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_onchainpayment_new_address_info_for_type( + it, + FfiConverterTypeAddressType.lower(`addressType`), + uniffiRustCallStatus, + ) + } + }) + } + + @Throws(NodeException::class) + override fun `revealReceiveAddressesTo`(`addressType`: AddressType, `index`: kotlin.UInt) { + callWithPointer { + uniffiRustCallWithError(NodeExceptionErrorHandler) { uniffiRustCallStatus -> + UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_onchainpayment_reveal_receive_addresses_to( + it, + FfiConverterTypeAddressType.lower(`addressType`), + FfiConverterUInt.lower(`index`), + uniffiRustCallStatus, + ) + } + } + } + @Throws(NodeException::class) override fun `selectUtxosWithAlgorithm`(`targetAmountSats`: kotlin.ULong, `feeRate`: FeeRate?, `algorithm`: CoinSelectionAlgorithm, `utxos`: List?): List { return FfiConverterSequenceTypeSpendableUtxo.lift(callWithPointer { @@ -9047,6 +9182,31 @@ object FfiConverterTypeVssHeaderProvider: FfiConverter { + override fun read(buf: ByteBuffer): AddressInfo { + return AddressInfo( + FfiConverterUInt.read(buf), + FfiConverterTypeAddress.read(buf), + FfiConverterTypeKeychainKind.read(buf), + ) + } + + override fun allocationSize(value: AddressInfo) = ( + FfiConverterUInt.allocationSize(value.`index`) + + FfiConverterTypeAddress.allocationSize(value.`address`) + + FfiConverterTypeKeychainKind.allocationSize(value.`keychain`) + ) + + override fun write(value: AddressInfo, buf: ByteBuffer) { + FfiConverterUInt.write(value.`index`, buf) + FfiConverterTypeAddress.write(value.`address`, buf) + FfiConverterTypeKeychainKind.write(value.`keychain`, buf) + } +} + + + + object FfiConverterTypeAddressTypeBalance: FfiConverterRustBuffer { override fun read(buf: ByteBuffer): AddressTypeBalance { return AddressTypeBalance( @@ -11214,6 +11374,24 @@ object FfiConverterTypeEvent : FfiConverterRustBuffer{ +object FfiConverterTypeKeychainKind: FfiConverterRustBuffer { + override fun read(buf: ByteBuffer) = try { + KeychainKind.entries[buf.getInt() - 1] + } catch (e: IndexOutOfBoundsException) { + throw RuntimeException("invalid enum value, something is very wrong!!", e) + } + + override fun allocationSize(value: KeychainKind) = 4UL + + override fun write(value: KeychainKind, buf: ByteBuffer) { + buf.putInt(value.ordinal + 1) + } +} + + + + + object FfiConverterTypeLSPS1PaymentState: FfiConverterRustBuffer { override fun read(buf: ByteBuffer) = try { Lsps1PaymentState.entries[buf.getInt() - 1] @@ -13732,6 +13910,31 @@ object FfiConverterSequenceString: FfiConverterRustBuffer> { +object FfiConverterSequenceTypeAddressInfo: FfiConverterRustBuffer> { + override fun read(buf: ByteBuffer): List { + val len = buf.getInt() + return List(len) { + FfiConverterTypeAddressInfo.read(buf) + } + } + + override fun allocationSize(value: List): ULong { + val sizeForLength = 4UL + val sizeForItems = value.sumOf { FfiConverterTypeAddressInfo.allocationSize(it) } + return sizeForLength + sizeForItems + } + + override fun write(value: List, buf: ByteBuffer) { + buf.putInt(value.size) + value.iterator().forEach { + FfiConverterTypeAddressInfo.write(it, buf) + } + } +} + + + + object FfiConverterSequenceTypeChannelDetails: FfiConverterRustBuffer> { override fun read(buf: ByteBuffer): List { val len = buf.getInt() diff --git a/bindings/kotlin/ldk-node-android/lib/src/main/kotlin/org/lightningdevkit/ldknode/ldk_node.common.kt b/bindings/kotlin/ldk-node-android/lib/src/main/kotlin/org/lightningdevkit/ldknode/ldk_node.common.kt index 5223da8bc5..21e71fdd6d 100644 --- a/bindings/kotlin/ldk-node-android/lib/src/main/kotlin/org/lightningdevkit/ldknode/ldk_node.common.kt +++ b/bindings/kotlin/ldk-node-android/lib/src/main/kotlin/org/lightningdevkit/ldknode/ldk_node.common.kt @@ -104,39 +104,39 @@ object NoPointer interface Bolt11InvoiceInterface { - + fun `amountMilliSatoshis`(): kotlin.ULong? - + fun `currency`(): Currency - + fun `expiryTimeSeconds`(): kotlin.ULong - + fun `fallbackAddresses`(): List
- + fun `invoiceDescription`(): Bolt11InvoiceDescription - + fun `isExpired`(): kotlin.Boolean - + fun `minFinalCltvExpiryDelta`(): kotlin.ULong - + fun `network`(): Network - + fun `paymentHash`(): PaymentHash - + fun `paymentSecret`(): PaymentSecret - + fun `recoverPayeePubKey`(): PublicKey - + fun `routeHints`(): List> - + fun `secondsSinceEpoch`(): kotlin.ULong - + fun `secondsUntilExpiry`(): kotlin.ULong - + fun `signableHash`(): List - + fun `wouldExpire`(`atTimeSeconds`: kotlin.ULong): kotlin.Boolean - + companion object } @@ -144,55 +144,55 @@ interface Bolt11InvoiceInterface { interface Bolt11PaymentInterface { - + @Throws(NodeException::class) fun `claimForHash`(`paymentHash`: PaymentHash, `claimableAmountMsat`: kotlin.ULong, `preimage`: PaymentPreimage) - + @Throws(NodeException::class) fun `estimateRoutingFees`(`invoice`: Bolt11Invoice): kotlin.ULong - + @Throws(NodeException::class) fun `estimateRoutingFeesUsingAmount`(`invoice`: Bolt11Invoice, `amountMsat`: kotlin.ULong): kotlin.ULong - + @Throws(NodeException::class) fun `failForHash`(`paymentHash`: PaymentHash) - + @Throws(NodeException::class) fun `receive`(`amountMsat`: kotlin.ULong, `description`: Bolt11InvoiceDescription, `expirySecs`: kotlin.UInt): Bolt11Invoice - + @Throws(NodeException::class) fun `receiveForHash`(`amountMsat`: kotlin.ULong, `description`: Bolt11InvoiceDescription, `expirySecs`: kotlin.UInt, `paymentHash`: PaymentHash): Bolt11Invoice - + @Throws(NodeException::class) fun `receiveVariableAmount`(`description`: Bolt11InvoiceDescription, `expirySecs`: kotlin.UInt): Bolt11Invoice - + @Throws(NodeException::class) fun `receiveVariableAmountForHash`(`description`: Bolt11InvoiceDescription, `expirySecs`: kotlin.UInt, `paymentHash`: PaymentHash): Bolt11Invoice - + @Throws(NodeException::class) fun `receiveVariableAmountViaJitChannel`(`description`: Bolt11InvoiceDescription, `expirySecs`: kotlin.UInt, `maxProportionalLspFeeLimitPpmMsat`: kotlin.ULong?): Bolt11Invoice - + @Throws(NodeException::class) fun `receiveVariableAmountViaJitChannelForHash`(`description`: Bolt11InvoiceDescription, `expirySecs`: kotlin.UInt, `maxProportionalLspFeeLimitPpmMsat`: kotlin.ULong?, `paymentHash`: PaymentHash): Bolt11Invoice - + @Throws(NodeException::class) fun `receiveViaJitChannel`(`amountMsat`: kotlin.ULong, `description`: Bolt11InvoiceDescription, `expirySecs`: kotlin.UInt, `maxLspFeeLimitMsat`: kotlin.ULong?): Bolt11Invoice - + @Throws(NodeException::class) fun `receiveViaJitChannelForHash`(`amountMsat`: kotlin.ULong, `description`: Bolt11InvoiceDescription, `expirySecs`: kotlin.UInt, `maxLspFeeLimitMsat`: kotlin.ULong?, `paymentHash`: PaymentHash): Bolt11Invoice - + @Throws(NodeException::class) fun `send`(`invoice`: Bolt11Invoice, `routeParameters`: RouteParametersConfig?): PaymentId - + @Throws(NodeException::class) fun `sendProbes`(`invoice`: Bolt11Invoice, `routeParameters`: RouteParametersConfig?): List - + @Throws(NodeException::class) fun `sendProbesUsingAmount`(`invoice`: Bolt11Invoice, `amountMsat`: kotlin.ULong, `routeParameters`: RouteParametersConfig?): List - + @Throws(NodeException::class) fun `sendUsingAmount`(`invoice`: Bolt11Invoice, `amountMsat`: kotlin.ULong, `routeParameters`: RouteParametersConfig?): PaymentId - + companion object } @@ -200,47 +200,47 @@ interface Bolt11PaymentInterface { interface Bolt12InvoiceInterface { - + fun `absoluteExpirySeconds`(): kotlin.ULong? - + fun `amount`(): OfferAmount? - + fun `amountMsats`(): kotlin.ULong - + fun `chain`(): List - + fun `createdAt`(): kotlin.ULong - + fun `encode`(): List - + fun `fallbackAddresses`(): List
- + fun `invoiceDescription`(): kotlin.String? - + fun `isExpired`(): kotlin.Boolean - + fun `issuer`(): kotlin.String? - + fun `issuerSigningPubkey`(): PublicKey? - + fun `metadata`(): List? - + fun `offerChains`(): List>? - + fun `payerNote`(): kotlin.String? - + fun `payerSigningPubkey`(): PublicKey - + fun `paymentHash`(): PaymentHash - + fun `quantity`(): kotlin.ULong? - + fun `relativeExpiry`(): kotlin.ULong - + fun `signableHash`(): List - + fun `signingPubkey`(): PublicKey - + companion object } @@ -248,34 +248,34 @@ interface Bolt12InvoiceInterface { interface Bolt12PaymentInterface { - + @Throws(NodeException::class) fun `blindedPathsForAsyncRecipient`(`recipientId`: kotlin.ByteArray): kotlin.ByteArray - + @Throws(NodeException::class) fun `initiateRefund`(`amountMsat`: kotlin.ULong, `expirySecs`: kotlin.UInt, `quantity`: kotlin.ULong?, `payerNote`: kotlin.String?, `routeParameters`: RouteParametersConfig?): Refund - + @Throws(NodeException::class) fun `receive`(`amountMsat`: kotlin.ULong, `description`: kotlin.String, `expirySecs`: kotlin.UInt?, `quantity`: kotlin.ULong?): Offer - + @Throws(NodeException::class) fun `receiveAsync`(): Offer - + @Throws(NodeException::class) fun `receiveVariableAmount`(`description`: kotlin.String, `expirySecs`: kotlin.UInt?): Offer - + @Throws(NodeException::class) fun `requestRefundPayment`(`refund`: Refund): Bolt12Invoice - + @Throws(NodeException::class) fun `send`(`offer`: Offer, `quantity`: kotlin.ULong?, `payerNote`: kotlin.String?, `routeParameters`: RouteParametersConfig?): PaymentId - + @Throws(NodeException::class) fun `sendUsingAmount`(`offer`: Offer, `amountMsat`: kotlin.ULong, `quantity`: kotlin.ULong?, `payerNote`: kotlin.String?, `routeParameters`: RouteParametersConfig?): PaymentId - + @Throws(NodeException::class) fun `setPathsToStaticInvoiceServer`(`paths`: kotlin.ByteArray) - + companion object } @@ -283,77 +283,77 @@ interface Bolt12PaymentInterface { interface BuilderInterface { - + @Throws(BuildException::class) fun `build`(): Node - + @Throws(BuildException::class) fun `buildWithFsStore`(): Node - + @Throws(BuildException::class) fun `buildWithVssStore`(`vssUrl`: kotlin.String, `storeId`: kotlin.String, `lnurlAuthServerUrl`: kotlin.String, `fixedHeaders`: Map): Node - + @Throws(BuildException::class) fun `buildWithVssStoreAndFixedHeaders`(`vssUrl`: kotlin.String, `storeId`: kotlin.String, `fixedHeaders`: Map): Node - + @Throws(BuildException::class) fun `buildWithVssStoreAndHeaderProvider`(`vssUrl`: kotlin.String, `storeId`: kotlin.String, `headerProvider`: VssHeaderProvider): Node - + fun `setAcceptStaleChannelMonitors`(`accept`: kotlin.Boolean) - + fun `setAddressType`(`addressType`: AddressType) - + fun `setAddressTypesToMonitor`(`addressTypesToMonitor`: List) - + @Throws(BuildException::class) fun `setAnnouncementAddresses`(`announcementAddresses`: List) - + @Throws(BuildException::class) fun `setAsyncPaymentsRole`(`role`: AsyncPaymentsRole?) - + fun `setChainSourceBitcoindRest`(`restHost`: kotlin.String, `restPort`: kotlin.UShort, `rpcHost`: kotlin.String, `rpcPort`: kotlin.UShort, `rpcUser`: kotlin.String, `rpcPassword`: kotlin.String) - + fun `setChainSourceBitcoindRpc`(`rpcHost`: kotlin.String, `rpcPort`: kotlin.UShort, `rpcUser`: kotlin.String, `rpcPassword`: kotlin.String) - + fun `setChainSourceElectrum`(`serverUrl`: kotlin.String, `config`: ElectrumSyncConfig?) - + fun `setChainSourceEsplora`(`serverUrl`: kotlin.String, `config`: EsploraSyncConfig?) - + fun `setChannelDataMigration`(`migration`: ChannelDataMigration) - + fun `setCustomLogger`(`logWriter`: LogWriter) - + fun `setEntropyBip39Mnemonic`(`mnemonic`: Mnemonic, `passphrase`: kotlin.String?) - + @Throws(BuildException::class) fun `setEntropySeedBytes`(`seedBytes`: List) - + fun `setEntropySeedPath`(`seedPath`: kotlin.String) - + fun `setFilesystemLogger`(`logFilePath`: kotlin.String?, `maxLogLevel`: LogLevel?) - + fun `setGossipSourceP2p`() - + fun `setGossipSourceRgs`(`rgsServerUrl`: kotlin.String) - + fun `setLiquiditySourceLsps1`(`nodeId`: PublicKey, `address`: SocketAddress, `token`: kotlin.String?) - + fun `setLiquiditySourceLsps2`(`nodeId`: PublicKey, `address`: SocketAddress, `token`: kotlin.String?) - + @Throws(BuildException::class) fun `setListeningAddresses`(`listeningAddresses`: List) - + fun `setLogFacadeLogger`() - + fun `setNetwork`(`network`: Network) - + @Throws(BuildException::class) fun `setNodeAlias`(`nodeAlias`: kotlin.String) - + fun `setPathfindingScoresSource`(`url`: kotlin.String) - + fun `setStorageDirPath`(`storageDirPath`: kotlin.String) - + companion object } @@ -361,13 +361,13 @@ interface BuilderInterface { interface FeeRateInterface { - + fun `toSatPerKwu`(): kotlin.ULong - + fun `toSatPerVbCeil`(): kotlin.ULong - + fun `toSatPerVbFloor`(): kotlin.ULong - + companion object } @@ -375,13 +375,13 @@ interface FeeRateInterface { interface Lsps1LiquidityInterface { - + @Throws(NodeException::class) fun `checkOrderStatus`(`orderId`: Lsps1OrderId): Lsps1OrderStatus - + @Throws(NodeException::class) fun `requestChannel`(`lspBalanceSat`: kotlin.ULong, `clientBalanceSat`: kotlin.ULong, `channelExpiryBlocks`: kotlin.UInt, `announceChannel`: kotlin.Boolean): Lsps1OrderStatus - + companion object } @@ -389,9 +389,9 @@ interface Lsps1LiquidityInterface { interface LogWriter { - + fun `log`(`record`: LogRecord) - + companion object } @@ -399,15 +399,15 @@ interface LogWriter { interface NetworkGraphInterface { - + fun `channel`(`shortChannelId`: kotlin.ULong): ChannelInfo? - + fun `listChannels`(): List - + fun `listNodes`(): List - + fun `node`(`nodeId`: NodeId): NodeInfo? - + companion object } @@ -415,128 +415,128 @@ interface NetworkGraphInterface { interface NodeInterface { - + @Throws(NodeException::class) fun `addAddressTypeToMonitor`(`addressType`: AddressType, `seedBytes`: List) - + @Throws(NodeException::class) fun `addAddressTypeToMonitorWithMnemonic`(`addressType`: AddressType, `mnemonic`: Mnemonic, `passphrase`: kotlin.String?) - + fun `announcementAddresses`(): List? - + fun `bolt11Payment`(): Bolt11Payment - + fun `bolt12Payment`(): Bolt12Payment - + @Throws(NodeException::class) fun `closeChannel`(`userChannelId`: UserChannelId, `counterpartyNodeId`: PublicKey) - + fun `config`(): Config - + @Throws(NodeException::class) fun `connect`(`nodeId`: PublicKey, `address`: SocketAddress, `persist`: kotlin.Boolean) - + fun `currentSyncIntervals`(): RuntimeSyncIntervals - + @Throws(NodeException::class) fun `disconnect`(`nodeId`: PublicKey) - + @Throws(NodeException::class) fun `eventHandled`() - + @Throws(NodeException::class) fun `exportPathfindingScores`(): kotlin.ByteArray - + @Throws(NodeException::class) fun `forceCloseChannel`(`userChannelId`: UserChannelId, `counterpartyNodeId`: PublicKey, `reason`: kotlin.String?) - + @Throws(NodeException::class) fun `getAddressBalance`(`addressStr`: kotlin.String): kotlin.ULong - + @Throws(NodeException::class) fun `getBalanceForAddressType`(`addressType`: AddressType): AddressTypeBalance - + fun `getTransactionDetails`(`txid`: Txid): TransactionDetails? - + fun `listBalances`(): BalanceDetails - + fun `listChannels`(): List - + fun `listMonitoredAddressTypes`(): List - + fun `listPayments`(): List - + fun `listPeers`(): List - + fun `listeningAddresses`(): List? - + fun `lsps1Liquidity`(): Lsps1Liquidity - + fun `networkGraph`(): NetworkGraph - + fun `nextEvent`(): Event? - + suspend fun `nextEventAsync`(): Event - + fun `nodeAlias`(): NodeAlias? - + fun `nodeId`(): PublicKey - + fun `onchainPayment`(): OnchainPayment - + @Throws(NodeException::class) fun `openAnnouncedChannel`(`nodeId`: PublicKey, `address`: SocketAddress, `channelAmountSats`: kotlin.ULong, `pushToCounterpartyMsat`: kotlin.ULong?, `channelConfig`: ChannelConfig?): UserChannelId - + @Throws(NodeException::class) fun `openChannel`(`nodeId`: PublicKey, `address`: SocketAddress, `channelAmountSats`: kotlin.ULong, `pushToCounterpartyMsat`: kotlin.ULong?, `channelConfig`: ChannelConfig?): UserChannelId - + fun `payment`(`paymentId`: PaymentId): PaymentDetails? - + @Throws(NodeException::class) fun `removeAddressTypeFromMonitor`(`addressType`: AddressType) - + @Throws(NodeException::class) fun `removePayment`(`paymentId`: PaymentId) - + @Throws(NodeException::class) fun `setPrimaryAddressType`(`addressType`: AddressType, `seedBytes`: List) - + @Throws(NodeException::class) fun `setPrimaryAddressTypeWithMnemonic`(`addressType`: AddressType, `mnemonic`: Mnemonic, `passphrase`: kotlin.String?) - + fun `signMessage`(`msg`: List): kotlin.String - + @Throws(NodeException::class) fun `spliceIn`(`userChannelId`: UserChannelId, `counterpartyNodeId`: PublicKey, `spliceAmountSats`: kotlin.ULong) - + @Throws(NodeException::class) fun `spliceOut`(`userChannelId`: UserChannelId, `counterpartyNodeId`: PublicKey, `address`: Address, `spliceAmountSats`: kotlin.ULong) - + fun `spontaneousPayment`(): SpontaneousPayment - + @Throws(NodeException::class) fun `start`() - + fun `status`(): NodeStatus - + @Throws(NodeException::class) fun `stop`() - + @Throws(NodeException::class) fun `syncWallets`() - + fun `unifiedQrPayment`(): UnifiedQrPayment - + @Throws(NodeException::class) fun `updateChannelConfig`(`userChannelId`: UserChannelId, `counterpartyNodeId`: PublicKey, `channelConfig`: ChannelConfig) - + @Throws(NodeException::class) fun `updateSyncIntervals`(`intervals`: RuntimeSyncIntervals) - + fun `verifySignature`(`msg`: List, `sig`: kotlin.String, `pkey`: PublicKey): kotlin.Boolean - + fun `waitNextEvent`(): Event - + companion object } @@ -544,31 +544,31 @@ interface NodeInterface { interface OfferInterface { - + fun `absoluteExpirySeconds`(): kotlin.ULong? - + fun `amount`(): OfferAmount? - + fun `chains`(): List - + fun `expectsQuantity`(): kotlin.Boolean - + fun `id`(): OfferId - + fun `isExpired`(): kotlin.Boolean - + fun `isValidQuantity`(`quantity`: kotlin.ULong): kotlin.Boolean - + fun `issuer`(): kotlin.String? - + fun `issuerSigningPubkey`(): PublicKey? - + fun `metadata`(): List? - + fun `offerDescription`(): kotlin.String? - + fun `supportsChain`(`chain`: Network): kotlin.Boolean - + companion object } @@ -576,40 +576,55 @@ interface OfferInterface { interface OnchainPaymentInterface { - + @Throws(NodeException::class) fun `accelerateByCpfp`(`txid`: Txid, `feeRate`: FeeRate?, `destinationAddress`: Address?): Txid - + + @Throws(NodeException::class) + fun `addressInfoForTypeAtIndex`(`addressType`: AddressType, `keychain`: KeychainKind, `index`: kotlin.UInt): AddressInfo + + @Throws(NodeException::class) + fun `addressInfosForType`(`addressType`: AddressType, `keychain`: KeychainKind, `startIndex`: kotlin.UInt, `count`: kotlin.UInt): List + @Throws(NodeException::class) fun `bumpFeeByRbf`(`txid`: Txid, `feeRate`: FeeRate): Txid - + @Throws(NodeException::class) fun `calculateCpfpFeeRate`(`parentTxid`: Txid, `urgent`: kotlin.Boolean): FeeRate - + @Throws(NodeException::class) fun `calculateSendAllFee`(`address`: Address, `retainReserves`: kotlin.Boolean, `feeRate`: FeeRate?): kotlin.ULong - + @Throws(NodeException::class) fun `calculateTotalFee`(`address`: Address, `amountSats`: kotlin.ULong, `feeRate`: FeeRate?, `utxosToSpend`: List?): kotlin.ULong - + @Throws(NodeException::class) fun `listSpendableOutputs`(): List - + @Throws(NodeException::class) fun `newAddress`(): Address - + @Throws(NodeException::class) fun `newAddressForType`(`addressType`: AddressType): Address - + + @Throws(NodeException::class) + fun `newAddressInfo`(): AddressInfo + + @Throws(NodeException::class) + fun `newAddressInfoForType`(`addressType`: AddressType): AddressInfo + + @Throws(NodeException::class) + fun `revealReceiveAddressesTo`(`addressType`: AddressType, `index`: kotlin.UInt) + @Throws(NodeException::class) fun `selectUtxosWithAlgorithm`(`targetAmountSats`: kotlin.ULong, `feeRate`: FeeRate?, `algorithm`: CoinSelectionAlgorithm, `utxos`: List?): List - + @Throws(NodeException::class) fun `sendAllToAddress`(`address`: Address, `retainReserve`: kotlin.Boolean, `feeRate`: FeeRate?): Txid - + @Throws(NodeException::class) fun `sendToAddress`(`address`: Address, `amountSats`: kotlin.ULong, `feeRate`: FeeRate?, `utxosToSpend`: List?): Txid - + companion object } @@ -617,27 +632,27 @@ interface OnchainPaymentInterface { interface RefundInterface { - + fun `absoluteExpirySeconds`(): kotlin.ULong? - + fun `amountMsats`(): kotlin.ULong - + fun `chain`(): Network? - + fun `isExpired`(): kotlin.Boolean - + fun `issuer`(): kotlin.String? - + fun `payerMetadata`(): List - + fun `payerNote`(): kotlin.String? - + fun `payerSigningPubkey`(): PublicKey - + fun `quantity`(): kotlin.ULong? - + fun `refundDescription`(): kotlin.String - + companion object } @@ -645,22 +660,22 @@ interface RefundInterface { interface SpontaneousPaymentInterface { - + @Throws(NodeException::class) fun `send`(`amountMsat`: kotlin.ULong, `nodeId`: PublicKey, `routeParameters`: RouteParametersConfig?): PaymentId - + @Throws(NodeException::class) fun `sendProbes`(`amountMsat`: kotlin.ULong, `nodeId`: PublicKey): List - + @Throws(NodeException::class) fun `sendWithCustomTlvs`(`amountMsat`: kotlin.ULong, `nodeId`: PublicKey, `routeParameters`: RouteParametersConfig?, `customTlvs`: List): PaymentId - + @Throws(NodeException::class) fun `sendWithPreimage`(`amountMsat`: kotlin.ULong, `nodeId`: PublicKey, `preimage`: PaymentPreimage, `routeParameters`: RouteParametersConfig?): PaymentId - + @Throws(NodeException::class) fun `sendWithPreimageAndCustomTlvs`(`amountMsat`: kotlin.ULong, `nodeId`: PublicKey, `customTlvs`: List, `preimage`: PaymentPreimage, `routeParameters`: RouteParametersConfig?): PaymentId - + companion object } @@ -668,13 +683,13 @@ interface SpontaneousPaymentInterface { interface UnifiedQrPaymentInterface { - + @Throws(NodeException::class) fun `receive`(`amountSats`: kotlin.ULong, `message`: kotlin.String, `expirySec`: kotlin.UInt): kotlin.String - + @Throws(NodeException::class) fun `send`(`uriStr`: kotlin.String, `routeParameters`: RouteParametersConfig?): QrPaymentResult - + companion object } @@ -682,19 +697,30 @@ interface UnifiedQrPaymentInterface { interface VssHeaderProviderInterface { - + @Throws(VssHeaderProviderException::class, kotlin.coroutines.cancellation.CancellationException::class) suspend fun `getHeaders`(`request`: List): Map - + companion object } +@kotlinx.serialization.Serializable +data class AddressInfo ( + val `index`: kotlin.UInt, + val `address`: Address, + val `keychain`: KeychainKind +) { + companion object +} + + + @kotlinx.serialization.Serializable data class AddressTypeBalance ( - val `totalSats`: kotlin.ULong, + val `totalSats`: kotlin.ULong, val `spendableSats`: kotlin.ULong ) { companion object @@ -704,7 +730,7 @@ data class AddressTypeBalance ( @kotlinx.serialization.Serializable data class AnchorChannelsConfig ( - val `trustedPeersNoReserve`: List, + val `trustedPeersNoReserve`: List, val `perChannelReserveSats`: kotlin.ULong ) { companion object @@ -714,8 +740,8 @@ data class AnchorChannelsConfig ( @kotlinx.serialization.Serializable data class BackgroundSyncConfig ( - val `onchainWalletSyncIntervalSecs`: kotlin.ULong, - val `lightningWalletSyncIntervalSecs`: kotlin.ULong, + val `onchainWalletSyncIntervalSecs`: kotlin.ULong, + val `lightningWalletSyncIntervalSecs`: kotlin.ULong, val `feeRateCacheUpdateIntervalSecs`: kotlin.ULong ) { companion object @@ -725,11 +751,11 @@ data class BackgroundSyncConfig ( @kotlinx.serialization.Serializable data class BalanceDetails ( - val `totalOnchainBalanceSats`: kotlin.ULong, - val `spendableOnchainBalanceSats`: kotlin.ULong, - val `totalAnchorChannelsReserveSats`: kotlin.ULong, - val `totalLightningBalanceSats`: kotlin.ULong, - val `lightningBalances`: List, + val `totalOnchainBalanceSats`: kotlin.ULong, + val `spendableOnchainBalanceSats`: kotlin.ULong, + val `totalAnchorChannelsReserveSats`: kotlin.ULong, + val `totalLightningBalanceSats`: kotlin.ULong, + val `lightningBalances`: List, val `pendingBalancesFromChannelClosures`: List ) { companion object @@ -739,7 +765,7 @@ data class BalanceDetails ( @kotlinx.serialization.Serializable data class BestBlock ( - val `blockHash`: BlockHash, + val `blockHash`: BlockHash, val `height`: kotlin.UInt ) { companion object @@ -749,11 +775,11 @@ data class BestBlock ( @kotlinx.serialization.Serializable data class ChannelConfig ( - val `forwardingFeeProportionalMillionths`: kotlin.UInt, - val `forwardingFeeBaseMsat`: kotlin.UInt, - val `cltvExpiryDelta`: kotlin.UShort, - val `maxDustHtlcExposure`: MaxDustHtlcExposure, - val `forceCloseAvoidanceMaxFeeSatoshis`: kotlin.ULong, + val `forwardingFeeProportionalMillionths`: kotlin.UInt, + val `forwardingFeeBaseMsat`: kotlin.UInt, + val `cltvExpiryDelta`: kotlin.UShort, + val `maxDustHtlcExposure`: MaxDustHtlcExposure, + val `forceCloseAvoidanceMaxFeeSatoshis`: kotlin.ULong, val `acceptUnderpayingHtlcs`: kotlin.Boolean ) { companion object @@ -763,7 +789,7 @@ data class ChannelConfig ( @kotlinx.serialization.Serializable data class ChannelDataMigration ( - val `channelManager`: List?, + val `channelManager`: List?, val `channelMonitors`: List> ) { companion object @@ -773,37 +799,37 @@ data class ChannelDataMigration ( @kotlinx.serialization.Serializable data class ChannelDetails ( - val `channelId`: ChannelId, - val `counterpartyNodeId`: PublicKey, - val `fundingTxo`: OutPoint?, - val `shortChannelId`: kotlin.ULong?, - val `outboundScidAlias`: kotlin.ULong?, - val `inboundScidAlias`: kotlin.ULong?, - val `channelValueSats`: kotlin.ULong, - val `unspendablePunishmentReserve`: kotlin.ULong?, - val `userChannelId`: UserChannelId, - val `feerateSatPer1000Weight`: kotlin.UInt, - val `outboundCapacityMsat`: kotlin.ULong, - val `inboundCapacityMsat`: kotlin.ULong, - val `confirmationsRequired`: kotlin.UInt?, - val `confirmations`: kotlin.UInt?, - val `isOutbound`: kotlin.Boolean, - val `isChannelReady`: kotlin.Boolean, - val `isUsable`: kotlin.Boolean, - val `isAnnounced`: kotlin.Boolean, - val `cltvExpiryDelta`: kotlin.UShort?, - val `counterpartyUnspendablePunishmentReserve`: kotlin.ULong, - val `counterpartyOutboundHtlcMinimumMsat`: kotlin.ULong?, - val `counterpartyOutboundHtlcMaximumMsat`: kotlin.ULong?, - val `counterpartyForwardingInfoFeeBaseMsat`: kotlin.UInt?, - val `counterpartyForwardingInfoFeeProportionalMillionths`: kotlin.UInt?, - val `counterpartyForwardingInfoCltvExpiryDelta`: kotlin.UShort?, - val `nextOutboundHtlcLimitMsat`: kotlin.ULong, - val `nextOutboundHtlcMinimumMsat`: kotlin.ULong, - val `forceCloseSpendDelay`: kotlin.UShort?, - val `inboundHtlcMinimumMsat`: kotlin.ULong, - val `inboundHtlcMaximumMsat`: kotlin.ULong?, - val `config`: ChannelConfig, + val `channelId`: ChannelId, + val `counterpartyNodeId`: PublicKey, + val `fundingTxo`: OutPoint?, + val `shortChannelId`: kotlin.ULong?, + val `outboundScidAlias`: kotlin.ULong?, + val `inboundScidAlias`: kotlin.ULong?, + val `channelValueSats`: kotlin.ULong, + val `unspendablePunishmentReserve`: kotlin.ULong?, + val `userChannelId`: UserChannelId, + val `feerateSatPer1000Weight`: kotlin.UInt, + val `outboundCapacityMsat`: kotlin.ULong, + val `inboundCapacityMsat`: kotlin.ULong, + val `confirmationsRequired`: kotlin.UInt?, + val `confirmations`: kotlin.UInt?, + val `isOutbound`: kotlin.Boolean, + val `isChannelReady`: kotlin.Boolean, + val `isUsable`: kotlin.Boolean, + val `isAnnounced`: kotlin.Boolean, + val `cltvExpiryDelta`: kotlin.UShort?, + val `counterpartyUnspendablePunishmentReserve`: kotlin.ULong, + val `counterpartyOutboundHtlcMinimumMsat`: kotlin.ULong?, + val `counterpartyOutboundHtlcMaximumMsat`: kotlin.ULong?, + val `counterpartyForwardingInfoFeeBaseMsat`: kotlin.UInt?, + val `counterpartyForwardingInfoFeeProportionalMillionths`: kotlin.UInt?, + val `counterpartyForwardingInfoCltvExpiryDelta`: kotlin.UShort?, + val `nextOutboundHtlcLimitMsat`: kotlin.ULong, + val `nextOutboundHtlcMinimumMsat`: kotlin.ULong, + val `forceCloseSpendDelay`: kotlin.UShort?, + val `inboundHtlcMinimumMsat`: kotlin.ULong, + val `inboundHtlcMaximumMsat`: kotlin.ULong?, + val `config`: ChannelConfig, val `claimableOnCloseSats`: kotlin.ULong? ) { companion object @@ -813,10 +839,10 @@ data class ChannelDetails ( @kotlinx.serialization.Serializable data class ChannelInfo ( - val `nodeOne`: NodeId, - val `oneToTwo`: ChannelUpdateInfo?, - val `nodeTwo`: NodeId, - val `twoToOne`: ChannelUpdateInfo?, + val `nodeOne`: NodeId, + val `oneToTwo`: ChannelUpdateInfo?, + val `nodeTwo`: NodeId, + val `twoToOne`: ChannelUpdateInfo?, val `capacitySats`: kotlin.ULong? ) { companion object @@ -826,11 +852,11 @@ data class ChannelInfo ( @kotlinx.serialization.Serializable data class ChannelUpdateInfo ( - val `lastUpdate`: kotlin.UInt, - val `enabled`: kotlin.Boolean, - val `cltvExpiryDelta`: kotlin.UShort, - val `htlcMinimumMsat`: kotlin.ULong, - val `htlcMaximumMsat`: kotlin.ULong, + val `lastUpdate`: kotlin.UInt, + val `enabled`: kotlin.Boolean, + val `cltvExpiryDelta`: kotlin.UShort, + val `htlcMinimumMsat`: kotlin.ULong, + val `htlcMaximumMsat`: kotlin.ULong, val `fees`: RoutingFees ) { companion object @@ -840,17 +866,17 @@ data class ChannelUpdateInfo ( @kotlinx.serialization.Serializable data class Config ( - val `storageDirPath`: kotlin.String, - val `network`: Network, - val `listeningAddresses`: List?, - val `announcementAddresses`: List?, - val `nodeAlias`: NodeAlias?, - val `trustedPeers0conf`: List, - val `probingLiquidityLimitMultiplier`: kotlin.ULong, - val `anchorChannelsConfig`: AnchorChannelsConfig?, - val `routeParameters`: RouteParametersConfig?, - val `includeUntrustedPendingInSpendable`: kotlin.Boolean, - val `addressType`: AddressType, + val `storageDirPath`: kotlin.String, + val `network`: Network, + val `listeningAddresses`: List?, + val `announcementAddresses`: List?, + val `nodeAlias`: NodeAlias?, + val `trustedPeers0conf`: List, + val `probingLiquidityLimitMultiplier`: kotlin.ULong, + val `anchorChannelsConfig`: AnchorChannelsConfig?, + val `routeParameters`: RouteParametersConfig?, + val `includeUntrustedPendingInSpendable`: kotlin.Boolean, + val `addressType`: AddressType, val `addressTypesToMonitor`: List ) { companion object @@ -860,7 +886,7 @@ data class Config ( @kotlinx.serialization.Serializable data class CustomTlvRecord ( - val `typeNum`: kotlin.ULong, + val `typeNum`: kotlin.ULong, val `value`: List ) { companion object @@ -870,7 +896,7 @@ data class CustomTlvRecord ( @kotlinx.serialization.Serializable data class ElectrumSyncConfig ( - val `backgroundSyncConfig`: BackgroundSyncConfig?, + val `backgroundSyncConfig`: BackgroundSyncConfig?, val `connectionTimeoutSecs`: kotlin.ULong ) { companion object @@ -889,7 +915,7 @@ data class EsploraSyncConfig ( @kotlinx.serialization.Serializable data class LspFeeLimits ( - val `maxTotalOpeningFeeMsat`: kotlin.ULong?, + val `maxTotalOpeningFeeMsat`: kotlin.ULong?, val `maxProportionalOpeningFeePpmMsat`: kotlin.ULong? ) { companion object @@ -899,10 +925,10 @@ data class LspFeeLimits ( data class Lsps1Bolt11PaymentInfo ( - val `state`: Lsps1PaymentState, - val `expiresAt`: LspsDateTime, - val `feeTotalSat`: kotlin.ULong, - val `orderTotalSat`: kotlin.ULong, + val `state`: Lsps1PaymentState, + val `expiresAt`: LspsDateTime, + val `feeTotalSat`: kotlin.ULong, + val `orderTotalSat`: kotlin.ULong, val `invoice`: Bolt11Invoice ) : Disposable { override fun destroy() { @@ -921,8 +947,8 @@ data class Lsps1Bolt11PaymentInfo ( @kotlinx.serialization.Serializable data class Lsps1ChannelInfo ( - val `fundedAt`: LspsDateTime, - val `fundingOutpoint`: OutPoint, + val `fundedAt`: LspsDateTime, + val `fundingOutpoint`: OutPoint, val `expiresAt`: LspsDateTime ) { companion object @@ -932,13 +958,13 @@ data class Lsps1ChannelInfo ( data class Lsps1OnchainPaymentInfo ( - val `state`: Lsps1PaymentState, - val `expiresAt`: LspsDateTime, - val `feeTotalSat`: kotlin.ULong, - val `orderTotalSat`: kotlin.ULong, - val `address`: Address, - val `minOnchainPaymentConfirmations`: kotlin.UShort?, - val `minFeeFor0conf`: FeeRate, + val `state`: Lsps1PaymentState, + val `expiresAt`: LspsDateTime, + val `feeTotalSat`: kotlin.ULong, + val `orderTotalSat`: kotlin.ULong, + val `address`: Address, + val `minOnchainPaymentConfirmations`: kotlin.UShort?, + val `minFeeFor0conf`: FeeRate, val `refundOnchainAddress`: Address? ) : Disposable { override fun destroy() { @@ -960,12 +986,12 @@ data class Lsps1OnchainPaymentInfo ( @kotlinx.serialization.Serializable data class Lsps1OrderParams ( - val `lspBalanceSat`: kotlin.ULong, - val `clientBalanceSat`: kotlin.ULong, - val `requiredChannelConfirmations`: kotlin.UShort, - val `fundingConfirmsWithinBlocks`: kotlin.UShort, - val `channelExpiryBlocks`: kotlin.UInt, - val `token`: kotlin.String?, + val `lspBalanceSat`: kotlin.ULong, + val `clientBalanceSat`: kotlin.ULong, + val `requiredChannelConfirmations`: kotlin.UShort, + val `fundingConfirmsWithinBlocks`: kotlin.UShort, + val `channelExpiryBlocks`: kotlin.UInt, + val `token`: kotlin.String?, val `announceChannel`: kotlin.Boolean ) { companion object @@ -975,9 +1001,9 @@ data class Lsps1OrderParams ( data class Lsps1OrderStatus ( - val `orderId`: Lsps1OrderId, - val `orderParams`: Lsps1OrderParams, - val `paymentOptions`: Lsps1PaymentInfo, + val `orderId`: Lsps1OrderId, + val `orderParams`: Lsps1OrderParams, + val `paymentOptions`: Lsps1PaymentInfo, val `channelState`: Lsps1ChannelInfo? ) : Disposable { override fun destroy() { @@ -995,7 +1021,7 @@ data class Lsps1OrderStatus ( data class Lsps1PaymentInfo ( - val `bolt11`: Lsps1Bolt11PaymentInfo?, + val `bolt11`: Lsps1Bolt11PaymentInfo?, val `onchain`: Lsps1OnchainPaymentInfo? ) : Disposable { override fun destroy() { @@ -1011,15 +1037,15 @@ data class Lsps1PaymentInfo ( @kotlinx.serialization.Serializable data class Lsps2ServiceConfig ( - val `requireToken`: kotlin.String?, - val `advertiseService`: kotlin.Boolean, - val `channelOpeningFeePpm`: kotlin.UInt, - val `channelOverProvisioningPpm`: kotlin.UInt, - val `minChannelOpeningFeeMsat`: kotlin.ULong, - val `minChannelLifetime`: kotlin.UInt, - val `maxClientToSelfDelay`: kotlin.UInt, - val `minPaymentSizeMsat`: kotlin.ULong, - val `maxPaymentSizeMsat`: kotlin.ULong, + val `requireToken`: kotlin.String?, + val `advertiseService`: kotlin.Boolean, + val `channelOpeningFeePpm`: kotlin.UInt, + val `channelOverProvisioningPpm`: kotlin.UInt, + val `minChannelOpeningFeeMsat`: kotlin.ULong, + val `minChannelLifetime`: kotlin.UInt, + val `maxClientToSelfDelay`: kotlin.UInt, + val `minPaymentSizeMsat`: kotlin.ULong, + val `maxPaymentSizeMsat`: kotlin.ULong, val `clientTrustsLsp`: kotlin.Boolean ) { companion object @@ -1029,9 +1055,9 @@ data class Lsps2ServiceConfig ( @kotlinx.serialization.Serializable data class LogRecord ( - val `level`: LogLevel, - val `args`: kotlin.String, - val `modulePath`: kotlin.String, + val `level`: LogLevel, + val `args`: kotlin.String, + val `modulePath`: kotlin.String, val `line`: kotlin.UInt ) { companion object @@ -1041,8 +1067,8 @@ data class LogRecord ( @kotlinx.serialization.Serializable data class NodeAnnouncementInfo ( - val `lastUpdate`: kotlin.UInt, - val `alias`: kotlin.String, + val `lastUpdate`: kotlin.UInt, + val `alias`: kotlin.String, val `addresses`: List ) { companion object @@ -1052,7 +1078,7 @@ data class NodeAnnouncementInfo ( @kotlinx.serialization.Serializable data class NodeInfo ( - val `channels`: List, + val `channels`: List, val `announcementInfo`: NodeAnnouncementInfo? ) { companion object @@ -1062,14 +1088,14 @@ data class NodeInfo ( @kotlinx.serialization.Serializable data class NodeStatus ( - val `isRunning`: kotlin.Boolean, - val `currentBestBlock`: BestBlock, - val `latestLightningWalletSyncTimestamp`: kotlin.ULong?, - val `latestOnchainWalletSyncTimestamp`: kotlin.ULong?, - val `latestFeeRateCacheUpdateTimestamp`: kotlin.ULong?, - val `latestRgsSnapshotTimestamp`: kotlin.ULong?, - val `latestPathfindingScoresSyncTimestamp`: kotlin.ULong?, - val `latestNodeAnnouncementBroadcastTimestamp`: kotlin.ULong?, + val `isRunning`: kotlin.Boolean, + val `currentBestBlock`: BestBlock, + val `latestLightningWalletSyncTimestamp`: kotlin.ULong?, + val `latestOnchainWalletSyncTimestamp`: kotlin.ULong?, + val `latestFeeRateCacheUpdateTimestamp`: kotlin.ULong?, + val `latestRgsSnapshotTimestamp`: kotlin.ULong?, + val `latestPathfindingScoresSyncTimestamp`: kotlin.ULong?, + val `latestNodeAnnouncementBroadcastTimestamp`: kotlin.ULong?, val `latestChannelMonitorArchivalHeight`: kotlin.UInt? ) { companion object @@ -1079,7 +1105,7 @@ data class NodeStatus ( @kotlinx.serialization.Serializable data class OutPoint ( - val `txid`: Txid, + val `txid`: Txid, val `vout`: kotlin.UInt ) { companion object @@ -1089,12 +1115,12 @@ data class OutPoint ( @kotlinx.serialization.Serializable data class PaymentDetails ( - val `id`: PaymentId, - val `kind`: PaymentKind, - val `amountMsat`: kotlin.ULong?, - val `feePaidMsat`: kotlin.ULong?, - val `direction`: PaymentDirection, - val `status`: PaymentStatus, + val `id`: PaymentId, + val `kind`: PaymentKind, + val `amountMsat`: kotlin.ULong?, + val `feePaidMsat`: kotlin.ULong?, + val `direction`: PaymentDirection, + val `status`: PaymentStatus, val `latestUpdateTimestamp`: kotlin.ULong ) { companion object @@ -1104,9 +1130,9 @@ data class PaymentDetails ( @kotlinx.serialization.Serializable data class PeerDetails ( - val `nodeId`: PublicKey, - val `address`: SocketAddress, - val `isPersisted`: kotlin.Boolean, + val `nodeId`: PublicKey, + val `address`: SocketAddress, + val `isPersisted`: kotlin.Boolean, val `isConnected`: kotlin.Boolean ) { companion object @@ -1116,7 +1142,7 @@ data class PeerDetails ( @kotlinx.serialization.Serializable data class ProbeHandle ( - val `paymentHash`: PaymentHash, + val `paymentHash`: PaymentHash, val `paymentId`: PaymentId ) { companion object @@ -1126,11 +1152,11 @@ data class ProbeHandle ( @kotlinx.serialization.Serializable data class RouteHintHop ( - val `srcNodeId`: PublicKey, - val `shortChannelId`: kotlin.ULong, - val `cltvExpiryDelta`: kotlin.UShort, - val `htlcMinimumMsat`: kotlin.ULong?, - val `htlcMaximumMsat`: kotlin.ULong?, + val `srcNodeId`: PublicKey, + val `shortChannelId`: kotlin.ULong, + val `cltvExpiryDelta`: kotlin.UShort, + val `htlcMinimumMsat`: kotlin.ULong?, + val `htlcMaximumMsat`: kotlin.ULong?, val `fees`: RoutingFees ) { companion object @@ -1140,9 +1166,9 @@ data class RouteHintHop ( @kotlinx.serialization.Serializable data class RouteParametersConfig ( - val `maxTotalRoutingFeeMsat`: kotlin.ULong?, - val `maxTotalCltvExpiryDelta`: kotlin.UInt, - val `maxPathCount`: kotlin.UByte, + val `maxTotalRoutingFeeMsat`: kotlin.ULong?, + val `maxTotalCltvExpiryDelta`: kotlin.UInt, + val `maxPathCount`: kotlin.UByte, val `maxChannelSaturationPowerOfHalf`: kotlin.UByte ) { companion object @@ -1152,7 +1178,7 @@ data class RouteParametersConfig ( @kotlinx.serialization.Serializable data class RoutingFees ( - val `baseMsat`: kotlin.UInt, + val `baseMsat`: kotlin.UInt, val `proportionalMillionths`: kotlin.UInt ) { companion object @@ -1162,8 +1188,8 @@ data class RoutingFees ( @kotlinx.serialization.Serializable data class RuntimeSyncIntervals ( - val `onchainWalletSyncIntervalSecs`: kotlin.ULong, - val `lightningWalletSyncIntervalSecs`: kotlin.ULong, + val `onchainWalletSyncIntervalSecs`: kotlin.ULong, + val `lightningWalletSyncIntervalSecs`: kotlin.ULong, val `feeRateCacheUpdateIntervalSecs`: kotlin.ULong ) { companion object @@ -1173,7 +1199,7 @@ data class RuntimeSyncIntervals ( @kotlinx.serialization.Serializable data class SpendableUtxo ( - val `outpoint`: OutPoint, + val `outpoint`: OutPoint, val `valueSats`: kotlin.ULong ) { companion object @@ -1183,8 +1209,8 @@ data class SpendableUtxo ( @kotlinx.serialization.Serializable data class TransactionDetails ( - val `amountSats`: kotlin.Long, - val `inputs`: List, + val `amountSats`: kotlin.Long, + val `inputs`: List, val `outputs`: List ) { companion object @@ -1194,10 +1220,10 @@ data class TransactionDetails ( @kotlinx.serialization.Serializable data class TxInput ( - val `txid`: Txid, - val `vout`: kotlin.UInt, - val `scriptsig`: kotlin.String, - val `witness`: List, + val `txid`: Txid, + val `vout`: kotlin.UInt, + val `scriptsig`: kotlin.String, + val `witness`: List, val `sequence`: kotlin.UInt ) { companion object @@ -1207,10 +1233,10 @@ data class TxInput ( @kotlinx.serialization.Serializable data class TxOutput ( - val `scriptpubkey`: kotlin.String, - val `scriptpubkeyType`: kotlin.String?, - val `scriptpubkeyAddress`: kotlin.String?, - val `value`: kotlin.Long, + val `scriptpubkey`: kotlin.String, + val `scriptpubkeyType`: kotlin.String?, + val `scriptpubkeyAddress`: kotlin.String?, + val `value`: kotlin.Long, val `n`: kotlin.UInt ) { companion object @@ -1222,7 +1248,7 @@ data class TxOutput ( @kotlinx.serialization.Serializable enum class AddressType { - + LEGACY, NESTED_SEGWIT, NATIVE_SEGWIT, @@ -1238,7 +1264,7 @@ enum class AddressType { @kotlinx.serialization.Serializable enum class AsyncPaymentsRole { - + CLIENT, SERVER; companion object @@ -1252,7 +1278,7 @@ enum class AsyncPaymentsRole { @kotlinx.serialization.Serializable enum class BalanceSource { - + HOLDER_FORCE_CLOSED, COUNTERPARTY_FORCE_CLOSED, COOP_CLOSE, @@ -1277,7 +1303,7 @@ sealed class Bolt11InvoiceDescription { val `description`: kotlin.String, ) : Bolt11InvoiceDescription() { } - + } @@ -1287,41 +1313,41 @@ sealed class Bolt11InvoiceDescription { sealed class BuildException(message: String): kotlin.Exception(message) { - + class InvalidSeedBytes(message: String) : BuildException(message) - + class InvalidSeedFile(message: String) : BuildException(message) - + class InvalidSystemTime(message: String) : BuildException(message) - + class InvalidChannelMonitor(message: String) : BuildException(message) - + class InvalidListeningAddresses(message: String) : BuildException(message) - + class InvalidAnnouncementAddresses(message: String) : BuildException(message) - + class InvalidNodeAlias(message: String) : BuildException(message) - + class RuntimeSetupFailed(message: String) : BuildException(message) - + class ReadFailed(message: String) : BuildException(message) - + class DangerousValue(message: String) : BuildException(message) - + class WriteFailed(message: String) : BuildException(message) - + class StoragePathAccessFailed(message: String) : BuildException(message) - + class KvStoreSetupFailed(message: String) : BuildException(message) - + class WalletSetupFailed(message: String) : BuildException(message) - + class LoggerSetupFailed(message: String) : BuildException(message) - + class NetworkMismatch(message: String) : BuildException(message) - + class AsyncPaymentsConfigMismatch(message: String) : BuildException(message) - + } @@ -1340,51 +1366,51 @@ sealed class ClosureReason { val `message`: kotlin.String, ) : ClosureReason() { } - + @kotlinx.serialization.Serializable - data object LegacyCooperativeClosure : ClosureReason() - - + data object LegacyCooperativeClosure : ClosureReason() + + @kotlinx.serialization.Serializable - data object CounterpartyInitiatedCooperativeClosure : ClosureReason() - - + data object CounterpartyInitiatedCooperativeClosure : ClosureReason() + + @kotlinx.serialization.Serializable - data object LocallyInitiatedCooperativeClosure : ClosureReason() - - + data object LocallyInitiatedCooperativeClosure : ClosureReason() + + @kotlinx.serialization.Serializable - data object CommitmentTxConfirmed : ClosureReason() - - + data object CommitmentTxConfirmed : ClosureReason() + + @kotlinx.serialization.Serializable - data object FundingTimedOut : ClosureReason() - + data object FundingTimedOut : ClosureReason() + @kotlinx.serialization.Serializable data class ProcessingError( val `err`: kotlin.String, ) : ClosureReason() { } - + @kotlinx.serialization.Serializable - data object DisconnectedPeer : ClosureReason() - - + data object DisconnectedPeer : ClosureReason() + + @kotlinx.serialization.Serializable - data object OutdatedChannelManager : ClosureReason() - - + data object OutdatedChannelManager : ClosureReason() + + @kotlinx.serialization.Serializable - data object CounterpartyCoopClosedUnfundedChannel : ClosureReason() - - + data object CounterpartyCoopClosedUnfundedChannel : ClosureReason() + + @kotlinx.serialization.Serializable - data object LocallyCoopClosedUnfundedChannel : ClosureReason() - - + data object LocallyCoopClosedUnfundedChannel : ClosureReason() + + @kotlinx.serialization.Serializable - data object FundingBatchClosure : ClosureReason() - + data object FundingBatchClosure : ClosureReason() + @kotlinx.serialization.Serializable data class HtlCsTimedOut( val `paymentHash`: PaymentHash?, @@ -1396,7 +1422,7 @@ sealed class ClosureReason { val `requiredFeerateSatPerKw`: kotlin.UInt, ) : ClosureReason() { } - + } @@ -1407,7 +1433,7 @@ sealed class ClosureReason { @kotlinx.serialization.Serializable enum class CoinSelectionAlgorithm { - + BRANCH_AND_BOUND, LARGEST_FIRST, OLDEST_FIRST, @@ -1429,11 +1455,11 @@ sealed class ConfirmationStatus { val `timestamp`: kotlin.ULong, ) : ConfirmationStatus() { } - + @kotlinx.serialization.Serializable - data object Unconfirmed : ConfirmationStatus() - - + data object Unconfirmed : ConfirmationStatus() + + } @@ -1444,7 +1470,7 @@ sealed class ConfirmationStatus { @kotlinx.serialization.Serializable enum class Currency { - + BITCOIN, BITCOIN_TESTNET, REGTEST, @@ -1615,7 +1641,21 @@ sealed class Event { val `newTotalLightningBalanceSats`: kotlin.ULong, ) : Event() { } - + +} + + + + + + + +@kotlinx.serialization.Serializable +enum class KeychainKind { + + EXTERNAL, + INTERNAL; + companion object } @@ -1626,7 +1666,7 @@ sealed class Event { @kotlinx.serialization.Serializable enum class Lsps1PaymentState { - + EXPECT_PAYMENT, PAID, REFUNDED; @@ -1697,7 +1737,7 @@ sealed class LightningBalance { val `amountSatoshis`: kotlin.ULong, ) : LightningBalance() { } - + } @@ -1708,7 +1748,7 @@ sealed class LightningBalance { @kotlinx.serialization.Serializable enum class LogLevel { - + GOSSIP, TRACE, DEBUG, @@ -1735,7 +1775,7 @@ sealed class MaxDustHtlcExposure { val `multiplier`: kotlin.ULong, ) : MaxDustHtlcExposure() { } - + } @@ -1746,7 +1786,7 @@ sealed class MaxDustHtlcExposure { @kotlinx.serialization.Serializable enum class Network { - + BITCOIN, TESTNET, SIGNET, @@ -1761,141 +1801,141 @@ enum class Network { sealed class NodeException(message: String): kotlin.Exception(message) { - + class AlreadyRunning(message: String) : NodeException(message) - + class NotRunning(message: String) : NodeException(message) - + class OnchainTxCreationFailed(message: String) : NodeException(message) - + class ConnectionFailed(message: String) : NodeException(message) - + class InvoiceCreationFailed(message: String) : NodeException(message) - + class InvoiceRequestCreationFailed(message: String) : NodeException(message) - + class OfferCreationFailed(message: String) : NodeException(message) - + class RefundCreationFailed(message: String) : NodeException(message) - + class PaymentSendingFailed(message: String) : NodeException(message) - + class InvalidCustomTlvs(message: String) : NodeException(message) - + class ProbeSendingFailed(message: String) : NodeException(message) - + class RouteNotFound(message: String) : NodeException(message) - + class ChannelCreationFailed(message: String) : NodeException(message) - + class ChannelClosingFailed(message: String) : NodeException(message) - + class ChannelSplicingFailed(message: String) : NodeException(message) - + class ChannelConfigUpdateFailed(message: String) : NodeException(message) - + class PersistenceFailed(message: String) : NodeException(message) - + class FeerateEstimationUpdateFailed(message: String) : NodeException(message) - + class FeerateEstimationUpdateTimeout(message: String) : NodeException(message) - + class WalletOperationFailed(message: String) : NodeException(message) - + class WalletOperationTimeout(message: String) : NodeException(message) - + class OnchainTxSigningFailed(message: String) : NodeException(message) - + class TxSyncFailed(message: String) : NodeException(message) - + class TxSyncTimeout(message: String) : NodeException(message) - + class GossipUpdateFailed(message: String) : NodeException(message) - + class GossipUpdateTimeout(message: String) : NodeException(message) - + class LiquidityRequestFailed(message: String) : NodeException(message) - + class UriParameterParsingFailed(message: String) : NodeException(message) - + class InvalidAddress(message: String) : NodeException(message) - + class InvalidSocketAddress(message: String) : NodeException(message) - + class InvalidPublicKey(message: String) : NodeException(message) - + class InvalidSecretKey(message: String) : NodeException(message) - + class InvalidOfferId(message: String) : NodeException(message) - + class InvalidNodeId(message: String) : NodeException(message) - + class InvalidPaymentId(message: String) : NodeException(message) - + class InvalidPaymentHash(message: String) : NodeException(message) - + class InvalidPaymentPreimage(message: String) : NodeException(message) - + class InvalidPaymentSecret(message: String) : NodeException(message) - + class InvalidAmount(message: String) : NodeException(message) - + class InvalidInvoice(message: String) : NodeException(message) - + class InvalidOffer(message: String) : NodeException(message) - + class InvalidRefund(message: String) : NodeException(message) - + class InvalidChannelId(message: String) : NodeException(message) - + class InvalidNetwork(message: String) : NodeException(message) - + class InvalidUri(message: String) : NodeException(message) - + class InvalidQuantity(message: String) : NodeException(message) - + class InvalidNodeAlias(message: String) : NodeException(message) - + class InvalidDateTime(message: String) : NodeException(message) - + class InvalidFeeRate(message: String) : NodeException(message) - + class DuplicatePayment(message: String) : NodeException(message) - + class UnsupportedCurrency(message: String) : NodeException(message) - + class InsufficientFunds(message: String) : NodeException(message) - + class LiquiditySourceUnavailable(message: String) : NodeException(message) - + class LiquidityFeeTooHigh(message: String) : NodeException(message) - + class InvalidBlindedPaths(message: String) : NodeException(message) - + class AsyncPaymentServicesDisabled(message: String) : NodeException(message) - + class CannotRbfFundingTransaction(message: String) : NodeException(message) - + class TransactionNotFound(message: String) : NodeException(message) - + class TransactionAlreadyConfirmed(message: String) : NodeException(message) - + class NoSpendableOutputs(message: String) : NodeException(message) - + class CoinSelectionFailed(message: String) : NodeException(message) - + class InvalidMnemonic(message: String) : NodeException(message) - + class BackgroundSyncNotEnabled(message: String) : NodeException(message) - + class AddressTypeAlreadyMonitored(message: String) : NodeException(message) - + class AddressTypeIsPrimary(message: String) : NodeException(message) - + class AddressTypeNotMonitored(message: String) : NodeException(message) - + class InvalidSeedBytes(message: String) : NodeException(message) - + } @@ -1914,7 +1954,7 @@ sealed class OfferAmount { val `amount`: kotlin.ULong, ) : OfferAmount() { } - + } @@ -1925,7 +1965,7 @@ sealed class OfferAmount { @kotlinx.serialization.Serializable enum class PaymentDirection { - + INBOUND, OUTBOUND; companion object @@ -1939,7 +1979,7 @@ enum class PaymentDirection { @kotlinx.serialization.Serializable enum class PaymentFailureReason { - + RECIPIENT_REJECTED, USER_ABANDONED, RETRIES_EXHAUSTED, @@ -2011,7 +2051,7 @@ sealed class PaymentKind { val `preimage`: PaymentPreimage?, ) : PaymentKind() { } - + } @@ -2022,7 +2062,7 @@ sealed class PaymentKind { @kotlinx.serialization.Serializable enum class PaymentStatus { - + PENDING, SUCCEEDED, FAILED; @@ -2059,7 +2099,7 @@ sealed class PendingSweepBalance { val `amountSatoshis`: kotlin.ULong, ) : PendingSweepBalance() { } - + } @@ -2084,7 +2124,7 @@ sealed class QrPaymentResult { val `paymentId`: PaymentId, ) : QrPaymentResult() { } - + } @@ -2095,7 +2135,7 @@ sealed class QrPaymentResult { @kotlinx.serialization.Serializable enum class SyncType { - + ONCHAIN_WALLET, LIGHTNING_WALLET, FEE_RATE_CACHE; @@ -2109,15 +2149,15 @@ enum class SyncType { sealed class VssHeaderProviderException(message: String): kotlin.Exception(message) { - + class InvalidData(message: String) : VssHeaderProviderException(message) - + class RequestException(message: String) : VssHeaderProviderException(message) - + class AuthorizationException(message: String) : VssHeaderProviderException(message) - + class InternalException(message: String) : VssHeaderProviderException(message) - + } @@ -2126,7 +2166,7 @@ sealed class VssHeaderProviderException(message: String): kotlin.Exception(messa @kotlinx.serialization.Serializable enum class WordCount { - + WORDS12, WORDS15, WORDS18, @@ -2272,6 +2312,8 @@ enum class WordCount { + + diff --git a/bindings/kotlin/ldk-node-jvm/gradle.properties b/bindings/kotlin/ldk-node-jvm/gradle.properties index a6c95664e8..7a235472f4 100644 --- a/bindings/kotlin/ldk-node-jvm/gradle.properties +++ b/bindings/kotlin/ldk-node-jvm/gradle.properties @@ -1,4 +1,4 @@ org.gradle.jvmargs=-Xmx1536m kotlin.code.style=official group=com.synonym -version=0.7.0-rc.37 +version=0.7.0-rc.39 diff --git a/bindings/kotlin/ldk-node-jvm/lib/src/main/kotlin/org/lightningdevkit/ldknode/ldk_node.common.kt b/bindings/kotlin/ldk-node-jvm/lib/src/main/kotlin/org/lightningdevkit/ldknode/ldk_node.common.kt index 5223da8bc5..21e71fdd6d 100644 --- a/bindings/kotlin/ldk-node-jvm/lib/src/main/kotlin/org/lightningdevkit/ldknode/ldk_node.common.kt +++ b/bindings/kotlin/ldk-node-jvm/lib/src/main/kotlin/org/lightningdevkit/ldknode/ldk_node.common.kt @@ -104,39 +104,39 @@ object NoPointer interface Bolt11InvoiceInterface { - + fun `amountMilliSatoshis`(): kotlin.ULong? - + fun `currency`(): Currency - + fun `expiryTimeSeconds`(): kotlin.ULong - + fun `fallbackAddresses`(): List
- + fun `invoiceDescription`(): Bolt11InvoiceDescription - + fun `isExpired`(): kotlin.Boolean - + fun `minFinalCltvExpiryDelta`(): kotlin.ULong - + fun `network`(): Network - + fun `paymentHash`(): PaymentHash - + fun `paymentSecret`(): PaymentSecret - + fun `recoverPayeePubKey`(): PublicKey - + fun `routeHints`(): List> - + fun `secondsSinceEpoch`(): kotlin.ULong - + fun `secondsUntilExpiry`(): kotlin.ULong - + fun `signableHash`(): List - + fun `wouldExpire`(`atTimeSeconds`: kotlin.ULong): kotlin.Boolean - + companion object } @@ -144,55 +144,55 @@ interface Bolt11InvoiceInterface { interface Bolt11PaymentInterface { - + @Throws(NodeException::class) fun `claimForHash`(`paymentHash`: PaymentHash, `claimableAmountMsat`: kotlin.ULong, `preimage`: PaymentPreimage) - + @Throws(NodeException::class) fun `estimateRoutingFees`(`invoice`: Bolt11Invoice): kotlin.ULong - + @Throws(NodeException::class) fun `estimateRoutingFeesUsingAmount`(`invoice`: Bolt11Invoice, `amountMsat`: kotlin.ULong): kotlin.ULong - + @Throws(NodeException::class) fun `failForHash`(`paymentHash`: PaymentHash) - + @Throws(NodeException::class) fun `receive`(`amountMsat`: kotlin.ULong, `description`: Bolt11InvoiceDescription, `expirySecs`: kotlin.UInt): Bolt11Invoice - + @Throws(NodeException::class) fun `receiveForHash`(`amountMsat`: kotlin.ULong, `description`: Bolt11InvoiceDescription, `expirySecs`: kotlin.UInt, `paymentHash`: PaymentHash): Bolt11Invoice - + @Throws(NodeException::class) fun `receiveVariableAmount`(`description`: Bolt11InvoiceDescription, `expirySecs`: kotlin.UInt): Bolt11Invoice - + @Throws(NodeException::class) fun `receiveVariableAmountForHash`(`description`: Bolt11InvoiceDescription, `expirySecs`: kotlin.UInt, `paymentHash`: PaymentHash): Bolt11Invoice - + @Throws(NodeException::class) fun `receiveVariableAmountViaJitChannel`(`description`: Bolt11InvoiceDescription, `expirySecs`: kotlin.UInt, `maxProportionalLspFeeLimitPpmMsat`: kotlin.ULong?): Bolt11Invoice - + @Throws(NodeException::class) fun `receiveVariableAmountViaJitChannelForHash`(`description`: Bolt11InvoiceDescription, `expirySecs`: kotlin.UInt, `maxProportionalLspFeeLimitPpmMsat`: kotlin.ULong?, `paymentHash`: PaymentHash): Bolt11Invoice - + @Throws(NodeException::class) fun `receiveViaJitChannel`(`amountMsat`: kotlin.ULong, `description`: Bolt11InvoiceDescription, `expirySecs`: kotlin.UInt, `maxLspFeeLimitMsat`: kotlin.ULong?): Bolt11Invoice - + @Throws(NodeException::class) fun `receiveViaJitChannelForHash`(`amountMsat`: kotlin.ULong, `description`: Bolt11InvoiceDescription, `expirySecs`: kotlin.UInt, `maxLspFeeLimitMsat`: kotlin.ULong?, `paymentHash`: PaymentHash): Bolt11Invoice - + @Throws(NodeException::class) fun `send`(`invoice`: Bolt11Invoice, `routeParameters`: RouteParametersConfig?): PaymentId - + @Throws(NodeException::class) fun `sendProbes`(`invoice`: Bolt11Invoice, `routeParameters`: RouteParametersConfig?): List - + @Throws(NodeException::class) fun `sendProbesUsingAmount`(`invoice`: Bolt11Invoice, `amountMsat`: kotlin.ULong, `routeParameters`: RouteParametersConfig?): List - + @Throws(NodeException::class) fun `sendUsingAmount`(`invoice`: Bolt11Invoice, `amountMsat`: kotlin.ULong, `routeParameters`: RouteParametersConfig?): PaymentId - + companion object } @@ -200,47 +200,47 @@ interface Bolt11PaymentInterface { interface Bolt12InvoiceInterface { - + fun `absoluteExpirySeconds`(): kotlin.ULong? - + fun `amount`(): OfferAmount? - + fun `amountMsats`(): kotlin.ULong - + fun `chain`(): List - + fun `createdAt`(): kotlin.ULong - + fun `encode`(): List - + fun `fallbackAddresses`(): List
- + fun `invoiceDescription`(): kotlin.String? - + fun `isExpired`(): kotlin.Boolean - + fun `issuer`(): kotlin.String? - + fun `issuerSigningPubkey`(): PublicKey? - + fun `metadata`(): List? - + fun `offerChains`(): List>? - + fun `payerNote`(): kotlin.String? - + fun `payerSigningPubkey`(): PublicKey - + fun `paymentHash`(): PaymentHash - + fun `quantity`(): kotlin.ULong? - + fun `relativeExpiry`(): kotlin.ULong - + fun `signableHash`(): List - + fun `signingPubkey`(): PublicKey - + companion object } @@ -248,34 +248,34 @@ interface Bolt12InvoiceInterface { interface Bolt12PaymentInterface { - + @Throws(NodeException::class) fun `blindedPathsForAsyncRecipient`(`recipientId`: kotlin.ByteArray): kotlin.ByteArray - + @Throws(NodeException::class) fun `initiateRefund`(`amountMsat`: kotlin.ULong, `expirySecs`: kotlin.UInt, `quantity`: kotlin.ULong?, `payerNote`: kotlin.String?, `routeParameters`: RouteParametersConfig?): Refund - + @Throws(NodeException::class) fun `receive`(`amountMsat`: kotlin.ULong, `description`: kotlin.String, `expirySecs`: kotlin.UInt?, `quantity`: kotlin.ULong?): Offer - + @Throws(NodeException::class) fun `receiveAsync`(): Offer - + @Throws(NodeException::class) fun `receiveVariableAmount`(`description`: kotlin.String, `expirySecs`: kotlin.UInt?): Offer - + @Throws(NodeException::class) fun `requestRefundPayment`(`refund`: Refund): Bolt12Invoice - + @Throws(NodeException::class) fun `send`(`offer`: Offer, `quantity`: kotlin.ULong?, `payerNote`: kotlin.String?, `routeParameters`: RouteParametersConfig?): PaymentId - + @Throws(NodeException::class) fun `sendUsingAmount`(`offer`: Offer, `amountMsat`: kotlin.ULong, `quantity`: kotlin.ULong?, `payerNote`: kotlin.String?, `routeParameters`: RouteParametersConfig?): PaymentId - + @Throws(NodeException::class) fun `setPathsToStaticInvoiceServer`(`paths`: kotlin.ByteArray) - + companion object } @@ -283,77 +283,77 @@ interface Bolt12PaymentInterface { interface BuilderInterface { - + @Throws(BuildException::class) fun `build`(): Node - + @Throws(BuildException::class) fun `buildWithFsStore`(): Node - + @Throws(BuildException::class) fun `buildWithVssStore`(`vssUrl`: kotlin.String, `storeId`: kotlin.String, `lnurlAuthServerUrl`: kotlin.String, `fixedHeaders`: Map): Node - + @Throws(BuildException::class) fun `buildWithVssStoreAndFixedHeaders`(`vssUrl`: kotlin.String, `storeId`: kotlin.String, `fixedHeaders`: Map): Node - + @Throws(BuildException::class) fun `buildWithVssStoreAndHeaderProvider`(`vssUrl`: kotlin.String, `storeId`: kotlin.String, `headerProvider`: VssHeaderProvider): Node - + fun `setAcceptStaleChannelMonitors`(`accept`: kotlin.Boolean) - + fun `setAddressType`(`addressType`: AddressType) - + fun `setAddressTypesToMonitor`(`addressTypesToMonitor`: List) - + @Throws(BuildException::class) fun `setAnnouncementAddresses`(`announcementAddresses`: List) - + @Throws(BuildException::class) fun `setAsyncPaymentsRole`(`role`: AsyncPaymentsRole?) - + fun `setChainSourceBitcoindRest`(`restHost`: kotlin.String, `restPort`: kotlin.UShort, `rpcHost`: kotlin.String, `rpcPort`: kotlin.UShort, `rpcUser`: kotlin.String, `rpcPassword`: kotlin.String) - + fun `setChainSourceBitcoindRpc`(`rpcHost`: kotlin.String, `rpcPort`: kotlin.UShort, `rpcUser`: kotlin.String, `rpcPassword`: kotlin.String) - + fun `setChainSourceElectrum`(`serverUrl`: kotlin.String, `config`: ElectrumSyncConfig?) - + fun `setChainSourceEsplora`(`serverUrl`: kotlin.String, `config`: EsploraSyncConfig?) - + fun `setChannelDataMigration`(`migration`: ChannelDataMigration) - + fun `setCustomLogger`(`logWriter`: LogWriter) - + fun `setEntropyBip39Mnemonic`(`mnemonic`: Mnemonic, `passphrase`: kotlin.String?) - + @Throws(BuildException::class) fun `setEntropySeedBytes`(`seedBytes`: List) - + fun `setEntropySeedPath`(`seedPath`: kotlin.String) - + fun `setFilesystemLogger`(`logFilePath`: kotlin.String?, `maxLogLevel`: LogLevel?) - + fun `setGossipSourceP2p`() - + fun `setGossipSourceRgs`(`rgsServerUrl`: kotlin.String) - + fun `setLiquiditySourceLsps1`(`nodeId`: PublicKey, `address`: SocketAddress, `token`: kotlin.String?) - + fun `setLiquiditySourceLsps2`(`nodeId`: PublicKey, `address`: SocketAddress, `token`: kotlin.String?) - + @Throws(BuildException::class) fun `setListeningAddresses`(`listeningAddresses`: List) - + fun `setLogFacadeLogger`() - + fun `setNetwork`(`network`: Network) - + @Throws(BuildException::class) fun `setNodeAlias`(`nodeAlias`: kotlin.String) - + fun `setPathfindingScoresSource`(`url`: kotlin.String) - + fun `setStorageDirPath`(`storageDirPath`: kotlin.String) - + companion object } @@ -361,13 +361,13 @@ interface BuilderInterface { interface FeeRateInterface { - + fun `toSatPerKwu`(): kotlin.ULong - + fun `toSatPerVbCeil`(): kotlin.ULong - + fun `toSatPerVbFloor`(): kotlin.ULong - + companion object } @@ -375,13 +375,13 @@ interface FeeRateInterface { interface Lsps1LiquidityInterface { - + @Throws(NodeException::class) fun `checkOrderStatus`(`orderId`: Lsps1OrderId): Lsps1OrderStatus - + @Throws(NodeException::class) fun `requestChannel`(`lspBalanceSat`: kotlin.ULong, `clientBalanceSat`: kotlin.ULong, `channelExpiryBlocks`: kotlin.UInt, `announceChannel`: kotlin.Boolean): Lsps1OrderStatus - + companion object } @@ -389,9 +389,9 @@ interface Lsps1LiquidityInterface { interface LogWriter { - + fun `log`(`record`: LogRecord) - + companion object } @@ -399,15 +399,15 @@ interface LogWriter { interface NetworkGraphInterface { - + fun `channel`(`shortChannelId`: kotlin.ULong): ChannelInfo? - + fun `listChannels`(): List - + fun `listNodes`(): List - + fun `node`(`nodeId`: NodeId): NodeInfo? - + companion object } @@ -415,128 +415,128 @@ interface NetworkGraphInterface { interface NodeInterface { - + @Throws(NodeException::class) fun `addAddressTypeToMonitor`(`addressType`: AddressType, `seedBytes`: List) - + @Throws(NodeException::class) fun `addAddressTypeToMonitorWithMnemonic`(`addressType`: AddressType, `mnemonic`: Mnemonic, `passphrase`: kotlin.String?) - + fun `announcementAddresses`(): List? - + fun `bolt11Payment`(): Bolt11Payment - + fun `bolt12Payment`(): Bolt12Payment - + @Throws(NodeException::class) fun `closeChannel`(`userChannelId`: UserChannelId, `counterpartyNodeId`: PublicKey) - + fun `config`(): Config - + @Throws(NodeException::class) fun `connect`(`nodeId`: PublicKey, `address`: SocketAddress, `persist`: kotlin.Boolean) - + fun `currentSyncIntervals`(): RuntimeSyncIntervals - + @Throws(NodeException::class) fun `disconnect`(`nodeId`: PublicKey) - + @Throws(NodeException::class) fun `eventHandled`() - + @Throws(NodeException::class) fun `exportPathfindingScores`(): kotlin.ByteArray - + @Throws(NodeException::class) fun `forceCloseChannel`(`userChannelId`: UserChannelId, `counterpartyNodeId`: PublicKey, `reason`: kotlin.String?) - + @Throws(NodeException::class) fun `getAddressBalance`(`addressStr`: kotlin.String): kotlin.ULong - + @Throws(NodeException::class) fun `getBalanceForAddressType`(`addressType`: AddressType): AddressTypeBalance - + fun `getTransactionDetails`(`txid`: Txid): TransactionDetails? - + fun `listBalances`(): BalanceDetails - + fun `listChannels`(): List - + fun `listMonitoredAddressTypes`(): List - + fun `listPayments`(): List - + fun `listPeers`(): List - + fun `listeningAddresses`(): List? - + fun `lsps1Liquidity`(): Lsps1Liquidity - + fun `networkGraph`(): NetworkGraph - + fun `nextEvent`(): Event? - + suspend fun `nextEventAsync`(): Event - + fun `nodeAlias`(): NodeAlias? - + fun `nodeId`(): PublicKey - + fun `onchainPayment`(): OnchainPayment - + @Throws(NodeException::class) fun `openAnnouncedChannel`(`nodeId`: PublicKey, `address`: SocketAddress, `channelAmountSats`: kotlin.ULong, `pushToCounterpartyMsat`: kotlin.ULong?, `channelConfig`: ChannelConfig?): UserChannelId - + @Throws(NodeException::class) fun `openChannel`(`nodeId`: PublicKey, `address`: SocketAddress, `channelAmountSats`: kotlin.ULong, `pushToCounterpartyMsat`: kotlin.ULong?, `channelConfig`: ChannelConfig?): UserChannelId - + fun `payment`(`paymentId`: PaymentId): PaymentDetails? - + @Throws(NodeException::class) fun `removeAddressTypeFromMonitor`(`addressType`: AddressType) - + @Throws(NodeException::class) fun `removePayment`(`paymentId`: PaymentId) - + @Throws(NodeException::class) fun `setPrimaryAddressType`(`addressType`: AddressType, `seedBytes`: List) - + @Throws(NodeException::class) fun `setPrimaryAddressTypeWithMnemonic`(`addressType`: AddressType, `mnemonic`: Mnemonic, `passphrase`: kotlin.String?) - + fun `signMessage`(`msg`: List): kotlin.String - + @Throws(NodeException::class) fun `spliceIn`(`userChannelId`: UserChannelId, `counterpartyNodeId`: PublicKey, `spliceAmountSats`: kotlin.ULong) - + @Throws(NodeException::class) fun `spliceOut`(`userChannelId`: UserChannelId, `counterpartyNodeId`: PublicKey, `address`: Address, `spliceAmountSats`: kotlin.ULong) - + fun `spontaneousPayment`(): SpontaneousPayment - + @Throws(NodeException::class) fun `start`() - + fun `status`(): NodeStatus - + @Throws(NodeException::class) fun `stop`() - + @Throws(NodeException::class) fun `syncWallets`() - + fun `unifiedQrPayment`(): UnifiedQrPayment - + @Throws(NodeException::class) fun `updateChannelConfig`(`userChannelId`: UserChannelId, `counterpartyNodeId`: PublicKey, `channelConfig`: ChannelConfig) - + @Throws(NodeException::class) fun `updateSyncIntervals`(`intervals`: RuntimeSyncIntervals) - + fun `verifySignature`(`msg`: List, `sig`: kotlin.String, `pkey`: PublicKey): kotlin.Boolean - + fun `waitNextEvent`(): Event - + companion object } @@ -544,31 +544,31 @@ interface NodeInterface { interface OfferInterface { - + fun `absoluteExpirySeconds`(): kotlin.ULong? - + fun `amount`(): OfferAmount? - + fun `chains`(): List - + fun `expectsQuantity`(): kotlin.Boolean - + fun `id`(): OfferId - + fun `isExpired`(): kotlin.Boolean - + fun `isValidQuantity`(`quantity`: kotlin.ULong): kotlin.Boolean - + fun `issuer`(): kotlin.String? - + fun `issuerSigningPubkey`(): PublicKey? - + fun `metadata`(): List? - + fun `offerDescription`(): kotlin.String? - + fun `supportsChain`(`chain`: Network): kotlin.Boolean - + companion object } @@ -576,40 +576,55 @@ interface OfferInterface { interface OnchainPaymentInterface { - + @Throws(NodeException::class) fun `accelerateByCpfp`(`txid`: Txid, `feeRate`: FeeRate?, `destinationAddress`: Address?): Txid - + + @Throws(NodeException::class) + fun `addressInfoForTypeAtIndex`(`addressType`: AddressType, `keychain`: KeychainKind, `index`: kotlin.UInt): AddressInfo + + @Throws(NodeException::class) + fun `addressInfosForType`(`addressType`: AddressType, `keychain`: KeychainKind, `startIndex`: kotlin.UInt, `count`: kotlin.UInt): List + @Throws(NodeException::class) fun `bumpFeeByRbf`(`txid`: Txid, `feeRate`: FeeRate): Txid - + @Throws(NodeException::class) fun `calculateCpfpFeeRate`(`parentTxid`: Txid, `urgent`: kotlin.Boolean): FeeRate - + @Throws(NodeException::class) fun `calculateSendAllFee`(`address`: Address, `retainReserves`: kotlin.Boolean, `feeRate`: FeeRate?): kotlin.ULong - + @Throws(NodeException::class) fun `calculateTotalFee`(`address`: Address, `amountSats`: kotlin.ULong, `feeRate`: FeeRate?, `utxosToSpend`: List?): kotlin.ULong - + @Throws(NodeException::class) fun `listSpendableOutputs`(): List - + @Throws(NodeException::class) fun `newAddress`(): Address - + @Throws(NodeException::class) fun `newAddressForType`(`addressType`: AddressType): Address - + + @Throws(NodeException::class) + fun `newAddressInfo`(): AddressInfo + + @Throws(NodeException::class) + fun `newAddressInfoForType`(`addressType`: AddressType): AddressInfo + + @Throws(NodeException::class) + fun `revealReceiveAddressesTo`(`addressType`: AddressType, `index`: kotlin.UInt) + @Throws(NodeException::class) fun `selectUtxosWithAlgorithm`(`targetAmountSats`: kotlin.ULong, `feeRate`: FeeRate?, `algorithm`: CoinSelectionAlgorithm, `utxos`: List?): List - + @Throws(NodeException::class) fun `sendAllToAddress`(`address`: Address, `retainReserve`: kotlin.Boolean, `feeRate`: FeeRate?): Txid - + @Throws(NodeException::class) fun `sendToAddress`(`address`: Address, `amountSats`: kotlin.ULong, `feeRate`: FeeRate?, `utxosToSpend`: List?): Txid - + companion object } @@ -617,27 +632,27 @@ interface OnchainPaymentInterface { interface RefundInterface { - + fun `absoluteExpirySeconds`(): kotlin.ULong? - + fun `amountMsats`(): kotlin.ULong - + fun `chain`(): Network? - + fun `isExpired`(): kotlin.Boolean - + fun `issuer`(): kotlin.String? - + fun `payerMetadata`(): List - + fun `payerNote`(): kotlin.String? - + fun `payerSigningPubkey`(): PublicKey - + fun `quantity`(): kotlin.ULong? - + fun `refundDescription`(): kotlin.String - + companion object } @@ -645,22 +660,22 @@ interface RefundInterface { interface SpontaneousPaymentInterface { - + @Throws(NodeException::class) fun `send`(`amountMsat`: kotlin.ULong, `nodeId`: PublicKey, `routeParameters`: RouteParametersConfig?): PaymentId - + @Throws(NodeException::class) fun `sendProbes`(`amountMsat`: kotlin.ULong, `nodeId`: PublicKey): List - + @Throws(NodeException::class) fun `sendWithCustomTlvs`(`amountMsat`: kotlin.ULong, `nodeId`: PublicKey, `routeParameters`: RouteParametersConfig?, `customTlvs`: List): PaymentId - + @Throws(NodeException::class) fun `sendWithPreimage`(`amountMsat`: kotlin.ULong, `nodeId`: PublicKey, `preimage`: PaymentPreimage, `routeParameters`: RouteParametersConfig?): PaymentId - + @Throws(NodeException::class) fun `sendWithPreimageAndCustomTlvs`(`amountMsat`: kotlin.ULong, `nodeId`: PublicKey, `customTlvs`: List, `preimage`: PaymentPreimage, `routeParameters`: RouteParametersConfig?): PaymentId - + companion object } @@ -668,13 +683,13 @@ interface SpontaneousPaymentInterface { interface UnifiedQrPaymentInterface { - + @Throws(NodeException::class) fun `receive`(`amountSats`: kotlin.ULong, `message`: kotlin.String, `expirySec`: kotlin.UInt): kotlin.String - + @Throws(NodeException::class) fun `send`(`uriStr`: kotlin.String, `routeParameters`: RouteParametersConfig?): QrPaymentResult - + companion object } @@ -682,19 +697,30 @@ interface UnifiedQrPaymentInterface { interface VssHeaderProviderInterface { - + @Throws(VssHeaderProviderException::class, kotlin.coroutines.cancellation.CancellationException::class) suspend fun `getHeaders`(`request`: List): Map - + companion object } +@kotlinx.serialization.Serializable +data class AddressInfo ( + val `index`: kotlin.UInt, + val `address`: Address, + val `keychain`: KeychainKind +) { + companion object +} + + + @kotlinx.serialization.Serializable data class AddressTypeBalance ( - val `totalSats`: kotlin.ULong, + val `totalSats`: kotlin.ULong, val `spendableSats`: kotlin.ULong ) { companion object @@ -704,7 +730,7 @@ data class AddressTypeBalance ( @kotlinx.serialization.Serializable data class AnchorChannelsConfig ( - val `trustedPeersNoReserve`: List, + val `trustedPeersNoReserve`: List, val `perChannelReserveSats`: kotlin.ULong ) { companion object @@ -714,8 +740,8 @@ data class AnchorChannelsConfig ( @kotlinx.serialization.Serializable data class BackgroundSyncConfig ( - val `onchainWalletSyncIntervalSecs`: kotlin.ULong, - val `lightningWalletSyncIntervalSecs`: kotlin.ULong, + val `onchainWalletSyncIntervalSecs`: kotlin.ULong, + val `lightningWalletSyncIntervalSecs`: kotlin.ULong, val `feeRateCacheUpdateIntervalSecs`: kotlin.ULong ) { companion object @@ -725,11 +751,11 @@ data class BackgroundSyncConfig ( @kotlinx.serialization.Serializable data class BalanceDetails ( - val `totalOnchainBalanceSats`: kotlin.ULong, - val `spendableOnchainBalanceSats`: kotlin.ULong, - val `totalAnchorChannelsReserveSats`: kotlin.ULong, - val `totalLightningBalanceSats`: kotlin.ULong, - val `lightningBalances`: List, + val `totalOnchainBalanceSats`: kotlin.ULong, + val `spendableOnchainBalanceSats`: kotlin.ULong, + val `totalAnchorChannelsReserveSats`: kotlin.ULong, + val `totalLightningBalanceSats`: kotlin.ULong, + val `lightningBalances`: List, val `pendingBalancesFromChannelClosures`: List ) { companion object @@ -739,7 +765,7 @@ data class BalanceDetails ( @kotlinx.serialization.Serializable data class BestBlock ( - val `blockHash`: BlockHash, + val `blockHash`: BlockHash, val `height`: kotlin.UInt ) { companion object @@ -749,11 +775,11 @@ data class BestBlock ( @kotlinx.serialization.Serializable data class ChannelConfig ( - val `forwardingFeeProportionalMillionths`: kotlin.UInt, - val `forwardingFeeBaseMsat`: kotlin.UInt, - val `cltvExpiryDelta`: kotlin.UShort, - val `maxDustHtlcExposure`: MaxDustHtlcExposure, - val `forceCloseAvoidanceMaxFeeSatoshis`: kotlin.ULong, + val `forwardingFeeProportionalMillionths`: kotlin.UInt, + val `forwardingFeeBaseMsat`: kotlin.UInt, + val `cltvExpiryDelta`: kotlin.UShort, + val `maxDustHtlcExposure`: MaxDustHtlcExposure, + val `forceCloseAvoidanceMaxFeeSatoshis`: kotlin.ULong, val `acceptUnderpayingHtlcs`: kotlin.Boolean ) { companion object @@ -763,7 +789,7 @@ data class ChannelConfig ( @kotlinx.serialization.Serializable data class ChannelDataMigration ( - val `channelManager`: List?, + val `channelManager`: List?, val `channelMonitors`: List> ) { companion object @@ -773,37 +799,37 @@ data class ChannelDataMigration ( @kotlinx.serialization.Serializable data class ChannelDetails ( - val `channelId`: ChannelId, - val `counterpartyNodeId`: PublicKey, - val `fundingTxo`: OutPoint?, - val `shortChannelId`: kotlin.ULong?, - val `outboundScidAlias`: kotlin.ULong?, - val `inboundScidAlias`: kotlin.ULong?, - val `channelValueSats`: kotlin.ULong, - val `unspendablePunishmentReserve`: kotlin.ULong?, - val `userChannelId`: UserChannelId, - val `feerateSatPer1000Weight`: kotlin.UInt, - val `outboundCapacityMsat`: kotlin.ULong, - val `inboundCapacityMsat`: kotlin.ULong, - val `confirmationsRequired`: kotlin.UInt?, - val `confirmations`: kotlin.UInt?, - val `isOutbound`: kotlin.Boolean, - val `isChannelReady`: kotlin.Boolean, - val `isUsable`: kotlin.Boolean, - val `isAnnounced`: kotlin.Boolean, - val `cltvExpiryDelta`: kotlin.UShort?, - val `counterpartyUnspendablePunishmentReserve`: kotlin.ULong, - val `counterpartyOutboundHtlcMinimumMsat`: kotlin.ULong?, - val `counterpartyOutboundHtlcMaximumMsat`: kotlin.ULong?, - val `counterpartyForwardingInfoFeeBaseMsat`: kotlin.UInt?, - val `counterpartyForwardingInfoFeeProportionalMillionths`: kotlin.UInt?, - val `counterpartyForwardingInfoCltvExpiryDelta`: kotlin.UShort?, - val `nextOutboundHtlcLimitMsat`: kotlin.ULong, - val `nextOutboundHtlcMinimumMsat`: kotlin.ULong, - val `forceCloseSpendDelay`: kotlin.UShort?, - val `inboundHtlcMinimumMsat`: kotlin.ULong, - val `inboundHtlcMaximumMsat`: kotlin.ULong?, - val `config`: ChannelConfig, + val `channelId`: ChannelId, + val `counterpartyNodeId`: PublicKey, + val `fundingTxo`: OutPoint?, + val `shortChannelId`: kotlin.ULong?, + val `outboundScidAlias`: kotlin.ULong?, + val `inboundScidAlias`: kotlin.ULong?, + val `channelValueSats`: kotlin.ULong, + val `unspendablePunishmentReserve`: kotlin.ULong?, + val `userChannelId`: UserChannelId, + val `feerateSatPer1000Weight`: kotlin.UInt, + val `outboundCapacityMsat`: kotlin.ULong, + val `inboundCapacityMsat`: kotlin.ULong, + val `confirmationsRequired`: kotlin.UInt?, + val `confirmations`: kotlin.UInt?, + val `isOutbound`: kotlin.Boolean, + val `isChannelReady`: kotlin.Boolean, + val `isUsable`: kotlin.Boolean, + val `isAnnounced`: kotlin.Boolean, + val `cltvExpiryDelta`: kotlin.UShort?, + val `counterpartyUnspendablePunishmentReserve`: kotlin.ULong, + val `counterpartyOutboundHtlcMinimumMsat`: kotlin.ULong?, + val `counterpartyOutboundHtlcMaximumMsat`: kotlin.ULong?, + val `counterpartyForwardingInfoFeeBaseMsat`: kotlin.UInt?, + val `counterpartyForwardingInfoFeeProportionalMillionths`: kotlin.UInt?, + val `counterpartyForwardingInfoCltvExpiryDelta`: kotlin.UShort?, + val `nextOutboundHtlcLimitMsat`: kotlin.ULong, + val `nextOutboundHtlcMinimumMsat`: kotlin.ULong, + val `forceCloseSpendDelay`: kotlin.UShort?, + val `inboundHtlcMinimumMsat`: kotlin.ULong, + val `inboundHtlcMaximumMsat`: kotlin.ULong?, + val `config`: ChannelConfig, val `claimableOnCloseSats`: kotlin.ULong? ) { companion object @@ -813,10 +839,10 @@ data class ChannelDetails ( @kotlinx.serialization.Serializable data class ChannelInfo ( - val `nodeOne`: NodeId, - val `oneToTwo`: ChannelUpdateInfo?, - val `nodeTwo`: NodeId, - val `twoToOne`: ChannelUpdateInfo?, + val `nodeOne`: NodeId, + val `oneToTwo`: ChannelUpdateInfo?, + val `nodeTwo`: NodeId, + val `twoToOne`: ChannelUpdateInfo?, val `capacitySats`: kotlin.ULong? ) { companion object @@ -826,11 +852,11 @@ data class ChannelInfo ( @kotlinx.serialization.Serializable data class ChannelUpdateInfo ( - val `lastUpdate`: kotlin.UInt, - val `enabled`: kotlin.Boolean, - val `cltvExpiryDelta`: kotlin.UShort, - val `htlcMinimumMsat`: kotlin.ULong, - val `htlcMaximumMsat`: kotlin.ULong, + val `lastUpdate`: kotlin.UInt, + val `enabled`: kotlin.Boolean, + val `cltvExpiryDelta`: kotlin.UShort, + val `htlcMinimumMsat`: kotlin.ULong, + val `htlcMaximumMsat`: kotlin.ULong, val `fees`: RoutingFees ) { companion object @@ -840,17 +866,17 @@ data class ChannelUpdateInfo ( @kotlinx.serialization.Serializable data class Config ( - val `storageDirPath`: kotlin.String, - val `network`: Network, - val `listeningAddresses`: List?, - val `announcementAddresses`: List?, - val `nodeAlias`: NodeAlias?, - val `trustedPeers0conf`: List, - val `probingLiquidityLimitMultiplier`: kotlin.ULong, - val `anchorChannelsConfig`: AnchorChannelsConfig?, - val `routeParameters`: RouteParametersConfig?, - val `includeUntrustedPendingInSpendable`: kotlin.Boolean, - val `addressType`: AddressType, + val `storageDirPath`: kotlin.String, + val `network`: Network, + val `listeningAddresses`: List?, + val `announcementAddresses`: List?, + val `nodeAlias`: NodeAlias?, + val `trustedPeers0conf`: List, + val `probingLiquidityLimitMultiplier`: kotlin.ULong, + val `anchorChannelsConfig`: AnchorChannelsConfig?, + val `routeParameters`: RouteParametersConfig?, + val `includeUntrustedPendingInSpendable`: kotlin.Boolean, + val `addressType`: AddressType, val `addressTypesToMonitor`: List ) { companion object @@ -860,7 +886,7 @@ data class Config ( @kotlinx.serialization.Serializable data class CustomTlvRecord ( - val `typeNum`: kotlin.ULong, + val `typeNum`: kotlin.ULong, val `value`: List ) { companion object @@ -870,7 +896,7 @@ data class CustomTlvRecord ( @kotlinx.serialization.Serializable data class ElectrumSyncConfig ( - val `backgroundSyncConfig`: BackgroundSyncConfig?, + val `backgroundSyncConfig`: BackgroundSyncConfig?, val `connectionTimeoutSecs`: kotlin.ULong ) { companion object @@ -889,7 +915,7 @@ data class EsploraSyncConfig ( @kotlinx.serialization.Serializable data class LspFeeLimits ( - val `maxTotalOpeningFeeMsat`: kotlin.ULong?, + val `maxTotalOpeningFeeMsat`: kotlin.ULong?, val `maxProportionalOpeningFeePpmMsat`: kotlin.ULong? ) { companion object @@ -899,10 +925,10 @@ data class LspFeeLimits ( data class Lsps1Bolt11PaymentInfo ( - val `state`: Lsps1PaymentState, - val `expiresAt`: LspsDateTime, - val `feeTotalSat`: kotlin.ULong, - val `orderTotalSat`: kotlin.ULong, + val `state`: Lsps1PaymentState, + val `expiresAt`: LspsDateTime, + val `feeTotalSat`: kotlin.ULong, + val `orderTotalSat`: kotlin.ULong, val `invoice`: Bolt11Invoice ) : Disposable { override fun destroy() { @@ -921,8 +947,8 @@ data class Lsps1Bolt11PaymentInfo ( @kotlinx.serialization.Serializable data class Lsps1ChannelInfo ( - val `fundedAt`: LspsDateTime, - val `fundingOutpoint`: OutPoint, + val `fundedAt`: LspsDateTime, + val `fundingOutpoint`: OutPoint, val `expiresAt`: LspsDateTime ) { companion object @@ -932,13 +958,13 @@ data class Lsps1ChannelInfo ( data class Lsps1OnchainPaymentInfo ( - val `state`: Lsps1PaymentState, - val `expiresAt`: LspsDateTime, - val `feeTotalSat`: kotlin.ULong, - val `orderTotalSat`: kotlin.ULong, - val `address`: Address, - val `minOnchainPaymentConfirmations`: kotlin.UShort?, - val `minFeeFor0conf`: FeeRate, + val `state`: Lsps1PaymentState, + val `expiresAt`: LspsDateTime, + val `feeTotalSat`: kotlin.ULong, + val `orderTotalSat`: kotlin.ULong, + val `address`: Address, + val `minOnchainPaymentConfirmations`: kotlin.UShort?, + val `minFeeFor0conf`: FeeRate, val `refundOnchainAddress`: Address? ) : Disposable { override fun destroy() { @@ -960,12 +986,12 @@ data class Lsps1OnchainPaymentInfo ( @kotlinx.serialization.Serializable data class Lsps1OrderParams ( - val `lspBalanceSat`: kotlin.ULong, - val `clientBalanceSat`: kotlin.ULong, - val `requiredChannelConfirmations`: kotlin.UShort, - val `fundingConfirmsWithinBlocks`: kotlin.UShort, - val `channelExpiryBlocks`: kotlin.UInt, - val `token`: kotlin.String?, + val `lspBalanceSat`: kotlin.ULong, + val `clientBalanceSat`: kotlin.ULong, + val `requiredChannelConfirmations`: kotlin.UShort, + val `fundingConfirmsWithinBlocks`: kotlin.UShort, + val `channelExpiryBlocks`: kotlin.UInt, + val `token`: kotlin.String?, val `announceChannel`: kotlin.Boolean ) { companion object @@ -975,9 +1001,9 @@ data class Lsps1OrderParams ( data class Lsps1OrderStatus ( - val `orderId`: Lsps1OrderId, - val `orderParams`: Lsps1OrderParams, - val `paymentOptions`: Lsps1PaymentInfo, + val `orderId`: Lsps1OrderId, + val `orderParams`: Lsps1OrderParams, + val `paymentOptions`: Lsps1PaymentInfo, val `channelState`: Lsps1ChannelInfo? ) : Disposable { override fun destroy() { @@ -995,7 +1021,7 @@ data class Lsps1OrderStatus ( data class Lsps1PaymentInfo ( - val `bolt11`: Lsps1Bolt11PaymentInfo?, + val `bolt11`: Lsps1Bolt11PaymentInfo?, val `onchain`: Lsps1OnchainPaymentInfo? ) : Disposable { override fun destroy() { @@ -1011,15 +1037,15 @@ data class Lsps1PaymentInfo ( @kotlinx.serialization.Serializable data class Lsps2ServiceConfig ( - val `requireToken`: kotlin.String?, - val `advertiseService`: kotlin.Boolean, - val `channelOpeningFeePpm`: kotlin.UInt, - val `channelOverProvisioningPpm`: kotlin.UInt, - val `minChannelOpeningFeeMsat`: kotlin.ULong, - val `minChannelLifetime`: kotlin.UInt, - val `maxClientToSelfDelay`: kotlin.UInt, - val `minPaymentSizeMsat`: kotlin.ULong, - val `maxPaymentSizeMsat`: kotlin.ULong, + val `requireToken`: kotlin.String?, + val `advertiseService`: kotlin.Boolean, + val `channelOpeningFeePpm`: kotlin.UInt, + val `channelOverProvisioningPpm`: kotlin.UInt, + val `minChannelOpeningFeeMsat`: kotlin.ULong, + val `minChannelLifetime`: kotlin.UInt, + val `maxClientToSelfDelay`: kotlin.UInt, + val `minPaymentSizeMsat`: kotlin.ULong, + val `maxPaymentSizeMsat`: kotlin.ULong, val `clientTrustsLsp`: kotlin.Boolean ) { companion object @@ -1029,9 +1055,9 @@ data class Lsps2ServiceConfig ( @kotlinx.serialization.Serializable data class LogRecord ( - val `level`: LogLevel, - val `args`: kotlin.String, - val `modulePath`: kotlin.String, + val `level`: LogLevel, + val `args`: kotlin.String, + val `modulePath`: kotlin.String, val `line`: kotlin.UInt ) { companion object @@ -1041,8 +1067,8 @@ data class LogRecord ( @kotlinx.serialization.Serializable data class NodeAnnouncementInfo ( - val `lastUpdate`: kotlin.UInt, - val `alias`: kotlin.String, + val `lastUpdate`: kotlin.UInt, + val `alias`: kotlin.String, val `addresses`: List ) { companion object @@ -1052,7 +1078,7 @@ data class NodeAnnouncementInfo ( @kotlinx.serialization.Serializable data class NodeInfo ( - val `channels`: List, + val `channels`: List, val `announcementInfo`: NodeAnnouncementInfo? ) { companion object @@ -1062,14 +1088,14 @@ data class NodeInfo ( @kotlinx.serialization.Serializable data class NodeStatus ( - val `isRunning`: kotlin.Boolean, - val `currentBestBlock`: BestBlock, - val `latestLightningWalletSyncTimestamp`: kotlin.ULong?, - val `latestOnchainWalletSyncTimestamp`: kotlin.ULong?, - val `latestFeeRateCacheUpdateTimestamp`: kotlin.ULong?, - val `latestRgsSnapshotTimestamp`: kotlin.ULong?, - val `latestPathfindingScoresSyncTimestamp`: kotlin.ULong?, - val `latestNodeAnnouncementBroadcastTimestamp`: kotlin.ULong?, + val `isRunning`: kotlin.Boolean, + val `currentBestBlock`: BestBlock, + val `latestLightningWalletSyncTimestamp`: kotlin.ULong?, + val `latestOnchainWalletSyncTimestamp`: kotlin.ULong?, + val `latestFeeRateCacheUpdateTimestamp`: kotlin.ULong?, + val `latestRgsSnapshotTimestamp`: kotlin.ULong?, + val `latestPathfindingScoresSyncTimestamp`: kotlin.ULong?, + val `latestNodeAnnouncementBroadcastTimestamp`: kotlin.ULong?, val `latestChannelMonitorArchivalHeight`: kotlin.UInt? ) { companion object @@ -1079,7 +1105,7 @@ data class NodeStatus ( @kotlinx.serialization.Serializable data class OutPoint ( - val `txid`: Txid, + val `txid`: Txid, val `vout`: kotlin.UInt ) { companion object @@ -1089,12 +1115,12 @@ data class OutPoint ( @kotlinx.serialization.Serializable data class PaymentDetails ( - val `id`: PaymentId, - val `kind`: PaymentKind, - val `amountMsat`: kotlin.ULong?, - val `feePaidMsat`: kotlin.ULong?, - val `direction`: PaymentDirection, - val `status`: PaymentStatus, + val `id`: PaymentId, + val `kind`: PaymentKind, + val `amountMsat`: kotlin.ULong?, + val `feePaidMsat`: kotlin.ULong?, + val `direction`: PaymentDirection, + val `status`: PaymentStatus, val `latestUpdateTimestamp`: kotlin.ULong ) { companion object @@ -1104,9 +1130,9 @@ data class PaymentDetails ( @kotlinx.serialization.Serializable data class PeerDetails ( - val `nodeId`: PublicKey, - val `address`: SocketAddress, - val `isPersisted`: kotlin.Boolean, + val `nodeId`: PublicKey, + val `address`: SocketAddress, + val `isPersisted`: kotlin.Boolean, val `isConnected`: kotlin.Boolean ) { companion object @@ -1116,7 +1142,7 @@ data class PeerDetails ( @kotlinx.serialization.Serializable data class ProbeHandle ( - val `paymentHash`: PaymentHash, + val `paymentHash`: PaymentHash, val `paymentId`: PaymentId ) { companion object @@ -1126,11 +1152,11 @@ data class ProbeHandle ( @kotlinx.serialization.Serializable data class RouteHintHop ( - val `srcNodeId`: PublicKey, - val `shortChannelId`: kotlin.ULong, - val `cltvExpiryDelta`: kotlin.UShort, - val `htlcMinimumMsat`: kotlin.ULong?, - val `htlcMaximumMsat`: kotlin.ULong?, + val `srcNodeId`: PublicKey, + val `shortChannelId`: kotlin.ULong, + val `cltvExpiryDelta`: kotlin.UShort, + val `htlcMinimumMsat`: kotlin.ULong?, + val `htlcMaximumMsat`: kotlin.ULong?, val `fees`: RoutingFees ) { companion object @@ -1140,9 +1166,9 @@ data class RouteHintHop ( @kotlinx.serialization.Serializable data class RouteParametersConfig ( - val `maxTotalRoutingFeeMsat`: kotlin.ULong?, - val `maxTotalCltvExpiryDelta`: kotlin.UInt, - val `maxPathCount`: kotlin.UByte, + val `maxTotalRoutingFeeMsat`: kotlin.ULong?, + val `maxTotalCltvExpiryDelta`: kotlin.UInt, + val `maxPathCount`: kotlin.UByte, val `maxChannelSaturationPowerOfHalf`: kotlin.UByte ) { companion object @@ -1152,7 +1178,7 @@ data class RouteParametersConfig ( @kotlinx.serialization.Serializable data class RoutingFees ( - val `baseMsat`: kotlin.UInt, + val `baseMsat`: kotlin.UInt, val `proportionalMillionths`: kotlin.UInt ) { companion object @@ -1162,8 +1188,8 @@ data class RoutingFees ( @kotlinx.serialization.Serializable data class RuntimeSyncIntervals ( - val `onchainWalletSyncIntervalSecs`: kotlin.ULong, - val `lightningWalletSyncIntervalSecs`: kotlin.ULong, + val `onchainWalletSyncIntervalSecs`: kotlin.ULong, + val `lightningWalletSyncIntervalSecs`: kotlin.ULong, val `feeRateCacheUpdateIntervalSecs`: kotlin.ULong ) { companion object @@ -1173,7 +1199,7 @@ data class RuntimeSyncIntervals ( @kotlinx.serialization.Serializable data class SpendableUtxo ( - val `outpoint`: OutPoint, + val `outpoint`: OutPoint, val `valueSats`: kotlin.ULong ) { companion object @@ -1183,8 +1209,8 @@ data class SpendableUtxo ( @kotlinx.serialization.Serializable data class TransactionDetails ( - val `amountSats`: kotlin.Long, - val `inputs`: List, + val `amountSats`: kotlin.Long, + val `inputs`: List, val `outputs`: List ) { companion object @@ -1194,10 +1220,10 @@ data class TransactionDetails ( @kotlinx.serialization.Serializable data class TxInput ( - val `txid`: Txid, - val `vout`: kotlin.UInt, - val `scriptsig`: kotlin.String, - val `witness`: List, + val `txid`: Txid, + val `vout`: kotlin.UInt, + val `scriptsig`: kotlin.String, + val `witness`: List, val `sequence`: kotlin.UInt ) { companion object @@ -1207,10 +1233,10 @@ data class TxInput ( @kotlinx.serialization.Serializable data class TxOutput ( - val `scriptpubkey`: kotlin.String, - val `scriptpubkeyType`: kotlin.String?, - val `scriptpubkeyAddress`: kotlin.String?, - val `value`: kotlin.Long, + val `scriptpubkey`: kotlin.String, + val `scriptpubkeyType`: kotlin.String?, + val `scriptpubkeyAddress`: kotlin.String?, + val `value`: kotlin.Long, val `n`: kotlin.UInt ) { companion object @@ -1222,7 +1248,7 @@ data class TxOutput ( @kotlinx.serialization.Serializable enum class AddressType { - + LEGACY, NESTED_SEGWIT, NATIVE_SEGWIT, @@ -1238,7 +1264,7 @@ enum class AddressType { @kotlinx.serialization.Serializable enum class AsyncPaymentsRole { - + CLIENT, SERVER; companion object @@ -1252,7 +1278,7 @@ enum class AsyncPaymentsRole { @kotlinx.serialization.Serializable enum class BalanceSource { - + HOLDER_FORCE_CLOSED, COUNTERPARTY_FORCE_CLOSED, COOP_CLOSE, @@ -1277,7 +1303,7 @@ sealed class Bolt11InvoiceDescription { val `description`: kotlin.String, ) : Bolt11InvoiceDescription() { } - + } @@ -1287,41 +1313,41 @@ sealed class Bolt11InvoiceDescription { sealed class BuildException(message: String): kotlin.Exception(message) { - + class InvalidSeedBytes(message: String) : BuildException(message) - + class InvalidSeedFile(message: String) : BuildException(message) - + class InvalidSystemTime(message: String) : BuildException(message) - + class InvalidChannelMonitor(message: String) : BuildException(message) - + class InvalidListeningAddresses(message: String) : BuildException(message) - + class InvalidAnnouncementAddresses(message: String) : BuildException(message) - + class InvalidNodeAlias(message: String) : BuildException(message) - + class RuntimeSetupFailed(message: String) : BuildException(message) - + class ReadFailed(message: String) : BuildException(message) - + class DangerousValue(message: String) : BuildException(message) - + class WriteFailed(message: String) : BuildException(message) - + class StoragePathAccessFailed(message: String) : BuildException(message) - + class KvStoreSetupFailed(message: String) : BuildException(message) - + class WalletSetupFailed(message: String) : BuildException(message) - + class LoggerSetupFailed(message: String) : BuildException(message) - + class NetworkMismatch(message: String) : BuildException(message) - + class AsyncPaymentsConfigMismatch(message: String) : BuildException(message) - + } @@ -1340,51 +1366,51 @@ sealed class ClosureReason { val `message`: kotlin.String, ) : ClosureReason() { } - + @kotlinx.serialization.Serializable - data object LegacyCooperativeClosure : ClosureReason() - - + data object LegacyCooperativeClosure : ClosureReason() + + @kotlinx.serialization.Serializable - data object CounterpartyInitiatedCooperativeClosure : ClosureReason() - - + data object CounterpartyInitiatedCooperativeClosure : ClosureReason() + + @kotlinx.serialization.Serializable - data object LocallyInitiatedCooperativeClosure : ClosureReason() - - + data object LocallyInitiatedCooperativeClosure : ClosureReason() + + @kotlinx.serialization.Serializable - data object CommitmentTxConfirmed : ClosureReason() - - + data object CommitmentTxConfirmed : ClosureReason() + + @kotlinx.serialization.Serializable - data object FundingTimedOut : ClosureReason() - + data object FundingTimedOut : ClosureReason() + @kotlinx.serialization.Serializable data class ProcessingError( val `err`: kotlin.String, ) : ClosureReason() { } - + @kotlinx.serialization.Serializable - data object DisconnectedPeer : ClosureReason() - - + data object DisconnectedPeer : ClosureReason() + + @kotlinx.serialization.Serializable - data object OutdatedChannelManager : ClosureReason() - - + data object OutdatedChannelManager : ClosureReason() + + @kotlinx.serialization.Serializable - data object CounterpartyCoopClosedUnfundedChannel : ClosureReason() - - + data object CounterpartyCoopClosedUnfundedChannel : ClosureReason() + + @kotlinx.serialization.Serializable - data object LocallyCoopClosedUnfundedChannel : ClosureReason() - - + data object LocallyCoopClosedUnfundedChannel : ClosureReason() + + @kotlinx.serialization.Serializable - data object FundingBatchClosure : ClosureReason() - + data object FundingBatchClosure : ClosureReason() + @kotlinx.serialization.Serializable data class HtlCsTimedOut( val `paymentHash`: PaymentHash?, @@ -1396,7 +1422,7 @@ sealed class ClosureReason { val `requiredFeerateSatPerKw`: kotlin.UInt, ) : ClosureReason() { } - + } @@ -1407,7 +1433,7 @@ sealed class ClosureReason { @kotlinx.serialization.Serializable enum class CoinSelectionAlgorithm { - + BRANCH_AND_BOUND, LARGEST_FIRST, OLDEST_FIRST, @@ -1429,11 +1455,11 @@ sealed class ConfirmationStatus { val `timestamp`: kotlin.ULong, ) : ConfirmationStatus() { } - + @kotlinx.serialization.Serializable - data object Unconfirmed : ConfirmationStatus() - - + data object Unconfirmed : ConfirmationStatus() + + } @@ -1444,7 +1470,7 @@ sealed class ConfirmationStatus { @kotlinx.serialization.Serializable enum class Currency { - + BITCOIN, BITCOIN_TESTNET, REGTEST, @@ -1615,7 +1641,21 @@ sealed class Event { val `newTotalLightningBalanceSats`: kotlin.ULong, ) : Event() { } - + +} + + + + + + + +@kotlinx.serialization.Serializable +enum class KeychainKind { + + EXTERNAL, + INTERNAL; + companion object } @@ -1626,7 +1666,7 @@ sealed class Event { @kotlinx.serialization.Serializable enum class Lsps1PaymentState { - + EXPECT_PAYMENT, PAID, REFUNDED; @@ -1697,7 +1737,7 @@ sealed class LightningBalance { val `amountSatoshis`: kotlin.ULong, ) : LightningBalance() { } - + } @@ -1708,7 +1748,7 @@ sealed class LightningBalance { @kotlinx.serialization.Serializable enum class LogLevel { - + GOSSIP, TRACE, DEBUG, @@ -1735,7 +1775,7 @@ sealed class MaxDustHtlcExposure { val `multiplier`: kotlin.ULong, ) : MaxDustHtlcExposure() { } - + } @@ -1746,7 +1786,7 @@ sealed class MaxDustHtlcExposure { @kotlinx.serialization.Serializable enum class Network { - + BITCOIN, TESTNET, SIGNET, @@ -1761,141 +1801,141 @@ enum class Network { sealed class NodeException(message: String): kotlin.Exception(message) { - + class AlreadyRunning(message: String) : NodeException(message) - + class NotRunning(message: String) : NodeException(message) - + class OnchainTxCreationFailed(message: String) : NodeException(message) - + class ConnectionFailed(message: String) : NodeException(message) - + class InvoiceCreationFailed(message: String) : NodeException(message) - + class InvoiceRequestCreationFailed(message: String) : NodeException(message) - + class OfferCreationFailed(message: String) : NodeException(message) - + class RefundCreationFailed(message: String) : NodeException(message) - + class PaymentSendingFailed(message: String) : NodeException(message) - + class InvalidCustomTlvs(message: String) : NodeException(message) - + class ProbeSendingFailed(message: String) : NodeException(message) - + class RouteNotFound(message: String) : NodeException(message) - + class ChannelCreationFailed(message: String) : NodeException(message) - + class ChannelClosingFailed(message: String) : NodeException(message) - + class ChannelSplicingFailed(message: String) : NodeException(message) - + class ChannelConfigUpdateFailed(message: String) : NodeException(message) - + class PersistenceFailed(message: String) : NodeException(message) - + class FeerateEstimationUpdateFailed(message: String) : NodeException(message) - + class FeerateEstimationUpdateTimeout(message: String) : NodeException(message) - + class WalletOperationFailed(message: String) : NodeException(message) - + class WalletOperationTimeout(message: String) : NodeException(message) - + class OnchainTxSigningFailed(message: String) : NodeException(message) - + class TxSyncFailed(message: String) : NodeException(message) - + class TxSyncTimeout(message: String) : NodeException(message) - + class GossipUpdateFailed(message: String) : NodeException(message) - + class GossipUpdateTimeout(message: String) : NodeException(message) - + class LiquidityRequestFailed(message: String) : NodeException(message) - + class UriParameterParsingFailed(message: String) : NodeException(message) - + class InvalidAddress(message: String) : NodeException(message) - + class InvalidSocketAddress(message: String) : NodeException(message) - + class InvalidPublicKey(message: String) : NodeException(message) - + class InvalidSecretKey(message: String) : NodeException(message) - + class InvalidOfferId(message: String) : NodeException(message) - + class InvalidNodeId(message: String) : NodeException(message) - + class InvalidPaymentId(message: String) : NodeException(message) - + class InvalidPaymentHash(message: String) : NodeException(message) - + class InvalidPaymentPreimage(message: String) : NodeException(message) - + class InvalidPaymentSecret(message: String) : NodeException(message) - + class InvalidAmount(message: String) : NodeException(message) - + class InvalidInvoice(message: String) : NodeException(message) - + class InvalidOffer(message: String) : NodeException(message) - + class InvalidRefund(message: String) : NodeException(message) - + class InvalidChannelId(message: String) : NodeException(message) - + class InvalidNetwork(message: String) : NodeException(message) - + class InvalidUri(message: String) : NodeException(message) - + class InvalidQuantity(message: String) : NodeException(message) - + class InvalidNodeAlias(message: String) : NodeException(message) - + class InvalidDateTime(message: String) : NodeException(message) - + class InvalidFeeRate(message: String) : NodeException(message) - + class DuplicatePayment(message: String) : NodeException(message) - + class UnsupportedCurrency(message: String) : NodeException(message) - + class InsufficientFunds(message: String) : NodeException(message) - + class LiquiditySourceUnavailable(message: String) : NodeException(message) - + class LiquidityFeeTooHigh(message: String) : NodeException(message) - + class InvalidBlindedPaths(message: String) : NodeException(message) - + class AsyncPaymentServicesDisabled(message: String) : NodeException(message) - + class CannotRbfFundingTransaction(message: String) : NodeException(message) - + class TransactionNotFound(message: String) : NodeException(message) - + class TransactionAlreadyConfirmed(message: String) : NodeException(message) - + class NoSpendableOutputs(message: String) : NodeException(message) - + class CoinSelectionFailed(message: String) : NodeException(message) - + class InvalidMnemonic(message: String) : NodeException(message) - + class BackgroundSyncNotEnabled(message: String) : NodeException(message) - + class AddressTypeAlreadyMonitored(message: String) : NodeException(message) - + class AddressTypeIsPrimary(message: String) : NodeException(message) - + class AddressTypeNotMonitored(message: String) : NodeException(message) - + class InvalidSeedBytes(message: String) : NodeException(message) - + } @@ -1914,7 +1954,7 @@ sealed class OfferAmount { val `amount`: kotlin.ULong, ) : OfferAmount() { } - + } @@ -1925,7 +1965,7 @@ sealed class OfferAmount { @kotlinx.serialization.Serializable enum class PaymentDirection { - + INBOUND, OUTBOUND; companion object @@ -1939,7 +1979,7 @@ enum class PaymentDirection { @kotlinx.serialization.Serializable enum class PaymentFailureReason { - + RECIPIENT_REJECTED, USER_ABANDONED, RETRIES_EXHAUSTED, @@ -2011,7 +2051,7 @@ sealed class PaymentKind { val `preimage`: PaymentPreimage?, ) : PaymentKind() { } - + } @@ -2022,7 +2062,7 @@ sealed class PaymentKind { @kotlinx.serialization.Serializable enum class PaymentStatus { - + PENDING, SUCCEEDED, FAILED; @@ -2059,7 +2099,7 @@ sealed class PendingSweepBalance { val `amountSatoshis`: kotlin.ULong, ) : PendingSweepBalance() { } - + } @@ -2084,7 +2124,7 @@ sealed class QrPaymentResult { val `paymentId`: PaymentId, ) : QrPaymentResult() { } - + } @@ -2095,7 +2135,7 @@ sealed class QrPaymentResult { @kotlinx.serialization.Serializable enum class SyncType { - + ONCHAIN_WALLET, LIGHTNING_WALLET, FEE_RATE_CACHE; @@ -2109,15 +2149,15 @@ enum class SyncType { sealed class VssHeaderProviderException(message: String): kotlin.Exception(message) { - + class InvalidData(message: String) : VssHeaderProviderException(message) - + class RequestException(message: String) : VssHeaderProviderException(message) - + class AuthorizationException(message: String) : VssHeaderProviderException(message) - + class InternalException(message: String) : VssHeaderProviderException(message) - + } @@ -2126,7 +2166,7 @@ sealed class VssHeaderProviderException(message: String): kotlin.Exception(messa @kotlinx.serialization.Serializable enum class WordCount { - + WORDS12, WORDS15, WORDS18, @@ -2272,6 +2312,8 @@ enum class WordCount { + + diff --git a/bindings/kotlin/ldk-node-jvm/lib/src/main/kotlin/org/lightningdevkit/ldknode/ldk_node.jvm.kt b/bindings/kotlin/ldk-node-jvm/lib/src/main/kotlin/org/lightningdevkit/ldknode/ldk_node.jvm.kt index f1cc546356..2802ce1ebb 100644 --- a/bindings/kotlin/ldk-node-jvm/lib/src/main/kotlin/org/lightningdevkit/ldknode/ldk_node.jvm.kt +++ b/bindings/kotlin/ldk-node-jvm/lib/src/main/kotlin/org/lightningdevkit/ldknode/ldk_node.jvm.kt @@ -1509,6 +1509,16 @@ internal typealias UniffiVTableCallbackInterfaceVssHeaderProviderUniffiByValue = + + + + + + + + + + @@ -2549,6 +2559,21 @@ internal interface UniffiLib : Library { `destinationAddress`: RustBufferByValue, uniffiCallStatus: UniffiRustCallStatus, ): RustBufferByValue + fun uniffi_ldk_node_fn_method_onchainpayment_address_info_for_type_at_index( + `ptr`: Pointer?, + `addressType`: RustBufferByValue, + `keychain`: RustBufferByValue, + `index`: Int, + uniffiCallStatus: UniffiRustCallStatus, + ): RustBufferByValue + fun uniffi_ldk_node_fn_method_onchainpayment_address_infos_for_type( + `ptr`: Pointer?, + `addressType`: RustBufferByValue, + `keychain`: RustBufferByValue, + `startIndex`: Int, + `count`: Int, + uniffiCallStatus: UniffiRustCallStatus, + ): RustBufferByValue fun uniffi_ldk_node_fn_method_onchainpayment_bump_fee_by_rbf( `ptr`: Pointer?, `txid`: RustBufferByValue, @@ -2589,6 +2614,21 @@ internal interface UniffiLib : Library { `addressType`: RustBufferByValue, uniffiCallStatus: UniffiRustCallStatus, ): RustBufferByValue + fun uniffi_ldk_node_fn_method_onchainpayment_new_address_info( + `ptr`: Pointer?, + uniffiCallStatus: UniffiRustCallStatus, + ): RustBufferByValue + fun uniffi_ldk_node_fn_method_onchainpayment_new_address_info_for_type( + `ptr`: Pointer?, + `addressType`: RustBufferByValue, + uniffiCallStatus: UniffiRustCallStatus, + ): RustBufferByValue + fun uniffi_ldk_node_fn_method_onchainpayment_reveal_receive_addresses_to( + `ptr`: Pointer?, + `addressType`: RustBufferByValue, + `index`: Int, + uniffiCallStatus: UniffiRustCallStatus, + ): Unit fun uniffi_ldk_node_fn_method_onchainpayment_select_utxos_with_algorithm( `ptr`: Pointer?, `targetAmountSats`: Long, @@ -3322,6 +3362,10 @@ internal interface UniffiLib : Library { ): Short fun uniffi_ldk_node_checksum_method_onchainpayment_accelerate_by_cpfp( ): Short + fun uniffi_ldk_node_checksum_method_onchainpayment_address_info_for_type_at_index( + ): Short + fun uniffi_ldk_node_checksum_method_onchainpayment_address_infos_for_type( + ): Short fun uniffi_ldk_node_checksum_method_onchainpayment_bump_fee_by_rbf( ): Short fun uniffi_ldk_node_checksum_method_onchainpayment_calculate_cpfp_fee_rate( @@ -3336,6 +3380,12 @@ internal interface UniffiLib : Library { ): Short fun uniffi_ldk_node_checksum_method_onchainpayment_new_address_for_type( ): Short + fun uniffi_ldk_node_checksum_method_onchainpayment_new_address_info( + ): Short + fun uniffi_ldk_node_checksum_method_onchainpayment_new_address_info_for_type( + ): Short + fun uniffi_ldk_node_checksum_method_onchainpayment_reveal_receive_addresses_to( + ): Short fun uniffi_ldk_node_checksum_method_onchainpayment_select_utxos_with_algorithm( ): Short fun uniffi_ldk_node_checksum_method_onchainpayment_send_all_to_address( @@ -3912,6 +3962,12 @@ private fun uniffiCheckApiChecksums(lib: UniffiLib) { if (lib.uniffi_ldk_node_checksum_method_onchainpayment_accelerate_by_cpfp() != 31954.toShort()) { throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") } + if (lib.uniffi_ldk_node_checksum_method_onchainpayment_address_info_for_type_at_index() != 42692.toShort()) { + throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + } + if (lib.uniffi_ldk_node_checksum_method_onchainpayment_address_infos_for_type() != 3701.toShort()) { + throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + } if (lib.uniffi_ldk_node_checksum_method_onchainpayment_bump_fee_by_rbf() != 53877.toShort()) { throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") } @@ -3933,6 +3989,15 @@ private fun uniffiCheckApiChecksums(lib: UniffiLib) { if (lib.uniffi_ldk_node_checksum_method_onchainpayment_new_address_for_type() != 9083.toShort()) { throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") } + if (lib.uniffi_ldk_node_checksum_method_onchainpayment_new_address_info() != 9889.toShort()) { + throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + } + if (lib.uniffi_ldk_node_checksum_method_onchainpayment_new_address_info_for_type() != 62171.toShort()) { + throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + } + if (lib.uniffi_ldk_node_checksum_method_onchainpayment_reveal_receive_addresses_to() != 44189.toShort()) { + throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + } if (lib.uniffi_ldk_node_checksum_method_onchainpayment_select_utxos_with_algorithm() != 14084.toShort()) { throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") } @@ -8049,6 +8114,37 @@ open class OnchainPayment: Disposable, OnchainPaymentInterface { }) } + @Throws(NodeException::class) + override fun `addressInfoForTypeAtIndex`(`addressType`: AddressType, `keychain`: KeychainKind, `index`: kotlin.UInt): AddressInfo { + return FfiConverterTypeAddressInfo.lift(callWithPointer { + uniffiRustCallWithError(NodeExceptionErrorHandler) { uniffiRustCallStatus -> + UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_onchainpayment_address_info_for_type_at_index( + it, + FfiConverterTypeAddressType.lower(`addressType`), + FfiConverterTypeKeychainKind.lower(`keychain`), + FfiConverterUInt.lower(`index`), + uniffiRustCallStatus, + ) + } + }) + } + + @Throws(NodeException::class) + override fun `addressInfosForType`(`addressType`: AddressType, `keychain`: KeychainKind, `startIndex`: kotlin.UInt, `count`: kotlin.UInt): List { + return FfiConverterSequenceTypeAddressInfo.lift(callWithPointer { + uniffiRustCallWithError(NodeExceptionErrorHandler) { uniffiRustCallStatus -> + UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_onchainpayment_address_infos_for_type( + it, + FfiConverterTypeAddressType.lower(`addressType`), + FfiConverterTypeKeychainKind.lower(`keychain`), + FfiConverterUInt.lower(`startIndex`), + FfiConverterUInt.lower(`count`), + uniffiRustCallStatus, + ) + } + }) + } + @Throws(NodeException::class) override fun `bumpFeeByRbf`(`txid`: Txid, `feeRate`: FeeRate): Txid { return FfiConverterTypeTxid.lift(callWithPointer { @@ -8145,6 +8241,45 @@ open class OnchainPayment: Disposable, OnchainPaymentInterface { }) } + @Throws(NodeException::class) + override fun `newAddressInfo`(): AddressInfo { + return FfiConverterTypeAddressInfo.lift(callWithPointer { + uniffiRustCallWithError(NodeExceptionErrorHandler) { uniffiRustCallStatus -> + UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_onchainpayment_new_address_info( + it, + uniffiRustCallStatus, + ) + } + }) + } + + @Throws(NodeException::class) + override fun `newAddressInfoForType`(`addressType`: AddressType): AddressInfo { + return FfiConverterTypeAddressInfo.lift(callWithPointer { + uniffiRustCallWithError(NodeExceptionErrorHandler) { uniffiRustCallStatus -> + UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_onchainpayment_new_address_info_for_type( + it, + FfiConverterTypeAddressType.lower(`addressType`), + uniffiRustCallStatus, + ) + } + }) + } + + @Throws(NodeException::class) + override fun `revealReceiveAddressesTo`(`addressType`: AddressType, `index`: kotlin.UInt) { + callWithPointer { + uniffiRustCallWithError(NodeExceptionErrorHandler) { uniffiRustCallStatus -> + UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_onchainpayment_reveal_receive_addresses_to( + it, + FfiConverterTypeAddressType.lower(`addressType`), + FfiConverterUInt.lower(`index`), + uniffiRustCallStatus, + ) + } + } + } + @Throws(NodeException::class) override fun `selectUtxosWithAlgorithm`(`targetAmountSats`: kotlin.ULong, `feeRate`: FeeRate?, `algorithm`: CoinSelectionAlgorithm, `utxos`: List?): List { return FfiConverterSequenceTypeSpendableUtxo.lift(callWithPointer { @@ -9036,6 +9171,31 @@ object FfiConverterTypeVssHeaderProvider: FfiConverter { + override fun read(buf: ByteBuffer): AddressInfo { + return AddressInfo( + FfiConverterUInt.read(buf), + FfiConverterTypeAddress.read(buf), + FfiConverterTypeKeychainKind.read(buf), + ) + } + + override fun allocationSize(value: AddressInfo) = ( + FfiConverterUInt.allocationSize(value.`index`) + + FfiConverterTypeAddress.allocationSize(value.`address`) + + FfiConverterTypeKeychainKind.allocationSize(value.`keychain`) + ) + + override fun write(value: AddressInfo, buf: ByteBuffer) { + FfiConverterUInt.write(value.`index`, buf) + FfiConverterTypeAddress.write(value.`address`, buf) + FfiConverterTypeKeychainKind.write(value.`keychain`, buf) + } +} + + + + object FfiConverterTypeAddressTypeBalance: FfiConverterRustBuffer { override fun read(buf: ByteBuffer): AddressTypeBalance { return AddressTypeBalance( @@ -11203,6 +11363,24 @@ object FfiConverterTypeEvent : FfiConverterRustBuffer{ +object FfiConverterTypeKeychainKind: FfiConverterRustBuffer { + override fun read(buf: ByteBuffer) = try { + KeychainKind.entries[buf.getInt() - 1] + } catch (e: IndexOutOfBoundsException) { + throw RuntimeException("invalid enum value, something is very wrong!!", e) + } + + override fun allocationSize(value: KeychainKind) = 4UL + + override fun write(value: KeychainKind, buf: ByteBuffer) { + buf.putInt(value.ordinal + 1) + } +} + + + + + object FfiConverterTypeLSPS1PaymentState: FfiConverterRustBuffer { override fun read(buf: ByteBuffer) = try { Lsps1PaymentState.entries[buf.getInt() - 1] @@ -13721,6 +13899,31 @@ object FfiConverterSequenceString: FfiConverterRustBuffer> { +object FfiConverterSequenceTypeAddressInfo: FfiConverterRustBuffer> { + override fun read(buf: ByteBuffer): List { + val len = buf.getInt() + return List(len) { + FfiConverterTypeAddressInfo.read(buf) + } + } + + override fun allocationSize(value: List): ULong { + val sizeForLength = 4UL + val sizeForItems = value.sumOf { FfiConverterTypeAddressInfo.allocationSize(it) } + return sizeForLength + sizeForItems + } + + override fun write(value: List, buf: ByteBuffer) { + buf.putInt(value.size) + value.iterator().forEach { + FfiConverterTypeAddressInfo.write(it, buf) + } + } +} + + + + object FfiConverterSequenceTypeChannelDetails: FfiConverterRustBuffer> { override fun read(buf: ByteBuffer): List { val len = buf.getInt() diff --git a/bindings/kotlin/ldk-node-jvm/lib/src/main/resources/darwin-aarch64/libldk_node.dylib b/bindings/kotlin/ldk-node-jvm/lib/src/main/resources/darwin-aarch64/libldk_node.dylib index 5d0ae096c8..abb7ce2f8e 100644 Binary files a/bindings/kotlin/ldk-node-jvm/lib/src/main/resources/darwin-aarch64/libldk_node.dylib and b/bindings/kotlin/ldk-node-jvm/lib/src/main/resources/darwin-aarch64/libldk_node.dylib differ diff --git a/bindings/kotlin/ldk-node-jvm/lib/src/main/resources/darwin-x86-64/libldk_node.dylib b/bindings/kotlin/ldk-node-jvm/lib/src/main/resources/darwin-x86-64/libldk_node.dylib index 86bc05d56c..e43411107f 100644 Binary files a/bindings/kotlin/ldk-node-jvm/lib/src/main/resources/darwin-x86-64/libldk_node.dylib and b/bindings/kotlin/ldk-node-jvm/lib/src/main/resources/darwin-x86-64/libldk_node.dylib differ diff --git a/bindings/ldk_node.udl b/bindings/ldk_node.udl index 3407471c30..02169f3349 100644 --- a/bindings/ldk_node.udl +++ b/bindings/ldk_node.udl @@ -75,6 +75,17 @@ enum AddressType { "Taproot", }; +enum KeychainKind { + "External", + "Internal", +}; + +dictionary AddressInfo { + u32 index; + Address address; + KeychainKind keychain; +}; + enum LogLevel { "Gossip", "Trace", @@ -302,8 +313,18 @@ interface OnchainPayment { [Throws=NodeError] Address new_address(); [Throws=NodeError] + AddressInfo new_address_info(); + [Throws=NodeError] Address new_address_for_type(AddressType address_type); [Throws=NodeError] + AddressInfo new_address_info_for_type(AddressType address_type); + [Throws=NodeError] + AddressInfo address_info_for_type_at_index(AddressType address_type, KeychainKind keychain, u32 index); + [Throws=NodeError] + sequence address_infos_for_type(AddressType address_type, KeychainKind keychain, u32 start_index, u32 count); + [Throws=NodeError] + void reveal_receive_addresses_to(AddressType address_type, u32 index); + [Throws=NodeError] sequence list_spendable_outputs(); [Throws=NodeError] sequence select_utxos_with_algorithm(u64 target_amount_sats, FeeRate? fee_rate, CoinSelectionAlgorithm algorithm, sequence? utxos); diff --git a/bindings/python/pyproject.toml b/bindings/python/pyproject.toml index 2918dabb53..a89f8d7e79 100644 --- a/bindings/python/pyproject.toml +++ b/bindings/python/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "ldk_node" -version = "0.7.0-rc.37" +version = "0.7.0-rc.39" authors = [ { name="Elias Rohrer", email="dev@tnull.de" }, ] diff --git a/bindings/python/src/ldk_node/ldk_node.py b/bindings/python/src/ldk_node/ldk_node.py index ddfc57e221..32b486ed6b 100644 --- a/bindings/python/src/ldk_node/ldk_node.py +++ b/bindings/python/src/ldk_node/ldk_node.py @@ -795,6 +795,10 @@ def _uniffi_check_api_checksums(lib): raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") if lib.uniffi_ldk_node_checksum_method_onchainpayment_accelerate_by_cpfp() != 31954: raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_ldk_node_checksum_method_onchainpayment_address_info_for_type_at_index() != 42692: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_ldk_node_checksum_method_onchainpayment_address_infos_for_type() != 3701: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") if lib.uniffi_ldk_node_checksum_method_onchainpayment_bump_fee_by_rbf() != 53877: raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") if lib.uniffi_ldk_node_checksum_method_onchainpayment_calculate_cpfp_fee_rate() != 32879: @@ -809,6 +813,12 @@ def _uniffi_check_api_checksums(lib): raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") if lib.uniffi_ldk_node_checksum_method_onchainpayment_new_address_for_type() != 9083: raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_ldk_node_checksum_method_onchainpayment_new_address_info() != 9889: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_ldk_node_checksum_method_onchainpayment_new_address_info_for_type() != 62171: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_ldk_node_checksum_method_onchainpayment_reveal_receive_addresses_to() != 44189: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") if lib.uniffi_ldk_node_checksum_method_onchainpayment_select_utxos_with_algorithm() != 14084: raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") if lib.uniffi_ldk_node_checksum_method_onchainpayment_send_all_to_address() != 37748: @@ -2185,6 +2195,23 @@ class _UniffiVTableCallbackInterfaceVssHeaderProvider(ctypes.Structure): ctypes.POINTER(_UniffiRustCallStatus), ) _UniffiLib.uniffi_ldk_node_fn_method_onchainpayment_accelerate_by_cpfp.restype = _UniffiRustBuffer +_UniffiLib.uniffi_ldk_node_fn_method_onchainpayment_address_info_for_type_at_index.argtypes = ( + ctypes.c_void_p, + _UniffiRustBuffer, + _UniffiRustBuffer, + ctypes.c_uint32, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_ldk_node_fn_method_onchainpayment_address_info_for_type_at_index.restype = _UniffiRustBuffer +_UniffiLib.uniffi_ldk_node_fn_method_onchainpayment_address_infos_for_type.argtypes = ( + ctypes.c_void_p, + _UniffiRustBuffer, + _UniffiRustBuffer, + ctypes.c_uint32, + ctypes.c_uint32, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_ldk_node_fn_method_onchainpayment_address_infos_for_type.restype = _UniffiRustBuffer _UniffiLib.uniffi_ldk_node_fn_method_onchainpayment_bump_fee_by_rbf.argtypes = ( ctypes.c_void_p, _UniffiRustBuffer, @@ -2232,6 +2259,24 @@ class _UniffiVTableCallbackInterfaceVssHeaderProvider(ctypes.Structure): ctypes.POINTER(_UniffiRustCallStatus), ) _UniffiLib.uniffi_ldk_node_fn_method_onchainpayment_new_address_for_type.restype = _UniffiRustBuffer +_UniffiLib.uniffi_ldk_node_fn_method_onchainpayment_new_address_info.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_ldk_node_fn_method_onchainpayment_new_address_info.restype = _UniffiRustBuffer +_UniffiLib.uniffi_ldk_node_fn_method_onchainpayment_new_address_info_for_type.argtypes = ( + ctypes.c_void_p, + _UniffiRustBuffer, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_ldk_node_fn_method_onchainpayment_new_address_info_for_type.restype = _UniffiRustBuffer +_UniffiLib.uniffi_ldk_node_fn_method_onchainpayment_reveal_receive_addresses_to.argtypes = ( + ctypes.c_void_p, + _UniffiRustBuffer, + ctypes.c_uint32, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_ldk_node_fn_method_onchainpayment_reveal_receive_addresses_to.restype = None _UniffiLib.uniffi_ldk_node_fn_method_onchainpayment_select_utxos_with_algorithm.argtypes = ( ctypes.c_void_p, ctypes.c_uint64, @@ -3226,6 +3271,12 @@ class _UniffiVTableCallbackInterfaceVssHeaderProvider(ctypes.Structure): _UniffiLib.uniffi_ldk_node_checksum_method_onchainpayment_accelerate_by_cpfp.argtypes = ( ) _UniffiLib.uniffi_ldk_node_checksum_method_onchainpayment_accelerate_by_cpfp.restype = ctypes.c_uint16 +_UniffiLib.uniffi_ldk_node_checksum_method_onchainpayment_address_info_for_type_at_index.argtypes = ( +) +_UniffiLib.uniffi_ldk_node_checksum_method_onchainpayment_address_info_for_type_at_index.restype = ctypes.c_uint16 +_UniffiLib.uniffi_ldk_node_checksum_method_onchainpayment_address_infos_for_type.argtypes = ( +) +_UniffiLib.uniffi_ldk_node_checksum_method_onchainpayment_address_infos_for_type.restype = ctypes.c_uint16 _UniffiLib.uniffi_ldk_node_checksum_method_onchainpayment_bump_fee_by_rbf.argtypes = ( ) _UniffiLib.uniffi_ldk_node_checksum_method_onchainpayment_bump_fee_by_rbf.restype = ctypes.c_uint16 @@ -3247,6 +3298,15 @@ class _UniffiVTableCallbackInterfaceVssHeaderProvider(ctypes.Structure): _UniffiLib.uniffi_ldk_node_checksum_method_onchainpayment_new_address_for_type.argtypes = ( ) _UniffiLib.uniffi_ldk_node_checksum_method_onchainpayment_new_address_for_type.restype = ctypes.c_uint16 +_UniffiLib.uniffi_ldk_node_checksum_method_onchainpayment_new_address_info.argtypes = ( +) +_UniffiLib.uniffi_ldk_node_checksum_method_onchainpayment_new_address_info.restype = ctypes.c_uint16 +_UniffiLib.uniffi_ldk_node_checksum_method_onchainpayment_new_address_info_for_type.argtypes = ( +) +_UniffiLib.uniffi_ldk_node_checksum_method_onchainpayment_new_address_info_for_type.restype = ctypes.c_uint16 +_UniffiLib.uniffi_ldk_node_checksum_method_onchainpayment_reveal_receive_addresses_to.argtypes = ( +) +_UniffiLib.uniffi_ldk_node_checksum_method_onchainpayment_reveal_receive_addresses_to.restype = ctypes.c_uint16 _UniffiLib.uniffi_ldk_node_checksum_method_onchainpayment_select_utxos_with_algorithm.argtypes = ( ) _UniffiLib.uniffi_ldk_node_checksum_method_onchainpayment_select_utxos_with_algorithm.restype = ctypes.c_uint16 @@ -3521,7 +3581,7 @@ def would_expire(self, at_time_seconds: "int"): class Bolt11Invoice: _pointer: ctypes.c_void_p - + def __init__(self, *args, **kwargs): raise ValueError("This class has no default constructor") @@ -3545,7 +3605,7 @@ def _make_instance_(cls, pointer): @classmethod def from_str(cls, invoice_str: "str"): _UniffiConverterString.check_lower(invoice_str) - + # Call the (fallible) function before creating any half-baked object instances. pointer = _uniffi_rust_call_with_error(_UniffiConverterTypeNodeError,_UniffiLib.uniffi_ldk_node_fn_constructor_bolt11invoice_from_str, _UniffiConverterString.lower(invoice_str)) @@ -3690,7 +3750,7 @@ def signable_hash(self, ) -> "typing.List[int]": def would_expire(self, at_time_seconds: "int") -> "bool": _UniffiConverterUInt64.check_lower(at_time_seconds) - + return _UniffiConverterBool.lift( _uniffi_rust_call(_UniffiLib.uniffi_ldk_node_fn_method_bolt11invoice_would_expire,self._uniffi_clone_pointer(), _UniffiConverterUInt64.lower(at_time_seconds)) @@ -3799,7 +3859,7 @@ def send_using_amount(self, invoice: "Bolt11Invoice",amount_msat: "int",route_pa class Bolt11Payment: _pointer: ctypes.c_void_p - + def __init__(self, *args, **kwargs): raise ValueError("This class has no default constructor") @@ -3824,11 +3884,11 @@ def _make_instance_(cls, pointer): def claim_for_hash(self, payment_hash: "PaymentHash",claimable_amount_msat: "int",preimage: "PaymentPreimage") -> None: _UniffiConverterTypePaymentHash.check_lower(payment_hash) - + _UniffiConverterUInt64.check_lower(claimable_amount_msat) - + _UniffiConverterTypePaymentPreimage.check_lower(preimage) - + _uniffi_rust_call_with_error(_UniffiConverterTypeNodeError,_UniffiLib.uniffi_ldk_node_fn_method_bolt11payment_claim_for_hash,self._uniffi_clone_pointer(), _UniffiConverterTypePaymentHash.lower(payment_hash), _UniffiConverterUInt64.lower(claimable_amount_msat), @@ -3841,7 +3901,7 @@ def claim_for_hash(self, payment_hash: "PaymentHash",claimable_amount_msat: "int def estimate_routing_fees(self, invoice: "Bolt11Invoice") -> "int": _UniffiConverterTypeBolt11Invoice.check_lower(invoice) - + return _UniffiConverterUInt64.lift( _uniffi_rust_call_with_error(_UniffiConverterTypeNodeError,_UniffiLib.uniffi_ldk_node_fn_method_bolt11payment_estimate_routing_fees,self._uniffi_clone_pointer(), _UniffiConverterTypeBolt11Invoice.lower(invoice)) @@ -3853,9 +3913,9 @@ def estimate_routing_fees(self, invoice: "Bolt11Invoice") -> "int": def estimate_routing_fees_using_amount(self, invoice: "Bolt11Invoice",amount_msat: "int") -> "int": _UniffiConverterTypeBolt11Invoice.check_lower(invoice) - + _UniffiConverterUInt64.check_lower(amount_msat) - + return _UniffiConverterUInt64.lift( _uniffi_rust_call_with_error(_UniffiConverterTypeNodeError,_UniffiLib.uniffi_ldk_node_fn_method_bolt11payment_estimate_routing_fees_using_amount,self._uniffi_clone_pointer(), _UniffiConverterTypeBolt11Invoice.lower(invoice), @@ -3868,7 +3928,7 @@ def estimate_routing_fees_using_amount(self, invoice: "Bolt11Invoice",amount_msa def fail_for_hash(self, payment_hash: "PaymentHash") -> None: _UniffiConverterTypePaymentHash.check_lower(payment_hash) - + _uniffi_rust_call_with_error(_UniffiConverterTypeNodeError,_UniffiLib.uniffi_ldk_node_fn_method_bolt11payment_fail_for_hash,self._uniffi_clone_pointer(), _UniffiConverterTypePaymentHash.lower(payment_hash)) @@ -3879,11 +3939,11 @@ def fail_for_hash(self, payment_hash: "PaymentHash") -> None: def receive(self, amount_msat: "int",description: "Bolt11InvoiceDescription",expiry_secs: "int") -> "Bolt11Invoice": _UniffiConverterUInt64.check_lower(amount_msat) - + _UniffiConverterTypeBolt11InvoiceDescription.check_lower(description) - + _UniffiConverterUInt32.check_lower(expiry_secs) - + return _UniffiConverterTypeBolt11Invoice.lift( _uniffi_rust_call_with_error(_UniffiConverterTypeNodeError,_UniffiLib.uniffi_ldk_node_fn_method_bolt11payment_receive,self._uniffi_clone_pointer(), _UniffiConverterUInt64.lower(amount_msat), @@ -3897,13 +3957,13 @@ def receive(self, amount_msat: "int",description: "Bolt11InvoiceDescription",exp def receive_for_hash(self, amount_msat: "int",description: "Bolt11InvoiceDescription",expiry_secs: "int",payment_hash: "PaymentHash") -> "Bolt11Invoice": _UniffiConverterUInt64.check_lower(amount_msat) - + _UniffiConverterTypeBolt11InvoiceDescription.check_lower(description) - + _UniffiConverterUInt32.check_lower(expiry_secs) - + _UniffiConverterTypePaymentHash.check_lower(payment_hash) - + return _UniffiConverterTypeBolt11Invoice.lift( _uniffi_rust_call_with_error(_UniffiConverterTypeNodeError,_UniffiLib.uniffi_ldk_node_fn_method_bolt11payment_receive_for_hash,self._uniffi_clone_pointer(), _UniffiConverterUInt64.lower(amount_msat), @@ -3918,9 +3978,9 @@ def receive_for_hash(self, amount_msat: "int",description: "Bolt11InvoiceDescrip def receive_variable_amount(self, description: "Bolt11InvoiceDescription",expiry_secs: "int") -> "Bolt11Invoice": _UniffiConverterTypeBolt11InvoiceDescription.check_lower(description) - + _UniffiConverterUInt32.check_lower(expiry_secs) - + return _UniffiConverterTypeBolt11Invoice.lift( _uniffi_rust_call_with_error(_UniffiConverterTypeNodeError,_UniffiLib.uniffi_ldk_node_fn_method_bolt11payment_receive_variable_amount,self._uniffi_clone_pointer(), _UniffiConverterTypeBolt11InvoiceDescription.lower(description), @@ -3933,11 +3993,11 @@ def receive_variable_amount(self, description: "Bolt11InvoiceDescription",expiry def receive_variable_amount_for_hash(self, description: "Bolt11InvoiceDescription",expiry_secs: "int",payment_hash: "PaymentHash") -> "Bolt11Invoice": _UniffiConverterTypeBolt11InvoiceDescription.check_lower(description) - + _UniffiConverterUInt32.check_lower(expiry_secs) - + _UniffiConverterTypePaymentHash.check_lower(payment_hash) - + return _UniffiConverterTypeBolt11Invoice.lift( _uniffi_rust_call_with_error(_UniffiConverterTypeNodeError,_UniffiLib.uniffi_ldk_node_fn_method_bolt11payment_receive_variable_amount_for_hash,self._uniffi_clone_pointer(), _UniffiConverterTypeBolt11InvoiceDescription.lower(description), @@ -3951,11 +4011,11 @@ def receive_variable_amount_for_hash(self, description: "Bolt11InvoiceDescriptio def receive_variable_amount_via_jit_channel(self, description: "Bolt11InvoiceDescription",expiry_secs: "int",max_proportional_lsp_fee_limit_ppm_msat: "typing.Optional[int]") -> "Bolt11Invoice": _UniffiConverterTypeBolt11InvoiceDescription.check_lower(description) - + _UniffiConverterUInt32.check_lower(expiry_secs) - + _UniffiConverterOptionalUInt64.check_lower(max_proportional_lsp_fee_limit_ppm_msat) - + return _UniffiConverterTypeBolt11Invoice.lift( _uniffi_rust_call_with_error(_UniffiConverterTypeNodeError,_UniffiLib.uniffi_ldk_node_fn_method_bolt11payment_receive_variable_amount_via_jit_channel,self._uniffi_clone_pointer(), _UniffiConverterTypeBolt11InvoiceDescription.lower(description), @@ -3969,13 +4029,13 @@ def receive_variable_amount_via_jit_channel(self, description: "Bolt11InvoiceDes def receive_variable_amount_via_jit_channel_for_hash(self, description: "Bolt11InvoiceDescription",expiry_secs: "int",max_proportional_lsp_fee_limit_ppm_msat: "typing.Optional[int]",payment_hash: "PaymentHash") -> "Bolt11Invoice": _UniffiConverterTypeBolt11InvoiceDescription.check_lower(description) - + _UniffiConverterUInt32.check_lower(expiry_secs) - + _UniffiConverterOptionalUInt64.check_lower(max_proportional_lsp_fee_limit_ppm_msat) - + _UniffiConverterTypePaymentHash.check_lower(payment_hash) - + return _UniffiConverterTypeBolt11Invoice.lift( _uniffi_rust_call_with_error(_UniffiConverterTypeNodeError,_UniffiLib.uniffi_ldk_node_fn_method_bolt11payment_receive_variable_amount_via_jit_channel_for_hash,self._uniffi_clone_pointer(), _UniffiConverterTypeBolt11InvoiceDescription.lower(description), @@ -3990,13 +4050,13 @@ def receive_variable_amount_via_jit_channel_for_hash(self, description: "Bolt11I def receive_via_jit_channel(self, amount_msat: "int",description: "Bolt11InvoiceDescription",expiry_secs: "int",max_lsp_fee_limit_msat: "typing.Optional[int]") -> "Bolt11Invoice": _UniffiConverterUInt64.check_lower(amount_msat) - + _UniffiConverterTypeBolt11InvoiceDescription.check_lower(description) - + _UniffiConverterUInt32.check_lower(expiry_secs) - + _UniffiConverterOptionalUInt64.check_lower(max_lsp_fee_limit_msat) - + return _UniffiConverterTypeBolt11Invoice.lift( _uniffi_rust_call_with_error(_UniffiConverterTypeNodeError,_UniffiLib.uniffi_ldk_node_fn_method_bolt11payment_receive_via_jit_channel,self._uniffi_clone_pointer(), _UniffiConverterUInt64.lower(amount_msat), @@ -4011,15 +4071,15 @@ def receive_via_jit_channel(self, amount_msat: "int",description: "Bolt11Invoice def receive_via_jit_channel_for_hash(self, amount_msat: "int",description: "Bolt11InvoiceDescription",expiry_secs: "int",max_lsp_fee_limit_msat: "typing.Optional[int]",payment_hash: "PaymentHash") -> "Bolt11Invoice": _UniffiConverterUInt64.check_lower(amount_msat) - + _UniffiConverterTypeBolt11InvoiceDescription.check_lower(description) - + _UniffiConverterUInt32.check_lower(expiry_secs) - + _UniffiConverterOptionalUInt64.check_lower(max_lsp_fee_limit_msat) - + _UniffiConverterTypePaymentHash.check_lower(payment_hash) - + return _UniffiConverterTypeBolt11Invoice.lift( _uniffi_rust_call_with_error(_UniffiConverterTypeNodeError,_UniffiLib.uniffi_ldk_node_fn_method_bolt11payment_receive_via_jit_channel_for_hash,self._uniffi_clone_pointer(), _UniffiConverterUInt64.lower(amount_msat), @@ -4035,9 +4095,9 @@ def receive_via_jit_channel_for_hash(self, amount_msat: "int",description: "Bolt def send(self, invoice: "Bolt11Invoice",route_parameters: "typing.Optional[RouteParametersConfig]") -> "PaymentId": _UniffiConverterTypeBolt11Invoice.check_lower(invoice) - + _UniffiConverterOptionalTypeRouteParametersConfig.check_lower(route_parameters) - + return _UniffiConverterTypePaymentId.lift( _uniffi_rust_call_with_error(_UniffiConverterTypeNodeError,_UniffiLib.uniffi_ldk_node_fn_method_bolt11payment_send,self._uniffi_clone_pointer(), _UniffiConverterTypeBolt11Invoice.lower(invoice), @@ -4050,9 +4110,9 @@ def send(self, invoice: "Bolt11Invoice",route_parameters: "typing.Optional[Route def send_probes(self, invoice: "Bolt11Invoice",route_parameters: "typing.Optional[RouteParametersConfig]") -> "typing.List[ProbeHandle]": _UniffiConverterTypeBolt11Invoice.check_lower(invoice) - + _UniffiConverterOptionalTypeRouteParametersConfig.check_lower(route_parameters) - + return _UniffiConverterSequenceTypeProbeHandle.lift( _uniffi_rust_call_with_error(_UniffiConverterTypeNodeError,_UniffiLib.uniffi_ldk_node_fn_method_bolt11payment_send_probes,self._uniffi_clone_pointer(), _UniffiConverterTypeBolt11Invoice.lower(invoice), @@ -4065,11 +4125,11 @@ def send_probes(self, invoice: "Bolt11Invoice",route_parameters: "typing.Optiona def send_probes_using_amount(self, invoice: "Bolt11Invoice",amount_msat: "int",route_parameters: "typing.Optional[RouteParametersConfig]") -> "typing.List[ProbeHandle]": _UniffiConverterTypeBolt11Invoice.check_lower(invoice) - + _UniffiConverterUInt64.check_lower(amount_msat) - + _UniffiConverterOptionalTypeRouteParametersConfig.check_lower(route_parameters) - + return _UniffiConverterSequenceTypeProbeHandle.lift( _uniffi_rust_call_with_error(_UniffiConverterTypeNodeError,_UniffiLib.uniffi_ldk_node_fn_method_bolt11payment_send_probes_using_amount,self._uniffi_clone_pointer(), _UniffiConverterTypeBolt11Invoice.lower(invoice), @@ -4083,11 +4143,11 @@ def send_probes_using_amount(self, invoice: "Bolt11Invoice",amount_msat: "int",r def send_using_amount(self, invoice: "Bolt11Invoice",amount_msat: "int",route_parameters: "typing.Optional[RouteParametersConfig]") -> "PaymentId": _UniffiConverterTypeBolt11Invoice.check_lower(invoice) - + _UniffiConverterUInt64.check_lower(amount_msat) - + _UniffiConverterOptionalTypeRouteParametersConfig.check_lower(route_parameters) - + return _UniffiConverterTypePaymentId.lift( _uniffi_rust_call_with_error(_UniffiConverterTypeNodeError,_UniffiLib.uniffi_ldk_node_fn_method_bolt11payment_send_using_amount,self._uniffi_clone_pointer(), _UniffiConverterTypeBolt11Invoice.lower(invoice), @@ -4175,7 +4235,7 @@ def signing_pubkey(self, ): class Bolt12Invoice: _pointer: ctypes.c_void_p - + def __init__(self, *args, **kwargs): raise ValueError("This class has no default constructor") @@ -4199,7 +4259,7 @@ def _make_instance_(cls, pointer): @classmethod def from_str(cls, invoice_str: "str"): _UniffiConverterString.check_lower(invoice_str) - + # Call the (fallible) function before creating any half-baked object instances. pointer = _uniffi_rust_call_with_error(_UniffiConverterTypeNodeError,_UniffiLib.uniffi_ldk_node_fn_constructor_bolt12invoice_from_str, _UniffiConverterString.lower(invoice_str)) @@ -4441,7 +4501,7 @@ def set_paths_to_static_invoice_server(self, paths: "bytes"): class Bolt12Payment: _pointer: ctypes.c_void_p - + def __init__(self, *args, **kwargs): raise ValueError("This class has no default constructor") @@ -4466,7 +4526,7 @@ def _make_instance_(cls, pointer): def blinded_paths_for_async_recipient(self, recipient_id: "bytes") -> "bytes": _UniffiConverterBytes.check_lower(recipient_id) - + return _UniffiConverterBytes.lift( _uniffi_rust_call_with_error(_UniffiConverterTypeNodeError,_UniffiLib.uniffi_ldk_node_fn_method_bolt12payment_blinded_paths_for_async_recipient,self._uniffi_clone_pointer(), _UniffiConverterBytes.lower(recipient_id)) @@ -4478,15 +4538,15 @@ def blinded_paths_for_async_recipient(self, recipient_id: "bytes") -> "bytes": def initiate_refund(self, amount_msat: "int",expiry_secs: "int",quantity: "typing.Optional[int]",payer_note: "typing.Optional[str]",route_parameters: "typing.Optional[RouteParametersConfig]") -> "Refund": _UniffiConverterUInt64.check_lower(amount_msat) - + _UniffiConverterUInt32.check_lower(expiry_secs) - + _UniffiConverterOptionalUInt64.check_lower(quantity) - + _UniffiConverterOptionalString.check_lower(payer_note) - + _UniffiConverterOptionalTypeRouteParametersConfig.check_lower(route_parameters) - + return _UniffiConverterTypeRefund.lift( _uniffi_rust_call_with_error(_UniffiConverterTypeNodeError,_UniffiLib.uniffi_ldk_node_fn_method_bolt12payment_initiate_refund,self._uniffi_clone_pointer(), _UniffiConverterUInt64.lower(amount_msat), @@ -4502,13 +4562,13 @@ def initiate_refund(self, amount_msat: "int",expiry_secs: "int",quantity: "typin def receive(self, amount_msat: "int",description: "str",expiry_secs: "typing.Optional[int]",quantity: "typing.Optional[int]") -> "Offer": _UniffiConverterUInt64.check_lower(amount_msat) - + _UniffiConverterString.check_lower(description) - + _UniffiConverterOptionalUInt32.check_lower(expiry_secs) - + _UniffiConverterOptionalUInt64.check_lower(quantity) - + return _UniffiConverterTypeOffer.lift( _uniffi_rust_call_with_error(_UniffiConverterTypeNodeError,_UniffiLib.uniffi_ldk_node_fn_method_bolt12payment_receive,self._uniffi_clone_pointer(), _UniffiConverterUInt64.lower(amount_msat), @@ -4532,9 +4592,9 @@ def receive_async(self, ) -> "Offer": def receive_variable_amount(self, description: "str",expiry_secs: "typing.Optional[int]") -> "Offer": _UniffiConverterString.check_lower(description) - + _UniffiConverterOptionalUInt32.check_lower(expiry_secs) - + return _UniffiConverterTypeOffer.lift( _uniffi_rust_call_with_error(_UniffiConverterTypeNodeError,_UniffiLib.uniffi_ldk_node_fn_method_bolt12payment_receive_variable_amount,self._uniffi_clone_pointer(), _UniffiConverterString.lower(description), @@ -4547,7 +4607,7 @@ def receive_variable_amount(self, description: "str",expiry_secs: "typing.Option def request_refund_payment(self, refund: "Refund") -> "Bolt12Invoice": _UniffiConverterTypeRefund.check_lower(refund) - + return _UniffiConverterTypeBolt12Invoice.lift( _uniffi_rust_call_with_error(_UniffiConverterTypeNodeError,_UniffiLib.uniffi_ldk_node_fn_method_bolt12payment_request_refund_payment,self._uniffi_clone_pointer(), _UniffiConverterTypeRefund.lower(refund)) @@ -4559,13 +4619,13 @@ def request_refund_payment(self, refund: "Refund") -> "Bolt12Invoice": def send(self, offer: "Offer",quantity: "typing.Optional[int]",payer_note: "typing.Optional[str]",route_parameters: "typing.Optional[RouteParametersConfig]") -> "PaymentId": _UniffiConverterTypeOffer.check_lower(offer) - + _UniffiConverterOptionalUInt64.check_lower(quantity) - + _UniffiConverterOptionalString.check_lower(payer_note) - + _UniffiConverterOptionalTypeRouteParametersConfig.check_lower(route_parameters) - + return _UniffiConverterTypePaymentId.lift( _uniffi_rust_call_with_error(_UniffiConverterTypeNodeError,_UniffiLib.uniffi_ldk_node_fn_method_bolt12payment_send,self._uniffi_clone_pointer(), _UniffiConverterTypeOffer.lower(offer), @@ -4580,15 +4640,15 @@ def send(self, offer: "Offer",quantity: "typing.Optional[int]",payer_note: "typi def send_using_amount(self, offer: "Offer",amount_msat: "int",quantity: "typing.Optional[int]",payer_note: "typing.Optional[str]",route_parameters: "typing.Optional[RouteParametersConfig]") -> "PaymentId": _UniffiConverterTypeOffer.check_lower(offer) - + _UniffiConverterUInt64.check_lower(amount_msat) - + _UniffiConverterOptionalUInt64.check_lower(quantity) - + _UniffiConverterOptionalString.check_lower(payer_note) - + _UniffiConverterOptionalTypeRouteParametersConfig.check_lower(route_parameters) - + return _UniffiConverterTypePaymentId.lift( _uniffi_rust_call_with_error(_UniffiConverterTypeNodeError,_UniffiLib.uniffi_ldk_node_fn_method_bolt12payment_send_using_amount,self._uniffi_clone_pointer(), _UniffiConverterTypeOffer.lower(offer), @@ -4604,7 +4664,7 @@ def send_using_amount(self, offer: "Offer",amount_msat: "int",quantity: "typing. def set_paths_to_static_invoice_server(self, paths: "bytes") -> None: _UniffiConverterBytes.check_lower(paths) - + _uniffi_rust_call_with_error(_UniffiConverterTypeNodeError,_UniffiLib.uniffi_ldk_node_fn_method_bolt12payment_set_paths_to_static_invoice_server,self._uniffi_clone_pointer(), _UniffiConverterBytes.lower(paths)) @@ -4732,7 +4792,7 @@ def _make_instance_(cls, pointer): @classmethod def from_config(cls, config: "Config"): _UniffiConverterTypeConfig.check_lower(config) - + # Call the (fallible) function before creating any half-baked object instances. pointer = _uniffi_rust_call(_UniffiLib.uniffi_ldk_node_fn_constructor_builder_from_config, _UniffiConverterTypeConfig.lower(config)) @@ -4760,13 +4820,13 @@ def build_with_fs_store(self, ) -> "Node": def build_with_vss_store(self, vss_url: "str",store_id: "str",lnurl_auth_server_url: "str",fixed_headers: "dict[str, str]") -> "Node": _UniffiConverterString.check_lower(vss_url) - + _UniffiConverterString.check_lower(store_id) - + _UniffiConverterString.check_lower(lnurl_auth_server_url) - + _UniffiConverterMapStringString.check_lower(fixed_headers) - + return _UniffiConverterTypeNode.lift( _uniffi_rust_call_with_error(_UniffiConverterTypeBuildError,_UniffiLib.uniffi_ldk_node_fn_method_builder_build_with_vss_store,self._uniffi_clone_pointer(), _UniffiConverterString.lower(vss_url), @@ -4781,11 +4841,11 @@ def build_with_vss_store(self, vss_url: "str",store_id: "str",lnurl_auth_server_ def build_with_vss_store_and_fixed_headers(self, vss_url: "str",store_id: "str",fixed_headers: "dict[str, str]") -> "Node": _UniffiConverterString.check_lower(vss_url) - + _UniffiConverterString.check_lower(store_id) - + _UniffiConverterMapStringString.check_lower(fixed_headers) - + return _UniffiConverterTypeNode.lift( _uniffi_rust_call_with_error(_UniffiConverterTypeBuildError,_UniffiLib.uniffi_ldk_node_fn_method_builder_build_with_vss_store_and_fixed_headers,self._uniffi_clone_pointer(), _UniffiConverterString.lower(vss_url), @@ -4799,11 +4859,11 @@ def build_with_vss_store_and_fixed_headers(self, vss_url: "str",store_id: "str", def build_with_vss_store_and_header_provider(self, vss_url: "str",store_id: "str",header_provider: "VssHeaderProvider") -> "Node": _UniffiConverterString.check_lower(vss_url) - + _UniffiConverterString.check_lower(store_id) - + _UniffiConverterTypeVssHeaderProvider.check_lower(header_provider) - + return _UniffiConverterTypeNode.lift( _uniffi_rust_call_with_error(_UniffiConverterTypeBuildError,_UniffiLib.uniffi_ldk_node_fn_method_builder_build_with_vss_store_and_header_provider,self._uniffi_clone_pointer(), _UniffiConverterString.lower(vss_url), @@ -4817,7 +4877,7 @@ def build_with_vss_store_and_header_provider(self, vss_url: "str",store_id: "str def set_accept_stale_channel_monitors(self, accept: "bool") -> None: _UniffiConverterBool.check_lower(accept) - + _uniffi_rust_call(_UniffiLib.uniffi_ldk_node_fn_method_builder_set_accept_stale_channel_monitors,self._uniffi_clone_pointer(), _UniffiConverterBool.lower(accept)) @@ -4828,7 +4888,7 @@ def set_accept_stale_channel_monitors(self, accept: "bool") -> None: def set_address_type(self, address_type: "AddressType") -> None: _UniffiConverterTypeAddressType.check_lower(address_type) - + _uniffi_rust_call(_UniffiLib.uniffi_ldk_node_fn_method_builder_set_address_type,self._uniffi_clone_pointer(), _UniffiConverterTypeAddressType.lower(address_type)) @@ -4839,7 +4899,7 @@ def set_address_type(self, address_type: "AddressType") -> None: def set_address_types_to_monitor(self, address_types_to_monitor: "typing.List[AddressType]") -> None: _UniffiConverterSequenceTypeAddressType.check_lower(address_types_to_monitor) - + _uniffi_rust_call(_UniffiLib.uniffi_ldk_node_fn_method_builder_set_address_types_to_monitor,self._uniffi_clone_pointer(), _UniffiConverterSequenceTypeAddressType.lower(address_types_to_monitor)) @@ -4850,7 +4910,7 @@ def set_address_types_to_monitor(self, address_types_to_monitor: "typing.List[Ad def set_announcement_addresses(self, announcement_addresses: "typing.List[SocketAddress]") -> None: _UniffiConverterSequenceTypeSocketAddress.check_lower(announcement_addresses) - + _uniffi_rust_call_with_error(_UniffiConverterTypeBuildError,_UniffiLib.uniffi_ldk_node_fn_method_builder_set_announcement_addresses,self._uniffi_clone_pointer(), _UniffiConverterSequenceTypeSocketAddress.lower(announcement_addresses)) @@ -4861,7 +4921,7 @@ def set_announcement_addresses(self, announcement_addresses: "typing.List[Socket def set_async_payments_role(self, role: "typing.Optional[AsyncPaymentsRole]") -> None: _UniffiConverterOptionalTypeAsyncPaymentsRole.check_lower(role) - + _uniffi_rust_call_with_error(_UniffiConverterTypeBuildError,_UniffiLib.uniffi_ldk_node_fn_method_builder_set_async_payments_role,self._uniffi_clone_pointer(), _UniffiConverterOptionalTypeAsyncPaymentsRole.lower(role)) @@ -4872,17 +4932,17 @@ def set_async_payments_role(self, role: "typing.Optional[AsyncPaymentsRole]") -> def set_chain_source_bitcoind_rest(self, rest_host: "str",rest_port: "int",rpc_host: "str",rpc_port: "int",rpc_user: "str",rpc_password: "str") -> None: _UniffiConverterString.check_lower(rest_host) - + _UniffiConverterUInt16.check_lower(rest_port) - + _UniffiConverterString.check_lower(rpc_host) - + _UniffiConverterUInt16.check_lower(rpc_port) - + _UniffiConverterString.check_lower(rpc_user) - + _UniffiConverterString.check_lower(rpc_password) - + _uniffi_rust_call(_UniffiLib.uniffi_ldk_node_fn_method_builder_set_chain_source_bitcoind_rest,self._uniffi_clone_pointer(), _UniffiConverterString.lower(rest_host), _UniffiConverterUInt16.lower(rest_port), @@ -4898,13 +4958,13 @@ def set_chain_source_bitcoind_rest(self, rest_host: "str",rest_port: "int",rpc_h def set_chain_source_bitcoind_rpc(self, rpc_host: "str",rpc_port: "int",rpc_user: "str",rpc_password: "str") -> None: _UniffiConverterString.check_lower(rpc_host) - + _UniffiConverterUInt16.check_lower(rpc_port) - + _UniffiConverterString.check_lower(rpc_user) - + _UniffiConverterString.check_lower(rpc_password) - + _uniffi_rust_call(_UniffiLib.uniffi_ldk_node_fn_method_builder_set_chain_source_bitcoind_rpc,self._uniffi_clone_pointer(), _UniffiConverterString.lower(rpc_host), _UniffiConverterUInt16.lower(rpc_port), @@ -4918,9 +4978,9 @@ def set_chain_source_bitcoind_rpc(self, rpc_host: "str",rpc_port: "int",rpc_user def set_chain_source_electrum(self, server_url: "str",config: "typing.Optional[ElectrumSyncConfig]") -> None: _UniffiConverterString.check_lower(server_url) - + _UniffiConverterOptionalTypeElectrumSyncConfig.check_lower(config) - + _uniffi_rust_call(_UniffiLib.uniffi_ldk_node_fn_method_builder_set_chain_source_electrum,self._uniffi_clone_pointer(), _UniffiConverterString.lower(server_url), _UniffiConverterOptionalTypeElectrumSyncConfig.lower(config)) @@ -4932,9 +4992,9 @@ def set_chain_source_electrum(self, server_url: "str",config: "typing.Optional[E def set_chain_source_esplora(self, server_url: "str",config: "typing.Optional[EsploraSyncConfig]") -> None: _UniffiConverterString.check_lower(server_url) - + _UniffiConverterOptionalTypeEsploraSyncConfig.check_lower(config) - + _uniffi_rust_call(_UniffiLib.uniffi_ldk_node_fn_method_builder_set_chain_source_esplora,self._uniffi_clone_pointer(), _UniffiConverterString.lower(server_url), _UniffiConverterOptionalTypeEsploraSyncConfig.lower(config)) @@ -4946,7 +5006,7 @@ def set_chain_source_esplora(self, server_url: "str",config: "typing.Optional[Es def set_channel_data_migration(self, migration: "ChannelDataMigration") -> None: _UniffiConverterTypeChannelDataMigration.check_lower(migration) - + _uniffi_rust_call(_UniffiLib.uniffi_ldk_node_fn_method_builder_set_channel_data_migration,self._uniffi_clone_pointer(), _UniffiConverterTypeChannelDataMigration.lower(migration)) @@ -4957,7 +5017,7 @@ def set_channel_data_migration(self, migration: "ChannelDataMigration") -> None: def set_custom_logger(self, log_writer: "LogWriter") -> None: _UniffiConverterTypeLogWriter.check_lower(log_writer) - + _uniffi_rust_call(_UniffiLib.uniffi_ldk_node_fn_method_builder_set_custom_logger,self._uniffi_clone_pointer(), _UniffiConverterTypeLogWriter.lower(log_writer)) @@ -4968,9 +5028,9 @@ def set_custom_logger(self, log_writer: "LogWriter") -> None: def set_entropy_bip39_mnemonic(self, mnemonic: "Mnemonic",passphrase: "typing.Optional[str]") -> None: _UniffiConverterTypeMnemonic.check_lower(mnemonic) - + _UniffiConverterOptionalString.check_lower(passphrase) - + _uniffi_rust_call(_UniffiLib.uniffi_ldk_node_fn_method_builder_set_entropy_bip39_mnemonic,self._uniffi_clone_pointer(), _UniffiConverterTypeMnemonic.lower(mnemonic), _UniffiConverterOptionalString.lower(passphrase)) @@ -4982,7 +5042,7 @@ def set_entropy_bip39_mnemonic(self, mnemonic: "Mnemonic",passphrase: "typing.Op def set_entropy_seed_bytes(self, seed_bytes: "typing.List[int]") -> None: _UniffiConverterSequenceUInt8.check_lower(seed_bytes) - + _uniffi_rust_call_with_error(_UniffiConverterTypeBuildError,_UniffiLib.uniffi_ldk_node_fn_method_builder_set_entropy_seed_bytes,self._uniffi_clone_pointer(), _UniffiConverterSequenceUInt8.lower(seed_bytes)) @@ -4993,7 +5053,7 @@ def set_entropy_seed_bytes(self, seed_bytes: "typing.List[int]") -> None: def set_entropy_seed_path(self, seed_path: "str") -> None: _UniffiConverterString.check_lower(seed_path) - + _uniffi_rust_call(_UniffiLib.uniffi_ldk_node_fn_method_builder_set_entropy_seed_path,self._uniffi_clone_pointer(), _UniffiConverterString.lower(seed_path)) @@ -5004,9 +5064,9 @@ def set_entropy_seed_path(self, seed_path: "str") -> None: def set_filesystem_logger(self, log_file_path: "typing.Optional[str]",max_log_level: "typing.Optional[LogLevel]") -> None: _UniffiConverterOptionalString.check_lower(log_file_path) - + _UniffiConverterOptionalTypeLogLevel.check_lower(max_log_level) - + _uniffi_rust_call(_UniffiLib.uniffi_ldk_node_fn_method_builder_set_filesystem_logger,self._uniffi_clone_pointer(), _UniffiConverterOptionalString.lower(log_file_path), _UniffiConverterOptionalTypeLogLevel.lower(max_log_level)) @@ -5026,7 +5086,7 @@ def set_gossip_source_p2p(self, ) -> None: def set_gossip_source_rgs(self, rgs_server_url: "str") -> None: _UniffiConverterString.check_lower(rgs_server_url) - + _uniffi_rust_call(_UniffiLib.uniffi_ldk_node_fn_method_builder_set_gossip_source_rgs,self._uniffi_clone_pointer(), _UniffiConverterString.lower(rgs_server_url)) @@ -5037,11 +5097,11 @@ def set_gossip_source_rgs(self, rgs_server_url: "str") -> None: def set_liquidity_source_lsps1(self, node_id: "PublicKey",address: "SocketAddress",token: "typing.Optional[str]") -> None: _UniffiConverterTypePublicKey.check_lower(node_id) - + _UniffiConverterTypeSocketAddress.check_lower(address) - + _UniffiConverterOptionalString.check_lower(token) - + _uniffi_rust_call(_UniffiLib.uniffi_ldk_node_fn_method_builder_set_liquidity_source_lsps1,self._uniffi_clone_pointer(), _UniffiConverterTypePublicKey.lower(node_id), _UniffiConverterTypeSocketAddress.lower(address), @@ -5054,11 +5114,11 @@ def set_liquidity_source_lsps1(self, node_id: "PublicKey",address: "SocketAddres def set_liquidity_source_lsps2(self, node_id: "PublicKey",address: "SocketAddress",token: "typing.Optional[str]") -> None: _UniffiConverterTypePublicKey.check_lower(node_id) - + _UniffiConverterTypeSocketAddress.check_lower(address) - + _UniffiConverterOptionalString.check_lower(token) - + _uniffi_rust_call(_UniffiLib.uniffi_ldk_node_fn_method_builder_set_liquidity_source_lsps2,self._uniffi_clone_pointer(), _UniffiConverterTypePublicKey.lower(node_id), _UniffiConverterTypeSocketAddress.lower(address), @@ -5071,7 +5131,7 @@ def set_liquidity_source_lsps2(self, node_id: "PublicKey",address: "SocketAddres def set_listening_addresses(self, listening_addresses: "typing.List[SocketAddress]") -> None: _UniffiConverterSequenceTypeSocketAddress.check_lower(listening_addresses) - + _uniffi_rust_call_with_error(_UniffiConverterTypeBuildError,_UniffiLib.uniffi_ldk_node_fn_method_builder_set_listening_addresses,self._uniffi_clone_pointer(), _UniffiConverterSequenceTypeSocketAddress.lower(listening_addresses)) @@ -5090,7 +5150,7 @@ def set_log_facade_logger(self, ) -> None: def set_network(self, network: "Network") -> None: _UniffiConverterTypeNetwork.check_lower(network) - + _uniffi_rust_call(_UniffiLib.uniffi_ldk_node_fn_method_builder_set_network,self._uniffi_clone_pointer(), _UniffiConverterTypeNetwork.lower(network)) @@ -5101,7 +5161,7 @@ def set_network(self, network: "Network") -> None: def set_node_alias(self, node_alias: "str") -> None: _UniffiConverterString.check_lower(node_alias) - + _uniffi_rust_call_with_error(_UniffiConverterTypeBuildError,_UniffiLib.uniffi_ldk_node_fn_method_builder_set_node_alias,self._uniffi_clone_pointer(), _UniffiConverterString.lower(node_alias)) @@ -5112,7 +5172,7 @@ def set_node_alias(self, node_alias: "str") -> None: def set_pathfinding_scores_source(self, url: "str") -> None: _UniffiConverterString.check_lower(url) - + _uniffi_rust_call(_UniffiLib.uniffi_ldk_node_fn_method_builder_set_pathfinding_scores_source,self._uniffi_clone_pointer(), _UniffiConverterString.lower(url)) @@ -5123,7 +5183,7 @@ def set_pathfinding_scores_source(self, url: "str") -> None: def set_storage_dir_path(self, storage_dir_path: "str") -> None: _UniffiConverterString.check_lower(storage_dir_path) - + _uniffi_rust_call(_UniffiLib.uniffi_ldk_node_fn_method_builder_set_storage_dir_path,self._uniffi_clone_pointer(), _UniffiConverterString.lower(storage_dir_path)) @@ -5174,7 +5234,7 @@ def to_sat_per_vb_floor(self, ): class FeeRate: _pointer: ctypes.c_void_p - + def __init__(self, *args, **kwargs): raise ValueError("This class has no default constructor") @@ -5198,7 +5258,7 @@ def _make_instance_(cls, pointer): @classmethod def from_sat_per_kwu(cls, sat_kwu: "int"): _UniffiConverterUInt64.check_lower(sat_kwu) - + # Call the (fallible) function before creating any half-baked object instances. pointer = _uniffi_rust_call(_UniffiLib.uniffi_ldk_node_fn_constructor_feerate_from_sat_per_kwu, _UniffiConverterUInt64.lower(sat_kwu)) @@ -5207,7 +5267,7 @@ def from_sat_per_kwu(cls, sat_kwu: "int"): @classmethod def from_sat_per_vb_unchecked(cls, sat_vb: "int"): _UniffiConverterUInt64.check_lower(sat_vb) - + # Call the (fallible) function before creating any half-baked object instances. pointer = _uniffi_rust_call(_UniffiLib.uniffi_ldk_node_fn_constructor_feerate_from_sat_per_vb_unchecked, _UniffiConverterUInt64.lower(sat_vb)) @@ -5280,7 +5340,7 @@ def log(self, record: "LogRecord"): class LogWriterImpl: _pointer: ctypes.c_void_p - + def __init__(self, *args, **kwargs): raise ValueError("This class has no default constructor") @@ -5305,7 +5365,7 @@ def _make_instance_(cls, pointer): def log(self, record: "LogRecord") -> None: _UniffiConverterTypeLogRecord.check_lower(record) - + _uniffi_rust_call(_UniffiLib.uniffi_ldk_node_fn_method_logwriter_log,self._uniffi_clone_pointer(), _UniffiConverterTypeLogRecord.lower(record)) @@ -5362,7 +5422,7 @@ def make_call(): method = uniffi_obj.log return method(*args) - + write_return_value = lambda v: None _uniffi_trait_interface_call( uniffi_call_status_ptr.contents, @@ -5422,7 +5482,7 @@ def request_channel(self, lsp_balance_sat: "int",client_balance_sat: "int",chann class Lsps1Liquidity: _pointer: ctypes.c_void_p - + def __init__(self, *args, **kwargs): raise ValueError("This class has no default constructor") @@ -5447,7 +5507,7 @@ def _make_instance_(cls, pointer): def check_order_status(self, order_id: "Lsps1OrderId") -> "Lsps1OrderStatus": _UniffiConverterTypeLsps1OrderId.check_lower(order_id) - + return _UniffiConverterTypeLsps1OrderStatus.lift( _uniffi_rust_call_with_error(_UniffiConverterTypeNodeError,_UniffiLib.uniffi_ldk_node_fn_method_lsps1liquidity_check_order_status,self._uniffi_clone_pointer(), _UniffiConverterTypeLsps1OrderId.lower(order_id)) @@ -5459,13 +5519,13 @@ def check_order_status(self, order_id: "Lsps1OrderId") -> "Lsps1OrderStatus": def request_channel(self, lsp_balance_sat: "int",client_balance_sat: "int",channel_expiry_blocks: "int",announce_channel: "bool") -> "Lsps1OrderStatus": _UniffiConverterUInt64.check_lower(lsp_balance_sat) - + _UniffiConverterUInt64.check_lower(client_balance_sat) - + _UniffiConverterUInt32.check_lower(channel_expiry_blocks) - + _UniffiConverterBool.check_lower(announce_channel) - + return _UniffiConverterTypeLsps1OrderStatus.lift( _uniffi_rust_call_with_error(_UniffiConverterTypeNodeError,_UniffiLib.uniffi_ldk_node_fn_method_lsps1liquidity_request_channel,self._uniffi_clone_pointer(), _UniffiConverterUInt64.lower(lsp_balance_sat), @@ -5522,7 +5582,7 @@ def node(self, node_id: "NodeId"): class NetworkGraph: _pointer: ctypes.c_void_p - + def __init__(self, *args, **kwargs): raise ValueError("This class has no default constructor") @@ -5547,7 +5607,7 @@ def _make_instance_(cls, pointer): def channel(self, short_channel_id: "int") -> "typing.Optional[ChannelInfo]": _UniffiConverterUInt64.check_lower(short_channel_id) - + return _UniffiConverterOptionalTypeChannelInfo.lift( _uniffi_rust_call(_UniffiLib.uniffi_ldk_node_fn_method_networkgraph_channel,self._uniffi_clone_pointer(), _UniffiConverterUInt64.lower(short_channel_id)) @@ -5577,7 +5637,7 @@ def list_nodes(self, ) -> "typing.List[NodeId]": def node(self, node_id: "NodeId") -> "typing.Optional[NodeInfo]": _UniffiConverterTypeNodeId.check_lower(node_id) - + return _UniffiConverterOptionalTypeNodeInfo.lift( _uniffi_rust_call(_UniffiLib.uniffi_ldk_node_fn_method_networkgraph_node,self._uniffi_clone_pointer(), _UniffiConverterTypeNodeId.lower(node_id)) @@ -5721,7 +5781,7 @@ def wait_next_event(self, ): class Node: _pointer: ctypes.c_void_p - + def __init__(self, *args, **kwargs): raise ValueError("This class has no default constructor") @@ -5746,9 +5806,9 @@ def _make_instance_(cls, pointer): def add_address_type_to_monitor(self, address_type: "AddressType",seed_bytes: "typing.List[int]") -> None: _UniffiConverterTypeAddressType.check_lower(address_type) - + _UniffiConverterSequenceUInt8.check_lower(seed_bytes) - + _uniffi_rust_call_with_error(_UniffiConverterTypeNodeError,_UniffiLib.uniffi_ldk_node_fn_method_node_add_address_type_to_monitor,self._uniffi_clone_pointer(), _UniffiConverterTypeAddressType.lower(address_type), _UniffiConverterSequenceUInt8.lower(seed_bytes)) @@ -5760,11 +5820,11 @@ def add_address_type_to_monitor(self, address_type: "AddressType",seed_bytes: "t def add_address_type_to_monitor_with_mnemonic(self, address_type: "AddressType",mnemonic: "Mnemonic",passphrase: "typing.Optional[str]") -> None: _UniffiConverterTypeAddressType.check_lower(address_type) - + _UniffiConverterTypeMnemonic.check_lower(mnemonic) - + _UniffiConverterOptionalString.check_lower(passphrase) - + _uniffi_rust_call_with_error(_UniffiConverterTypeNodeError,_UniffiLib.uniffi_ldk_node_fn_method_node_add_address_type_to_monitor_with_mnemonic,self._uniffi_clone_pointer(), _UniffiConverterTypeAddressType.lower(address_type), _UniffiConverterTypeMnemonic.lower(mnemonic), @@ -5804,9 +5864,9 @@ def bolt12_payment(self, ) -> "Bolt12Payment": def close_channel(self, user_channel_id: "UserChannelId",counterparty_node_id: "PublicKey") -> None: _UniffiConverterTypeUserChannelId.check_lower(user_channel_id) - + _UniffiConverterTypePublicKey.check_lower(counterparty_node_id) - + _uniffi_rust_call_with_error(_UniffiConverterTypeNodeError,_UniffiLib.uniffi_ldk_node_fn_method_node_close_channel,self._uniffi_clone_pointer(), _UniffiConverterTypeUserChannelId.lower(user_channel_id), _UniffiConverterTypePublicKey.lower(counterparty_node_id)) @@ -5827,11 +5887,11 @@ def config(self, ) -> "Config": def connect(self, node_id: "PublicKey",address: "SocketAddress",persist: "bool") -> None: _UniffiConverterTypePublicKey.check_lower(node_id) - + _UniffiConverterTypeSocketAddress.check_lower(address) - + _UniffiConverterBool.check_lower(persist) - + _uniffi_rust_call_with_error(_UniffiConverterTypeNodeError,_UniffiLib.uniffi_ldk_node_fn_method_node_connect,self._uniffi_clone_pointer(), _UniffiConverterTypePublicKey.lower(node_id), _UniffiConverterTypeSocketAddress.lower(address), @@ -5853,7 +5913,7 @@ def current_sync_intervals(self, ) -> "RuntimeSyncIntervals": def disconnect(self, node_id: "PublicKey") -> None: _UniffiConverterTypePublicKey.check_lower(node_id) - + _uniffi_rust_call_with_error(_UniffiConverterTypeNodeError,_UniffiLib.uniffi_ldk_node_fn_method_node_disconnect,self._uniffi_clone_pointer(), _UniffiConverterTypePublicKey.lower(node_id)) @@ -5881,11 +5941,11 @@ def export_pathfinding_scores(self, ) -> "bytes": def force_close_channel(self, user_channel_id: "UserChannelId",counterparty_node_id: "PublicKey",reason: "typing.Optional[str]") -> None: _UniffiConverterTypeUserChannelId.check_lower(user_channel_id) - + _UniffiConverterTypePublicKey.check_lower(counterparty_node_id) - + _UniffiConverterOptionalString.check_lower(reason) - + _uniffi_rust_call_with_error(_UniffiConverterTypeNodeError,_UniffiLib.uniffi_ldk_node_fn_method_node_force_close_channel,self._uniffi_clone_pointer(), _UniffiConverterTypeUserChannelId.lower(user_channel_id), _UniffiConverterTypePublicKey.lower(counterparty_node_id), @@ -5898,7 +5958,7 @@ def force_close_channel(self, user_channel_id: "UserChannelId",counterparty_node def get_address_balance(self, address_str: "str") -> "int": _UniffiConverterString.check_lower(address_str) - + return _UniffiConverterUInt64.lift( _uniffi_rust_call_with_error(_UniffiConverterTypeNodeError,_UniffiLib.uniffi_ldk_node_fn_method_node_get_address_balance,self._uniffi_clone_pointer(), _UniffiConverterString.lower(address_str)) @@ -5910,7 +5970,7 @@ def get_address_balance(self, address_str: "str") -> "int": def get_balance_for_address_type(self, address_type: "AddressType") -> "AddressTypeBalance": _UniffiConverterTypeAddressType.check_lower(address_type) - + return _UniffiConverterTypeAddressTypeBalance.lift( _uniffi_rust_call_with_error(_UniffiConverterTypeNodeError,_UniffiLib.uniffi_ldk_node_fn_method_node_get_balance_for_address_type,self._uniffi_clone_pointer(), _UniffiConverterTypeAddressType.lower(address_type)) @@ -5922,7 +5982,7 @@ def get_balance_for_address_type(self, address_type: "AddressType") -> "AddressT def get_transaction_details(self, txid: "Txid") -> "typing.Optional[TransactionDetails]": _UniffiConverterTypeTxid.check_lower(txid) - + return _UniffiConverterOptionalTypeTransactionDetails.lift( _uniffi_rust_call(_UniffiLib.uniffi_ldk_node_fn_method_node_get_transaction_details,self._uniffi_clone_pointer(), _UniffiConverterTypeTxid.lower(txid)) @@ -6015,14 +6075,14 @@ def next_event(self, ) -> "typing.Optional[Event]": async def next_event_async(self, ) -> "Event": return await _uniffi_rust_call_async( _UniffiLib.uniffi_ldk_node_fn_method_node_next_event_async( - self._uniffi_clone_pointer(), + self._uniffi_clone_pointer(), ), _UniffiLib.ffi_ldk_node_rust_future_poll_rust_buffer, _UniffiLib.ffi_ldk_node_rust_future_complete_rust_buffer, _UniffiLib.ffi_ldk_node_rust_future_free_rust_buffer, # lift function _UniffiConverterTypeEvent.lift, - + # Error FFI converter None, @@ -6061,15 +6121,15 @@ def onchain_payment(self, ) -> "OnchainPayment": def open_announced_channel(self, node_id: "PublicKey",address: "SocketAddress",channel_amount_sats: "int",push_to_counterparty_msat: "typing.Optional[int]",channel_config: "typing.Optional[ChannelConfig]") -> "UserChannelId": _UniffiConverterTypePublicKey.check_lower(node_id) - + _UniffiConverterTypeSocketAddress.check_lower(address) - + _UniffiConverterUInt64.check_lower(channel_amount_sats) - + _UniffiConverterOptionalUInt64.check_lower(push_to_counterparty_msat) - + _UniffiConverterOptionalTypeChannelConfig.check_lower(channel_config) - + return _UniffiConverterTypeUserChannelId.lift( _uniffi_rust_call_with_error(_UniffiConverterTypeNodeError,_UniffiLib.uniffi_ldk_node_fn_method_node_open_announced_channel,self._uniffi_clone_pointer(), _UniffiConverterTypePublicKey.lower(node_id), @@ -6085,15 +6145,15 @@ def open_announced_channel(self, node_id: "PublicKey",address: "SocketAddress",c def open_channel(self, node_id: "PublicKey",address: "SocketAddress",channel_amount_sats: "int",push_to_counterparty_msat: "typing.Optional[int]",channel_config: "typing.Optional[ChannelConfig]") -> "UserChannelId": _UniffiConverterTypePublicKey.check_lower(node_id) - + _UniffiConverterTypeSocketAddress.check_lower(address) - + _UniffiConverterUInt64.check_lower(channel_amount_sats) - + _UniffiConverterOptionalUInt64.check_lower(push_to_counterparty_msat) - + _UniffiConverterOptionalTypeChannelConfig.check_lower(channel_config) - + return _UniffiConverterTypeUserChannelId.lift( _uniffi_rust_call_with_error(_UniffiConverterTypeNodeError,_UniffiLib.uniffi_ldk_node_fn_method_node_open_channel,self._uniffi_clone_pointer(), _UniffiConverterTypePublicKey.lower(node_id), @@ -6109,7 +6169,7 @@ def open_channel(self, node_id: "PublicKey",address: "SocketAddress",channel_amo def payment(self, payment_id: "PaymentId") -> "typing.Optional[PaymentDetails]": _UniffiConverterTypePaymentId.check_lower(payment_id) - + return _UniffiConverterOptionalTypePaymentDetails.lift( _uniffi_rust_call(_UniffiLib.uniffi_ldk_node_fn_method_node_payment,self._uniffi_clone_pointer(), _UniffiConverterTypePaymentId.lower(payment_id)) @@ -6121,7 +6181,7 @@ def payment(self, payment_id: "PaymentId") -> "typing.Optional[PaymentDetails]": def remove_address_type_from_monitor(self, address_type: "AddressType") -> None: _UniffiConverterTypeAddressType.check_lower(address_type) - + _uniffi_rust_call_with_error(_UniffiConverterTypeNodeError,_UniffiLib.uniffi_ldk_node_fn_method_node_remove_address_type_from_monitor,self._uniffi_clone_pointer(), _UniffiConverterTypeAddressType.lower(address_type)) @@ -6132,7 +6192,7 @@ def remove_address_type_from_monitor(self, address_type: "AddressType") -> None: def remove_payment(self, payment_id: "PaymentId") -> None: _UniffiConverterTypePaymentId.check_lower(payment_id) - + _uniffi_rust_call_with_error(_UniffiConverterTypeNodeError,_UniffiLib.uniffi_ldk_node_fn_method_node_remove_payment,self._uniffi_clone_pointer(), _UniffiConverterTypePaymentId.lower(payment_id)) @@ -6143,9 +6203,9 @@ def remove_payment(self, payment_id: "PaymentId") -> None: def set_primary_address_type(self, address_type: "AddressType",seed_bytes: "typing.List[int]") -> None: _UniffiConverterTypeAddressType.check_lower(address_type) - + _UniffiConverterSequenceUInt8.check_lower(seed_bytes) - + _uniffi_rust_call_with_error(_UniffiConverterTypeNodeError,_UniffiLib.uniffi_ldk_node_fn_method_node_set_primary_address_type,self._uniffi_clone_pointer(), _UniffiConverterTypeAddressType.lower(address_type), _UniffiConverterSequenceUInt8.lower(seed_bytes)) @@ -6157,11 +6217,11 @@ def set_primary_address_type(self, address_type: "AddressType",seed_bytes: "typi def set_primary_address_type_with_mnemonic(self, address_type: "AddressType",mnemonic: "Mnemonic",passphrase: "typing.Optional[str]") -> None: _UniffiConverterTypeAddressType.check_lower(address_type) - + _UniffiConverterTypeMnemonic.check_lower(mnemonic) - + _UniffiConverterOptionalString.check_lower(passphrase) - + _uniffi_rust_call_with_error(_UniffiConverterTypeNodeError,_UniffiLib.uniffi_ldk_node_fn_method_node_set_primary_address_type_with_mnemonic,self._uniffi_clone_pointer(), _UniffiConverterTypeAddressType.lower(address_type), _UniffiConverterTypeMnemonic.lower(mnemonic), @@ -6174,7 +6234,7 @@ def set_primary_address_type_with_mnemonic(self, address_type: "AddressType",mne def sign_message(self, msg: "typing.List[int]") -> "str": _UniffiConverterSequenceUInt8.check_lower(msg) - + return _UniffiConverterString.lift( _uniffi_rust_call(_UniffiLib.uniffi_ldk_node_fn_method_node_sign_message,self._uniffi_clone_pointer(), _UniffiConverterSequenceUInt8.lower(msg)) @@ -6186,11 +6246,11 @@ def sign_message(self, msg: "typing.List[int]") -> "str": def splice_in(self, user_channel_id: "UserChannelId",counterparty_node_id: "PublicKey",splice_amount_sats: "int") -> None: _UniffiConverterTypeUserChannelId.check_lower(user_channel_id) - + _UniffiConverterTypePublicKey.check_lower(counterparty_node_id) - + _UniffiConverterUInt64.check_lower(splice_amount_sats) - + _uniffi_rust_call_with_error(_UniffiConverterTypeNodeError,_UniffiLib.uniffi_ldk_node_fn_method_node_splice_in,self._uniffi_clone_pointer(), _UniffiConverterTypeUserChannelId.lower(user_channel_id), _UniffiConverterTypePublicKey.lower(counterparty_node_id), @@ -6203,13 +6263,13 @@ def splice_in(self, user_channel_id: "UserChannelId",counterparty_node_id: "Publ def splice_out(self, user_channel_id: "UserChannelId",counterparty_node_id: "PublicKey",address: "Address",splice_amount_sats: "int") -> None: _UniffiConverterTypeUserChannelId.check_lower(user_channel_id) - + _UniffiConverterTypePublicKey.check_lower(counterparty_node_id) - + _UniffiConverterTypeAddress.check_lower(address) - + _UniffiConverterUInt64.check_lower(splice_amount_sats) - + _uniffi_rust_call_with_error(_UniffiConverterTypeNodeError,_UniffiLib.uniffi_ldk_node_fn_method_node_splice_out,self._uniffi_clone_pointer(), _UniffiConverterTypeUserChannelId.lower(user_channel_id), _UniffiConverterTypePublicKey.lower(counterparty_node_id), @@ -6274,11 +6334,11 @@ def unified_qr_payment(self, ) -> "UnifiedQrPayment": def update_channel_config(self, user_channel_id: "UserChannelId",counterparty_node_id: "PublicKey",channel_config: "ChannelConfig") -> None: _UniffiConverterTypeUserChannelId.check_lower(user_channel_id) - + _UniffiConverterTypePublicKey.check_lower(counterparty_node_id) - + _UniffiConverterTypeChannelConfig.check_lower(channel_config) - + _uniffi_rust_call_with_error(_UniffiConverterTypeNodeError,_UniffiLib.uniffi_ldk_node_fn_method_node_update_channel_config,self._uniffi_clone_pointer(), _UniffiConverterTypeUserChannelId.lower(user_channel_id), _UniffiConverterTypePublicKey.lower(counterparty_node_id), @@ -6291,7 +6351,7 @@ def update_channel_config(self, user_channel_id: "UserChannelId",counterparty_no def update_sync_intervals(self, intervals: "RuntimeSyncIntervals") -> None: _UniffiConverterTypeRuntimeSyncIntervals.check_lower(intervals) - + _uniffi_rust_call_with_error(_UniffiConverterTypeNodeError,_UniffiLib.uniffi_ldk_node_fn_method_node_update_sync_intervals,self._uniffi_clone_pointer(), _UniffiConverterTypeRuntimeSyncIntervals.lower(intervals)) @@ -6302,11 +6362,11 @@ def update_sync_intervals(self, intervals: "RuntimeSyncIntervals") -> None: def verify_signature(self, msg: "typing.List[int]",sig: "str",pkey: "PublicKey") -> "bool": _UniffiConverterSequenceUInt8.check_lower(msg) - + _UniffiConverterString.check_lower(sig) - + _UniffiConverterTypePublicKey.check_lower(pkey) - + return _UniffiConverterBool.lift( _uniffi_rust_call(_UniffiLib.uniffi_ldk_node_fn_method_node_verify_signature,self._uniffi_clone_pointer(), _UniffiConverterSequenceUInt8.lower(msg), @@ -6387,7 +6447,7 @@ def supports_chain(self, chain: "Network"): class Offer: _pointer: ctypes.c_void_p - + def __init__(self, *args, **kwargs): raise ValueError("This class has no default constructor") @@ -6411,7 +6471,7 @@ def _make_instance_(cls, pointer): @classmethod def from_str(cls, offer_str: "str"): _UniffiConverterString.check_lower(offer_str) - + # Call the (fallible) function before creating any half-baked object instances. pointer = _uniffi_rust_call_with_error(_UniffiConverterTypeNodeError,_UniffiLib.uniffi_ldk_node_fn_constructor_offer_from_str, _UniffiConverterString.lower(offer_str)) @@ -6475,7 +6535,7 @@ def is_expired(self, ) -> "bool": def is_valid_quantity(self, quantity: "int") -> "bool": _UniffiConverterUInt64.check_lower(quantity) - + return _UniffiConverterBool.lift( _uniffi_rust_call(_UniffiLib.uniffi_ldk_node_fn_method_offer_is_valid_quantity,self._uniffi_clone_pointer(), _UniffiConverterUInt64.lower(quantity)) @@ -6523,7 +6583,7 @@ def offer_description(self, ) -> "typing.Optional[str]": def supports_chain(self, chain: "Network") -> "bool": _UniffiConverterTypeNetwork.check_lower(chain) - + return _UniffiConverterBool.lift( _uniffi_rust_call(_UniffiLib.uniffi_ldk_node_fn_method_offer_supports_chain,self._uniffi_clone_pointer(), _UniffiConverterTypeNetwork.lower(chain)) @@ -6598,6 +6658,10 @@ def write(cls, value: OfferProtocol, buf: _UniffiRustBuffer): class OnchainPaymentProtocol(typing.Protocol): def accelerate_by_cpfp(self, txid: "Txid",fee_rate: "typing.Optional[FeeRate]",destination_address: "typing.Optional[Address]"): raise NotImplementedError + def address_info_for_type_at_index(self, address_type: "AddressType",keychain: "KeychainKind",index: "int"): + raise NotImplementedError + def address_infos_for_type(self, address_type: "AddressType",keychain: "KeychainKind",start_index: "int",count: "int"): + raise NotImplementedError def bump_fee_by_rbf(self, txid: "Txid",fee_rate: "FeeRate"): raise NotImplementedError def calculate_cpfp_fee_rate(self, parent_txid: "Txid",urgent: "bool"): @@ -6612,6 +6676,12 @@ def new_address(self, ): raise NotImplementedError def new_address_for_type(self, address_type: "AddressType"): raise NotImplementedError + def new_address_info(self, ): + raise NotImplementedError + def new_address_info_for_type(self, address_type: "AddressType"): + raise NotImplementedError + def reveal_receive_addresses_to(self, address_type: "AddressType",index: "int"): + raise NotImplementedError def select_utxos_with_algorithm(self, target_amount_sats: "int",fee_rate: "typing.Optional[FeeRate]",algorithm: "CoinSelectionAlgorithm",utxos: "typing.Optional[typing.List[SpendableUtxo]]"): raise NotImplementedError def send_all_to_address(self, address: "Address",retain_reserve: "bool",fee_rate: "typing.Optional[FeeRate]"): @@ -6622,7 +6692,7 @@ def send_to_address(self, address: "Address",amount_sats: "int",fee_rate: "typin class OnchainPayment: _pointer: ctypes.c_void_p - + def __init__(self, *args, **kwargs): raise ValueError("This class has no default constructor") @@ -6647,11 +6717,11 @@ def _make_instance_(cls, pointer): def accelerate_by_cpfp(self, txid: "Txid",fee_rate: "typing.Optional[FeeRate]",destination_address: "typing.Optional[Address]") -> "Txid": _UniffiConverterTypeTxid.check_lower(txid) - + _UniffiConverterOptionalTypeFeeRate.check_lower(fee_rate) - + _UniffiConverterOptionalTypeAddress.check_lower(destination_address) - + return _UniffiConverterTypeTxid.lift( _uniffi_rust_call_with_error(_UniffiConverterTypeNodeError,_UniffiLib.uniffi_ldk_node_fn_method_onchainpayment_accelerate_by_cpfp,self._uniffi_clone_pointer(), _UniffiConverterTypeTxid.lower(txid), @@ -6663,11 +6733,50 @@ def accelerate_by_cpfp(self, txid: "Txid",fee_rate: "typing.Optional[FeeRate]",d + def address_info_for_type_at_index(self, address_type: "AddressType",keychain: "KeychainKind",index: "int") -> "AddressInfo": + _UniffiConverterTypeAddressType.check_lower(address_type) + + _UniffiConverterTypeKeychainKind.check_lower(keychain) + + _UniffiConverterUInt32.check_lower(index) + + return _UniffiConverterTypeAddressInfo.lift( + _uniffi_rust_call_with_error(_UniffiConverterTypeNodeError,_UniffiLib.uniffi_ldk_node_fn_method_onchainpayment_address_info_for_type_at_index,self._uniffi_clone_pointer(), + _UniffiConverterTypeAddressType.lower(address_type), + _UniffiConverterTypeKeychainKind.lower(keychain), + _UniffiConverterUInt32.lower(index)) + ) + + + + + + def address_infos_for_type(self, address_type: "AddressType",keychain: "KeychainKind",start_index: "int",count: "int") -> "typing.List[AddressInfo]": + _UniffiConverterTypeAddressType.check_lower(address_type) + + _UniffiConverterTypeKeychainKind.check_lower(keychain) + + _UniffiConverterUInt32.check_lower(start_index) + + _UniffiConverterUInt32.check_lower(count) + + return _UniffiConverterSequenceTypeAddressInfo.lift( + _uniffi_rust_call_with_error(_UniffiConverterTypeNodeError,_UniffiLib.uniffi_ldk_node_fn_method_onchainpayment_address_infos_for_type,self._uniffi_clone_pointer(), + _UniffiConverterTypeAddressType.lower(address_type), + _UniffiConverterTypeKeychainKind.lower(keychain), + _UniffiConverterUInt32.lower(start_index), + _UniffiConverterUInt32.lower(count)) + ) + + + + + def bump_fee_by_rbf(self, txid: "Txid",fee_rate: "FeeRate") -> "Txid": _UniffiConverterTypeTxid.check_lower(txid) - + _UniffiConverterTypeFeeRate.check_lower(fee_rate) - + return _UniffiConverterTypeTxid.lift( _uniffi_rust_call_with_error(_UniffiConverterTypeNodeError,_UniffiLib.uniffi_ldk_node_fn_method_onchainpayment_bump_fee_by_rbf,self._uniffi_clone_pointer(), _UniffiConverterTypeTxid.lower(txid), @@ -6680,9 +6789,9 @@ def bump_fee_by_rbf(self, txid: "Txid",fee_rate: "FeeRate") -> "Txid": def calculate_cpfp_fee_rate(self, parent_txid: "Txid",urgent: "bool") -> "FeeRate": _UniffiConverterTypeTxid.check_lower(parent_txid) - + _UniffiConverterBool.check_lower(urgent) - + return _UniffiConverterTypeFeeRate.lift( _uniffi_rust_call_with_error(_UniffiConverterTypeNodeError,_UniffiLib.uniffi_ldk_node_fn_method_onchainpayment_calculate_cpfp_fee_rate,self._uniffi_clone_pointer(), _UniffiConverterTypeTxid.lower(parent_txid), @@ -6695,11 +6804,11 @@ def calculate_cpfp_fee_rate(self, parent_txid: "Txid",urgent: "bool") -> "FeeRat def calculate_send_all_fee(self, address: "Address",retain_reserves: "bool",fee_rate: "typing.Optional[FeeRate]") -> "int": _UniffiConverterTypeAddress.check_lower(address) - + _UniffiConverterBool.check_lower(retain_reserves) - + _UniffiConverterOptionalTypeFeeRate.check_lower(fee_rate) - + return _UniffiConverterUInt64.lift( _uniffi_rust_call_with_error(_UniffiConverterTypeNodeError,_UniffiLib.uniffi_ldk_node_fn_method_onchainpayment_calculate_send_all_fee,self._uniffi_clone_pointer(), _UniffiConverterTypeAddress.lower(address), @@ -6713,13 +6822,13 @@ def calculate_send_all_fee(self, address: "Address",retain_reserves: "bool",fee_ def calculate_total_fee(self, address: "Address",amount_sats: "int",fee_rate: "typing.Optional[FeeRate]",utxos_to_spend: "typing.Optional[typing.List[SpendableUtxo]]") -> "int": _UniffiConverterTypeAddress.check_lower(address) - + _UniffiConverterUInt64.check_lower(amount_sats) - + _UniffiConverterOptionalTypeFeeRate.check_lower(fee_rate) - + _UniffiConverterOptionalSequenceTypeSpendableUtxo.check_lower(utxos_to_spend) - + return _UniffiConverterUInt64.lift( _uniffi_rust_call_with_error(_UniffiConverterTypeNodeError,_UniffiLib.uniffi_ldk_node_fn_method_onchainpayment_calculate_total_fee,self._uniffi_clone_pointer(), _UniffiConverterTypeAddress.lower(address), @@ -6752,7 +6861,7 @@ def new_address(self, ) -> "Address": def new_address_for_type(self, address_type: "AddressType") -> "Address": _UniffiConverterTypeAddressType.check_lower(address_type) - + return _UniffiConverterTypeAddress.lift( _uniffi_rust_call_with_error(_UniffiConverterTypeNodeError,_UniffiLib.uniffi_ldk_node_fn_method_onchainpayment_new_address_for_type,self._uniffi_clone_pointer(), _UniffiConverterTypeAddressType.lower(address_type)) @@ -6762,15 +6871,50 @@ def new_address_for_type(self, address_type: "AddressType") -> "Address": + def new_address_info(self, ) -> "AddressInfo": + return _UniffiConverterTypeAddressInfo.lift( + _uniffi_rust_call_with_error(_UniffiConverterTypeNodeError,_UniffiLib.uniffi_ldk_node_fn_method_onchainpayment_new_address_info,self._uniffi_clone_pointer(),) + ) + + + + + + def new_address_info_for_type(self, address_type: "AddressType") -> "AddressInfo": + _UniffiConverterTypeAddressType.check_lower(address_type) + + return _UniffiConverterTypeAddressInfo.lift( + _uniffi_rust_call_with_error(_UniffiConverterTypeNodeError,_UniffiLib.uniffi_ldk_node_fn_method_onchainpayment_new_address_info_for_type,self._uniffi_clone_pointer(), + _UniffiConverterTypeAddressType.lower(address_type)) + ) + + + + + + def reveal_receive_addresses_to(self, address_type: "AddressType",index: "int") -> None: + _UniffiConverterTypeAddressType.check_lower(address_type) + + _UniffiConverterUInt32.check_lower(index) + + _uniffi_rust_call_with_error(_UniffiConverterTypeNodeError,_UniffiLib.uniffi_ldk_node_fn_method_onchainpayment_reveal_receive_addresses_to,self._uniffi_clone_pointer(), + _UniffiConverterTypeAddressType.lower(address_type), + _UniffiConverterUInt32.lower(index)) + + + + + + def select_utxos_with_algorithm(self, target_amount_sats: "int",fee_rate: "typing.Optional[FeeRate]",algorithm: "CoinSelectionAlgorithm",utxos: "typing.Optional[typing.List[SpendableUtxo]]") -> "typing.List[SpendableUtxo]": _UniffiConverterUInt64.check_lower(target_amount_sats) - + _UniffiConverterOptionalTypeFeeRate.check_lower(fee_rate) - + _UniffiConverterTypeCoinSelectionAlgorithm.check_lower(algorithm) - + _UniffiConverterOptionalSequenceTypeSpendableUtxo.check_lower(utxos) - + return _UniffiConverterSequenceTypeSpendableUtxo.lift( _uniffi_rust_call_with_error(_UniffiConverterTypeNodeError,_UniffiLib.uniffi_ldk_node_fn_method_onchainpayment_select_utxos_with_algorithm,self._uniffi_clone_pointer(), _UniffiConverterUInt64.lower(target_amount_sats), @@ -6785,11 +6929,11 @@ def select_utxos_with_algorithm(self, target_amount_sats: "int",fee_rate: "typin def send_all_to_address(self, address: "Address",retain_reserve: "bool",fee_rate: "typing.Optional[FeeRate]") -> "Txid": _UniffiConverterTypeAddress.check_lower(address) - + _UniffiConverterBool.check_lower(retain_reserve) - + _UniffiConverterOptionalTypeFeeRate.check_lower(fee_rate) - + return _UniffiConverterTypeTxid.lift( _uniffi_rust_call_with_error(_UniffiConverterTypeNodeError,_UniffiLib.uniffi_ldk_node_fn_method_onchainpayment_send_all_to_address,self._uniffi_clone_pointer(), _UniffiConverterTypeAddress.lower(address), @@ -6803,13 +6947,13 @@ def send_all_to_address(self, address: "Address",retain_reserve: "bool",fee_rate def send_to_address(self, address: "Address",amount_sats: "int",fee_rate: "typing.Optional[FeeRate]",utxos_to_spend: "typing.Optional[typing.List[SpendableUtxo]]") -> "Txid": _UniffiConverterTypeAddress.check_lower(address) - + _UniffiConverterUInt64.check_lower(amount_sats) - + _UniffiConverterOptionalTypeFeeRate.check_lower(fee_rate) - + _UniffiConverterOptionalSequenceTypeSpendableUtxo.check_lower(utxos_to_spend) - + return _UniffiConverterTypeTxid.lift( _uniffi_rust_call_with_error(_UniffiConverterTypeNodeError,_UniffiLib.uniffi_ldk_node_fn_method_onchainpayment_send_to_address,self._uniffi_clone_pointer(), _UniffiConverterTypeAddress.lower(address), @@ -6878,7 +7022,7 @@ def refund_description(self, ): class Refund: _pointer: ctypes.c_void_p - + def __init__(self, *args, **kwargs): raise ValueError("This class has no default constructor") @@ -6902,7 +7046,7 @@ def _make_instance_(cls, pointer): @classmethod def from_str(cls, refund_str: "str"): _UniffiConverterString.check_lower(refund_str) - + # Call the (fallible) function before creating any half-baked object instances. pointer = _uniffi_rust_call_with_error(_UniffiConverterTypeNodeError,_UniffiLib.uniffi_ldk_node_fn_constructor_refund_from_str, _UniffiConverterString.lower(refund_str)) @@ -7077,7 +7221,7 @@ def send_with_preimage_and_custom_tlvs(self, amount_msat: "int",node_id: "Public class SpontaneousPayment: _pointer: ctypes.c_void_p - + def __init__(self, *args, **kwargs): raise ValueError("This class has no default constructor") @@ -7102,11 +7246,11 @@ def _make_instance_(cls, pointer): def send(self, amount_msat: "int",node_id: "PublicKey",route_parameters: "typing.Optional[RouteParametersConfig]") -> "PaymentId": _UniffiConverterUInt64.check_lower(amount_msat) - + _UniffiConverterTypePublicKey.check_lower(node_id) - + _UniffiConverterOptionalTypeRouteParametersConfig.check_lower(route_parameters) - + return _UniffiConverterTypePaymentId.lift( _uniffi_rust_call_with_error(_UniffiConverterTypeNodeError,_UniffiLib.uniffi_ldk_node_fn_method_spontaneouspayment_send,self._uniffi_clone_pointer(), _UniffiConverterUInt64.lower(amount_msat), @@ -7120,9 +7264,9 @@ def send(self, amount_msat: "int",node_id: "PublicKey",route_parameters: "typing def send_probes(self, amount_msat: "int",node_id: "PublicKey") -> "typing.List[ProbeHandle]": _UniffiConverterUInt64.check_lower(amount_msat) - + _UniffiConverterTypePublicKey.check_lower(node_id) - + return _UniffiConverterSequenceTypeProbeHandle.lift( _uniffi_rust_call_with_error(_UniffiConverterTypeNodeError,_UniffiLib.uniffi_ldk_node_fn_method_spontaneouspayment_send_probes,self._uniffi_clone_pointer(), _UniffiConverterUInt64.lower(amount_msat), @@ -7135,13 +7279,13 @@ def send_probes(self, amount_msat: "int",node_id: "PublicKey") -> "typing.List[P def send_with_custom_tlvs(self, amount_msat: "int",node_id: "PublicKey",route_parameters: "typing.Optional[RouteParametersConfig]",custom_tlvs: "typing.List[CustomTlvRecord]") -> "PaymentId": _UniffiConverterUInt64.check_lower(amount_msat) - + _UniffiConverterTypePublicKey.check_lower(node_id) - + _UniffiConverterOptionalTypeRouteParametersConfig.check_lower(route_parameters) - + _UniffiConverterSequenceTypeCustomTlvRecord.check_lower(custom_tlvs) - + return _UniffiConverterTypePaymentId.lift( _uniffi_rust_call_with_error(_UniffiConverterTypeNodeError,_UniffiLib.uniffi_ldk_node_fn_method_spontaneouspayment_send_with_custom_tlvs,self._uniffi_clone_pointer(), _UniffiConverterUInt64.lower(amount_msat), @@ -7156,13 +7300,13 @@ def send_with_custom_tlvs(self, amount_msat: "int",node_id: "PublicKey",route_pa def send_with_preimage(self, amount_msat: "int",node_id: "PublicKey",preimage: "PaymentPreimage",route_parameters: "typing.Optional[RouteParametersConfig]") -> "PaymentId": _UniffiConverterUInt64.check_lower(amount_msat) - + _UniffiConverterTypePublicKey.check_lower(node_id) - + _UniffiConverterTypePaymentPreimage.check_lower(preimage) - + _UniffiConverterOptionalTypeRouteParametersConfig.check_lower(route_parameters) - + return _UniffiConverterTypePaymentId.lift( _uniffi_rust_call_with_error(_UniffiConverterTypeNodeError,_UniffiLib.uniffi_ldk_node_fn_method_spontaneouspayment_send_with_preimage,self._uniffi_clone_pointer(), _UniffiConverterUInt64.lower(amount_msat), @@ -7177,15 +7321,15 @@ def send_with_preimage(self, amount_msat: "int",node_id: "PublicKey",preimage: " def send_with_preimage_and_custom_tlvs(self, amount_msat: "int",node_id: "PublicKey",custom_tlvs: "typing.List[CustomTlvRecord]",preimage: "PaymentPreimage",route_parameters: "typing.Optional[RouteParametersConfig]") -> "PaymentId": _UniffiConverterUInt64.check_lower(amount_msat) - + _UniffiConverterTypePublicKey.check_lower(node_id) - + _UniffiConverterSequenceTypeCustomTlvRecord.check_lower(custom_tlvs) - + _UniffiConverterTypePaymentPreimage.check_lower(preimage) - + _UniffiConverterOptionalTypeRouteParametersConfig.check_lower(route_parameters) - + return _UniffiConverterTypePaymentId.lift( _uniffi_rust_call_with_error(_UniffiConverterTypeNodeError,_UniffiLib.uniffi_ldk_node_fn_method_spontaneouspayment_send_with_preimage_and_custom_tlvs,self._uniffi_clone_pointer(), _UniffiConverterUInt64.lower(amount_msat), @@ -7239,7 +7383,7 @@ def send(self, uri_str: "str",route_parameters: "typing.Optional[RouteParameters class UnifiedQrPayment: _pointer: ctypes.c_void_p - + def __init__(self, *args, **kwargs): raise ValueError("This class has no default constructor") @@ -7264,11 +7408,11 @@ def _make_instance_(cls, pointer): def receive(self, amount_sats: "int",message: "str",expiry_sec: "int") -> "str": _UniffiConverterUInt64.check_lower(amount_sats) - + _UniffiConverterString.check_lower(message) - + _UniffiConverterUInt32.check_lower(expiry_sec) - + return _UniffiConverterString.lift( _uniffi_rust_call_with_error(_UniffiConverterTypeNodeError,_UniffiLib.uniffi_ldk_node_fn_method_unifiedqrpayment_receive,self._uniffi_clone_pointer(), _UniffiConverterUInt64.lower(amount_sats), @@ -7282,9 +7426,9 @@ def receive(self, amount_sats: "int",message: "str",expiry_sec: "int") -> "str": def send(self, uri_str: "str",route_parameters: "typing.Optional[RouteParametersConfig]") -> "QrPaymentResult": _UniffiConverterString.check_lower(uri_str) - + _UniffiConverterOptionalTypeRouteParametersConfig.check_lower(route_parameters) - + return _UniffiConverterTypeQrPaymentResult.lift( _uniffi_rust_call_with_error(_UniffiConverterTypeNodeError,_UniffiLib.uniffi_ldk_node_fn_method_unifiedqrpayment_send,self._uniffi_clone_pointer(), _UniffiConverterString.lower(uri_str), @@ -7333,7 +7477,7 @@ def get_headers(self, request: "typing.List[int]"): class VssHeaderProvider: _pointer: ctypes.c_void_p - + def __init__(self, *args, **kwargs): raise ValueError("This class has no default constructor") @@ -7357,10 +7501,10 @@ def _make_instance_(cls, pointer): async def get_headers(self, request: "typing.List[int]") -> "dict[str, str]": _UniffiConverterSequenceUInt8.check_lower(request) - + return await _uniffi_rust_call_async( _UniffiLib.uniffi_ldk_node_fn_method_vssheaderprovider_get_headers( - self._uniffi_clone_pointer(), + self._uniffi_clone_pointer(), _UniffiConverterSequenceUInt8.lower(request) ), _UniffiLib.ffi_ldk_node_rust_future_poll_rust_buffer, @@ -7368,7 +7512,7 @@ async def get_headers(self, request: "typing.List[int]") -> "dict[str, str]": _UniffiLib.ffi_ldk_node_rust_future_free_rust_buffer, # lift function _UniffiConverterMapStringString.lift, - + # Error FFI converter _UniffiConverterTypeVssHeaderProviderError, @@ -7407,6 +7551,49 @@ def write(cls, value: VssHeaderProviderProtocol, buf: _UniffiRustBuffer): buf.write_u64(cls.lower(value)) +class AddressInfo: + index: "int" + address: "Address" + keychain: "KeychainKind" + def __init__(self, *, index: "int", address: "Address", keychain: "KeychainKind"): + self.index = index + self.address = address + self.keychain = keychain + + def __str__(self): + return "AddressInfo(index={}, address={}, keychain={})".format(self.index, self.address, self.keychain) + + def __eq__(self, other): + if self.index != other.index: + return False + if self.address != other.address: + return False + if self.keychain != other.keychain: + return False + return True + +class _UniffiConverterTypeAddressInfo(_UniffiConverterRustBuffer): + @staticmethod + def read(buf): + return AddressInfo( + index=_UniffiConverterUInt32.read(buf), + address=_UniffiConverterTypeAddress.read(buf), + keychain=_UniffiConverterTypeKeychainKind.read(buf), + ) + + @staticmethod + def check_lower(value): + _UniffiConverterUInt32.check_lower(value.index) + _UniffiConverterTypeAddress.check_lower(value.address) + _UniffiConverterTypeKeychainKind.check_lower(value.keychain) + + @staticmethod + def write(value, buf): + _UniffiConverterUInt32.write(value.index, buf) + _UniffiConverterTypeAddress.write(value.address, buf) + _UniffiConverterTypeKeychainKind.write(value.keychain, buf) + + class AddressTypeBalance: total_sats: "int" spendable_sats: "int" @@ -9557,13 +9744,13 @@ def write(value, buf): class AddressType(enum.Enum): LEGACY = 0 - + NESTED_SEGWIT = 1 - + NATIVE_SEGWIT = 2 - + TAPROOT = 3 - + class _UniffiConverterTypeAddressType(_UniffiConverterRustBuffer): @@ -9611,9 +9798,9 @@ def write(value, buf): class AsyncPaymentsRole(enum.Enum): CLIENT = 0 - + SERVER = 1 - + class _UniffiConverterTypeAsyncPaymentsRole(_UniffiConverterRustBuffer): @@ -9649,13 +9836,13 @@ def write(value, buf): class BalanceSource(enum.Enum): HOLDER_FORCE_CLOSED = 0 - + COUNTERPARTY_FORCE_CLOSED = 1 - + COOP_CLOSE = 2 - + HTLC = 3 - + class _UniffiConverterTypeBalanceSource(_UniffiConverterRustBuffer): @@ -9721,7 +9908,7 @@ def __eq__(self, other): if self.hash != other.hash: return False return True - + class DIRECT: description: "str" @@ -9737,8 +9924,8 @@ def __eq__(self, other): if self.description != other.description: return False return True - - + + # For each variant, we have an `is_NAME` method for easily checking # whether an instance is that variant. @@ -9746,7 +9933,7 @@ def is_hash(self) -> bool: return isinstance(self, Bolt11InvoiceDescription.HASH) def is_direct(self) -> bool: return isinstance(self, Bolt11InvoiceDescription.DIRECT) - + # Now, a little trick - we make each nested variant class be a subclass of the main # enum class, so that method calls and instance checks etc will work intuitively. @@ -10067,7 +10254,7 @@ def __eq__(self, other): if self.peer_msg != other.peer_msg: return False return True - + class HOLDER_FORCE_CLOSED: broadcasted_latest_txn: "typing.Optional[bool]" message: "str" @@ -10087,7 +10274,7 @@ def __eq__(self, other): if self.message != other.message: return False return True - + class LEGACY_COOPERATIVE_CLOSURE: def __init__(self,): @@ -10100,7 +10287,7 @@ def __eq__(self, other): if not other.is_legacy_cooperative_closure(): return False return True - + class COUNTERPARTY_INITIATED_COOPERATIVE_CLOSURE: def __init__(self,): @@ -10113,7 +10300,7 @@ def __eq__(self, other): if not other.is_counterparty_initiated_cooperative_closure(): return False return True - + class LOCALLY_INITIATED_COOPERATIVE_CLOSURE: def __init__(self,): @@ -10126,7 +10313,7 @@ def __eq__(self, other): if not other.is_locally_initiated_cooperative_closure(): return False return True - + class COMMITMENT_TX_CONFIRMED: def __init__(self,): @@ -10139,7 +10326,7 @@ def __eq__(self, other): if not other.is_commitment_tx_confirmed(): return False return True - + class FUNDING_TIMED_OUT: def __init__(self,): @@ -10152,7 +10339,7 @@ def __eq__(self, other): if not other.is_funding_timed_out(): return False return True - + class PROCESSING_ERROR: err: "str" @@ -10168,7 +10355,7 @@ def __eq__(self, other): if self.err != other.err: return False return True - + class DISCONNECTED_PEER: def __init__(self,): @@ -10181,7 +10368,7 @@ def __eq__(self, other): if not other.is_disconnected_peer(): return False return True - + class OUTDATED_CHANNEL_MANAGER: def __init__(self,): @@ -10194,7 +10381,7 @@ def __eq__(self, other): if not other.is_outdated_channel_manager(): return False return True - + class COUNTERPARTY_COOP_CLOSED_UNFUNDED_CHANNEL: def __init__(self,): @@ -10207,7 +10394,7 @@ def __eq__(self, other): if not other.is_counterparty_coop_closed_unfunded_channel(): return False return True - + class LOCALLY_COOP_CLOSED_UNFUNDED_CHANNEL: def __init__(self,): @@ -10220,7 +10407,7 @@ def __eq__(self, other): if not other.is_locally_coop_closed_unfunded_channel(): return False return True - + class FUNDING_BATCH_CLOSURE: def __init__(self,): @@ -10233,7 +10420,7 @@ def __eq__(self, other): if not other.is_funding_batch_closure(): return False return True - + class HTL_CS_TIMED_OUT: payment_hash: "typing.Optional[PaymentHash]" @@ -10249,7 +10436,7 @@ def __eq__(self, other): if self.payment_hash != other.payment_hash: return False return True - + class PEER_FEERATE_TOO_LOW: peer_feerate_sat_per_kw: "int" required_feerate_sat_per_kw: "int" @@ -10269,8 +10456,8 @@ def __eq__(self, other): if self.required_feerate_sat_per_kw != other.required_feerate_sat_per_kw: return False return True - - + + # For each variant, we have an `is_NAME` method for easily checking # whether an instance is that variant. @@ -10304,7 +10491,7 @@ def is_htl_cs_timed_out(self) -> bool: return isinstance(self, ClosureReason.HTL_CS_TIMED_OUT) def is_peer_feerate_too_low(self) -> bool: return isinstance(self, ClosureReason.PEER_FEERATE_TOO_LOW) - + # Now, a little trick - we make each nested variant class be a subclass of the main # enum class, so that method calls and instance checks etc will work intuitively. @@ -10475,13 +10662,13 @@ def write(value, buf): class CoinSelectionAlgorithm(enum.Enum): BRANCH_AND_BOUND = 0 - + LARGEST_FIRST = 1 - + OLDEST_FIRST = 2 - + SINGLE_RANDOM_DRAW = 3 - + class _UniffiConverterTypeCoinSelectionAlgorithm(_UniffiConverterRustBuffer): @@ -10555,7 +10742,7 @@ def __eq__(self, other): if self.timestamp != other.timestamp: return False return True - + class UNCONFIRMED: def __init__(self,): @@ -10568,8 +10755,8 @@ def __eq__(self, other): if not other.is_unconfirmed(): return False return True - - + + # For each variant, we have an `is_NAME` method for easily checking # whether an instance is that variant. @@ -10577,7 +10764,7 @@ def is_confirmed(self) -> bool: return isinstance(self, ConfirmationStatus.CONFIRMED) def is_unconfirmed(self) -> bool: return isinstance(self, ConfirmationStatus.UNCONFIRMED) - + # Now, a little trick - we make each nested variant class be a subclass of the main # enum class, so that method calls and instance checks etc will work intuitively. @@ -10632,15 +10819,15 @@ def write(value, buf): class Currency(enum.Enum): BITCOIN = 0 - + BITCOIN_TESTNET = 1 - + REGTEST = 2 - + SIMNET = 3 - + SIGNET = 4 - + class _UniffiConverterTypeCurrency(_UniffiConverterRustBuffer): @@ -10724,7 +10911,7 @@ def __eq__(self, other): if self.fee_paid_msat != other.fee_paid_msat: return False return True - + class PAYMENT_FAILED: payment_id: "typing.Optional[PaymentId]" payment_hash: "typing.Optional[PaymentHash]" @@ -10748,7 +10935,7 @@ def __eq__(self, other): if self.reason != other.reason: return False return True - + class PAYMENT_RECEIVED: payment_id: "typing.Optional[PaymentId]" payment_hash: "PaymentHash" @@ -10776,7 +10963,7 @@ def __eq__(self, other): if self.custom_records != other.custom_records: return False return True - + class PAYMENT_CLAIMABLE: payment_id: "PaymentId" payment_hash: "PaymentHash" @@ -10808,7 +10995,7 @@ def __eq__(self, other): if self.custom_records != other.custom_records: return False return True - + class PAYMENT_FORWARDED: prev_channel_id: "ChannelId" next_channel_id: "ChannelId" @@ -10860,7 +11047,7 @@ def __eq__(self, other): if self.outbound_amount_forwarded_msat != other.outbound_amount_forwarded_msat: return False return True - + class PROBE_SUCCESSFUL: payment_id: "PaymentId" payment_hash: "PaymentHash" @@ -10880,7 +11067,7 @@ def __eq__(self, other): if self.payment_hash != other.payment_hash: return False return True - + class PROBE_FAILED: payment_id: "PaymentId" payment_hash: "PaymentHash" @@ -10904,7 +11091,7 @@ def __eq__(self, other): if self.short_channel_id != other.short_channel_id: return False return True - + class CHANNEL_PENDING: channel_id: "ChannelId" user_channel_id: "UserChannelId" @@ -10936,7 +11123,7 @@ def __eq__(self, other): if self.funding_txo != other.funding_txo: return False return True - + class CHANNEL_READY: channel_id: "ChannelId" user_channel_id: "UserChannelId" @@ -10964,7 +11151,7 @@ def __eq__(self, other): if self.funding_txo != other.funding_txo: return False return True - + class CHANNEL_CLOSED: channel_id: "ChannelId" user_channel_id: "UserChannelId" @@ -10992,7 +11179,7 @@ def __eq__(self, other): if self.reason != other.reason: return False return True - + class SPLICE_PENDING: channel_id: "ChannelId" user_channel_id: "UserChannelId" @@ -11020,7 +11207,7 @@ def __eq__(self, other): if self.new_funding_txo != other.new_funding_txo: return False return True - + class SPLICE_FAILED: channel_id: "ChannelId" user_channel_id: "UserChannelId" @@ -11048,7 +11235,7 @@ def __eq__(self, other): if self.abandoned_funding_txo != other.abandoned_funding_txo: return False return True - + class ONCHAIN_TRANSACTION_CONFIRMED: txid: "Txid" block_hash: "BlockHash" @@ -11080,7 +11267,7 @@ def __eq__(self, other): if self.details != other.details: return False return True - + class ONCHAIN_TRANSACTION_RECEIVED: txid: "Txid" details: "TransactionDetails" @@ -11100,7 +11287,7 @@ def __eq__(self, other): if self.details != other.details: return False return True - + class ONCHAIN_TRANSACTION_REPLACED: txid: "Txid" conflicts: "typing.List[Txid]" @@ -11120,7 +11307,7 @@ def __eq__(self, other): if self.conflicts != other.conflicts: return False return True - + class ONCHAIN_TRANSACTION_REORGED: txid: "Txid" @@ -11136,7 +11323,7 @@ def __eq__(self, other): if self.txid != other.txid: return False return True - + class ONCHAIN_TRANSACTION_EVICTED: txid: "Txid" @@ -11152,7 +11339,7 @@ def __eq__(self, other): if self.txid != other.txid: return False return True - + class SYNC_PROGRESS: sync_type: "SyncType" progress_percent: "int" @@ -11180,7 +11367,7 @@ def __eq__(self, other): if self.target_block_height != other.target_block_height: return False return True - + class SYNC_COMPLETED: sync_type: "SyncType" synced_block_height: "int" @@ -11200,7 +11387,7 @@ def __eq__(self, other): if self.synced_block_height != other.synced_block_height: return False return True - + class BALANCE_CHANGED: old_spendable_onchain_balance_sats: "int" new_spendable_onchain_balance_sats: "int" @@ -11236,8 +11423,8 @@ def __eq__(self, other): if self.new_total_lightning_balance_sats != other.new_total_lightning_balance_sats: return False return True - - + + # For each variant, we have an `is_NAME` method for easily checking # whether an instance is that variant. @@ -11281,7 +11468,7 @@ def is_sync_completed(self) -> bool: return isinstance(self, Event.SYNC_COMPLETED) def is_balance_changed(self) -> bool: return isinstance(self, Event.BALANCE_CHANGED) - + # Now, a little trick - we make each nested variant class be a subclass of the main # enum class, so that method calls and instance checks etc will work intuitively. @@ -11694,6 +11881,44 @@ def write(value, buf): +class KeychainKind(enum.Enum): + EXTERNAL = 0 + + INTERNAL = 1 + + + +class _UniffiConverterTypeKeychainKind(_UniffiConverterRustBuffer): + @staticmethod + def read(buf): + variant = buf.read_i32() + if variant == 1: + return KeychainKind.EXTERNAL + if variant == 2: + return KeychainKind.INTERNAL + raise InternalError("Raw enum value doesn't match any cases") + + @staticmethod + def check_lower(value): + if value == KeychainKind.EXTERNAL: + return + if value == KeychainKind.INTERNAL: + return + raise ValueError(value) + + @staticmethod + def write(value, buf): + if value == KeychainKind.EXTERNAL: + buf.write_i32(1) + if value == KeychainKind.INTERNAL: + buf.write_i32(2) + + + + + + + class LightningBalance: def __init__(self): raise RuntimeError("LightningBalance cannot be instantiated directly") @@ -11742,7 +11967,7 @@ def __eq__(self, other): if self.inbound_htlc_rounded_msat != other.inbound_htlc_rounded_msat: return False return True - + class CLAIMABLE_AWAITING_CONFIRMATIONS: channel_id: "ChannelId" counterparty_node_id: "PublicKey" @@ -11774,7 +11999,7 @@ def __eq__(self, other): if self.source != other.source: return False return True - + class CONTENTIOUS_CLAIMABLE: channel_id: "ChannelId" counterparty_node_id: "PublicKey" @@ -11810,7 +12035,7 @@ def __eq__(self, other): if self.payment_preimage != other.payment_preimage: return False return True - + class MAYBE_TIMEOUT_CLAIMABLE_HTLC: channel_id: "ChannelId" counterparty_node_id: "PublicKey" @@ -11846,7 +12071,7 @@ def __eq__(self, other): if self.outbound_payment != other.outbound_payment: return False return True - + class MAYBE_PREIMAGE_CLAIMABLE_HTLC: channel_id: "ChannelId" counterparty_node_id: "PublicKey" @@ -11878,7 +12103,7 @@ def __eq__(self, other): if self.payment_hash != other.payment_hash: return False return True - + class COUNTERPARTY_REVOKED_OUTPUT_CLAIMABLE: channel_id: "ChannelId" counterparty_node_id: "PublicKey" @@ -11902,8 +12127,8 @@ def __eq__(self, other): if self.amount_satoshis != other.amount_satoshis: return False return True - - + + # For each variant, we have an `is_NAME` method for easily checking # whether an instance is that variant. @@ -11919,7 +12144,7 @@ def is_maybe_preimage_claimable_htlc(self) -> bool: return isinstance(self, LightningBalance.MAYBE_PREIMAGE_CLAIMABLE_HTLC) def is_counterparty_revoked_output_claimable(self) -> bool: return isinstance(self, LightningBalance.COUNTERPARTY_REVOKED_OUTPUT_CLAIMABLE) - + # Now, a little trick - we make each nested variant class be a subclass of the main # enum class, so that method calls and instance checks etc will work intuitively. @@ -12096,17 +12321,17 @@ def write(value, buf): class LogLevel(enum.Enum): GOSSIP = 0 - + TRACE = 1 - + DEBUG = 2 - + INFO = 3 - + WARN = 4 - + ERROR = 5 - + class _UniffiConverterTypeLogLevel(_UniffiConverterRustBuffer): @@ -12166,11 +12391,11 @@ def write(value, buf): class Lsps1PaymentState(enum.Enum): EXPECT_PAYMENT = 0 - + PAID = 1 - + REFUNDED = 2 - + class _UniffiConverterTypeLsps1PaymentState(_UniffiConverterRustBuffer): @@ -12230,7 +12455,7 @@ def __eq__(self, other): if self.limit_msat != other.limit_msat: return False return True - + class FEE_RATE_MULTIPLIER: multiplier: "int" @@ -12246,8 +12471,8 @@ def __eq__(self, other): if self.multiplier != other.multiplier: return False return True - - + + # For each variant, we have an `is_NAME` method for easily checking # whether an instance is that variant. @@ -12255,7 +12480,7 @@ def is_fixed_limit(self) -> bool: return isinstance(self, MaxDustHtlcExposure.FIXED_LIMIT) def is_fee_rate_multiplier(self) -> bool: return isinstance(self, MaxDustHtlcExposure.FEE_RATE_MULTIPLIER) - + # Now, a little trick - we make each nested variant class be a subclass of the main # enum class, so that method calls and instance checks etc will work intuitively. @@ -12307,13 +12532,13 @@ def write(value, buf): class Network(enum.Enum): BITCOIN = 0 - + TESTNET = 1 - + SIGNET = 2 - + REGTEST = 3 - + class _UniffiConverterTypeNetwork(_UniffiConverterRustBuffer): @@ -13280,7 +13505,7 @@ def __eq__(self, other): if self.amount_msats != other.amount_msats: return False return True - + class CURRENCY: iso4217_code: "str" amount: "int" @@ -13300,8 +13525,8 @@ def __eq__(self, other): if self.amount != other.amount: return False return True - - + + # For each variant, we have an `is_NAME` method for easily checking # whether an instance is that variant. @@ -13309,7 +13534,7 @@ def is_bitcoin(self) -> bool: return isinstance(self, OfferAmount.BITCOIN) def is_currency(self) -> bool: return isinstance(self, OfferAmount.CURRENCY) - + # Now, a little trick - we make each nested variant class be a subclass of the main # enum class, so that method calls and instance checks etc will work intuitively. @@ -13364,9 +13589,9 @@ def write(value, buf): class PaymentDirection(enum.Enum): INBOUND = 0 - + OUTBOUND = 1 - + class _UniffiConverterTypePaymentDirection(_UniffiConverterRustBuffer): @@ -13402,25 +13627,25 @@ def write(value, buf): class PaymentFailureReason(enum.Enum): RECIPIENT_REJECTED = 0 - + USER_ABANDONED = 1 - + RETRIES_EXHAUSTED = 2 - + PAYMENT_EXPIRED = 3 - + ROUTE_NOT_FOUND = 4 - + UNEXPECTED_ERROR = 5 - + UNKNOWN_REQUIRED_FEATURES = 6 - + INVOICE_REQUEST_EXPIRED = 7 - + INVOICE_REQUEST_REJECTED = 8 - + BLINDED_PATH_CREATION_FAILED = 9 - + class _UniffiConverterTypePaymentFailureReason(_UniffiConverterRustBuffer): @@ -13526,7 +13751,7 @@ def __eq__(self, other): if self.status != other.status: return False return True - + class BOLT11: hash: "PaymentHash" preimage: "typing.Optional[PaymentPreimage]" @@ -13558,7 +13783,7 @@ def __eq__(self, other): if self.bolt11 != other.bolt11: return False return True - + class BOLT11_JIT: hash: "PaymentHash" preimage: "typing.Optional[PaymentPreimage]" @@ -13598,7 +13823,7 @@ def __eq__(self, other): if self.bolt11 != other.bolt11: return False return True - + class BOLT12_OFFER: hash: "typing.Optional[PaymentHash]" preimage: "typing.Optional[PaymentPreimage]" @@ -13634,7 +13859,7 @@ def __eq__(self, other): if self.quantity != other.quantity: return False return True - + class BOLT12_REFUND: hash: "typing.Optional[PaymentHash]" preimage: "typing.Optional[PaymentPreimage]" @@ -13666,7 +13891,7 @@ def __eq__(self, other): if self.quantity != other.quantity: return False return True - + class SPONTANEOUS: hash: "PaymentHash" preimage: "typing.Optional[PaymentPreimage]" @@ -13686,8 +13911,8 @@ def __eq__(self, other): if self.preimage != other.preimage: return False return True - - + + # For each variant, we have an `is_NAME` method for easily checking # whether an instance is that variant. @@ -13703,7 +13928,7 @@ def is_bolt12_refund(self) -> bool: return isinstance(self, PaymentKind.BOLT12_REFUND) def is_spontaneous(self) -> bool: return isinstance(self, PaymentKind.SPONTANEOUS) - + # Now, a little trick - we make each nested variant class be a subclass of the main # enum class, so that method calls and instance checks etc will work intuitively. @@ -13862,11 +14087,11 @@ def write(value, buf): class PaymentStatus(enum.Enum): PENDING = 0 - + SUCCEEDED = 1 - + FAILED = 2 - + class _UniffiConverterTypePaymentStatus(_UniffiConverterRustBuffer): @@ -13930,7 +14155,7 @@ def __eq__(self, other): if self.amount_satoshis != other.amount_satoshis: return False return True - + class BROADCAST_AWAITING_CONFIRMATION: channel_id: "typing.Optional[ChannelId]" latest_broadcast_height: "int" @@ -13958,7 +14183,7 @@ def __eq__(self, other): if self.amount_satoshis != other.amount_satoshis: return False return True - + class AWAITING_THRESHOLD_CONFIRMATIONS: channel_id: "typing.Optional[ChannelId]" latest_spending_txid: "Txid" @@ -13990,8 +14215,8 @@ def __eq__(self, other): if self.amount_satoshis != other.amount_satoshis: return False return True - - + + # For each variant, we have an `is_NAME` method for easily checking # whether an instance is that variant. @@ -14001,7 +14226,7 @@ def is_broadcast_awaiting_confirmation(self) -> bool: return isinstance(self, PendingSweepBalance.BROADCAST_AWAITING_CONFIRMATION) def is_awaiting_threshold_confirmations(self) -> bool: return isinstance(self, PendingSweepBalance.AWAITING_THRESHOLD_CONFIRMATIONS) - + # Now, a little trick - we make each nested variant class be a subclass of the main # enum class, so that method calls and instance checks etc will work intuitively. @@ -14106,7 +14331,7 @@ def __eq__(self, other): if self.txid != other.txid: return False return True - + class BOLT11: payment_id: "PaymentId" @@ -14122,7 +14347,7 @@ def __eq__(self, other): if self.payment_id != other.payment_id: return False return True - + class BOLT12: payment_id: "PaymentId" @@ -14138,8 +14363,8 @@ def __eq__(self, other): if self.payment_id != other.payment_id: return False return True - - + + # For each variant, we have an `is_NAME` method for easily checking # whether an instance is that variant. @@ -14149,7 +14374,7 @@ def is_bolt11(self) -> bool: return isinstance(self, QrPaymentResult.BOLT11) def is_bolt12(self) -> bool: return isinstance(self, QrPaymentResult.BOLT12) - + # Now, a little trick - we make each nested variant class be a subclass of the main # enum class, so that method calls and instance checks etc will work intuitively. @@ -14212,11 +14437,11 @@ def write(value, buf): class SyncType(enum.Enum): ONCHAIN_WALLET = 0 - + LIGHTNING_WALLET = 1 - + FEE_RATE_CACHE = 2 - + class _UniffiConverterTypeSyncType(_UniffiConverterRustBuffer): @@ -14340,15 +14565,15 @@ def write(value, buf): class WordCount(enum.Enum): WORDS12 = 0 - + WORDS15 = 1 - + WORDS18 = 2 - + WORDS21 = 3 - + WORDS24 = 4 - + class _UniffiConverterTypeWordCount(_UniffiConverterRustBuffer): @@ -15661,6 +15886,31 @@ def read(cls, buf): +class _UniffiConverterSequenceTypeAddressInfo(_UniffiConverterRustBuffer): + @classmethod + def check_lower(cls, value): + for item in value: + _UniffiConverterTypeAddressInfo.check_lower(item) + + @classmethod + def write(cls, value, buf): + items = len(value) + buf.write_i32(items) + for item in value: + _UniffiConverterTypeAddressInfo.write(item, buf) + + @classmethod + def read(cls, buf): + count = buf.read_i32() + if count < 0: + raise InternalError("Unexpected negative sequence length") + + return [ + _UniffiConverterTypeAddressInfo.read(buf) for i in range(count) + ] + + + class _UniffiConverterSequenceTypeChannelDetails(_UniffiConverterRustBuffer): @classmethod def check_lower(cls, value): @@ -16680,9 +16930,9 @@ def default_config() -> "Config": def derive_node_secret_from_mnemonic(mnemonic: "str",passphrase: "typing.Optional[str]") -> "typing.List[int]": _UniffiConverterString.check_lower(mnemonic) - + _UniffiConverterOptionalString.check_lower(passphrase) - + return _UniffiConverterSequenceUInt8.lift(_uniffi_rust_call_with_error(_UniffiConverterTypeNodeError,_UniffiLib.uniffi_ldk_node_fn_func_derive_node_secret_from_mnemonic, _UniffiConverterString.lower(mnemonic), _UniffiConverterOptionalString.lower(passphrase))) @@ -16690,7 +16940,7 @@ def derive_node_secret_from_mnemonic(mnemonic: "str",passphrase: "typing.Optiona def generate_entropy_mnemonic(word_count: "typing.Optional[WordCount]") -> "Mnemonic": _UniffiConverterOptionalTypeWordCount.check_lower(word_count) - + return _UniffiConverterTypeMnemonic.lift(_uniffi_rust_call(_UniffiLib.uniffi_ldk_node_fn_func_generate_entropy_mnemonic, _UniffiConverterOptionalTypeWordCount.lower(word_count))) @@ -16707,6 +16957,7 @@ def generate_entropy_mnemonic(word_count: "typing.Optional[WordCount]") -> "Mnem "ConfirmationStatus", "Currency", "Event", + "KeychainKind", "LightningBalance", "LogLevel", "Lsps1PaymentState", @@ -16723,6 +16974,7 @@ def generate_entropy_mnemonic(word_count: "typing.Optional[WordCount]") -> "Mnem "SyncType", "VssHeaderProviderError", "WordCount", + "AddressInfo", "AddressTypeBalance", "AnchorChannelsConfig", "BackgroundSyncConfig", diff --git a/bindings/swift/Sources/LDKNode/LDKNode.swift b/bindings/swift/Sources/LDKNode/LDKNode.swift index 6df5b6859a..52453c1815 100644 --- a/bindings/swift/Sources/LDKNode/LDKNode.swift +++ b/bindings/swift/Sources/LDKNode/LDKNode.swift @@ -3299,6 +3299,10 @@ public func FfiConverterTypeOffer_lower(_ value: Offer) -> UnsafeMutableRawPoint public protocol OnchainPaymentProtocol: AnyObject { func accelerateByCpfp(txid: Txid, feeRate: FeeRate?, destinationAddress: Address?) throws -> Txid + func addressInfoForTypeAtIndex(addressType: AddressType, keychain: KeychainKind, index: UInt32) throws -> AddressInfo + + func addressInfosForType(addressType: AddressType, keychain: KeychainKind, startIndex: UInt32, count: UInt32) throws -> [AddressInfo] + func bumpFeeByRbf(txid: Txid, feeRate: FeeRate) throws -> Txid func calculateCpfpFeeRate(parentTxid: Txid, urgent: Bool) throws -> FeeRate @@ -3313,6 +3317,12 @@ public protocol OnchainPaymentProtocol: AnyObject { func newAddressForType(addressType: AddressType) throws -> Address + func newAddressInfo() throws -> AddressInfo + + func newAddressInfoForType(addressType: AddressType) throws -> AddressInfo + + func revealReceiveAddressesTo(addressType: AddressType, index: UInt32) throws + func selectUtxosWithAlgorithm(targetAmountSats: UInt64, feeRate: FeeRate?, algorithm: CoinSelectionAlgorithm, utxos: [SpendableUtxo]?) throws -> [SpendableUtxo] func sendAllToAddress(address: Address, retainReserve: Bool, feeRate: FeeRate?) throws -> Txid @@ -3378,6 +3388,25 @@ open class OnchainPayment: }) } + open func addressInfoForTypeAtIndex(addressType: AddressType, keychain: KeychainKind, index: UInt32) throws -> AddressInfo { + return try FfiConverterTypeAddressInfo.lift(rustCallWithError(FfiConverterTypeNodeError.lift) { + uniffi_ldk_node_fn_method_onchainpayment_address_info_for_type_at_index(self.uniffiClonePointer(), + FfiConverterTypeAddressType.lower(addressType), + FfiConverterTypeKeychainKind.lower(keychain), + FfiConverterUInt32.lower(index), $0) + }) + } + + open func addressInfosForType(addressType: AddressType, keychain: KeychainKind, startIndex: UInt32, count: UInt32) throws -> [AddressInfo] { + return try FfiConverterSequenceTypeAddressInfo.lift(rustCallWithError(FfiConverterTypeNodeError.lift) { + uniffi_ldk_node_fn_method_onchainpayment_address_infos_for_type(self.uniffiClonePointer(), + FfiConverterTypeAddressType.lower(addressType), + FfiConverterTypeKeychainKind.lower(keychain), + FfiConverterUInt32.lower(startIndex), + FfiConverterUInt32.lower(count), $0) + }) + } + open func bumpFeeByRbf(txid: Txid, feeRate: FeeRate) throws -> Txid { return try FfiConverterTypeTxid.lift(rustCallWithError(FfiConverterTypeNodeError.lift) { uniffi_ldk_node_fn_method_onchainpayment_bump_fee_by_rbf(self.uniffiClonePointer(), @@ -3432,6 +3461,27 @@ open class OnchainPayment: }) } + open func newAddressInfo() throws -> AddressInfo { + return try FfiConverterTypeAddressInfo.lift(rustCallWithError(FfiConverterTypeNodeError.lift) { + uniffi_ldk_node_fn_method_onchainpayment_new_address_info(self.uniffiClonePointer(), $0) + }) + } + + open func newAddressInfoForType(addressType: AddressType) throws -> AddressInfo { + return try FfiConverterTypeAddressInfo.lift(rustCallWithError(FfiConverterTypeNodeError.lift) { + uniffi_ldk_node_fn_method_onchainpayment_new_address_info_for_type(self.uniffiClonePointer(), + FfiConverterTypeAddressType.lower(addressType), $0) + }) + } + + open func revealReceiveAddressesTo(addressType: AddressType, index: UInt32) throws { + try rustCallWithError(FfiConverterTypeNodeError.lift) { + uniffi_ldk_node_fn_method_onchainpayment_reveal_receive_addresses_to(self.uniffiClonePointer(), + FfiConverterTypeAddressType.lower(addressType), + FfiConverterUInt32.lower(index), $0) + } + } + open func selectUtxosWithAlgorithm(targetAmountSats: UInt64, feeRate: FeeRate?, algorithm: CoinSelectionAlgorithm, utxos: [SpendableUtxo]?) throws -> [SpendableUtxo] { return try FfiConverterSequenceTypeSpendableUtxo.lift(rustCallWithError(FfiConverterTypeNodeError.lift) { uniffi_ldk_node_fn_method_onchainpayment_select_utxos_with_algorithm(self.uniffiClonePointer(), @@ -4119,6 +4169,75 @@ public func FfiConverterTypeVssHeaderProvider_lower(_ value: VssHeaderProvider) return FfiConverterTypeVssHeaderProvider.lower(value) } +public struct AddressInfo { + public var index: UInt32 + public var address: Address + public var keychain: KeychainKind + + /// Default memberwise initializers are never public by default, so we + /// declare one manually. + public init(index: UInt32, address: Address, keychain: KeychainKind) { + self.index = index + self.address = address + self.keychain = keychain + } +} + +extension AddressInfo: Equatable, Hashable { + public static func == (lhs: AddressInfo, rhs: AddressInfo) -> Bool { + if lhs.index != rhs.index { + return false + } + if lhs.address != rhs.address { + return false + } + if lhs.keychain != rhs.keychain { + return false + } + return true + } + + public func hash(into hasher: inout Hasher) { + hasher.combine(index) + hasher.combine(address) + hasher.combine(keychain) + } +} + +#if swift(>=5.8) + @_documentation(visibility: private) +#endif +public struct FfiConverterTypeAddressInfo: FfiConverterRustBuffer { + public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> AddressInfo { + return + try AddressInfo( + index: FfiConverterUInt32.read(from: &buf), + address: FfiConverterTypeAddress.read(from: &buf), + keychain: FfiConverterTypeKeychainKind.read(from: &buf) + ) + } + + public static func write(_ value: AddressInfo, into buf: inout [UInt8]) { + FfiConverterUInt32.write(value.index, into: &buf) + FfiConverterTypeAddress.write(value.address, into: &buf) + FfiConverterTypeKeychainKind.write(value.keychain, into: &buf) + } +} + +#if swift(>=5.8) + @_documentation(visibility: private) +#endif +public func FfiConverterTypeAddressInfo_lift(_ buf: RustBuffer) throws -> AddressInfo { + return try FfiConverterTypeAddressInfo.lift(buf) +} + +#if swift(>=5.8) + @_documentation(visibility: private) +#endif +public func FfiConverterTypeAddressInfo_lower(_ value: AddressInfo) -> RustBuffer { + return FfiConverterTypeAddressInfo.lower(value) +} + public struct AddressTypeBalance { public var totalSats: UInt64 public var spendableSats: UInt64 @@ -8176,6 +8295,58 @@ 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 KeychainKind { + case external + case `internal` +} + +#if swift(>=5.8) + @_documentation(visibility: private) +#endif +public struct FfiConverterTypeKeychainKind: FfiConverterRustBuffer { + typealias SwiftType = KeychainKind + + public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> KeychainKind { + let variant: Int32 = try readInt(&buf) + switch variant { + case 1: return .external + + case 2: return .internal + + default: throw UniffiInternalError.unexpectedEnumCase + } + } + + public static func write(_ value: KeychainKind, into buf: inout [UInt8]) { + switch value { + case .external: + writeInt(&buf, Int32(1)) + + case .internal: + writeInt(&buf, Int32(2)) + } + } +} + +#if swift(>=5.8) + @_documentation(visibility: private) +#endif +public func FfiConverterTypeKeychainKind_lift(_ buf: RustBuffer) throws -> KeychainKind { + return try FfiConverterTypeKeychainKind.lift(buf) +} + +#if swift(>=5.8) + @_documentation(visibility: private) +#endif +public func FfiConverterTypeKeychainKind_lower(_ value: KeychainKind) -> RustBuffer { + return FfiConverterTypeKeychainKind.lower(value) +} + +extension KeychainKind: 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 Lsps1PaymentState { case expectPayment case paid @@ -10917,6 +11088,31 @@ private struct FfiConverterSequenceString: FfiConverterRustBuffer { } } +#if swift(>=5.8) + @_documentation(visibility: private) +#endif +private struct FfiConverterSequenceTypeAddressInfo: FfiConverterRustBuffer { + typealias SwiftType = [AddressInfo] + + static func write(_ value: [AddressInfo], into buf: inout [UInt8]) { + let len = Int32(value.count) + writeInt(&buf, len) + for item in value { + FfiConverterTypeAddressInfo.write(item, into: &buf) + } + } + + static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> [AddressInfo] { + let len: Int32 = try readInt(&buf) + var seq = [AddressInfo]() + seq.reserveCapacity(Int(len)) + for _ in 0 ..< len { + try seq.append(FfiConverterTypeAddressInfo.read(from: &buf)) + } + return seq + } +} + #if swift(>=5.8) @_documentation(visibility: private) #endif @@ -12774,6 +12970,12 @@ private var initializationResult: InitializationResult = { if uniffi_ldk_node_checksum_method_onchainpayment_accelerate_by_cpfp() != 31954 { return InitializationResult.apiChecksumMismatch } + if uniffi_ldk_node_checksum_method_onchainpayment_address_info_for_type_at_index() != 42692 { + return InitializationResult.apiChecksumMismatch + } + if uniffi_ldk_node_checksum_method_onchainpayment_address_infos_for_type() != 3701 { + return InitializationResult.apiChecksumMismatch + } if uniffi_ldk_node_checksum_method_onchainpayment_bump_fee_by_rbf() != 53877 { return InitializationResult.apiChecksumMismatch } @@ -12795,6 +12997,15 @@ private var initializationResult: InitializationResult = { if uniffi_ldk_node_checksum_method_onchainpayment_new_address_for_type() != 9083 { return InitializationResult.apiChecksumMismatch } + if uniffi_ldk_node_checksum_method_onchainpayment_new_address_info() != 9889 { + return InitializationResult.apiChecksumMismatch + } + if uniffi_ldk_node_checksum_method_onchainpayment_new_address_info_for_type() != 62171 { + return InitializationResult.apiChecksumMismatch + } + if uniffi_ldk_node_checksum_method_onchainpayment_reveal_receive_addresses_to() != 44189 { + return InitializationResult.apiChecksumMismatch + } if uniffi_ldk_node_checksum_method_onchainpayment_select_utxos_with_algorithm() != 14084 { return InitializationResult.apiChecksumMismatch } diff --git a/crates/bdk-wallet-aggregate/src/lib.rs b/crates/bdk-wallet-aggregate/src/lib.rs index fb10611c49..637ab70e22 100644 --- a/crates/bdk-wallet-aggregate/src/lib.rs +++ b/crates/bdk-wallet-aggregate/src/lib.rs @@ -29,7 +29,9 @@ use std::sync::Arc; use bdk_chain::spk_client::{FullScanRequest, SyncRequest}; use bdk_wallet::event::WalletEvent; -use bdk_wallet::{Balance, KeychainKind, LocalOutput, PersistedWallet, Update, WalletPersister}; +use bdk_wallet::{ + AddressInfo, Balance, KeychainKind, LocalOutput, PersistedWallet, Update, WalletPersister, +}; use bitcoin::blockdata::locktime::absolute::LockTime; use bitcoin::hashes::Hash as _; use bitcoin::psbt::Psbt; @@ -39,6 +41,31 @@ use bitcoin::{ }; pub use types::{CoinSelectionAlgorithm, Error, UtxoPsbtInfo}; +const BIP32_MAX_NORMAL_INDEX: u32 = (1 << 31) - 1; + +/// Maximum number of address metadata entries returned by a single batch derivation call. +pub const MAX_ADDRESS_INFO_BATCH_COUNT: u32 = 10_000; + +fn validate_derivation_index(index: u32) -> Result<(), Error> { + if index > BIP32_MAX_NORMAL_INDEX { + return Err(Error::InvalidQuantity); + } + Ok(()) +} + +fn validate_derivation_range(start_index: u32, count: u32) -> Result<(), Error> { + validate_derivation_index(start_index)?; + if count > MAX_ADDRESS_INFO_BATCH_COUNT { + return Err(Error::InvalidQuantity); + } + if count == 0 { + return Ok(()); + } + + let last_index = start_index.checked_add(count - 1).ok_or(Error::InvalidQuantity)?; + validate_derivation_index(last_index) +} + /// A wallet aggregator that presents multiple BDK wallets as a single logical /// wallet. /// @@ -367,12 +394,22 @@ where /// Generate a new receiving address from the primary wallet. pub fn new_address(&mut self) -> Result { + self.new_address_info().map(|address_info| address_info.address) + } + + /// Generate a new receiving address with derivation metadata from the primary wallet. + pub fn new_address_info(&mut self) -> Result { let key = self.primary; - self.new_address_for(&key) + self.new_address_info_for(&key) } /// Generate a new receiving address for a specific wallet. pub fn new_address_for(&mut self, key: &K) -> Result { + self.new_address_info_for(key).map(|address_info| address_info.address) + } + + /// Generate a new receiving address with derivation metadata for a specific wallet. + pub fn new_address_info_for(&mut self, key: &K) -> Result { let wallet = self.wallets.get_mut(key).ok_or(Error::WalletNotFound)?; let persister = self.persisters.get_mut(key).ok_or(Error::PersisterNotFound)?; @@ -381,7 +418,43 @@ where log::error!("Failed to persist wallet for {:?}: {}", key, e); Error::PersistenceFailed })?; - Ok(address_info.address) + Ok(address_info) + } + + /// Return address metadata at a derivation index without revealing it. + pub fn address_info_for( + &self, key: &K, keychain: KeychainKind, index: u32, + ) -> Result { + validate_derivation_index(index)?; + + let wallet = self.wallets.get(key).ok_or(Error::WalletNotFound)?; + Ok(wallet.peek_address(keychain, index)) + } + + /// Return address metadata for a range of derivation indexes without revealing them. + pub fn address_infos_for( + &self, key: &K, keychain: KeychainKind, start_index: u32, count: u32, + ) -> Result, Error> { + validate_derivation_range(start_index, count)?; + + let wallet = self.wallets.get(key).ok_or(Error::WalletNotFound)?; + let end_index = start_index.checked_add(count).ok_or(Error::InvalidQuantity)?; + Ok((start_index..end_index).map(|index| wallet.peek_address(keychain, index)).collect()) + } + + /// Reveal external receiving addresses through `index` for a specific wallet and persist. + pub fn reveal_addresses_to(&mut self, key: &K, index: u32) -> Result<(), Error> { + validate_derivation_index(index)?; + + let wallet = self.wallets.get_mut(key).ok_or(Error::WalletNotFound)?; + let persister = self.persisters.get_mut(key).ok_or(Error::PersisterNotFound)?; + + wallet.reveal_addresses_to(KeychainKind::External, index).count(); + wallet.persist(persister).map_err(|e| { + log::error!("Failed to persist wallet for {:?}: {}", key, e); + Error::PersistenceFailed + })?; + Ok(()) } /// Generate a new internal (change) address from the primary wallet. @@ -1362,6 +1435,9 @@ where #[cfg(test)] mod tests { + use std::sync::{Arc, Mutex}; + + use bdk_chain::Merge; use bdk_wallet::template::Bip84; use bdk_wallet::{ChangeSet, KeychainKind, PersistedWallet, Wallet, WalletPersister}; use bitcoin::bip32::Xpriv; @@ -1383,15 +1459,35 @@ mod tests { } } + #[derive(Clone, Default)] + struct MemoryPersister { + change_set: Arc>, + } + + impl WalletPersister for MemoryPersister { + type Error = std::convert::Infallible; + + fn initialize(persister: &mut Self) -> Result { + Ok(persister.change_set.lock().unwrap().clone()) + } + + fn persist(persister: &mut Self, change_set: &ChangeSet) -> Result<(), Self::Error> { + persister.change_set.lock().unwrap().merge(change_set.clone()); + Ok(()) + } + } + fn test_xprv() -> Xpriv { Xpriv::new_master(Network::Regtest, &[0x42; 32]).unwrap() } - fn create_funded_wallet( - persister: &mut NoopPersister, amount: Amount, - ) -> PersistedWallet { + fn create_empty_wallet

(persister: &mut P) -> PersistedWallet

+ where + P: WalletPersister, + P::Error: std::fmt::Debug, + { let xprv = test_xprv(); - let mut wallet = PersistedWallet::create( + PersistedWallet::create( persister, Wallet::create( Bip84(xprv, KeychainKind::External), @@ -1399,7 +1495,25 @@ mod tests { ) .network(Network::Regtest), ) - .unwrap(); + .unwrap() + } + + fn load_empty_wallet(persister: &mut MemoryPersister) -> PersistedWallet { + let xprv = test_xprv(); + Wallet::load() + .descriptor(KeychainKind::External, Some(Bip84(xprv, KeychainKind::External))) + .descriptor(KeychainKind::Internal, Some(Bip84(xprv, KeychainKind::Internal))) + .extract_keys() + .check_network(Network::Regtest) + .load_wallet(persister) + .unwrap() + .expect("wallet should have been persisted") + } + + fn create_funded_wallet( + persister: &mut NoopPersister, amount: Amount, + ) -> PersistedWallet { + let mut wallet = create_empty_wallet(persister); let addr = wallet.reveal_next_address(KeychainKind::External); let funding_tx = Transaction { @@ -1419,6 +1533,157 @@ mod tests { ScriptBuf::new_p2wpkh(&bitcoin::WPubkeyHash::from_byte_array([0xab; 20])) } + #[test] + fn new_address_info_reveals_external_indexes() { + let mut persister = NoopPersister; + let wallet = create_empty_wallet(&mut persister); + let mut agg = AggregateWallet::::new(wallet, persister, 0, vec![]); + + let first = agg.new_address_info_for(&0).unwrap(); + assert_eq!(first.index, 0); + assert_eq!(first.keychain, KeychainKind::External); + + let second = agg.new_address_info().unwrap(); + assert_eq!(second.index, 1); + assert_eq!(second.keychain, KeychainKind::External); + + let third_address = agg.new_address_for(&0).unwrap(); + let third_peek = agg.address_info_for(&0, KeychainKind::External, 2).unwrap(); + assert_eq!(third_peek.index, 2); + assert_eq!(third_peek.address, third_address); + } + + #[test] + fn address_info_for_index_does_not_advance_receive_index() { + let mut persister = NoopPersister; + let wallet = create_empty_wallet(&mut persister); + let mut agg = AggregateWallet::::new(wallet, persister, 0, vec![]); + + let peeked = agg.address_info_for(&0, KeychainKind::External, 7).unwrap(); + assert_eq!(peeked.index, 7); + assert_eq!(peeked.keychain, KeychainKind::External); + + let next = agg.new_address_info_for(&0).unwrap(); + assert_eq!(next.index, 0); + assert_ne!(next.address, peeked.address); + } + + #[test] + fn address_info_for_index_supports_internal_keychain_without_advancing_receive_index() { + let mut persister = NoopPersister; + let wallet = create_empty_wallet(&mut persister); + let mut agg = AggregateWallet::::new(wallet, persister, 0, vec![]); + + let change = agg.address_info_for(&0, KeychainKind::Internal, 3).unwrap(); + assert_eq!(change.index, 3); + assert_eq!(change.keychain, KeychainKind::Internal); + + let next_receive = agg.new_address_info_for(&0).unwrap(); + assert_eq!(next_receive.index, 0); + assert_eq!(next_receive.keychain, KeychainKind::External); + assert_ne!(next_receive.address, change.address); + } + + #[test] + fn address_infos_for_returns_keychain_range_without_advancing() { + let mut persister = NoopPersister; + let wallet = create_empty_wallet(&mut persister); + let mut agg = AggregateWallet::::new(wallet, persister, 0, vec![]); + + let addresses = agg.address_infos_for(&0, KeychainKind::Internal, 2, 3).unwrap(); + let indexes: Vec = addresses.iter().map(|info| info.index).collect(); + assert_eq!(indexes, vec![2, 3, 4]); + assert!(addresses.iter().all(|info| info.keychain == KeychainKind::Internal)); + + let single = agg.address_info_for(&0, KeychainKind::Internal, 3).unwrap(); + assert_eq!(addresses[1], single); + + let next_receive = agg.new_address_info_for(&0).unwrap(); + assert_eq!(next_receive.index, 0); + } + + #[test] + fn address_infos_for_allows_empty_ranges() { + let mut persister = NoopPersister; + let wallet = create_empty_wallet(&mut persister); + let agg = AggregateWallet::::new(wallet, persister, 0, vec![]); + + let addresses = agg.address_infos_for(&0, KeychainKind::External, 0, 0).unwrap(); + assert!(addresses.is_empty()); + } + + #[test] + fn address_info_for_rejects_hardened_index() { + let mut persister = NoopPersister; + let wallet = create_empty_wallet(&mut persister); + let agg = AggregateWallet::::new(wallet, persister, 0, vec![]); + + let result = agg.address_info_for(&0, KeychainKind::External, BIP32_MAX_NORMAL_INDEX + 1); + assert_eq!(result, Err(Error::InvalidQuantity)); + } + + #[test] + fn address_infos_for_rejects_invalid_ranges() { + let mut persister = NoopPersister; + let wallet = create_empty_wallet(&mut persister); + let agg = AggregateWallet::::new(wallet, persister, 0, vec![]); + + let too_many = + agg.address_infos_for(&0, KeychainKind::External, 0, MAX_ADDRESS_INFO_BATCH_COUNT + 1); + assert_eq!(too_many, Err(Error::InvalidQuantity)); + + let hardened_end = + agg.address_infos_for(&0, KeychainKind::External, BIP32_MAX_NORMAL_INDEX - 1, 3); + assert_eq!(hardened_end, Err(Error::InvalidQuantity)); + + let overflow = agg.address_infos_for(&0, KeychainKind::External, u32::MAX, 1); + assert_eq!(overflow, Err(Error::InvalidQuantity)); + } + + #[test] + fn reveal_addresses_to_rejects_hardened_index() { + let mut persister = NoopPersister; + let wallet = create_empty_wallet(&mut persister); + let mut agg = AggregateWallet::::new(wallet, persister, 0, vec![]); + + let result = agg.reveal_addresses_to(&0, BIP32_MAX_NORMAL_INDEX + 1); + assert_eq!(result, Err(Error::InvalidQuantity)); + } + + #[test] + fn reveal_addresses_to_advances_next_receive_index() { + let mut persister = NoopPersister; + let wallet = create_empty_wallet(&mut persister); + let mut agg = AggregateWallet::::new(wallet, persister, 0, vec![]); + + agg.reveal_addresses_to(&0, 4).unwrap(); + agg.reveal_addresses_to(&0, 4).unwrap(); + + let next = agg.new_address_info_for(&0).unwrap(); + assert_eq!(next.index, 5); + assert_eq!(next.keychain, KeychainKind::External); + } + + #[test] + fn revealed_receive_index_persists_across_reload() { + let mut create_persister = MemoryPersister::default(); + let wallet = create_empty_wallet(&mut create_persister); + let aggregate_persister = create_persister.clone(); + + { + let mut agg = AggregateWallet::::new(wallet, aggregate_persister, 0, vec![]); + agg.reveal_addresses_to(&0, 3).unwrap(); + } + + let mut reload_persister = create_persister.clone(); + let reloaded_wallet = load_empty_wallet(&mut reload_persister); + let mut reloaded = + AggregateWallet::::new(reloaded_wallet, reload_persister, 0, vec![]); + + let next = reloaded.new_address_info_for(&0).unwrap(); + assert_eq!(next.index, 4); + } + /// Demonstrates the bug: without cancel_tx, each finish() call /// cumulatively advances the internal (change) derivation index. #[test] diff --git a/crates/bdk-wallet-aggregate/src/types.rs b/crates/bdk-wallet-aggregate/src/types.rs index e5453a4ab7..5c37236ce6 100644 --- a/crates/bdk-wallet-aggregate/src/types.rs +++ b/crates/bdk-wallet-aggregate/src/types.rs @@ -28,6 +28,8 @@ pub enum Error { InsufficientFunds, /// The requested fee rate is invalid. InvalidFeeRate, + /// The requested quantity is invalid. + InvalidQuantity, /// No spendable outputs available. NoSpendableOutputs, /// Coin selection failed. @@ -56,6 +58,7 @@ impl fmt::Display for Error { Error::OnchainTxSigningFailed => write!(f, "On-chain transaction signing failed"), Error::InsufficientFunds => write!(f, "Insufficient funds"), Error::InvalidFeeRate => write!(f, "Invalid fee rate"), + Error::InvalidQuantity => write!(f, "Invalid quantity"), Error::NoSpendableOutputs => write!(f, "No spendable outputs available"), Error::CoinSelectionFailed => write!(f, "Coin selection failed"), Error::WalletOperationFailed => write!(f, "Wallet operation failed"), diff --git a/src/ffi/types.rs b/src/ffi/types.rs index 020f5bd22d..147bde5e40 100644 --- a/src/ffi/types.rs +++ b/src/ffi/types.rs @@ -58,6 +58,8 @@ pub use crate::payment::store::{ ConfirmationStatus, LSPFeeLimits, PaymentDirection, PaymentKind, PaymentStatus, }; pub use crate::payment::QrPaymentResult; +#[allow(unused_imports)] +pub use crate::payment::{AddressInfo, KeychainKind}; pub use crate::types::SpendableUtxo; use crate::{hex_utils, SocketAddress, UniffiCustomTypeConverter, UserChannelId}; diff --git a/src/lib.rs b/src/lib.rs index 8497b5c33c..212e3660d4 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -157,6 +157,7 @@ use liquidity::{LSPS1Liquidity, LiquiditySource}; use logger::{log_debug, log_error, log_info, log_trace, LdkLogger, Logger}; use payment::asynchronous::om_mailbox::OnionMessageMailbox; use payment::asynchronous::static_invoice_store::StaticInvoiceStore; +pub use payment::{AddressInfo, KeychainKind}; use payment::{ Bolt11Payment, Bolt12Payment, OnchainPayment, PaymentDetails, SpontaneousPayment, UnifiedQrPayment, diff --git a/src/payment/mod.rs b/src/payment/mod.rs index f629960e1d..ba59aea06a 100644 --- a/src/payment/mod.rs +++ b/src/payment/mod.rs @@ -17,7 +17,7 @@ mod unified_qr; pub use bolt11::Bolt11Payment; pub use bolt12::Bolt12Payment; -pub use onchain::OnchainPayment; +pub use onchain::{AddressInfo, KeychainKind, OnchainPayment}; pub use spontaneous::SpontaneousPayment; pub use store::{ ConfirmationStatus, LSPFeeLimits, PaymentDetails, PaymentDirection, PaymentKind, PaymentStatus, diff --git a/src/payment/onchain.rs b/src/payment/onchain.rs index 5709f7274d..e409322303 100644 --- a/src/payment/onchain.rs +++ b/src/payment/onchain.rs @@ -36,6 +36,62 @@ macro_rules! maybe_map_fee_rate_opt { }}; } +/// The keychain an address was derived from. +/// +/// Address derivation APIs can use [`KeychainKind::External`] for receive addresses or +/// [`KeychainKind::Internal`] for change addresses. APIs that generate or reveal new receive +/// addresses always operate on [`KeychainKind::External`]. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub enum KeychainKind { + /// External receive-address keychain. + External, + /// Internal change-address keychain. + Internal, +} + +impl From for KeychainKind { + fn from(keychain: bdk_wallet::KeychainKind) -> Self { + match keychain { + bdk_wallet::KeychainKind::External => Self::External, + bdk_wallet::KeychainKind::Internal => Self::Internal, + } + } +} + +impl From for bdk_wallet::KeychainKind { + fn from(keychain: KeychainKind) -> Self { + match keychain { + KeychainKind::External => Self::External, + KeychainKind::Internal => Self::Internal, + } + } +} + +/// Metadata for an address derived by the on-chain wallet. +/// +/// The `index` is the BIP32 child index within `keychain`. For receive addresses generated by +/// [`OnchainPayment::new_address_info`] and [`OnchainPayment::new_address_info_for_type`], +/// `keychain` is expected to be [`KeychainKind::External`]. +#[derive(Debug, Clone, PartialEq, Eq)] +pub struct AddressInfo { + /// Child index of this address within its keychain. + pub index: u32, + /// The derived Bitcoin address. + pub address: Address, + /// The keychain this address belongs to. + pub keychain: KeychainKind, +} + +impl From for AddressInfo { + fn from(address_info: bdk_wallet::AddressInfo) -> Self { + Self { + index: address_info.index, + address: address_info.address, + keychain: address_info.keychain.into(), + } + } +} + /// A payment handler allowing to send and receive on-chain payments. /// /// Should be retrieved by calling [`Node::onchain_payment`]. @@ -64,6 +120,17 @@ impl OnchainPayment { Ok(funding_address) } + /// Retrieve a new on-chain/funding address with derivation metadata. + /// + /// This uses the same default address type and receive cursor as [`new_address`]. + /// + /// [`new_address`]: Self::new_address + pub fn new_address_info(&self) -> Result { + let funding_address_info = AddressInfo::from(self.wallet.get_new_address_info()?); + log_info!(self.logger, "Generated new funding address: {}", funding_address_info.address); + Ok(funding_address_info) + } + /// Retrieve a new on-chain address for a specific address type. pub fn new_address_for_type(&self, address_type: AddressType) -> Result { if !*self.is_running.read().unwrap() { @@ -80,6 +147,70 @@ impl OnchainPayment { Ok(funding_address) } + /// Retrieve a new on-chain address with derivation metadata for a specific address type. + pub fn new_address_info_for_type( + &self, address_type: AddressType, + ) -> Result { + if !*self.is_running.read().unwrap() { + return Err(Error::NotRunning); + } + + let funding_address_info = + AddressInfo::from(self.wallet.get_new_address_info_for_type(address_type)?); + log_info!( + self.logger, + "Generated new funding address for {:?}: {}", + address_type, + funding_address_info.address + ); + Ok(funding_address_info) + } + + /// Derive address metadata for `address_type`, `keychain`, and `index`. + /// + /// This does not reveal, reserve, or advance any wallet cursor. + pub fn address_info_for_type_at_index( + &self, address_type: AddressType, keychain: KeychainKind, index: u32, + ) -> Result { + if !*self.is_running.read().unwrap() { + return Err(Error::NotRunning); + } + + self.wallet + .get_address_info_for_type_at_index(address_type, keychain, index) + .map(Into::into) + } + + /// Derive address metadata for a contiguous range without advancing any wallet cursor. + /// + /// The returned vector contains `count` addresses starting at `start_index`. Batch requests are + /// capped at 10,000 addresses per call. + pub fn address_infos_for_type( + &self, address_type: AddressType, keychain: KeychainKind, start_index: u32, count: u32, + ) -> Result, Error> { + if !*self.is_running.read().unwrap() { + return Err(Error::NotRunning); + } + + self.wallet + .get_address_infos_for_type(address_type, keychain, start_index, count) + .map(|infos| infos.into_iter().map(Into::into).collect()) + } + + /// Reveal external receive addresses for `address_type` up to and including `index`. + /// + /// After this returns successfully, normal address generation for `address_type` will not return + /// any receive address with an index at or below `index`. + pub fn reveal_receive_addresses_to( + &self, address_type: AddressType, index: u32, + ) -> Result<(), Error> { + if !*self.is_running.read().unwrap() { + return Err(Error::NotRunning); + } + + self.wallet.reveal_receive_addresses_to(address_type, index) + } + /// Returns a list of all UTXOs that are safe to spend. /// /// This excludes any outputs that are currently being used to fund Lightning channels. diff --git a/src/wallet/mod.rs b/src/wallet/mod.rs index 49928f0beb..ac1b69a790 100644 --- a/src/wallet/mod.rs +++ b/src/wallet/mod.rs @@ -13,7 +13,9 @@ use std::sync::{Arc, Mutex, MutexGuard, RwLock}; use bdk_chain::spk_client::{FullScanRequest, SyncRequest}; use bdk_wallet::event::WalletEvent; -use bdk_wallet::{Balance, KeychainKind, LocalOutput, PersistedWallet, Update}; +use bdk_wallet::{ + AddressInfo, Balance, KeychainKind as BdkKeychainKind, LocalOutput, PersistedWallet, Update, +}; use bdk_wallet_aggregate::AggregateWallet; use bitcoin::address::NetworkUnchecked; use bitcoin::bip32::Xpriv; @@ -51,12 +53,34 @@ use crate::event::{TxInput, TxOutput}; use crate::fee_estimator::{ConfirmationTarget, FeeEstimator, OnchainFeeEstimator}; use crate::logger::{log_debug, log_error, log_info, log_trace, LdkLogger, Logger}; use crate::payment::store::ConfirmationStatus; -use crate::payment::{PaymentDetails, PaymentDirection, PaymentStatus}; +use crate::payment::{KeychainKind, PaymentDetails, PaymentDirection, PaymentStatus}; use crate::types::{Broadcaster, ChannelManager, DynStore, PaymentStore}; use crate::{Error, NodeMetrics}; // Minimum economical output value (dust limit) const DUST_LIMIT_SATS: u64 = 546; +const BIP32_MAX_NORMAL_INDEX: u32 = (1 << 31) - 1; +const MAX_ADDRESS_INFO_BATCH_COUNT: u32 = bdk_wallet_aggregate::MAX_ADDRESS_INFO_BATCH_COUNT; + +fn validate_derivation_index(index: u32) -> Result<(), Error> { + if index > BIP32_MAX_NORMAL_INDEX { + return Err(Error::InvalidQuantity); + } + Ok(()) +} + +fn validate_derivation_range(start_index: u32, count: u32) -> Result<(), Error> { + validate_derivation_index(start_index)?; + if count > MAX_ADDRESS_INFO_BATCH_COUNT { + return Err(Error::InvalidQuantity); + } + if count == 0 { + return Ok(()); + } + + let last_index = start_index.checked_add(count - 1).ok_or(Error::InvalidQuantity)?; + validate_derivation_index(last_index) +} #[derive(Clone, Copy)] pub(crate) enum OnchainSendAmount { @@ -151,23 +175,23 @@ impl Wallet { self.fee_estimator.estimate_fee_rate(target) } - pub(crate) fn get_full_scan_request(&self) -> FullScanRequest { + pub(crate) fn get_full_scan_request(&self) -> FullScanRequest { self.inner.lock().unwrap().start_full_scan().build() } - pub(crate) fn get_incremental_sync_request(&self) -> SyncRequest<(KeychainKind, u32)> { + pub(crate) fn get_incremental_sync_request(&self) -> SyncRequest<(BdkKeychainKind, u32)> { self.inner.lock().unwrap().start_sync_with_revealed_spks().build() } pub(crate) fn get_wallet_full_scan_request( &self, address_type: AddressType, - ) -> Result, bdk_wallet_aggregate::Error> { + ) -> Result, bdk_wallet_aggregate::Error> { self.inner.lock().unwrap().wallet_full_scan_request(&address_type) } pub(crate) fn get_wallet_incremental_sync_request( &self, address_type: AddressType, - ) -> Result, bdk_wallet_aggregate::Error> { + ) -> Result, bdk_wallet_aggregate::Error> { self.inner.lock().unwrap().wallet_incremental_sync_request(&address_type) } @@ -191,7 +215,7 @@ impl Wallet { // Get a drain script for change outputs. pub(crate) fn get_drain_script(&self) -> Result { let locked_wallet = self.inner.lock().unwrap(); - let change_address = locked_wallet.peek_address(KeychainKind::Internal, 0); + let change_address = locked_wallet.peek_address(BdkKeychainKind::Internal, 0); Ok(change_address.address.script_pubkey()) } @@ -694,8 +718,12 @@ impl Wallet { } pub(crate) fn get_new_address(&self) -> Result { + self.get_new_address_info().map(|address_info| address_info.address) + } + + pub(crate) fn get_new_address_info(&self) -> Result { let mut locked_wallet = self.inner.lock().unwrap(); - locked_wallet.new_address().map_err(|e| { + locked_wallet.new_address_info().map_err(|e| { log_error!(self.logger, "Failed to get new address: {}", e); Error::WalletOperationFailed }) @@ -704,13 +732,78 @@ impl Wallet { pub(crate) fn get_new_address_for_type( &self, address_type: AddressType, ) -> Result { + self.get_new_address_info_for_type(address_type).map(|address_info| address_info.address) + } + + pub(crate) fn get_new_address_info_for_type( + &self, address_type: AddressType, + ) -> Result { let mut locked_wallet = self.inner.lock().unwrap(); - locked_wallet.new_address_for(&address_type).map_err(|e| { + locked_wallet.new_address_info_for(&address_type).map_err(|e| { log_error!(self.logger, "Failed to get new address for type {:?}: {}", address_type, e); Error::WalletOperationFailed }) } + pub(crate) fn get_address_info_for_type_at_index( + &self, address_type: AddressType, keychain: KeychainKind, index: u32, + ) -> Result { + validate_derivation_index(index)?; + + let locked_wallet = self.inner.lock().unwrap(); + locked_wallet.address_info_for(&address_type, keychain.into(), index).map_err(|e| { + log_error!( + self.logger, + "Failed to get address info for type {:?} keychain {:?} at index {}: {}", + address_type, + keychain, + index, + e + ); + Error::WalletOperationFailed + }) + } + + pub(crate) fn get_address_infos_for_type( + &self, address_type: AddressType, keychain: KeychainKind, start_index: u32, count: u32, + ) -> Result, Error> { + validate_derivation_range(start_index, count)?; + + let locked_wallet = self.inner.lock().unwrap(); + locked_wallet.address_infos_for(&address_type, keychain.into(), start_index, count).map_err( + |e| { + log_error!( + self.logger, + "Failed to get address infos for type {:?} keychain {:?} at indexes {}..{}: {}", + address_type, + keychain, + start_index, + start_index.saturating_add(count), + e + ); + Error::WalletOperationFailed + }, + ) + } + + pub(crate) fn reveal_receive_addresses_to( + &self, address_type: AddressType, index: u32, + ) -> Result<(), Error> { + validate_derivation_index(index)?; + + let mut locked_wallet = self.inner.lock().unwrap(); + locked_wallet.reveal_addresses_to(&address_type, index).map_err(|e| { + log_error!( + self.logger, + "Failed to reveal receive addresses through {} for type {:?}: {}", + index, + address_type, + e + ); + Error::WalletOperationFailed + }) + } + // Returns a native witness address for Lightning channel scripts. // Falls back to a loaded NativeSegwit/Taproot wallet if the primary is not one. pub(crate) fn get_new_witness_address(&self) -> Result { @@ -1030,7 +1123,7 @@ impl Wallet { OnchainSendAmount::AllRetainingReserve { cur_anchor_reserve_sats } if cur_anchor_reserve_sats > DUST_LIMIT_SATS => { - let change_address_info = primary.peek_address(KeychainKind::Internal, 0); + let change_address_info = primary.peek_address(BdkKeychainKind::Internal, 0); let spendable_amount_sats = self .get_balances_inner(&aggregate_balance, cur_anchor_reserve_sats) .map(|(_, s)| s) @@ -1815,3 +1908,45 @@ impl ChangeDestinationSource for WalletKeysManager { }) } } + +#[cfg(test)] +mod tests { + use super::{ + validate_derivation_index, validate_derivation_range, BIP32_MAX_NORMAL_INDEX, + MAX_ADDRESS_INFO_BATCH_COUNT, + }; + use crate::Error; + + #[test] + fn derivation_index_validation_rejects_hardened_range() { + assert_eq!(validate_derivation_index(BIP32_MAX_NORMAL_INDEX), Ok(())); + assert_eq!( + validate_derivation_index(BIP32_MAX_NORMAL_INDEX + 1), + Err(Error::InvalidQuantity) + ); + } + + #[test] + fn derivation_range_validation_rejects_overflow_into_hardened_range() { + assert_eq!(validate_derivation_range(BIP32_MAX_NORMAL_INDEX - 1, 2), Ok(())); + assert_eq!( + validate_derivation_range(BIP32_MAX_NORMAL_INDEX - 1, 3), + Err(Error::InvalidQuantity) + ); + assert_eq!(validate_derivation_range(u32::MAX, 1), Err(Error::InvalidQuantity)); + } + + #[test] + fn derivation_range_validation_rejects_oversized_batches() { + assert_eq!(validate_derivation_range(0, MAX_ADDRESS_INFO_BATCH_COUNT), Ok(())); + assert_eq!( + validate_derivation_range(0, MAX_ADDRESS_INFO_BATCH_COUNT + 1), + Err(Error::InvalidQuantity) + ); + } + + #[test] + fn derivation_range_validation_allows_empty_ranges_at_valid_start() { + assert_eq!(validate_derivation_range(BIP32_MAX_NORMAL_INDEX, 0), Ok(())); + } +}