diff --git a/lib/globals.dart b/lib/globals.dart index 7057e15..2a3f1da 100644 --- a/lib/globals.dart +++ b/lib/globals.dart @@ -15,7 +15,6 @@ Directory? appPath; late String appVersion; late SharedPreferences prefs; -late String endPointGVA; const int pinLength = 5; const String appLang = 'english'; diff --git a/lib/main.dart b/lib/main.dart index d1e3a76..fba4194 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -36,7 +36,6 @@ import 'package:flutter/material.dart'; import 'package:gecko/screens/myWallets/wallets_home.dart'; import 'package:gecko/screens/search.dart'; import 'package:gecko/screens/search_result.dart'; -import 'package:graphql_flutter/graphql_flutter.dart'; import 'package:hive_flutter/hive_flutter.dart'; import 'package:provider/provider.dart'; import 'package:flutter/foundation.dart'; @@ -73,26 +72,9 @@ Future main() async { await Hive.deleteBoxFromDisk('g1WalletsBox'); g1WalletsBox = await Hive.openBox("g1WalletsBox"); - - // keystoreBox = await Hive.openBox("keystoreBox"); - - // g1WalletsBox.clear(); - - // final HiveStore _store = - // await HiveStore.open(path: '${appPath.path}/gqlCache'); - - // Get a valid GVA endpoint - endPointGVA = 'https://g1.librelois.fr/gva'; - // endPointGVA = 'https://duniter-g1.p2p.legal/gva'; await _homeProvider.getValidEndpoints(); // log.d(await configBox.get('endpoint')); - // if (endPointGVA == 'HS') { - // _homeProvider.playSound('faché', 0.8); - // } else { - // _homeProvider.playSound('start', 0.2); - // } - HttpOverrides.global = MyHttpOverrides(); if (kReleaseMode && enableSentry) { @@ -109,7 +91,7 @@ Future main() async { await SentryFlutter.init((options) { options.dsn = 'https://c09587b46eaa42e8b9fda28d838ed180@o496840.ingest.sentry.io/5572110'; - }, appRunner: () => runApp(Gecko(endPointGVA))); + }, appRunner: () => runApp(const Gecko())); // runZoned>( // () async { @@ -126,30 +108,17 @@ Future main() async { } else { print('Debug mode enabled: No sentry alerte'); - runApp(Gecko(endPointGVA)); + runApp(const Gecko()); } } class Gecko extends StatelessWidget { - const Gecko(this.randomEndpoint, {Key? key}) : super(key: key); - final String? randomEndpoint; + const Gecko({Key? key}) : super(key: key); @override Widget build(BuildContext context) { SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]); - final _httpLink = HttpLink( - randomEndpoint!, - ); - final _client = ValueNotifier( - GraphQLClient( - cache: GraphQLCache(), - link: _httpLink, - ), - ); - - // HistoryProvider _historyProvider = Provider.of(context); - // HistoryProvider('').snackNode(context); return MultiProvider( providers: [ // Provider(create: (context) => HistoryProvider()), @@ -163,44 +132,41 @@ class Gecko extends StatelessWidget { ChangeNotifierProvider(create: (_) => CesiumPlusProvider()), ChangeNotifierProvider(create: (_) => SubstrateSdk()) ], - child: GraphQLProvider( - client: _client, - child: MaterialApp( - builder: (context, widget) => ResponsiveWrapper.builder( - BouncingScrollWrapper.builder(context, widget!), - maxWidth: 1200, - minWidth: 480, - defaultScale: true, - breakpoints: [ - const ResponsiveBreakpoint.resize(480, name: MOBILE), - const ResponsiveBreakpoint.autoScale(800, name: TABLET), - const ResponsiveBreakpoint.resize(1000, name: DESKTOP), - ], - background: Container(color: backgroundColor)), - title: 'Ğecko', - theme: ThemeData( - appBarTheme: const AppBarTheme( - color: Color(0xffFFD58D), - foregroundColor: Color(0xFF000000), - ), - primaryColor: const Color(0xffFFD58D), - textTheme: const TextTheme( - bodyText1: TextStyle(fontSize: 16), - bodyText2: TextStyle(fontSize: 18), - ).apply( - bodyColor: const Color(0xFF000000), - ), - colorScheme: - ColorScheme.fromSwatch().copyWith(secondary: Colors.grey[850]), + child: MaterialApp( + builder: (context, widget) => ResponsiveWrapper.builder( + BouncingScrollWrapper.builder(context, widget!), + maxWidth: 1200, + minWidth: 480, + defaultScale: true, + breakpoints: [ + const ResponsiveBreakpoint.resize(480, name: MOBILE), + const ResponsiveBreakpoint.autoScale(800, name: TABLET), + const ResponsiveBreakpoint.resize(1000, name: DESKTOP), + ], + background: Container(color: backgroundColor)), + title: 'Ğecko', + theme: ThemeData( + appBarTheme: const AppBarTheme( + color: Color(0xffFFD58D), + foregroundColor: Color(0xFF000000), ), - home: const HomeScreen(), - initialRoute: "/", - routes: { - '/mywallets': (context) => const WalletsHome(), - '/search': (context) => const SearchScreen(), - '/searchResult': (context) => const SearchResultScreen(), - }, + primaryColor: const Color(0xffFFD58D), + textTheme: const TextTheme( + bodyText1: TextStyle(fontSize: 16), + bodyText2: TextStyle(fontSize: 18), + ).apply( + bodyColor: const Color(0xFF000000), + ), + colorScheme: + ColorScheme.fromSwatch().copyWith(secondary: Colors.grey[850]), ), + home: const HomeScreen(), + initialRoute: "/", + routes: { + '/mywallets': (context) => const WalletsHome(), + '/search': (context) => const SearchScreen(), + '/searchResult': (context) => const SearchResultScreen(), + }, ), ); } diff --git a/lib/models/queries.dart b/lib/models/queries.dart deleted file mode 100644 index ed47ac8..0000000 --- a/lib/models/queries.dart +++ /dev/null @@ -1,95 +0,0 @@ -const String getHistory = r''' - query ($pubkey: String!, $number: Int!, $cursor: String) { - txsHistoryBc( - script: $pubkey - pagination: { pageSize: $number, ord: DESC, cursor: $cursor } - ) { - both { - pageInfo { - hasPreviousPage - hasNextPage - startCursor - endCursor - } - edges { - direction - node { - currency - issuers - outputs - comment - writtenTime - } - } - } - } - txsHistoryMp(pubkey: $pubkey) { - receiving { - currency - issuers - comment - outputs - } - sending { - currency - issuers - comment - outputs - } - } - currentUd { - amount - base - } - balance(script: $pubkey) { - amount - base - } - } - '''; - -const String getBalance = r''' - query ($pubkey: String!) { - balance(script: $pubkey) { - amount - base - } - currentUd { - amount - base - } - } - '''; - -const String getWallets = r''' -query ($number: Int!, $cursor: String) { - wallets(pagination: {ord: ASC, pageSize: $number, cursor: $cursor}) { - pageInfo { - hasNextPage - endCursor - } - edges { - node { - script - balance { - amount - base - } - idty { - isMember - username - } - } - } - } -} -'''; - -const String getId = r''' -query ($pubkey: PubKeyGva!) { - idty(pubkey: $pubkey) { - isMember - username - } -} -'''; diff --git a/lib/providers/search.dart b/lib/providers/search.dart index bacad73..604d679 100644 --- a/lib/providers/search.dart +++ b/lib/providers/search.dart @@ -14,66 +14,78 @@ class SearchProvider with ChangeNotifier { notifyListeners(); } - Future searchBlockchain() async { - searchResult.clear(); - int searchTime = DateTime.now().millisecondsSinceEpoch; - WalletsProfilesProvider _walletProfiles = WalletsProfilesProvider('pubkey'); + // Future searchBlockchain() async { + // searchResult.clear(); + // int searchTime = DateTime.now().millisecondsSinceEpoch; + // WalletsProfilesProvider _walletProfiles = WalletsProfilesProvider('pubkey'); - if (cacheTime + cacheDuring <= searchTime) { - g1WalletsBox.clear(); - // final url = Uri.parse('https://g1-stats.axiom-team.fr/data/forbes.json'); - // final response = await http.get(url); + // if (cacheTime + cacheDuring <= searchTime) { + // g1WalletsBox.clear(); + // // final url = Uri.parse('https://g1-stats.axiom-team.fr/data/forbes.json'); + // // final response = await http.get(url); - var dio = Dio(); - late Response response; - try { - response = await dio.get( - 'https://g1-stats.axiom-team.fr/data/forbes.json', - options: Options( - sendTimeout: 5000, - receiveTimeout: 10000, - ), - ); - // response = await http.post((Uri.parse(queryOptions[0])), - // body: queryOptions[1], headers: queryOptions[2]); - } catch (e) { - log.e(e); - } + // var dio = Dio(); + // late Response response; + // try { + // response = await dio.get( + // 'https://g1-stats.axiom-team.fr/data/forbes.json', + // options: Options( + // sendTimeout: 5000, + // receiveTimeout: 10000, + // ), + // ); + // // response = await http.post((Uri.parse(queryOptions[0])), + // // body: queryOptions[1], headers: queryOptions[2]); + // } catch (e) { + // log.e(e); + // } - List _listWallets = _parseG1Wallets(response.data)!; - Map _mapWallets = { - for (var e in _listWallets) e.pubkey: e - }; + // List _listWallets = _parseG1Wallets(response.data)!; + // Map _mapWallets = { + // for (var e in _listWallets) e.pubkey: e + // }; - await g1WalletsBox.putAll(_mapWallets); - cacheTime = DateTime.now().millisecondsSinceEpoch; + // await g1WalletsBox.putAll(_mapWallets); + // cacheTime = DateTime.now().millisecondsSinceEpoch; + // } + + // g1WalletsBox.toMap().forEach((key, value) { + // if ((value.id != null && + // value.id!.username != null && + // value.id!.username! + // .toLowerCase() + // .contains(searchController.text)) || + // value.pubkey!.contains(searchController.text)) { + // searchResult.add(value); + // return; + // } + // }); + + // if (searchResult.isEmpty && + // _walletProfiles.isPubkey(searchController.text)) { + // searchResult = [G1WalletsList(pubkey: searchController.text)]; + // } + + // return searchResult; + // } + + Future> searchAddress() async { + final WalletsProfilesProvider _walletProfiles = + WalletsProfilesProvider('pubkey'); + + if (_walletProfiles.isAddress(searchController.text)) { + G1WalletsList _wallet = G1WalletsList(pubkey: searchController.text); + return [_wallet]; + } else { + return []; } - - g1WalletsBox.toMap().forEach((key, value) { - if ((value.id != null && - value.id!.username != null && - value.id!.username! - .toLowerCase() - .contains(searchController.text)) || - value.pubkey!.contains(searchController.text)) { - searchResult.add(value); - return; - } - }); - - if (searchResult.isEmpty && - _walletProfiles.isPubkey(searchController.text)) { - searchResult = [G1WalletsList(pubkey: searchController.text)]; - } - - return searchResult; } } -List? _parseG1Wallets(var responseBody) { - final parsed = responseBody.cast>(); +// List? _parseG1Wallets(var responseBody) { +// final parsed = responseBody.cast>(); - return parsed - .map((json) => G1WalletsList.fromJson(json)) - .toList(); -} +// return parsed +// .map((json) => G1WalletsList.fromJson(json)) +// .toList(); +// } diff --git a/lib/providers/wallets_profiles.dart b/lib/providers/wallets_profiles.dart index dc958d7..ca0a77e 100644 --- a/lib/providers/wallets_profiles.dart +++ b/lib/providers/wallets_profiles.dart @@ -11,9 +11,9 @@ import 'dart:math'; import 'package:intl/intl.dart'; class WalletsProfilesProvider with ChangeNotifier { - WalletsProfilesProvider(this.pubkey); + WalletsProfilesProvider(this.address); - String? pubkey = ''; + String? address = ''; String pubkeyShort = ''; List? transBC; String? fetchMoreCursor; @@ -38,7 +38,7 @@ class WalletsProfilesProvider with ChangeNotifier { log.e(e); return 'false'; } - if (barcode != null && isPubkey(barcode)) { + if (barcode != null && isAddress(barcode)) { Navigator.push( context, MaterialPageRoute(builder: (context) { @@ -70,19 +70,19 @@ class WalletsProfilesProvider with ChangeNotifier { // return result; // } - bool isPubkey(pubkey) { + bool isAddress(address) { final RegExp regExp = RegExp( r'^[a-zA-Z0-9]+$', caseSensitive: false, multiLine: false, ); - if (regExp.hasMatch(pubkey) == true && - pubkey.length > 42 && - pubkey.length < 50) { - log.d("C'est une pubkey !"); + if (regExp.hasMatch(address) == true && + address.length > 47 && + address.length < 50) { + log.d("C'est une adresse !"); - this.pubkey = pubkey; + this.address = address; return true; } else { diff --git a/lib/screens/history.dart b/lib/screens/history.dart index 5f96254..119034f 100644 --- a/lib/screens/history.dart +++ b/lib/screens/history.dart @@ -1,7 +1,6 @@ import 'package:flutter/services.dart'; import 'package:gecko/globals.dart'; import 'package:gecko/providers/cesium_plus.dart'; -import 'package:gecko/models/queries.dart'; import 'package:gecko/providers/substrate_sdk.dart'; import 'package:gecko/providers/wallets_profiles.dart'; import 'package:flutter/material.dart'; @@ -65,7 +64,7 @@ class HistoryScreen extends StatelessWidget with ChangeNotifier { children: [ Query( options: QueryOptions( - document: gql(getHistory), + document: gql('getHistory'), variables: { 'pubkey': pubkey, 'number': 10, @@ -419,7 +418,7 @@ class HistoryScreen extends StatelessWidget with ChangeNotifier { if (username == null) Query( options: QueryOptions( - document: gql(getId), + document: gql('getId'), variables: { 'pubkey': pubkey, }, diff --git a/lib/screens/myWallets/unlocking_wallet.dart b/lib/screens/myWallets/unlocking_wallet.dart index 64acdaf..4d39e12 100644 --- a/lib/screens/myWallets/unlocking_wallet.dart +++ b/lib/screens/myWallets/unlocking_wallet.dart @@ -240,10 +240,10 @@ class UnlockingWallet extends StatelessWidget { listen: false); final acc = _sub.getCurrentWallet(); log.d( - "fromAddress: ${acc.address!},destAddress: ${_walletViewProvider.pubkey!}, amount: ${double.parse(_walletViewProvider.payAmount.text)}, password: $_pin"); + "fromAddress: ${acc.address!},destAddress: ${_walletViewProvider.address!}, amount: ${double.parse(_walletViewProvider.payAmount.text)}, password: $_pin"); _sub.pay( fromAddress: acc.address!, - destAddress: _walletViewProvider.pubkey!, + destAddress: _walletViewProvider.address!, amount: double.parse(_walletViewProvider.payAmount.text), password: _pin.toUpperCase()); @@ -260,7 +260,7 @@ class UnlockingWallet extends StatelessWidget { listen: false); final acc = _sub.getCurrentWallet(); _sub.certify(acc.address!, _pin.toUpperCase(), - _walletViewProvider.pubkey!); + _walletViewProvider.address!); Navigator.push( context, diff --git a/lib/screens/search_result.dart b/lib/screens/search_result.dart index 3f34899..6e57a54 100644 --- a/lib/screens/search_result.dart +++ b/lib/screens/search_result.dart @@ -43,153 +43,159 @@ class SearchResultScreen extends StatelessWidget { body: SafeArea( child: Padding( padding: const EdgeInsets.symmetric(horizontal: 20), - child: - Column(crossAxisAlignment: CrossAxisAlignment.start, children: < - Widget>[ - const SizedBox(height: 30), - RichText( - text: TextSpan( - style: TextStyle( - fontSize: 18, - color: Colors.grey[700], + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + const SizedBox(height: 30), + RichText( + text: TextSpan( + style: TextStyle( + fontSize: 18, + color: Colors.grey[700], + ), + children: [ + const TextSpan( + text: "Résultats pour ", + ), + TextSpan( + text: '"${_searchProvider.searchController.text}"', + style: const TextStyle(fontStyle: FontStyle.italic), + ), + ], + ), ), - children: [ - const TextSpan( - text: "Résultats pour ", - ), - TextSpan( - text: '"${_searchProvider.searchController.text}"', - style: const TextStyle(fontStyle: FontStyle.italic), - ), - ], - ), - ), - const SizedBox(height: 40), - Text( - 'Dans la blockchain $currencyName', - style: const TextStyle(fontSize: 20), - ), - const SizedBox(height: 20), - FutureBuilder( - future: _searchProvider.searchBlockchain(), - builder: (context, AsyncSnapshot snapshot) { - if (snapshot.connectionState == ConnectionState.done) { - return Expanded( - child: ListView(children: [ - for (G1WalletsList g1Wallet in snapshot.data ?? []) - Padding( - padding: const EdgeInsets.symmetric(horizontal: 5), - child: ListTile( - key: Key('searchResult${keyID++}'), - horizontalTitleGap: 40, - contentPadding: const EdgeInsets.all(5), - leading: g1WalletsBox - .get(g1Wallet.pubkey) - ?.avatar != - null - ? ClipOval( - child: g1WalletsBox - .get(g1Wallet.pubkey)! - .avatar) - : FutureBuilder( - future: _cesiumPlusProvider.getAvatar( - g1Wallet.pubkey, _avatarSize), - builder: (BuildContext context, - AsyncSnapshot _avatar) { - if (_avatar.connectionState != - ConnectionState.done || - _avatar.hasError) { - return Stack(children: [ - _cesiumPlusProvider - .defaultAvatar(_avatarSize), - Positioned( - top: 8, - right: 0, - width: 12, - height: 12, - child: CircularProgressIndicator( - strokeWidth: 1, - color: orangeC, - ), - ), - ]); - } - if (_avatar.hasData) { - final _w = - g1WalletsBox.get(g1Wallet.pubkey); - if (_w != null) { - _w.avatar = _avatar.data; - } - return ClipOval(child: _avatar.data); - } else { - g1WalletsBox - .get(g1Wallet.pubkey)! - .avatar = - _cesiumPlusProvider - .defaultAvatar(_avatarSize); - return _cesiumPlusProvider - .defaultAvatar(_avatarSize); - } - }), - title: Row(children: [ - Text(getShortPubkey(g1Wallet.pubkey!), - style: const TextStyle( - fontSize: 18, - fontFamily: 'Monospace', - fontWeight: FontWeight.w500), - textAlign: TextAlign.center), - ]), - trailing: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - balance(context, g1Wallet.pubkey!, 16) - ]), - subtitle: Row(children: [ - Text(g1Wallet.id?.username ?? '', - style: const TextStyle( - fontSize: 18, - fontWeight: FontWeight.w500), - textAlign: TextAlign.center), - ]), - dense: false, - isThreeLine: false, - onTap: () { - Navigator.push( - context, - MaterialPageRoute(builder: (context) { - _walletsProfilesClass.pubkey = - g1Wallet.pubkey; - return WalletViewScreen( - pubkey: g1Wallet.pubkey, - username: g1WalletsBox - .get(g1Wallet.pubkey) - ?.id - ?.username, - avatar: g1WalletsBox - .get(g1Wallet.pubkey) - ?.avatar, - ); - }), - ); - }), - ), - ]), - ); - } - return Center( - heightFactor: 5, - child: CircularProgressIndicator( - strokeWidth: 3, - backgroundColor: yellowC, - color: orangeC, - ), - ); - }, - ), - // Text( - // _searchProvider.searchResult.toString(), - // ) - ]), + const SizedBox(height: 40), + Text( + 'Dans la blockchain $currencyName', + style: const TextStyle(fontSize: 20), + ), + const SizedBox(height: 20), + FutureBuilder( + future: _searchProvider.searchAddress(), + builder: (context, AsyncSnapshot snapshot) { + if (snapshot.connectionState == ConnectionState.done) { + log.d(snapshot.data); + if (snapshot.data?.isEmpty ?? true) { + return const Text('Aucun résultat'); + } else { + return Expanded( + child: ListView(children: [ + for (G1WalletsList g1Wallet in snapshot.data ?? []) + Padding( + padding: + const EdgeInsets.symmetric(horizontal: 5), + child: ListTile( + key: Key('searchResult${keyID++}'), + horizontalTitleGap: 40, + contentPadding: const EdgeInsets.all(5), + leading: + // g1WalletsBox.get(g1Wallet.pubkey) + // ?.avatar != + // null + // ? + _cesiumPlusProvider + .defaultAvatar(_avatarSize), + // : FutureBuilder( + // future: _cesiumPlusProvider.getAvatar( + // g1Wallet.pubkey, _avatarSize), + // builder: (BuildContext context, + // AsyncSnapshot _avatar) { + // if (_avatar.connectionState != + // ConnectionState.done || + // _avatar.hasError) { + // return Stack(children: [ + // _cesiumPlusProvider + // .defaultAvatar(_avatarSize), + // Positioned( + // top: 8, + // right: 0, + // width: 12, + // height: 12, + // child: CircularProgressIndicator( + // strokeWidth: 1, + // color: orangeC, + // ), + // ), + // ]); + // } + // if (_avatar.hasData) { + // final _w = + // g1WalletsBox.get(g1Wallet.pubkey); + // if (_w != null) { + // _w.avatar = _avatar.data; + // } + // return ClipOval(child: _avatar.data); + // } else { + // g1WalletsBox + // .get(g1Wallet.pubkey)! + // .avatar = + // _cesiumPlusProvider + // .defaultAvatar(_avatarSize); + // return _cesiumPlusProvider + // .defaultAvatar(_avatarSize); + // } + // }), + title: Row(children: [ + Text(getShortPubkey(g1Wallet.pubkey!), + style: const TextStyle( + fontSize: 18, + fontFamily: 'Monospace', + fontWeight: FontWeight.w500), + textAlign: TextAlign.center), + ]), + trailing: Column( + mainAxisAlignment: + MainAxisAlignment.center, + children: [ + balance(context, g1Wallet.pubkey!, 16) + ]), + subtitle: Row(children: [ + Text(g1Wallet.id?.username ?? '', + style: const TextStyle( + fontSize: 18, + fontWeight: FontWeight.w500), + textAlign: TextAlign.center), + ]), + dense: false, + isThreeLine: false, + onTap: () { + Navigator.push( + context, + MaterialPageRoute(builder: (context) { + _walletsProfilesClass.address = + g1Wallet.pubkey; + return WalletViewScreen( + pubkey: g1Wallet.pubkey, + username: g1WalletsBox + .get(g1Wallet.pubkey) + ?.id + ?.username, + avatar: g1WalletsBox + .get(g1Wallet.pubkey) + ?.avatar, + ); + }), + ); + }), + ), + ]), + ); + } + } + return Center( + heightFactor: 5, + child: CircularProgressIndicator( + strokeWidth: 3, + backgroundColor: yellowC, + color: orangeC, + ), + ); + }, + ), + // Text( + // _searchProvider.searchResult.toString(), + // ) + ]), ), ), ); diff --git a/lib/screens/transaction_in_progress.dart b/lib/screens/transaction_in_progress.dart index 70a5f10..756bda9 100644 --- a/lib/screens/transaction_in_progress.dart +++ b/lib/screens/transaction_in_progress.dart @@ -28,10 +28,10 @@ class TransactionInProgress extends StatelessWidget { // Map jsonResult; final _result = _sub.transactionStatus; - log.d(_walletViewProvider.pubkey!); + log.d(_walletViewProvider.address!); final from = _myWalletProvider.getDefaultWallet()!.name!; - final to = getShortPubkey(_walletViewProvider.pubkey!); + final to = getShortPubkey(_walletViewProvider.address!); final amount = _walletViewProvider.payAmount.text; String _actionName = ''; diff --git a/lib/screens/wallet_view.dart b/lib/screens/wallet_view.dart index 3038be8..9fcb6c4 100644 --- a/lib/screens/wallet_view.dart +++ b/lib/screens/wallet_view.dart @@ -29,7 +29,7 @@ class WalletViewScreen extends StatelessWidget { Provider.of(context, listen: false); CesiumPlusProvider _cesiumPlusProvider = Provider.of(context, listen: false); - _walletViewProvider.pubkey = pubkey!; + _walletViewProvider.address = pubkey!; SubstrateSdk _sub = Provider.of(context, listen: false); HomeProvider _homeProvider = Provider.of(context, listen: false); @@ -278,7 +278,7 @@ class WalletViewScreen extends StatelessWidget { double.parse(_walletViewProvider.payAmount.text) <= double.parse( balanceCache[defaultWallet.address]!.split(' ')[0]) && - _walletViewProvider.pubkey != defaultWallet.address) { + _walletViewProvider.address != defaultWallet.address) { canValidate = true; } else { canValidate = false;