Merge pull request #104 from breez/savage-service-status

Update 0.2.10 & add service status page
This commit is contained in:
Roei Erez
2023-11-27 17:27:25 +02:00
committed by GitHub
20 changed files with 379 additions and 42 deletions

View File

@@ -0,0 +1,36 @@
using Breez.Sdk;
public class ServiceStatusSnippets
{
public void HealthCheckStatus(BlockingBreezServices sdk)
{
// ANCHOR: health-check-status
try
{
var healthCheck = sdk.ServiceHealthCheck();
Console.WriteLine($"Current service status is: {healthCheck.status}");
}
catch (Exception)
{
// Handle error
}
// ANCHOR_END: health-check-status
}
public void ReportPaymentFailure(BlockingBreezServices sdk)
{
// ANCHOR: report-payment-failure
var paymentHash = "...";
try
{
sdk.ReportIssue(new ReportIssueRequest.PaymentFailure(
new ReportPaymentFailureDetails(paymentHash)
));
}
catch (Exception)
{
// Handle error
}
// ANCHOR_END: report-payment-failure
}
}

View File

@@ -0,0 +1,18 @@
import 'package:breez_sdk/breez_sdk.dart';
import 'package:breez_sdk/bridge_generated.dart';
Future<void> healthCheckStatus() async {
// ANCHOR: health-check-status
ServiceHealthCheckResponse healthCheck = await BreezSDK().serviceHealthCheck();
print("Current service status is: ${healthCheck.status}");
// ANCHOR_END: health-check-status
}
Future<void> reportPaymentFailure() async {
// ANCHOR: report-payment-failure
String paymentHash = "...";
await BreezSDK().reportIssue(
req: ReportIssueRequest.paymentFailure(
data: ReportPaymentFailureDetails(paymentHash: paymentHash)));
// ANCHOR_END: report-payment-failure
}

View File

@@ -52,12 +52,10 @@ packages:
breez_sdk:
dependency: "direct main"
description:
path: "."
ref: HEAD
resolved-ref: "9629def110a9dd03413850a05e9709d3c9794b0d"
url: "https://github.com/breez/breez-sdk-flutter"
source: git
version: "0.2.9"
path: "packages/breez-sdk-flutter"
relative: true
source: path
version: "0.2.10"
build:
dependency: transitive
description:
@@ -106,14 +104,6 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.17.2"
colorize:
dependency: transitive
description:
name: colorize
sha256: "584746cd6ba1cba0633b6720f494fe6f9601c4170f0666c1579d2aa2a61071ba"
url: "https://pub.dev"
source: hosted
version: "3.0.0"
convert:
dependency: transitive
description:
@@ -171,10 +161,10 @@ packages:
dependency: transitive
description:
name: flutter_rust_bridge
sha256: "8dcfeff9dcf0db9c76578c8805a337c0e5e21b4d96887eb1007b6fe141e15ea9"
sha256: ff90d5ddd0cda6d94ed048cc9c4a4d993d1a4bb11605d60a1282fc1bbf173c77
url: "https://pub.dev"
source: hosted
version: "1.75.2"
version: "1.80.1"
freezed:
dependency: transitive
description:
@@ -331,10 +321,10 @@ packages:
dependency: transitive
description:
name: petitparser
sha256: cb3798bef7fc021ac45b308f4b51208a152792445cce0448c9a4ba5879dd8750
sha256: eeb2d1428ee7f4170e2bd498827296a18d4e7fc462b71727d111c0ac7707cfa6
url: "https://pub.dev"
source: hosted
version: "5.4.0"
version: "6.0.1"
pointycastle:
dependency: transitive
description:
@@ -371,10 +361,10 @@ packages:
dependency: transitive
description:
name: puppeteer
sha256: dd49117259867d0ce0de33ddd95628fb70cff94581a6432c08272447b8dd1d27
sha256: eedeaae6ec5d2e54f9ae22ab4d6b3dda2e8791c356cc783046d06c287ffe11d8
url: "https://pub.dev"
source: hosted
version: "2.24.0"
version: "3.6.0"
rxdart:
dependency: transitive
description:
@@ -589,5 +579,5 @@ packages:
source: hosted
version: "3.1.2"
sdks:
dart: ">=3.1.0-185.0.dev <4.0.0"
flutter: ">=3.7.12"
dart: ">=3.1.0 <4.0.0"
flutter: ">=3.10.0"

View File

@@ -2,6 +2,6 @@ module main
go 1.19
require github.com/breez/breez-sdk-go v0.2.9
require github.com/breez/breez-sdk-go v0.2.10
replace github.com/breez/breez-sdk-go => ./packages/breez-sdk-go

View File

