Skip to content

Commit

Permalink
Apply naming changes in the SDK
Browse files Browse the repository at this point in the history
Addresses changes in: breez/breez-sdk-greenlight#350
  • Loading branch information
erdemyerebasmaz committed Jul 24, 2023
1 parent ac9a97b commit 5c5e802
Show file tree
Hide file tree
Showing 26 changed files with 31 additions and 31 deletions.
2 changes: 1 addition & 1 deletion integration_test/breez_sdk_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ void main() {
const input = "LNURL1DP68GURN8GHJ7MRFVA58GUMPW3EJUCM0D5HKZURF9ASH2ARG9AKXUATJDSHKGMEDD3HKW6TW"
"8A4NZ0F4VFJRZVMRX5MXGWTYVYMNJDTR8PJRYEFEVD3NSVMXXSCXVVECVYER2ENRVFJKXVEKVYUNVCE4XUUX2E3H"
"VCEKGEFCVG6KXDFJV9JRYFN5V9NN6MR0VA5KUZPFUCA";
final bridge = BreezBridge();
final bridge = BreezSDK();
final result = await bridge.parseInput(input: input);
expect(result, isNotNull);
// TODO real asserts
Expand Down
4 changes: 2 additions & 2 deletions lib/background/breez_service_initializer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import 'package:c_breez/bloc/account/credentials_manager.dart';
import 'package:c_breez/config.dart';
import 'package:c_breez/services/injector.dart';

Future<BreezBridge> initializeBreezServices() async {
Future<BreezSDK> initializeBreezServices() async {
final injector = ServiceInjector();
final breezLib = injector.breezLib;
final breezLib = injector.breezSDK;
final bool isBreezInitialized = await breezLib.isInitialized();
print("Is Breez Services initialized: $isBreezInitialized");
if (!isBreezInitialized) {
Expand Down
2 changes: 1 addition & 1 deletion lib/background/payment_hash_poller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class PaymentHashPoller {

void isPaymentReceived(Timer timer) async {
final injector = ServiceInjector();
final breezLib = injector.breezLib;
final breezLib = injector.breezSDK;
try {
final List<Payment> paymentList = await breezLib.listPayments(
filter: PaymentTypeFilter.Received,
Expand Down
2 changes: 1 addition & 1 deletion lib/bloc/account/account_bloc.dart
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class AccountBloc extends Cubit<AccountState> with HydratedMixin {

Stream<PaymentFilters> get paymentFiltersStream => _paymentFiltersStreamController.stream;

final BreezBridge _breezLib;
final BreezSDK _breezLib;
final CredentialsManager _credentialsManager;

AccountBloc(
Expand Down
2 changes: 1 addition & 1 deletion lib/bloc/backup/backup_bloc.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import 'package:breez_sdk/bridge_generated.dart' as sdk;

class BackupBloc extends Cubit<BackupState?> {
final _log = FimberLog("BackupBloc");
final BreezBridge _breezLib;
final BreezSDK _breezLib;

BackupBloc(this._breezLib) : super(null) {
_listenBackupEvents();
Expand Down
2 changes: 1 addition & 1 deletion lib/bloc/buy_bitcoin/moonpay/moonpay_bloc.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import 'package:flutter_bloc/flutter_bloc.dart';
final _log = FimberLog("MoonPayBloc");

class MoonPayBloc extends Cubit<MoonPayState> {
final BreezBridge _breezLib;
final BreezSDK _breezLib;
final Preferences _preferences;

MoonPayBloc(
Expand Down
2 changes: 1 addition & 1 deletion lib/bloc/currency/currency_bloc.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import 'package:c_breez/bloc/currency/currency_state.dart';
import 'package:hydrated_bloc/hydrated_bloc.dart';

class CurrencyBloc extends Cubit<CurrencyState> with HydratedMixin {
final BreezBridge _breezLib;
final BreezSDK _breezLib;

CurrencyBloc(this._breezLib) : super(CurrencyState.initial()) {
_initializeCurrencyBloc();
Expand Down
2 changes: 1 addition & 1 deletion lib/bloc/input/input_bloc.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import 'package:rxdart/rxdart.dart';

class InputBloc extends Cubit<InputState> {
final _log = FimberLog("InputBloc");
final BreezBridge _breezLib;
final BreezSDK _breezLib;
final LightningLinksService _lightningLinks;
final Device _device;

Expand Down
4 changes: 2 additions & 2 deletions lib/bloc/lsp/lsp_bloc.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ import 'package:hydrated_bloc/hydrated_bloc.dart';
import 'lsp_state.dart';

class LSPBloc extends Cubit<LspState?> {
final BreezBridge _breezLib;
final BreezSDK _breezLib;
NodeState? _nodeState;

LSPBloc(this._breezLib) : super(null) {
// for every change in node state check if we have the current selected lsp as a peer.
// If not instruct the sdk to connect.
_breezLib.nodeStateStream.where((nodeState) => nodeState != null).listen((nodeState) async {
// emit first with the current selected lsp
emit(LspState(selectedLspId: await _breezLib.getLspId(), lspInfo: state?.lspInfo));
emit(LspState(selectedLspId: await _breezLib.lspId(), lspInfo: state?.lspInfo));
_nodeState = nodeState;
_refreshLspInfo();
});
Expand Down
2 changes: 1 addition & 1 deletion lib/bloc/refund/refund_bloc.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import 'package:flutter_bloc/flutter_bloc.dart';
final _log = FimberLog("RefundBloc");

class RefundBloc extends Cubit<RefundState> {
final BreezBridge _breezLib;
final BreezSDK _breezLib;

RefundBloc(this._breezLib) : super(RefundState.initial()) {
_initializeRefundBloc();
Expand Down
2 changes: 1 addition & 1 deletion lib/bloc/swap_in/swap_in_bloc.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import 'package:flutter_bloc/flutter_bloc.dart';

class SwapInBloc extends Cubit<SwapInState> {
final _log = FimberLog("SwapInBloc");
final BreezBridge _breezLib;
final BreezSDK _breezLib;
late Timer timer;

SwapInBloc(this._breezLib) : super(SwapInState(null, null, isLoading: true)) {
Expand Down
2 changes: 1 addition & 1 deletion lib/bloc/withdraw/withdraw_funds_bloc.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import 'package:hydrated_bloc/hydrated_bloc.dart';
final _log = FimberLog("WithdrawFundsBloc");

class WithdrawFundsBloc extends Cubit<WithdrawFundsState> {
final BreezBridge _breezLib;
final BreezSDK _breezLib;

WithdrawFundsBloc(
this._breezLib,
Expand Down
4 changes: 2 additions & 2 deletions lib/config.dart
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class Config {
if (_instance == null) {
_log.v("Creating Config instance");
final injector = serviceInjector ?? ServiceInjector();
final breezLib = injector.breezLib;
final breezLib = injector.breezSDK;
final breezConfig = await _getBundledConfig();
final defaultConf = await _getDefaultConf(breezLib, breezConfig.apiKey, breezConfig.nodeConfig);
final defaultMempoolUrl = defaultConf.mempoolspaceUrl;
Expand All @@ -49,7 +49,7 @@ class Config {
}

static Future<sdk.Config> _getDefaultConf(
BreezBridge breezLib,
BreezSDK breezLib,
String apiKey,
sdk.NodeConfig nodeConfig, {
sdk.EnvironmentType environmentType = sdk.EnvironmentType.Production,
Expand Down
2 changes: 1 addition & 1 deletion lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ void main() async {
BreezDateUtils.setupLocales();
await Firebase.initializeApp();
final injector = ServiceInjector();
final breezLib = injector.breezLib;
final breezLib = injector.breezSDK;
breezLib.initialize();
FirebaseMessaging.onBackgroundMessage(_onBackgroundMessage);
final appDir = await getApplicationDocumentsDirectory();
Expand Down
2 changes: 1 addition & 1 deletion lib/routes/dev/commands_list.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class CommandsList extends StatefulWidget {
}

class _CommandsListState extends State<CommandsList> {
final _breezLib = ServiceInjector().breezLib;
final _breezLib = ServiceInjector().breezSDK;

final _cliInputController = TextEditingController();
final FocusNode _cliEntryFocusNode = FocusNode();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ class AccountRequiredActionsIndicator extends StatelessWidget {
useRootNavigator: false,
useSafeArea: false,
context: context,
builder: (_) => EnableBackupDialog(context, ServiceInjector().breezLib),
builder: (_) => EnableBackupDialog(context, ServiceInjector().breezSDK),
);
},
),
Expand Down
2 changes: 1 addition & 1 deletion lib/routes/home/widgets/enable_backup_dialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import 'package:flutter/material.dart';

class EnableBackupDialog extends StatefulWidget {
final BuildContext context;
final bridge.BreezBridge breezLib;
final bridge.BreezSDK breezLib;

const EnableBackupDialog(this.context, this.breezLib);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ void main() async {
MultiBlocProvider(
providers: [
BlocProvider<CurrencyBloc>(
create: (BuildContext context) => CurrencyBloc(ServiceInjector().breezLib),
create: (BuildContext context) => CurrencyBloc(ServiceInjector().breezSDK),
),
],
child: MaterialApp(
Expand Down
2 changes: 1 addition & 1 deletion lib/routes/home/widgets/payments_list/payments_list.dart
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ void main() async {
MultiBlocProvider(
providers: [
BlocProvider<CurrencyBloc>(
create: (BuildContext context) => CurrencyBloc(injector.breezLib),
create: (BuildContext context) => CurrencyBloc(injector.breezSDK),
),
BlocProvider<UserProfileBloc>(
create: (BuildContext context) => UserProfileBloc(injector.breezServer, injector.notifications),
Expand Down
2 changes: 1 addition & 1 deletion lib/routes/subswap/swap/swap_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class SwapPage extends StatefulWidget {
}

class SwapPageState extends State<SwapPage> {
final BreezBridge breezLib = ServiceInjector().breezLib;
final BreezSDK breezLib = ServiceInjector().breezSDK;
SwapInfo? swapInProgress;
SwapInfo? swapUnused;
String? bitcoinAddress;
Expand Down
4 changes: 2 additions & 2 deletions lib/services/injector.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class ServiceInjector {
DeepLinksService? _deepLinksService;

// breez sdk
BreezBridge? _breezBridge;
BreezSDK? _breezSDK;
LightningLinksService? _lightningLinksService;

Device? _device;
Expand Down Expand Up @@ -50,7 +50,7 @@ class ServiceInjector {
return _breezServer ??= BreezServer();
}

BreezBridge get breezLib => _breezBridge ??= BreezBridge();
BreezSDK get breezSDK => _breezSDK ??= BreezSDK();

Device get device {
return _device ??= Device();
Expand Down
2 changes: 1 addition & 1 deletion lib/user_app.dart
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ class UserApp extends StatelessWidget {
return FadeInRoute(
builder: (_) => BlocProvider(
create: (BuildContext context) => SwapInBloc(
ServiceInjector().breezLib,
ServiceInjector().breezSDK,
),
child: const SwapPage(),
),
Expand Down
2 changes: 1 addition & 1 deletion test/bloc/account/account_bloc_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ void main() {

test('recover node', () async {
var injector = InjectorMock();
var breezLib = injector.breezLib;
var breezLib = injector.breezSDK;
injector.keychain.write(CredentialsManager.accountMnemonic, "a3eed");
AccountBloc accBloc = AccountBloc(breezLib, CredentialsManager(keyChain: injector.keychain));

Expand Down
2 changes: 1 addition & 1 deletion test/bloc/input/input_bloc_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ void main() {
});

test('lnurl', () async {
var breezLib = injector.breezLib;
var breezLib = injector.breezSDK;

const input = "LNURL1DP68GURN8GHJ7MRFVA58GUMPW3EJUCM0D5HKZURF9ASH2ARG9AKXUATJDSHKGMEDD3HKW6TW"
"8A4NZ0F4VFJRZVMRX5MXGWTYVYMNJDTR8PJRYEFEVD3NSVMXXSCXVVECVYER2ENRVFJKXVEKVYUNVCE4XUUX2E3H"
Expand Down
2 changes: 1 addition & 1 deletion test/mock/breez_bridge_mock.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import 'package:breez_sdk/bridge_generated.dart';
import 'package:mockito/mockito.dart';
import 'package:rxdart/rxdart.dart';

class BreezBridgeMock extends Mock implements BreezBridge {
class BreezSDKMock extends Mock implements BreezSDK {
GreenlightCredentials credentials = GreenlightCredentials(
deviceKey: Uint8List(2),
deviceCert: Uint8List(2),
Expand Down
4 changes: 2 additions & 2 deletions test/mock/injector_mock.dart
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,10 @@ class InjectorMock extends Mock implements ServiceInjector {
@override
BreezServer get breezServer => breezServerMock;

final breezLibMock = BreezBridgeMock();
final breezLibMock = BreezSDKMock();

@override
BreezBridge get breezLib => breezLibMock;
BreezSDK get breezSDK => breezLibMock;

final preferencesMock = PreferencesMock();

Expand Down

0 comments on commit 5c5e802

Please sign in to comment.