Skip to content

Commit

Permalink
Merge pull request #956 from breez/savage-v0.4.0
Browse files Browse the repository at this point in the history
Prepare v0.4.0 release
  • Loading branch information
dangeross authored Apr 30, 2024
2 parents cd65efc + 5387b59 commit b08215d
Show file tree
Hide file tree
Showing 15 changed files with 101 additions and 29 deletions.
4 changes: 2 additions & 2 deletions libs/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion libs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ members = [
resolver = "2"

[workspace.package]
version = "0.4.0-rc5"
version = "0.4.0"

[workspace.dependencies]
uniffi = "0.23.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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 =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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()
}
}

Expand All @@ -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,
Expand All @@ -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
),
)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"
}
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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
Expand Down
50 changes: 43 additions & 7 deletions libs/sdk-flutter/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -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.
Expand Down Expand Up @@ -58,12 +94,12 @@ 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.
`ReceivePaymentRequest`, `SendPaymentRequest`, `SendSpontaneousPaymentRequest` now use `amount_msat` instead of `amount_sat`.
* 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.
* Allow `GetInfo` command to be executed through `executeCommand` API.
2 changes: 1 addition & 1 deletion libs/sdk-flutter/android/build.gradle.production
Original file line number Diff line number Diff line change
@@ -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'
Expand Down
2 changes: 1 addition & 1 deletion libs/sdk-flutter/ios/breez_sdk.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion libs/sdk-flutter/ios/breez_sdk.podspec.production
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
2 changes: 1 addition & 1 deletion libs/sdk-flutter/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -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'
Expand Down
2 changes: 1 addition & 1 deletion libs/sdk-react-native/example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion libs/sdk-react-native/package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
2 changes: 1 addition & 1 deletion tools/sdk-cli/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit b08215d

Please sign in to comment.