@@ -0,0 +1,29 @@
package example
import (
"log"
"github.com/breez/breez-sdk-go/breez_sdk"
)
func HealthCheckStatus() {
// ANCHOR: health-check-status
if healthCheck, err := sdk.ServiceHealthCheck(); err != nil {
log.Printf("Current service status is: %v", healthCheck.Status)
}
// ANCHOR_END: health-check-status
}
func ReportPaymentFailure() {
// ANCHOR: report-payment-failure
paymentHash := "..."
reportIssueRequest := breez_sdk.ReportIssueRequestPaymentFailure{
Data: breez_sdk.ReportPaymentFailureDetails{
PaymentHash: paymentHash,
},
}
if err := sdk.ReportIssue(reportIssueRequest); err != nil {
log.Printf("%#v", err)
}
// ANCHOR_END: report-payment-failure
}

View File

@@ -34,7 +34,7 @@ kotlin {
}
val commonMain by getting {
dependencies {
implementation("technology.breez:breez-sdk-kmp:0.2.9")
implementation("technology.breez:breez-sdk-kmp:0.2.10")
}
}
}

View File

@@ -0,0 +1,27 @@
package com.example.kotlinmpplib
import breez_sdk.*
class ServiceStatus {
fun HealthCheckStatus(sdk: BlockingBreezServices) {
// ANCHOR: health-check-status
try {
val healthCheck = sdk.serviceHealthCheck()
// Log.v("Breez", "Current service status is: ${healthCheck.status}")
} catch (e: Exception) {
// Handle error
}
// ANCHOR_END: health-check-status
}
fun reportPaymentFailure(sdk: BlockingBreezServices) {
// ANCHOR: report-payment-failure
val paymentHash = "..."
try {
sdk.reportIssue(ReportIssueRequest.PaymentFailure(
ReportPaymentFailureDetails(paymentHash)))
} catch (e: Exception) {
// Handle error
}
// ANCHOR_END: report-payment-failure
}
}

View File

@@ -0,0 +1,23 @@
import breez_sdk
def health_check_status(sdk_services):
try:
# ANCHOR: health-check-status
health_check = sdk_services.service_health_check()
print("Current service status is: ", health_check.status)
# ANCHOR_END: health-check-status
except Exception as error:
print(error)
raise
def report_payment_failure(sdk_services):
try:
# ANCHOR: report-payment-failure
payment_hash = "..."
sdk_services.report_issue(
breez_sdk.ReportIssueRequest.PAYMENT_FAILURE(
breez_sdk.ReportPaymentFailureDetails(payment_hash)))
# ANCHOR_END: report-payment-failure
except Exception as error:
print(error)
raise

View File

@@ -0,0 +1,18 @@
import { serviceHealthCheck, reportIssue, ReportIssueRequestVariant } from '@breeztech/react-native-breez-sdk'
const healthCheckStatus = async () => {
// ANCHOR: health-check-status
const healthCheck = await serviceHealthCheck()
console.log(`Current service status is: ${healthCheck.status}`)
// ANCHOR_END: health-check-status
}
const reportPaymentFailure = async () => {
// ANCHOR: report-payment-failure
const paymentHash = '...'
await reportIssue({
type: ReportIssueRequestVariant.PAYMENT_FAILURE,
data: { paymentHash }
})
// ANCHOR_END: report-payment-failure
}

View File

@@ -714,10 +714,10 @@
"@babel/helper-validator-identifier" "^7.22.20"
to-fast-properties "^2.0.0"
"@breeztech/react-native-breez-sdk@0.2.9":
version "0.2.9"
resolved "https://registry.yarnpkg.com/@breeztech/react-native-breez-sdk/-/react-native-breez-sdk-0.2.9.tgz#e1bcd37f16b92ac5792fedf7c4afa481322dac80"
integrity sha512-4mziuxCa8hpDGtMFD4VWK7tj+z3F/48x5NsKwxIYMkfLxxYP+6ZvD0ucEbyqr3P0Lwn0Cj4/iCnwM2gIL8UFcw==
"@breeztech/react-native-breez-sdk@0.2.10":
version "0.2.10"
resolved "https://registry.yarnpkg.com/@breeztech/react-native-breez-sdk/-/react-native-breez-sdk-0.2.10.tgz#072b00f57028b5276c600a462cbcaac93d3dee22"
integrity sha512-81wtbkKGxhDaIweIQkD+LLDUL7WTtbI3qEb9vx4Itiu1hGzM8Q2RlYNF5R1jh2m4wdYKUKMWSBd3O4VRnywf1Q==
"@esbuild/android-arm64@0.18.20":
version "0.18.20"

View File

