diff --git a/libs/Cargo.lock b/libs/Cargo.lock index 154f72f1f..987871469 100644 --- a/libs/Cargo.lock +++ b/libs/Cargo.lock @@ -512,7 +512,7 @@ dependencies = [ [[package]] name = "breez-sdk-core" -version = "0.4.0-rc5" +version = "0.4.0" dependencies = [ "aes", "anyhow", @@ -558,7 +558,7 @@ dependencies = [ [[package]] name = "breez_sdk" -version = "0.4.0-rc5" +version = "0.4.0" dependencies = [ "anyhow", "breez-sdk-core", diff --git a/libs/Cargo.toml b/libs/Cargo.toml index 972e352b7..3add1b61c 100644 --- a/libs/Cargo.toml +++ b/libs/Cargo.toml @@ -13,7 +13,7 @@ members = [ resolver = "2" [workspace.package] -version = "0.4.0-rc5" +version = "0.4.0" [workspace.dependencies] uniffi = "0.23.0" diff --git a/libs/sdk-bindings/bindings-android/lib/src/main/kotlin/breez_sdk_notification/Constants.kt b/libs/sdk-bindings/bindings-android/lib/src/main/kotlin/breez_sdk_notification/Constants.kt index a2e7fccb0..8601b35aa 100644 --- a/libs/sdk-bindings/bindings-android/lib/src/main/kotlin/breez_sdk_notification/Constants.kt +++ b/libs/sdk-bindings/bindings-android/lib/src/main/kotlin/breez_sdk_notification/Constants.kt @@ -69,8 +69,10 @@ object Constants { "swap_tx_confirmed_notification_channel_description" const val SWAP_TX_CONFIRMED_NOTIFICATION_CHANNEL_NAME = "swap_tx_confirmed_notification_channel_name" - const val SWAP_TX_CONFIRMED_NOTIFICATION_FAILURE_TITLE = + const val SWAP_TX_CONFIRMED_NOTIFICATION_FAILURE_TEXT = "swap_tx_confirmed_notification_failure_text" + const val SWAP_TX_CONFIRMED_NOTIFICATION_FAILURE_TITLE = + "swap_tx_confirmed_notification_failure_title" const val SWAP_TX_CONFIRMED_NOTIFICATION_TITLE = "swap_tx_confirmed_notification_title" const val SWAP_TX_CONFIRMED_WORKGROUP_ID = "swap_tx" @@ -116,8 +118,10 @@ object Constants { "Notifications for received swaps when the application is in the background" const val DEFAULT_SWAP_TX_CONFIRMED_NOTIFICATION_CHANNEL_NAME = "Received Swaps" + const val DEFAULT_SWAP_TX_CONFIRMED_NOTIFICATION_FAILURE_TEXT = + "Tap to complete swap" const val DEFAULT_SWAP_TX_CONFIRMED_NOTIFICATION_FAILURE_TITLE = - "Redeem Swap Failed" + "Swap Ongoing" const val DEFAULT_SWAP_TX_CONFIRMED_NOTIFICATION_TITLE = "Swap Confirmed" const val DEFAULT_SWAP_TX_CONFIRMED_WORKGROUP_DESCRIPTION = diff --git a/libs/sdk-bindings/bindings-android/lib/src/main/kotlin/breez_sdk_notification/job/RedeemSwap.kt b/libs/sdk-bindings/bindings-android/lib/src/main/kotlin/breez_sdk_notification/job/RedeemSwap.kt index e44c1f354..cadd213de 100644 --- a/libs/sdk-bindings/bindings-android/lib/src/main/kotlin/breez_sdk_notification/job/RedeemSwap.kt +++ b/libs/sdk-bindings/bindings-android/lib/src/main/kotlin/breez_sdk_notification/job/RedeemSwap.kt @@ -3,9 +3,11 @@ package breez_sdk_notification.job import android.content.Context import breez_sdk.BlockingBreezServices import breez_sdk.BreezEvent +import breez_sdk_notification.Constants.DEFAULT_SWAP_TX_CONFIRMED_NOTIFICATION_FAILURE_TEXT import breez_sdk_notification.Constants.DEFAULT_SWAP_TX_CONFIRMED_NOTIFICATION_FAILURE_TITLE import breez_sdk_notification.Constants.DEFAULT_SWAP_TX_CONFIRMED_NOTIFICATION_TITLE import breez_sdk_notification.Constants.NOTIFICATION_CHANNEL_SWAP_TX_CONFIRMED +import breez_sdk_notification.Constants.SWAP_TX_CONFIRMED_NOTIFICATION_FAILURE_TEXT import breez_sdk_notification.Constants.SWAP_TX_CONFIRMED_NOTIFICATION_FAILURE_TITLE import breez_sdk_notification.Constants.SWAP_TX_CONFIRMED_NOTIFICATION_TITLE import breez_sdk_notification.NotificationHelper.Companion.notifyChannel @@ -39,6 +41,7 @@ class RedeemSwapJob( logger.log(TAG, "Found swap for ${request.address}", "INFO") } catch (e: Exception) { logger.log(TAG, "Failed to manually redeem swap notification: ${e.message}", "WARN") + notifyFailure() } } @@ -60,9 +63,11 @@ class RedeemSwapJob( } } - override fun onShutdown() {} + override fun onShutdown() { + notifyFailure() + } - private fun notifySuccessAndShutdown(address: String) { + private fun notifySuccessAndShutdown(address: String) { logger.log(TAG, "Swap address $address redeemed successfully", "INFO") notifyChannel( context, @@ -75,4 +80,24 @@ class RedeemSwapJob( ) fgService.onFinished(this) } + + private fun notifyFailure() { + this.bitcoinAddress?.let{address -> + logger.log(TAG, "Swap address $address not redeemed", "INFO") + notifyChannel( + context, + NOTIFICATION_CHANNEL_SWAP_TX_CONFIRMED, + getString( + context, + SWAP_TX_CONFIRMED_NOTIFICATION_FAILURE_TITLE, + DEFAULT_SWAP_TX_CONFIRMED_NOTIFICATION_FAILURE_TITLE + ), + getString( + context, + SWAP_TX_CONFIRMED_NOTIFICATION_FAILURE_TEXT, + DEFAULT_SWAP_TX_CONFIRMED_NOTIFICATION_FAILURE_TEXT + ), + ) + } + } } diff --git a/libs/sdk-bindings/bindings-swift/Sources/BreezSDK/Constants.swift b/libs/sdk-bindings/bindings-swift/Sources/BreezSDK/Constants.swift index 9be2f0af5..5801b6c64 100644 --- a/libs/sdk-bindings/bindings-swift/Sources/BreezSDK/Constants.swift +++ b/libs/sdk-bindings/bindings-swift/Sources/BreezSDK/Constants.swift @@ -24,6 +24,7 @@ struct Constants { static let PAYMENT_RECEIVED_NOTIFICATION_TITLE = "payment_received_notification_title" static let PAYMENT_RECEIVED_NOTIFICATION_FAILURE_TITLE = "payment_received_notification_failure_title" static let SWAP_TX_CONFIRMED_NOTIFICATION_TITLE = "swap_tx_confirmed_notification_title" + static let SWAP_TX_CONFIRMED_NOTIFICATION_FAILURE_TEXT = "swap_tx_confirmed_notification_failure_text" static let SWAP_TX_CONFIRMED_NOTIFICATION_FAILURE_TITLE = "swap_tx_confirmed_notification_failure_title" // Resource Identifier Defaults @@ -35,5 +36,6 @@ struct Constants { static let DEFAULT_PAYMENT_RECEIVED_NOTIFICATION_TITLE = "Received %d sats" static let DEFAULT_PAYMENT_RECEIVED_NOTIFICATION_FAILURE_TITLE = "Receive Payment Failed" static let DEFAULT_SWAP_TX_CONFIRMED_NOTIFICATION_TITLE = "Swap Confirmed" - static let DEFAULT_SWAP_TX_CONFIRMED_NOTIFICATION_FAILURE_TITLE = "Redeem Swap Failed" + static let DEFAULT_SWAP_TX_CONFIRMED_NOTIFICATION_FAILURE_TEXT = "Tap to complete swap" + static let DEFAULT_SWAP_TX_CONFIRMED_NOTIFICATION_FAILURE_TITLE = "Swap Ongoing" } diff --git a/libs/sdk-bindings/bindings-swift/Sources/BreezSDK/Task/RedeemSwap.swift b/libs/sdk-bindings/bindings-swift/Sources/BreezSDK/Task/RedeemSwap.swift index 74502d400..be8876870 100644 --- a/libs/sdk-bindings/bindings-swift/Sources/BreezSDK/Task/RedeemSwap.swift +++ b/libs/sdk-bindings/bindings-swift/Sources/BreezSDK/Task/RedeemSwap.swift @@ -29,8 +29,8 @@ class RedeemSwapTask : TaskProtocol { if address == swapInfo.bitcoinAddress { if (swapInfo.paidMsat > 0) { self.logger.log(tag: TAG, line: "Swap address \(swapInfo.bitcoinAddress) redeemed succesfully", level: "INFO") - let successRedeemSwap = ResourceHelper.shared.getString(key: Constants.SWAP_TX_CONFIRMED_NOTIFICATION_TITLE, fallback: Constants.DEFAULT_SWAP_TX_CONFIRMED_NOTIFICATION_TITLE) - self.displayPushNotification(title: successRedeemSwap, logger: self.logger, threadIdentifier: Constants.NOTIFICATION_THREAD_SWAP_TX_CONFIRMED) + let notificationTitle = ResourceHelper.shared.getString(key: Constants.SWAP_TX_CONFIRMED_NOTIFICATION_TITLE, fallback: Constants.DEFAULT_SWAP_TX_CONFIRMED_NOTIFICATION_TITLE) + self.displayPushNotification(title: notificationTitle, logger: self.logger, threadIdentifier: Constants.NOTIFICATION_THREAD_SWAP_TX_CONFIRMED) } } break @@ -65,7 +65,8 @@ class RedeemSwapTask : TaskProtocol { } func onShutdown() { - let failRedeemSwap = ResourceHelper.shared.getString(key: Constants.SWAP_TX_CONFIRMED_NOTIFICATION_FAILURE_TITLE, fallback: Constants.DEFAULT_SWAP_TX_CONFIRMED_NOTIFICATION_FAILURE_TITLE) - self.displayPushNotification(title: failRedeemSwap, logger: self.logger, threadIdentifier: Constants.NOTIFICATION_THREAD_SWAP_TX_CONFIRMED) + let notificationTitle = ResourceHelper.shared.getString(key: Constants.SWAP_TX_CONFIRMED_NOTIFICATION_FAILURE_TITLE, fallback: Constants.DEFAULT_SWAP_TX_CONFIRMED_NOTIFICATION_FAILURE_TITLE) + let notificationBody = ResourceHelper.shared.getString(key: Constants.SWAP_TX_CONFIRMED_NOTIFICATION_FAILURE_TEXT, fallback: Constants.DEFAULT_SWAP_TX_CONFIRMED_NOTIFICATION_FAILURE_TEXT) + self.displayPushNotification(title: notificationTitle, body: notificationBody, logger: self.logger, threadIdentifier: Constants.NOTIFICATION_THREAD_SWAP_TX_CONFIRMED) } } diff --git a/libs/sdk-bindings/bindings-swift/Sources/BreezSDK/TaskProtocol.swift b/libs/sdk-bindings/bindings-swift/Sources/BreezSDK/TaskProtocol.swift index e33afd954..6f237bbbe 100644 --- a/libs/sdk-bindings/bindings-swift/Sources/BreezSDK/TaskProtocol.swift +++ b/libs/sdk-bindings/bindings-swift/Sources/BreezSDK/TaskProtocol.swift @@ -10,7 +10,7 @@ public protocol TaskProtocol : EventListener { } extension TaskProtocol { - func displayPushNotification(title: String, logger: ServiceLogger, threadIdentifier: String? = nil) { + func displayPushNotification(title: String, body: String? = nil, logger: ServiceLogger, threadIdentifier: String? = nil) { logger.log(tag: "TaskProtocol", line:"displayPushNotification \(title)", level: "INFO") guard let contentHandler = contentHandler, @@ -19,8 +19,12 @@ extension TaskProtocol { return } - if threadIdentifier != nil { - bestAttemptContent.threadIdentifier = threadIdentifier! + if let body = body { + bestAttemptContent.body = body + } + + if let threadIdentifier = threadIdentifier { + bestAttemptContent.threadIdentifier = threadIdentifier } bestAttemptContent.title = title diff --git a/libs/sdk-flutter/CHANGELOG.md b/libs/sdk-flutter/CHANGELOG.md index c6924b0a7..3638e8e62 100644 --- a/libs/sdk-flutter/CHANGELOG.md +++ b/libs/sdk-flutter/CHANGELOG.md @@ -1,10 +1,46 @@ SDK release notes can be found at [breez-sdk/releases](https://github.com/breez/breez-sdk/releases/) +## 0.4.0 +* **Breaking** Update Dart SDK range to be compatible with Flutter 3.19 +* **Breaking** Replace parameters of `connect` with `ConnectRequest`. +* **Breaking** `serviceHealthCheck` API now requires an `apiKey` which properly conducts a health check when services are offline. +* **Deprecation** `sendOnchain` is now deprecated. Use `payOnchain` instead. +* **Deprecation** `inProgressReverseSwaps` is now deprecated. Use `inProgressOnchainPayments` instead. +* **Deprecation** `fetchReverseSwapFees` is now deprecated. Use `prepareOnchainPayment` instead. +* Introduce `swapEventsStream` to listen in on swap events. +* Introduce `rescanSwaps` API to iterate all historical swap addresses and fetch their current status from the blockchain. +* Introduce `configureNode` API to configure an optional address to send funds to during a mutual channel close. +* Introduce `onchainPaymentLimits` API to fetch latest on-chain payment limits. +* Notification Service plugins are now bundled with the Flutter package. [Setup guide](https://sdk-doc-prerelease.breez.technology/notifications/setup_plugin.html). +* Various improvements to Notification Service plugins: + - Set log stream natively on Android. + - Allow setting channel setup fee limit through `ServiceConfig` that will be used to accept or decline LNURL-Payments that require a channel opening. + - Notifications on iOS are now grouped. + - Improved resource management. + - Notification Service is no longer attempted to start without permissions to show notifications on Android, which lead to an application crash. + +## 0.3.9 +* Introduce `generateDiagnosticData` API to generate diagnostic data. +* Fix swap confirmed block to be the earliest. + +## 0.3.8 +* Signer connects immediately on startup (fixes 30 seconds delay). +* Adapt signer policy to allow paying zero amount invoice. +* Update signer keep alive. + +## 0.3.6 +* Fix swap `INVOICE_AMOUNT_MISMATCH`. +* Defer signer start to increase overall startup time. +* Improve performance by reusing Breez server grpc connection. + +## 0.3.3 +* Upgrade to VLS 0.11. + ## 0.3.2 -* Fixed a signer crash +* Fixed a signer crash. ## 0.3.1 * Support notifications via a webhook after a swap transaction confirms. -* Reduced package size by not bundling pre-built binaries +* Reduced package size by not bundling pre-built binaries. ## 0.3.0 * Fixes compatibility issues ith `bdk-flutter` plugin. @@ -13,9 +49,9 @@ SDK release notes can be found at [breez-sdk/releases](https://github.com/breez/ * Introduce `setPaymentMetadata` API to set the external metadata of a payment as a valid JSON string. * Add optional `chainnotifierUrl` to `Config`. * Include `openChannelBolt11`, `lnurlPayDomain`, `reverseSwapInfo` in `LnPaymentDetails`. - `openChannelBolt11` for received payments which required to open a channel. - `lnurlPayDomain` for sent payments that are not to a Lightning Address. - `reverseSwapInfo` for payments that were sent in the context of a reverse swap. + - `openChannelBolt11` for received payments which required to open a channel. + - `lnurlPayDomain` for sent payments that are not to a Lightning Address. + - `reverseSwapInfo` for payments that were sent in the context of a reverse swap. ## 0.2.15 * This is a hotfix release that fixes a critical issue from previous release. @@ -58,7 +94,7 @@ SDK release notes can be found at [breez-sdk/releases](https://github.com/breez/ ## 0.2.7 * **Breaking** All APIs which previously allowed multiple parameters to be passed now require their corresponding `Request` object. - These API's include: `sendOnchain`, `sendPayment`, `sendSpontaneousPayment`, `refund`, `lnurlPay`, `lnurlWithdraw`. + These APIs include: `sendOnchain`, `sendPayment`, `sendSpontaneousPayment`, `refund`, `lnurlPay`, `lnurlWithdraw`. * **Breaking** All `request` params is renamed to `req`. * **Breaking** All `reqData` params that belong to a `req` object(_lnurlPay, lnurlWithdraw except lnurlAuth_) is renamed to `data`. * **Breaking** Use millisatoshi instead of satoshi for lightning amounts. @@ -66,4 +102,4 @@ SDK release notes can be found at [breez-sdk/releases](https://github.com/breez/ * Support pagination in `listPayments`. * Add optional `claimTxid` and `lockTxid` to `ReverseSwapInfo`. * Add `closingTxid` to closed channels received in payments list. -* Allow `GetInfo` command to be executed through `executeCommand` API. \ No newline at end of file +* Allow `GetInfo` command to be executed through `executeCommand` API. diff --git a/libs/sdk-flutter/android/build.gradle.production b/libs/sdk-flutter/android/build.gradle.production index 74a6523c8..4cea38708 100644 --- a/libs/sdk-flutter/android/build.gradle.production +++ b/libs/sdk-flutter/android/build.gradle.production @@ -1,5 +1,5 @@ group 'com.breez.breez_sdk' -version '0.4.0-rc5' +version '0.4.0' buildscript { ext.kotlin_version = '1.8.20' diff --git a/libs/sdk-flutter/ios/breez_sdk.podspec b/libs/sdk-flutter/ios/breez_sdk.podspec index deb2edee0..3d036c584 100644 --- a/libs/sdk-flutter/ios/breez_sdk.podspec +++ b/libs/sdk-flutter/ios/breez_sdk.podspec @@ -2,7 +2,7 @@ # Run `pod lib lint breez_sdk.podspec` to validate before publishing. Pod::Spec.new do |s| s.name = 'breez_sdk' - s.version = '0.4.0-rc5' + s.version = '0.4.0' s.summary = 'BreezSDK flutter plugin.' s.description = <<-DESC BreezSDK flutter plugin. diff --git a/libs/sdk-flutter/ios/breez_sdk.podspec.production b/libs/sdk-flutter/ios/breez_sdk.podspec.production index 46ea75a41..7e45e0398 100644 --- a/libs/sdk-flutter/ios/breez_sdk.podspec.production +++ b/libs/sdk-flutter/ios/breez_sdk.podspec.production @@ -1,4 +1,4 @@ -tag_version = '0.4.0-rc5' +tag_version = '0.4.0' framework = 'breez_sdkFFI.xcframework' lib_name = "breez-sdkFFI.#{tag_version}" url = "https://github.com/breez/breez-sdk-swift/releases/download/#{tag_version}/#{framework}.zip" diff --git a/libs/sdk-flutter/pubspec.yaml b/libs/sdk-flutter/pubspec.yaml index f1c2e85ac..56b28f3bf 100644 --- a/libs/sdk-flutter/pubspec.yaml +++ b/libs/sdk-flutter/pubspec.yaml @@ -1,7 +1,7 @@ name: breez_sdk description: Flutter bindings for the Breez SDK repository: https://github.com/breez/breez-sdk-flutter -version: 0.4.0-rc5 +version: 0.4.0 environment: sdk: '>=3.3.0 <4.0.0' diff --git a/libs/sdk-react-native/example/package.json b/libs/sdk-react-native/example/package.json index 95295d881..e8d85a26c 100644 --- a/libs/sdk-react-native/example/package.json +++ b/libs/sdk-react-native/example/package.json @@ -13,7 +13,7 @@ "rebuild": "rm -rf node_modules && yarn && yarn pods" }, "dependencies": { - "@breeztech/react-native-breez-sdk": "0.4.0-rc5", + "@breeztech/react-native-breez-sdk": "0.4.0", "@dreson4/react-native-quick-bip39": "^0.0.5", "react": "18.1.0", "react-native": "0.70.15", diff --git a/libs/sdk-react-native/package.json b/libs/sdk-react-native/package.json index 6595567a9..fafd0e08f 100644 --- a/libs/sdk-react-native/package.json +++ b/libs/sdk-react-native/package.json @@ -1,6 +1,6 @@ { "name": "@breeztech/react-native-breez-sdk", - "version": "0.4.0-rc5", + "version": "0.4.0", "description": "React Native Breez SDK", "main": "lib/commonjs/index", "module": "lib/module/index", diff --git a/tools/sdk-cli/Cargo.lock b/tools/sdk-cli/Cargo.lock index cce3c96ab..be04aa760 100644 --- a/tools/sdk-cli/Cargo.lock +++ b/tools/sdk-cli/Cargo.lock @@ -458,7 +458,7 @@ dependencies = [ [[package]] name = "breez-sdk-core" -version = "0.4.0-rc5" +version = "0.4.0" dependencies = [ "aes", "anyhow",