mirror of
https://github.com/aljazceru/breez-sdk-liquid.git
synced 2025-12-24 09:24:25 +01:00
Rename namespace (#345)
* Rename namespace * Fix flutter build * Fix kotlin-multiplatform CI * Rename repositories
This commit is contained in:
@@ -6,12 +6,12 @@ import 'package:flutter_breez_liquid_example/services/credentials_manager.dart';
|
||||
import 'package:flutter_breez_liquid_example/services/keychain.dart';
|
||||
import 'package:flutter_breez_liquid_example/utils/config.dart';
|
||||
|
||||
import 'services/breez_liquid_sdk.dart';
|
||||
import 'services/breez_sdk_liquid.dart';
|
||||
|
||||
void main() async {
|
||||
WidgetsFlutterBinding.ensureInitialized();
|
||||
await initialize();
|
||||
final BreezLiquidSDK liquidSDK = BreezLiquidSDK();
|
||||
final BreezSDKLiquid liquidSDK = BreezSDKLiquid();
|
||||
final credentialsManager = CredentialsManager(keyChain: KeyChain());
|
||||
final mnemonic = await credentialsManager.restoreMnemonic();
|
||||
if (mnemonic.isNotEmpty) {
|
||||
@@ -21,7 +21,7 @@ void main() async {
|
||||
}
|
||||
|
||||
Future<BindingLiquidSdk> reconnect({
|
||||
required BreezLiquidSDK liquidSDK,
|
||||
required BreezSDKLiquid liquidSDK,
|
||||
required String mnemonic,
|
||||
LiquidNetwork network = LiquidNetwork.mainnet,
|
||||
}) async {
|
||||
@@ -35,7 +35,7 @@ Future<BindingLiquidSdk> reconnect({
|
||||
|
||||
class App extends StatefulWidget {
|
||||
final CredentialsManager credentialsManager;
|
||||
final BreezLiquidSDK liquidSDK;
|
||||
final BreezSDKLiquid liquidSDK;
|
||||
const App({super.key, required this.credentialsManager, required this.liquidSDK});
|
||||
|
||||
static const title = 'Breez Liquid SDK Demo';
|
||||
|
||||
@@ -3,12 +3,12 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter_breez_liquid/flutter_breez_liquid.dart';
|
||||
import 'package:flutter_breez_liquid_example/routes/connect/restore_page.dart';
|
||||
import 'package:flutter_breez_liquid_example/routes/home/home_page.dart';
|
||||
import 'package:flutter_breez_liquid_example/services/breez_liquid_sdk.dart';
|
||||
import 'package:flutter_breez_liquid_example/services/breez_sdk_liquid.dart';
|
||||
import 'package:flutter_breez_liquid_example/services/credentials_manager.dart';
|
||||
import 'package:flutter_breez_liquid_example/utils/config.dart';
|
||||
|
||||
class ConnectPage extends StatefulWidget {
|
||||
final BreezLiquidSDK liquidSDK;
|
||||
final BreezSDKLiquid liquidSDK;
|
||||
final CredentialsManager credentialsManager;
|
||||
const ConnectPage({super.key, required this.liquidSDK, required this.credentialsManager});
|
||||
|
||||
|
||||
@@ -6,11 +6,11 @@ import 'package:flutter_breez_liquid_example/routes/home/widgets/bottom_app_bar.
|
||||
import 'package:flutter_breez_liquid_example/routes/home/widgets/drawer.dart';
|
||||
import 'package:flutter_breez_liquid_example/routes/home/widgets/payment_list/payment_list.dart';
|
||||
import 'package:flutter_breez_liquid_example/routes/home/widgets/qr_scan_action_button.dart';
|
||||
import 'package:flutter_breez_liquid_example/services/breez_liquid_sdk.dart';
|
||||
import 'package:flutter_breez_liquid_example/services/breez_sdk_liquid.dart';
|
||||
import 'package:flutter_breez_liquid_example/services/credentials_manager.dart';
|
||||
|
||||
class HomePage extends StatefulWidget {
|
||||
final BreezLiquidSDK liquidSDK;
|
||||
final BreezSDKLiquid liquidSDK;
|
||||
final CredentialsManager credentialsManager;
|
||||
|
||||
const HomePage({
|
||||
|
||||
@@ -3,7 +3,7 @@ import 'dart:async';
|
||||
import 'package:flutter_breez_liquid/flutter_breez_liquid.dart' as liquid_sdk;
|
||||
import 'package:rxdart/rxdart.dart';
|
||||
|
||||
class BreezLiquidSDK {
|
||||
class BreezSDKLiquid {
|
||||
liquid_sdk.BindingLiquidSdk? instance;
|
||||
|
||||
Future<liquid_sdk.BindingLiquidSdk> connect({
|
||||
@@ -49,9 +49,9 @@ class BreezLiquidSDK {
|
||||
_breezLogStream ??= liquid_sdk.breezLogStream().asBroadcastStream();
|
||||
}
|
||||
|
||||
StreamSubscription<liquid_sdk.LiquidSdkEvent>? _breezEventsSubscription;
|
||||
StreamSubscription<liquid_sdk.SdkEvent>? _breezEventsSubscription;
|
||||
|
||||
Stream<liquid_sdk.LiquidSdkEvent>? _breezEventsStream;
|
||||
Stream<liquid_sdk.SdkEvent>? _breezEventsStream;
|
||||
|
||||
void _initializeEventsStream(liquid_sdk.BindingLiquidSdk sdk) {
|
||||
_breezEventsStream ??= sdk.addEventListener().asBroadcastStream();
|
||||
@@ -78,42 +78,42 @@ class BreezLiquidSDK {
|
||||
Stream<liquid_sdk.Payment> get paymentResultStream => _paymentResultStream.stream;
|
||||
|
||||
/* TODO: Liquid - Log statements are added for debugging purposes, should be removed after early development stage is complete & events are behaving as expected.*/
|
||||
/// Subscribes to LiquidSdkEvent's stream
|
||||
/// Subscribes to SdkEvent's stream
|
||||
void _subscribeToEventsStream(liquid_sdk.BindingLiquidSdk sdk) {
|
||||
_breezEventsSubscription = _breezEventsStream?.listen(
|
||||
(event) async {
|
||||
if (event is liquid_sdk.LiquidSdkEvent_PaymentFailed) {
|
||||
if (event is liquid_sdk.SdkEvent_PaymentFailed) {
|
||||
_logStreamController
|
||||
.add(liquid_sdk.LogEntry(line: "Payment Failed. ${event.details.swapId}", level: "WARN"));
|
||||
_paymentResultStream.addError(PaymentException(event.details));
|
||||
}
|
||||
if (event is liquid_sdk.LiquidSdkEvent_PaymentPending) {
|
||||
if (event is liquid_sdk.SdkEvent_PaymentPending) {
|
||||
_logStreamController
|
||||
.add(liquid_sdk.LogEntry(line: "Payment Pending. ${event.details.swapId}", level: "INFO"));
|
||||
_paymentResultStream.add(event.details);
|
||||
}
|
||||
if (event is liquid_sdk.LiquidSdkEvent_PaymentRefunded) {
|
||||
if (event is liquid_sdk.SdkEvent_PaymentRefunded) {
|
||||
_logStreamController
|
||||
.add(liquid_sdk.LogEntry(line: "Payment Refunded. ${event.details.swapId}", level: "INFO"));
|
||||
_paymentResultStream.add(event.details);
|
||||
}
|
||||
if (event is liquid_sdk.LiquidSdkEvent_PaymentRefundPending) {
|
||||
if (event is liquid_sdk.SdkEvent_PaymentRefundPending) {
|
||||
_logStreamController.add(
|
||||
liquid_sdk.LogEntry(line: "Pending Payment Refund. ${event.details.swapId}", level: "INFO"));
|
||||
_paymentResultStream.add(event.details);
|
||||
}
|
||||
if (event is liquid_sdk.LiquidSdkEvent_PaymentSucceeded) {
|
||||
if (event is liquid_sdk.SdkEvent_PaymentSucceeded) {
|
||||
_logStreamController
|
||||
.add(liquid_sdk.LogEntry(line: "Payment Succeeded. ${event.details.swapId}", level: "INFO"));
|
||||
_paymentResultStream.add(event.details);
|
||||
await _fetchWalletData(sdk);
|
||||
}
|
||||
if (event is liquid_sdk.LiquidSdkEvent_PaymentWaitingConfirmation) {
|
||||
if (event is liquid_sdk.SdkEvent_PaymentWaitingConfirmation) {
|
||||
_logStreamController.add(liquid_sdk.LogEntry(
|
||||
line: "Payment Waiting Confirmation. ${event.details.swapId}", level: "INFO"));
|
||||
_paymentResultStream.add(event.details);
|
||||
}
|
||||
if (event is liquid_sdk.LiquidSdkEvent_Synced) {
|
||||
if (event is liquid_sdk.SdkEvent_Synced) {
|
||||
_logStreamController.add(const liquid_sdk.LogEntry(line: "Received Synced event.", level: "INFO"));
|
||||
await _fetchWalletData(sdk);
|
||||
}
|
||||
Reference in New Issue
Block a user