@@ -458,8 +458,8 @@ dependencies = [
[[package]]
name = "breez-sdk-core"
version = "0.2.9"
source = "git+https://github.com/breez/breez-sdk?tag=0.2.9#82fdc4f7d2de354fc299cc4fbf8691492d4bc642"
version = "0.2.10"
source = "git+https://github.com/breez/breez-sdk?tag=0.2.10#d18529988eb7b1038473161e44c88225c7a0236d"
dependencies = [
"aes",
"anyhow",
@@ -605,9 +605,8 @@ dependencies = [
[[package]]
name = "cln-grpc"
version = "0.1.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "57af6eff15ee3fd7a0e09d0baeab8d33c892a73d97b87248e5f94f4749eacfe1"
version = "0.1.7"
source = "git+https://github.com/cdecker/lightning.git?tag=gl-20231113#075927b2c5f38fdbde4c0764135be58340b0ce08"
dependencies = [
"anyhow",
"bitcoin 0.30.1",
@@ -1132,7 +1131,7 @@ checksum = "6fb8d784f27acf97159b40fc4db5ecd8aa23b9ad5ef69cdd136d3bc80665f0c0"
[[package]]
name = "gl-client"
version = "0.1.9"
source = "git+https://github.com/Blockstream/greenlight.git?rev=c7ff67eb062c021105f5601df3ac8699ecbeb51c#c7ff67eb062c021105f5601df3ac8699ecbeb51c"
source = "git+https://github.com/Blockstream/greenlight.git?rev=84a66ac3c467569365285814ef5a691b5b97f60d#84a66ac3c467569365285814ef5a691b5b97f60d"
dependencies = [
"anyhow",
"async-trait",
@@ -1160,7 +1159,6 @@ dependencies = [
"serde",
"serde_bolt 0.2.6",
"serde_json",
"serde_with 2.3.3",
"sha256",
"tempfile",
"thiserror",
@@ -2583,7 +2581,6 @@ dependencies = [
"base64 0.13.1",
"chrono",
"hex",
"indexmap 1.9.3",
"serde",
"serde_json",
"serde_with_macros 2.3.3",

View File

@@ -6,6 +6,6 @@ edition = "2021"
[dependencies]
anyhow = "1"
bip39 = { version = "2", features = ["rand"] }
breez-sdk-core = { git = "https://github.com/breez/breez-sdk", tag = "0.2.9" }
breez-sdk-core = { git = "https://github.com/breez/breez-sdk", tag = "0.2.10" }
log = "0.4"
tokio = "1.29"

View File

@@ -11,6 +11,7 @@ mod receive_payment;
mod send_onchain;
mod send_payment;
mod send_spontaneous_payment;
mod service_status;
mod static_channel_backup;
use anyhow::Result;

View File

@@ -0,0 +1,30 @@
use std::sync::Arc;
use anyhow::Result;
use breez_sdk_core::*;
use log::info;
async fn health_check_status(sdk: Arc<BreezServices>) -> Result<()> {
// ANCHOR: health-check-status
let health_check = sdk.service_health_check().await?;
info!("Current service status is: {:?}", health_check.status);
// ANCHOR_END: health-check-status
Ok(())
}
async fn report_payment_failure(sdk: Arc<BreezServices>) -> Result<()> {
// ANCHOR: report-payment-failure
let payment_hash = String::from("...");
sdk.report_issue(ReportIssueRequest::PaymentFailure {
data: ReportPaymentFailureDetails {
payment_hash,
comment: None,
},
})
.await?;
// ANCHOR_END: report-payment-failure
Ok(())
}

View File

@@ -5,8 +5,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/breez/breez-sdk-swift",
"state" : {
"revision" : "dcbb39d45bc6797447bf20f52bc22344026d0662",
"version" : "0.2.9"
"revision" : "74402afba8218ff84a0f32d1bc0d4ddc7698f576",
"version" : "0.2.10"
}
},
{

View File

@@ -8,7 +8,7 @@ let package = Package(
platforms: [.macOS(.v12)],
dependencies: [
.package(url: "https://github.com/apple/swift-argument-parser", from: "1.2.3"),
.package(url: "https://github.com/breez/breez-sdk-swift", from:"0.2.9")
.package(url: "https://github.com/breez/breez-sdk-swift", from:"0.2.10")
],
targets: [
// Targets are the basic building blocks of a package, defining a module or a test suite.

View File

@@ -0,0 +1,27 @@
//
// ServiceStatus.swift
//
//
// Created by dangeross on 27/11/2023.
//
import Foundation
import BreezSDK
func getServiceStatus(sdk: BlockingBreezServices) -> ServiceHealthCheckResponse? {
// ANCHOR: health-check-status
let healthCheck = try? sdk.serviceHealthCheck()
print("Current service status is: \(healthCheck?.status)")
// ANCHOR_END: health-check-status
return healthCheck
}
func reportPaymentFailure(sdk: BlockingBreezServices) {
// ANCHOR: report-payment-failure
let paymentHash = "..."
try? sdk.reportIssue(
req: ReportIssueRequest.paymentFailure(
data: ReportPaymentFailureDetails(paymentHash: paymentHash)))
// ANCHOR_END: report-payment-failure
}