diff --git a/README.md b/README.md index 1c6ec2c..de2eb89 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,6 @@ A digital wallet app, developed in dart language and flutter framework. The idea is to help developers to understand how to build dApps using blockchain and associated technologies. This app can transfer tokens from one wallet to another, through an [ERC-20](https://en.wikipedia.org/wiki/ERC-20) Ethereum contract. - ### What's being used - Built in [Flutter](https://flutter.dev/docs/get-started/install) framework @@ -10,19 +9,17 @@ A digital wallet app, developed in dart language and flutter framework. The idea - [Web3Dart](https://github.com/simolus3/web3dart) to interact with Ethereum blockchain - [Flutter hooks](https://github.com/rrousselGit/flutter_hooks) to manage widget life-cycle. -Wallet | Send tokens | Processing -:-----:|:------------:|:------------:| -![Your wallet](https://faucet.clempe.dev/images/your-wallet.jpg) | ![Your wallet](https://faucet.clempe.dev/images/transfer-address.jpg) | ![Your wallet](https://faucet.clempe.dev/images/transfer-processing.jpg) - - +| Wallet | Send tokens | Processing | +| :--------------------------------------------------------------: | :-------------------------------------------------------------------: | :----------------------------------------------------------------------: | +| ![Your wallet](https://faucet.clempe.dev/images/your-wallet.jpg) | ![Your wallet](https://faucet.clempe.dev/images/transfer-address.jpg) | ![Your wallet](https://faucet.clempe.dev/images/transfer-processing.jpg) | ### Getting started -How to watch/build autogenerated files +How to watch/build autogenerated files ```bash -$ flutter packages pub run build_runner build # to build -$ flutter packages pub run build_runner watch # to watch +$ flutter packages pub run build_runner build # to build +$ flutter packages pub run build_runner watch # to watch ``` How to run the app @@ -34,6 +31,7 @@ $ flutter run ``` How to run tests + ```bash $ flutter test ``` @@ -42,20 +40,19 @@ $ flutter test For those who don't want to play with smart contracts yet, you can claim some test coins (tokens) and ether using the following links or check out [this repo](https://github.com/allanclempe/ether-wallet-contract) to understand how to deploy your own contract. -***Transfer test TOKENS to your wallet:*** +**_Transfer test TOKENS to your wallet:_** After setting up your wallet, you will need some tokens to play with. Use the link below to transfer some tokens to your wallet. [https://faucet.clempe.dev](https://faucet.clempe.dev) - -***Transfer test Ether to your wallet*** +**_Transfer test Ether to your wallet_** Also to process transactions on the network, you will also need ETH to pay transaction fees, called gas. You also can claim some using the link below. [https://faucet.ropsten.be/](https://faucet.ropsten.be/) -just be patient, the transaction might take a while to be processed. +just be patient, the transaction might take a while to be processed. ### The smart contract @@ -63,11 +60,30 @@ Feel free to check out the smart contract used in this project [https://github.c ### Release notes -2021 feb 27: App running and tested on iOS and android with flutter version 1.22 (dart 2.10.5). Flutter and libraries has been upgraded. Small code changes just to get rid of deprecated flutter components. +1.3.0+6: + +- Flutter has been upgraded to version 2.0.1 (dart 2.12.0). +- Libraries has been upgraded. +- Fixed issue to generate and store private key when imported from seed phrase. + +1.2.0+5: + +- Flutter has been upgraded to version 1.22 (dart 2.10.5). +- Libraries has been upgraded. +- Small code changes just to get rid of deprecated flutter components. + +### Buy me a coffee + +If you enjoy my work, a small donation would be greatly appreciated. + +| BTC | ETH | +| :------------------------------------------------------------------------: | :--------------------------------------------------------------------------: | +| | | ### License -Copyright © 2019-present Allan Clempe. This source code is licensed under the MIT license found in the [LICENSE.txt](https://github.com/allanclempe/ether-wallet-flutter/blob/master/LICENSE.txt) file. +Copyright © 2019-present Allan Clempe. This source code is licensed under the MIT license found in the [LICENSE.txt](https://github.com/allanclempe/ether-wallet-flutter/blob/master/LICENSE.txt) file. --- -dart wallet cryto flutter eth smart contracts - by [Allan Clempe](https://twitter.com/aclempe) \ No newline at end of file + +dart wallet cryto flutter eth smart contracts - by [Allan Clempe](https://twitter.com/aclempe) diff --git a/android/app/build.gradle b/android/app/build.gradle index 0d0025d..2dd8098 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -55,6 +55,7 @@ android { dependencies { api 'com.google.firebase:firebase-ml-vision-image-label-model:17.0.2' + // api 'com.google.mlkit:image-labeling:17.0.2' TODO: upgrade. } } diff --git a/ios/Podfile b/ios/Podfile index d8a3210..0073cd4 100644 --- a/ios/Podfile +++ b/ios/Podfile @@ -1,5 +1,5 @@ # Uncomment this line to define a global platform for your project -platform :ios, '9.0' +# platform :ios, '10.0' # CocoaPods analytics sends network stats synchronously affecting flutter build latency. ENV['COCOAPODS_DISABLE_STATS'] = 'true' @@ -28,6 +28,7 @@ require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelpe flutter_ios_podfile_setup target 'Runner' do + # pod 'GoogleMLKit/BarcodeScanning' - TODO: update. pod 'Firebase/MLVisionBarcodeModel' use_frameworks! use_modular_headers! diff --git a/ios/Podfile.lock b/ios/Podfile.lock index 9667e6b..ce00c45 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -1,17 +1,17 @@ PODS: - camera (0.0.1): - Flutter - - Firebase/Analytics (6.33.0): + - Firebase/Analytics (6.34.0): - Firebase/Core - - Firebase/Core (6.33.0): + - Firebase/Core (6.34.0): - Firebase/CoreOnly - - FirebaseAnalytics (= 6.8.3) - - Firebase/CoreOnly (6.33.0): - - FirebaseCore (= 6.10.3) - - Firebase/MLVision (6.33.0): + - FirebaseAnalytics (= 6.9.0) + - Firebase/CoreOnly (6.34.0): + - FirebaseCore (= 6.10.4) + - Firebase/MLVision (6.34.0): - Firebase/CoreOnly - FirebaseMLVision (~> 0.21.0) - - Firebase/MLVisionBarcodeModel (6.33.0): + - Firebase/MLVisionBarcodeModel (6.34.0): - Firebase/CoreOnly - FirebaseMLVisionBarcodeModel (~> 0.21.0) - firebase_analytics (0.0.1): @@ -22,16 +22,16 @@ PODS: - Firebase/Core - Firebase/MLVision - Flutter - - FirebaseAnalytics (6.8.3): + - FirebaseAnalytics (6.9.0): - FirebaseCore (~> 6.10) - - FirebaseInstallations (~> 1.6) - - GoogleAppMeasurement (= 6.8.3) + - FirebaseInstallations (~> 1.7) + - GoogleAppMeasurement (= 6.9.0) - GoogleUtilities/AppDelegateSwizzler (~> 6.7) - GoogleUtilities/MethodSwizzler (~> 6.7) - GoogleUtilities/Network (~> 6.7) - "GoogleUtilities/NSData+zlib (~> 6.7)" - nanopb (~> 1.30906.0) - - FirebaseCore (6.10.3): + - FirebaseCore (6.10.4): - FirebaseCoreDiagnostics (~> 1.6) - GoogleUtilities/Environment (~> 6.7) - GoogleUtilities/Logger (~> 6.7) @@ -71,7 +71,7 @@ PODS: - GoogleAPIClientForREST/Vision (1.5.1): - GoogleAPIClientForREST/Core - GTMSessionFetcher (>= 1.1.7) - - GoogleAppMeasurement (6.8.3): + - GoogleAppMeasurement (6.9.0): - GoogleUtilities/AppDelegateSwizzler (~> 6.7) - GoogleUtilities/MethodSwizzler (~> 6.7) - GoogleUtilities/Network (~> 6.7) @@ -172,19 +172,19 @@ EXTERNAL SOURCES: SPEC CHECKSUMS: camera: a0ca5080336f7af47b88436e5e26da3dee5568f0 - Firebase: 8db6f2d1b2c5e2984efba4949a145875a8f65fe5 + Firebase: c23a36d9e4cdf7877dfcba8dd0c58add66358999 firebase_analytics: 9118044ffb98bee71d84733fc594f5134fe4bc1b firebase_ml_vision: cf3db3a9b870a2424e4c1c369b2123d31177cc9f - FirebaseAnalytics: 5dd088bd2e67bb9d13dbf792d1164ceaf3052193 - FirebaseCore: d889d9e12535b7f36ac8bfbf1713a0836a3012cd + FirebaseAnalytics: 3bb096873ee0d7fa4b6c70f5e9166b6da413cc7f + FirebaseCore: d3a978a3cfa3240bf7e4ba7d137fdf5b22b628ec FirebaseCoreDiagnostics: 770ac5958e1372ce67959ae4b4f31d8e127c3ac1 FirebaseInstallations: 466c7b4d1f58fe16707693091da253726a731ed2 FirebaseMLCommon: f42d067ca7fed962e09f02ba94a24e06ee50d933 FirebaseMLVision: fd7cdd33d067c976c16fd521e7e92c26c980c947 FirebaseMLVisionBarcodeModel: 394cd61c52dc03558088caf82b0dade8028f57d5 - Flutter: 0e3d915762c693b495b44d77113d4970485de6ec + Flutter: 434fef37c0980e73bb6479ef766c45957d4b510c GoogleAPIClientForREST: 4bb409633efcc2e1b3f945afe7e35039b5a61db2 - GoogleAppMeasurement: 966e88df9d19c15715137bb2ddaf52373f111436 + GoogleAppMeasurement: a6a3a066369828db64eda428cb2856dc1cdc7c4e GoogleDataTransport: f56af7caa4ed338dc8e138a5d7c5973e66440833 GoogleToolboxForMac: 471e0c05d39506e50e6398f46fa9a12ae0efeff9 GoogleUtilities: 7f2f5a07f888cdb145101d6042bc4422f57e70b3 @@ -195,6 +195,6 @@ SPEC CHECKSUMS: shared_preferences: af6bfa751691cdc24be3045c43ec037377ada40d url_launcher: 6fef411d543ceb26efce54b05a0a40bfd74cbbef -PODFILE CHECKSUM: 76cfc2fa0003e9287778eb8d305c4079de8a0386 +PODFILE CHECKSUM: 92de5e6e176219356a0144477ff81b3a723353c3 COCOAPODS: 1.10.1 diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index 827a525..0f7df6b 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -158,7 +158,7 @@ 97C146E61CF9000F007C117D /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 1020; + LastUpgradeCheck = 1240; ORGANIZATIONNAME = ""; TargetAttributes = { 97C146ED1CF9000F007C117D = { @@ -325,6 +325,7 @@ CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; @@ -343,7 +344,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SUPPORTED_PLATFORMS = iphoneos; @@ -362,7 +363,7 @@ DEVELOPMENT_TEAM = CUFZ3BA873; ENABLE_BITCODE = NO; INFOPLIST_FILE = Runner/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -398,6 +399,7 @@ CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; @@ -422,7 +424,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; @@ -453,6 +455,7 @@ CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; @@ -471,7 +474,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SUPPORTED_PLATFORMS = iphoneos; @@ -492,7 +495,7 @@ DEVELOPMENT_TEAM = CUFZ3BA873; ENABLE_BITCODE = NO; INFOPLIST_FILE = Runner/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -516,7 +519,7 @@ DEVELOPMENT_TEAM = CUFZ3BA873; ENABLE_BITCODE = NO; INFOPLIST_FILE = Runner/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", diff --git a/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme index a28140c..46d2d0d 100644 --- a/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme +++ b/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -1,6 +1,6 @@ - - - - + + - - = Widget Function( BuildContext context, Handler store); @@ -12,9 +12,9 @@ abstract class ContextProviderWidget extends HookWidget { ContextProviderWidget({this.child, this.builder}); Widget provide(BuildContext context, T handler) { - return p.MultiProvider( + return MultiProvider( providers: [ - p.Provider.value(value: handler), + Provider.value(value: handler), ], child: builder != null ? builder(context, handler) : child, ); diff --git a/lib/context/setup/wallet_setup_provider.dart b/lib/context/setup/wallet_setup_provider.dart index 9b4d4d0..3cad380 100644 --- a/lib/context/setup/wallet_setup_provider.dart +++ b/lib/context/setup/wallet_setup_provider.dart @@ -5,7 +5,7 @@ import 'package:etherwallet/service/address_service.dart'; import 'package:flutter/widgets.dart'; import 'package:flutter_hooks/flutter_hooks.dart'; -import 'package:provider/provider.dart' as p; +import 'package:provider/provider.dart'; import '../hook_provider.dart'; @@ -19,7 +19,7 @@ class WalletSetupProvider extends ContextProviderWidget { final store = useReducer(reducer, initialState: WalletSetup()); - final addressService = p.Provider.of(context); + final addressService = Provider.of(context); final handler = useMemoized( () => WalletSetupHandler(store, addressService), [addressService, store], @@ -30,7 +30,7 @@ class WalletSetupProvider extends ContextProviderWidget { } WalletSetupHandler useWalletSetup(BuildContext context) { - var handler = p.Provider.of(context); + var handler = Provider.of(context); return handler; } diff --git a/lib/context/transfer/wallet_transfer_provider.dart b/lib/context/transfer/wallet_transfer_provider.dart index 48e17df..06c0660 100644 --- a/lib/context/transfer/wallet_transfer_provider.dart +++ b/lib/context/transfer/wallet_transfer_provider.dart @@ -6,7 +6,7 @@ import 'package:etherwallet/service/contract_service.dart'; import 'package:flutter/widgets.dart'; import 'package:flutter_hooks/flutter_hooks.dart'; -import 'package:provider/provider.dart' as p; +import 'package:provider/provider.dart'; import '../hook_provider.dart'; @@ -21,8 +21,8 @@ class WalletTransferProvider final store = useReducer(reducer, initialState: WalletTransfer()); - final contractService = p.Provider.of(context); - final configurationService = p.Provider.of(context); + final contractService = Provider.of(context); + final configurationService = Provider.of(context); final handler = useMemoized( () => WalletTransferHandler(store, contractService, configurationService), [contractService, store], @@ -33,7 +33,7 @@ class WalletTransferProvider } WalletTransferHandler useWalletTransfer(BuildContext context) { - var handler = p.Provider.of(context); + var handler = Provider.of(context); return handler; } diff --git a/lib/context/wallet/wallet_provider.dart b/lib/context/wallet/wallet_provider.dart index f853a80..05e5d0c 100644 --- a/lib/context/wallet/wallet_provider.dart +++ b/lib/context/wallet/wallet_provider.dart @@ -5,7 +5,7 @@ import 'package:etherwallet/service/contract_service.dart'; import 'package:flutter/widgets.dart'; import 'package:flutter_hooks/flutter_hooks.dart'; -import 'package:provider/provider.dart' as p; +import 'package:provider/provider.dart'; import '../hook_provider.dart'; import 'wallet_state.dart'; @@ -20,9 +20,9 @@ class WalletProvider extends ContextProviderWidget { final store = useReducer(reducer, initialState: Wallet()); - final addressService = p.Provider.of(context); - final contractService = p.Provider.of(context); - final configurationService = p.Provider.of(context); + final addressService = Provider.of(context); + final contractService = Provider.of(context); + final configurationService = Provider.of(context); final handler = useMemoized( () => WalletHandler( store, @@ -38,7 +38,7 @@ class WalletProvider extends ContextProviderWidget { } WalletHandler useWallet(BuildContext context) { - var handler = p.Provider.of(context); + var handler = Provider.of(context); return handler; } diff --git a/lib/main.dart b/lib/main.dart index 167a381..485719a 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -3,7 +3,7 @@ import 'package:etherwallet/router.dart'; import 'package:etherwallet/services_provider.dart'; import 'package:firebase_analytics/observer.dart'; import 'package:flutter/material.dart'; -import 'package:provider/provider.dart' as p; +import 'package:provider/provider.dart'; import 'package:firebase_analytics/firebase_analytics.dart'; import 'package:provider/single_child_widget.dart'; @@ -23,7 +23,7 @@ class MainApp extends StatelessWidget { // This widget is the root of your application. @override Widget build(BuildContext context) { - return p.MultiProvider( + return MultiProvider( providers: stores, child: new MaterialApp( title: 'Flutter App', diff --git a/lib/model/wallet.g.dart b/lib/model/wallet.g.dart index 521810f..398c4ae 100644 --- a/lib/model/wallet.g.dart +++ b/lib/model/wallet.g.dart @@ -31,15 +31,10 @@ class _$Wallet extends Wallet { this.loading, this.errors}) : super._() { - if (tokenBalance == null) { - throw new BuiltValueNullFieldError('Wallet', 'tokenBalance'); - } - if (ethBalance == null) { - throw new BuiltValueNullFieldError('Wallet', 'ethBalance'); - } - if (loading == null) { - throw new BuiltValueNullFieldError('Wallet', 'loading'); - } + BuiltValueNullFieldError.checkNotNull( + tokenBalance, 'Wallet', 'tokenBalance'); + BuiltValueNullFieldError.checkNotNull(ethBalance, 'Wallet', 'ethBalance'); + BuiltValueNullFieldError.checkNotNull(loading, 'Wallet', 'loading'); } @override @@ -117,13 +112,14 @@ class WalletBuilder implements Builder { WalletBuilder(); WalletBuilder get _$this { - if (_$v != null) { - _address = _$v.address; - _privateKey = _$v.privateKey; - _tokenBalance = _$v.tokenBalance; - _ethBalance = _$v.ethBalance; - _loading = _$v.loading; - _errors = _$v.errors?.toBuilder(); + final $v = _$v; + if ($v != null) { + _address = $v.address; + _privateKey = $v.privateKey; + _tokenBalance = $v.tokenBalance; + _ethBalance = $v.ethBalance; + _loading = $v.loading; + _errors = $v.errors?.toBuilder(); _$v = null; } return this; @@ -131,9 +127,7 @@ class WalletBuilder implements Builder { @override void replace(Wallet other) { - if (other == null) { - throw new ArgumentError.notNull('other'); - } + ArgumentError.checkNotNull(other, 'other'); _$v = other as _$Wallet; } @@ -150,9 +144,12 @@ class WalletBuilder implements Builder { new _$Wallet._( address: address, privateKey: privateKey, - tokenBalance: tokenBalance, - ethBalance: ethBalance, - loading: loading, + tokenBalance: BuiltValueNullFieldError.checkNotNull( + tokenBalance, 'Wallet', 'tokenBalance'), + ethBalance: BuiltValueNullFieldError.checkNotNull( + ethBalance, 'Wallet', 'ethBalance'), + loading: BuiltValueNullFieldError.checkNotNull( + loading, 'Wallet', 'loading'), errors: _errors?.build()); } catch (_) { String _$failedField; diff --git a/lib/model/wallet_setup.g.dart b/lib/model/wallet_setup.g.dart index 24074f0..3cfcb80 100644 --- a/lib/model/wallet_setup.g.dart +++ b/lib/model/wallet_setup.g.dart @@ -31,15 +31,9 @@ class _$WalletSetup extends WalletSetup { this.loading, this.errors}) : super._() { - if (step == null) { - throw new BuiltValueNullFieldError('WalletSetup', 'step'); - } - if (method == null) { - throw new BuiltValueNullFieldError('WalletSetup', 'method'); - } - if (loading == null) { - throw new BuiltValueNullFieldError('WalletSetup', 'loading'); - } + BuiltValueNullFieldError.checkNotNull(step, 'WalletSetup', 'step'); + BuiltValueNullFieldError.checkNotNull(method, 'WalletSetup', 'method'); + BuiltValueNullFieldError.checkNotNull(loading, 'WalletSetup', 'loading'); } @override @@ -117,13 +111,14 @@ class WalletSetupBuilder implements Builder { WalletSetupBuilder(); WalletSetupBuilder get _$this { - if (_$v != null) { - _mnemonic = _$v.mnemonic; - _privateKey = _$v.privateKey; - _step = _$v.step; - _method = _$v.method; - _loading = _$v.loading; - _errors = _$v.errors?.toBuilder(); + final $v = _$v; + if ($v != null) { + _mnemonic = $v.mnemonic; + _privateKey = $v.privateKey; + _step = $v.step; + _method = $v.method; + _loading = $v.loading; + _errors = $v.errors?.toBuilder(); _$v = null; } return this; @@ -131,9 +126,7 @@ class WalletSetupBuilder implements Builder { @override void replace(WalletSetup other) { - if (other == null) { - throw new ArgumentError.notNull('other'); - } + ArgumentError.checkNotNull(other, 'other'); _$v = other as _$WalletSetup; } @@ -150,9 +143,12 @@ class WalletSetupBuilder implements Builder { new _$WalletSetup._( mnemonic: mnemonic, privateKey: privateKey, - step: step, - method: method, - loading: loading, + step: BuiltValueNullFieldError.checkNotNull( + step, 'WalletSetup', 'step'), + method: BuiltValueNullFieldError.checkNotNull( + method, 'WalletSetup', 'method'), + loading: BuiltValueNullFieldError.checkNotNull( + loading, 'WalletSetup', 'loading'), errors: _errors?.build()); } catch (_) { String _$failedField; diff --git a/lib/model/wallet_transfer.g.dart b/lib/model/wallet_transfer.g.dart index 864a326..e285e9d 100644 --- a/lib/model/wallet_transfer.g.dart +++ b/lib/model/wallet_transfer.g.dart @@ -18,12 +18,8 @@ class _$WalletTransfer extends WalletTransfer { (new WalletTransferBuilder()..update(updates)).build(); _$WalletTransfer._({this.errors, this.status, this.loading}) : super._() { - if (status == null) { - throw new BuiltValueNullFieldError('WalletTransfer', 'status'); - } - if (loading == null) { - throw new BuiltValueNullFieldError('WalletTransfer', 'loading'); - } + BuiltValueNullFieldError.checkNotNull(status, 'WalletTransfer', 'status'); + BuiltValueNullFieldError.checkNotNull(loading, 'WalletTransfer', 'loading'); } @override @@ -79,10 +75,11 @@ class WalletTransferBuilder WalletTransferBuilder(); WalletTransferBuilder get _$this { - if (_$v != null) { - _errors = _$v.errors?.toBuilder(); - _status = _$v.status; - _loading = _$v.loading; + final $v = _$v; + if ($v != null) { + _errors = $v.errors?.toBuilder(); + _status = $v.status; + _loading = $v.loading; _$v = null; } return this; @@ -90,9 +87,7 @@ class WalletTransferBuilder @override void replace(WalletTransfer other) { - if (other == null) { - throw new ArgumentError.notNull('other'); - } + ArgumentError.checkNotNull(other, 'other'); _$v = other as _$WalletTransfer; } @@ -107,7 +102,11 @@ class WalletTransferBuilder try { _$result = _$v ?? new _$WalletTransfer._( - errors: _errors?.build(), status: status, loading: loading); + errors: _errors?.build(), + status: BuiltValueNullFieldError.checkNotNull( + status, 'WalletTransfer', 'status'), + loading: BuiltValueNullFieldError.checkNotNull( + loading, 'WalletTransfer', 'loading')); } catch (_) { String _$failedField; try { diff --git a/lib/router.dart b/lib/router.dart index 510ddca..4def5bd 100644 --- a/lib/router.dart +++ b/lib/router.dart @@ -6,7 +6,7 @@ import 'package:etherwallet/wallet_main_page.dart'; import 'package:etherwallet/wallet_transfer_page.dart'; import 'package:flutter/material.dart'; import 'package:flutter_hooks/flutter_hooks.dart'; -import 'package:provider/provider.dart' as p; +import 'package:provider/provider.dart'; import 'context/wallet/wallet_provider.dart'; import 'context/setup/wallet_setup_provider.dart'; @@ -16,7 +16,7 @@ import 'intro_page.dart'; Map getRoutes(context) { return { '/': (BuildContext context) { - var configurationService = p.Provider.of(context); + var configurationService = Provider.of(context); if (configurationService.didSetupWallet()) return WalletProvider(builder: (context, store) { return WalletMainPage("Your wallet"); diff --git a/lib/service/address_service.dart b/lib/service/address_service.dart index fe081b6..0ee0885 100644 --- a/lib/service/address_service.dart +++ b/lib/service/address_service.dart @@ -47,7 +47,7 @@ class AddressService implements IAddressService { @override Future setupFromMnemonic(String mnemonic) async { final cryptMnemonic = bip39.mnemonicToEntropy(mnemonic); - final privateKey = this.getPrivateKey(cryptMnemonic); + final privateKey = this.getPrivateKey(mnemonic); await _configService.setMnemonic(cryptMnemonic); await _configService.setPrivateKey(privateKey); diff --git a/lib/wallet_main_page.dart b/lib/wallet_main_page.dart index a8910af..0be707f 100644 --- a/lib/wallet_main_page.dart +++ b/lib/wallet_main_page.dart @@ -51,7 +51,7 @@ class WalletMainPage extends HookWidget { onPressed: !store.state.loading ? () async { await store.fetchOwnBalance(); - Scaffold.of(context).showSnackBar(SnackBar( + ScaffoldMessenger.of(context).showSnackBar(SnackBar( content: Text("Balance updated"), duration: Duration(milliseconds: 800), )); diff --git a/pubspec.lock b/pubspec.lock index 4edc11b..cbeeada 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -28,7 +28,7 @@ packages: name: async url: "https://pub.dartlang.org" source: hosted - version: "2.5.0-nullsafety.1" + version: "2.5.0" bip39: dependency: "direct main" description: @@ -42,21 +42,21 @@ packages: name: boolean_selector url: "https://pub.dartlang.org" source: hosted - version: "2.1.0-nullsafety.1" + version: "2.1.0" build: dependency: transitive description: name: build url: "https://pub.dartlang.org" source: hosted - version: "1.5.2" + version: "1.6.3" build_config: dependency: transitive description: name: build_config url: "https://pub.dartlang.org" source: hosted - version: "0.4.2" + version: "0.4.6" build_daemon: dependency: transitive description: @@ -70,70 +70,70 @@ packages: name: build_resolvers url: "https://pub.dartlang.org" source: hosted - version: "1.4.4" + version: "1.5.4" build_runner: dependency: "direct dev" description: name: build_runner url: "https://pub.dartlang.org" source: hosted - version: "1.11.1" + version: "1.11.5" build_runner_core: dependency: transitive description: name: build_runner_core url: "https://pub.dartlang.org" source: hosted - version: "6.0.3" + version: "6.1.10" built_collection: dependency: "direct main" description: name: built_collection url: "https://pub.dartlang.org" source: hosted - version: "4.3.2" + version: "5.0.0" built_value: dependency: "direct main" description: name: built_value url: "https://pub.dartlang.org" source: hosted - version: "7.1.0" + version: "8.0.0" built_value_generator: dependency: "direct dev" description: name: built_value_generator url: "https://pub.dartlang.org" source: hosted - version: "7.1.0" + version: "8.0.0" camera: dependency: "direct main" description: name: camera url: "https://pub.dartlang.org" source: hosted - version: "0.7.0+2" + version: "0.8.0" camera_platform_interface: dependency: transitive description: name: camera_platform_interface url: "https://pub.dartlang.org" source: hosted - version: "1.5.0" + version: "2.0.1" characters: dependency: transitive description: name: characters url: "https://pub.dartlang.org" source: hosted - version: "1.1.0-nullsafety.3" + version: "1.1.0" charcode: dependency: transitive description: name: charcode url: "https://pub.dartlang.org" source: hosted - version: "1.2.0-nullsafety.1" + version: "1.2.0" checked_yaml: dependency: transitive description: @@ -154,7 +154,7 @@ packages: name: clock url: "https://pub.dartlang.org" source: hosted - version: "1.1.0-nullsafety.1" + version: "1.1.0" code_builder: dependency: transitive description: @@ -168,7 +168,7 @@ packages: name: collection url: "https://pub.dartlang.org" source: hosted - version: "1.15.0-nullsafety.3" + version: "1.15.0" convert: dependency: transitive description: @@ -182,7 +182,7 @@ packages: name: cross_file url: "https://pub.dartlang.org" source: hosted - version: "0.1.0" + version: "0.3.1" crypto: dependency: transitive description: @@ -210,21 +210,21 @@ packages: name: fake_async url: "https://pub.dartlang.org" source: hosted - version: "1.2.0-nullsafety.1" + version: "1.2.0" ffi: dependency: transitive description: name: ffi url: "https://pub.dartlang.org" source: hosted - version: "0.1.3" + version: "1.0.0" file: dependency: transitive description: name: file url: "https://pub.dartlang.org" source: hosted - version: "5.2.1" + version: "6.1.0" firebase: dependency: transitive description: @@ -245,7 +245,7 @@ packages: name: firebase_analytics_platform_interface url: "https://pub.dartlang.org" source: hosted - version: "1.0.3" + version: "1.1.0" firebase_analytics_web: dependency: transitive description: @@ -261,12 +261,12 @@ packages: source: hosted version: "0.9.10" fixnum: - dependency: transitive + dependency: "direct overridden" description: name: fixnum url: "https://pub.dartlang.org" source: hosted - version: "0.10.11" + version: "1.0.0" flutter: dependency: "direct main" description: flutter @@ -302,7 +302,7 @@ packages: name: glob url: "https://pub.dartlang.org" source: hosted - version: "1.2.0" + version: "2.0.0" graphs: dependency: transitive description: @@ -365,14 +365,14 @@ packages: name: js url: "https://pub.dartlang.org" source: hosted - version: "0.6.2" + version: "0.6.3" json_annotation: dependency: transitive description: name: json_annotation url: "https://pub.dartlang.org" source: hosted - version: "3.1.1" + version: "4.0.0" json_rpc_2: dependency: transitive description: @@ -386,7 +386,7 @@ packages: name: json_serializable url: "https://pub.dartlang.org" source: hosted - version: "3.5.1" + version: "4.0.2" logging: dependency: transitive description: @@ -400,14 +400,14 @@ packages: name: matcher url: "https://pub.dartlang.org" source: hosted - version: "0.12.10-nullsafety.1" + version: "0.12.10" meta: dependency: transitive description: name: meta url: "https://pub.dartlang.org" source: hosted - version: "1.3.0-nullsafety.3" + version: "1.3.0" mime: dependency: transitive description: @@ -422,20 +422,6 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "0.0.4" - node_interop: - dependency: transitive - description: - name: node_interop - url: "https://pub.dartlang.org" - source: hosted - version: "1.2.1" - node_io: - dependency: transitive - description: - name: node_io - url: "https://pub.dartlang.org" - source: hosted - version: "1.2.0" package_config: dependency: transitive description: @@ -449,49 +435,49 @@ packages: name: path url: "https://pub.dartlang.org" source: hosted - version: "1.8.0-nullsafety.1" + version: "1.8.0" path_provider_linux: dependency: transitive description: name: path_provider_linux url: "https://pub.dartlang.org" source: hosted - version: "0.0.1+2" + version: "2.0.0" path_provider_platform_interface: dependency: transitive description: name: path_provider_platform_interface url: "https://pub.dartlang.org" source: hosted - version: "1.0.4" + version: "2.0.0" path_provider_windows: dependency: transitive description: name: path_provider_windows url: "https://pub.dartlang.org" source: hosted - version: "0.0.4+3" + version: "2.0.0" pedantic: dependency: transitive description: name: pedantic url: "https://pub.dartlang.org" source: hosted - version: "1.9.2" + version: "1.11.0" platform: dependency: transitive description: name: platform url: "https://pub.dartlang.org" source: hosted - version: "2.2.1" + version: "3.0.0" plugin_platform_interface: dependency: transitive description: name: plugin_platform_interface url: "https://pub.dartlang.org" source: hosted - version: "1.0.3" + version: "2.0.0" pointycastle: dependency: "direct main" description: @@ -512,7 +498,7 @@ packages: name: process url: "https://pub.dartlang.org" source: hosted - version: "3.0.13" + version: "4.1.0" provider: dependency: "direct main" description: @@ -549,54 +535,54 @@ packages: source: hosted version: "3.2.0" quiver: - dependency: transitive + dependency: "direct overridden" description: name: quiver url: "https://pub.dartlang.org" source: hosted - version: "2.1.5" + version: "3.0.0" shared_preferences: dependency: "direct main" description: name: shared_preferences url: "https://pub.dartlang.org" source: hosted - version: "0.5.12+4" + version: "2.0.3" shared_preferences_linux: dependency: transitive description: name: shared_preferences_linux url: "https://pub.dartlang.org" source: hosted - version: "0.0.2+4" + version: "2.0.0" shared_preferences_macos: dependency: transitive description: name: shared_preferences_macos url: "https://pub.dartlang.org" source: hosted - version: "0.0.1+11" + version: "2.0.0" shared_preferences_platform_interface: dependency: transitive description: name: shared_preferences_platform_interface url: "https://pub.dartlang.org" source: hosted - version: "1.0.4" + version: "2.0.0" shared_preferences_web: dependency: transitive description: name: shared_preferences_web url: "https://pub.dartlang.org" source: hosted - version: "0.1.2+7" + version: "2.0.0" shared_preferences_windows: dependency: transitive description: name: shared_preferences_windows url: "https://pub.dartlang.org" source: hosted - version: "0.0.2+3" + version: "2.0.0" shelf: dependency: transitive description: @@ -622,56 +608,56 @@ packages: name: source_gen url: "https://pub.dartlang.org" source: hosted - version: "0.9.7+1" + version: "0.9.10+3" source_span: dependency: transitive description: name: source_span url: "https://pub.dartlang.org" source: hosted - version: "1.8.0-nullsafety.2" + version: "1.8.0" stack_trace: dependency: transitive description: name: stack_trace url: "https://pub.dartlang.org" source: hosted - version: "1.10.0-nullsafety.1" + version: "1.10.0" stream_channel: dependency: transitive description: name: stream_channel url: "https://pub.dartlang.org" source: hosted - version: "2.1.0-nullsafety.1" + version: "2.1.0" stream_transform: dependency: transitive description: name: stream_transform url: "https://pub.dartlang.org" source: hosted - version: "1.2.0" + version: "2.0.0" string_scanner: dependency: transitive description: name: string_scanner url: "https://pub.dartlang.org" source: hosted - version: "1.1.0-nullsafety.1" + version: "1.1.0" term_glyph: dependency: transitive description: name: term_glyph url: "https://pub.dartlang.org" source: hosted - version: "1.2.0-nullsafety.1" + version: "1.2.0" test_api: dependency: transitive description: name: test_api url: "https://pub.dartlang.org" source: hosted - version: "0.2.19-nullsafety.2" + version: "0.2.19" timing: dependency: transitive description: @@ -692,49 +678,49 @@ packages: name: typed_data url: "https://pub.dartlang.org" source: hosted - version: "1.3.0-nullsafety.3" + version: "1.3.0" url_launcher: dependency: "direct main" description: name: url_launcher url: "https://pub.dartlang.org" source: hosted - version: "5.7.10" + version: "6.0.2" url_launcher_linux: dependency: transitive description: name: url_launcher_linux url: "https://pub.dartlang.org" source: hosted - version: "0.0.1+4" + version: "2.0.0" url_launcher_macos: dependency: transitive description: name: url_launcher_macos url: "https://pub.dartlang.org" source: hosted - version: "0.0.1+9" + version: "2.0.0" url_launcher_platform_interface: dependency: transitive description: name: url_launcher_platform_interface url: "https://pub.dartlang.org" source: hosted - version: "1.0.9" + version: "2.0.2" url_launcher_web: dependency: transitive description: name: url_launcher_web url: "https://pub.dartlang.org" source: hosted - version: "0.1.5+3" + version: "2.0.0" url_launcher_windows: dependency: transitive description: name: url_launcher_windows url: "https://pub.dartlang.org" source: hosted - version: "0.0.1+3" + version: "2.0.0" uuid: dependency: transitive description: @@ -748,7 +734,7 @@ packages: name: vector_math url: "https://pub.dartlang.org" source: hosted - version: "2.1.0-nullsafety.3" + version: "2.1.0" watcher: dependency: transitive description: @@ -776,14 +762,14 @@ packages: name: win32 url: "https://pub.dartlang.org" source: hosted - version: "1.7.4+1" + version: "2.0.0" xdg_directories: dependency: transitive description: name: xdg_directories url: "https://pub.dartlang.org" source: hosted - version: "0.1.2" + version: "0.2.0" yaml: dependency: transitive description: @@ -792,5 +778,5 @@ packages: source: hosted version: "2.2.1" sdks: - dart: ">=2.10.0 <2.11.0" - flutter: ">=1.22.0 <2.0.0" + dart: ">=2.12.0-259.9.beta <3.0.0" + flutter: ">=1.22.0" diff --git a/pubspec.yaml b/pubspec.yaml index 0b8e2cb..0c7d851 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -15,7 +15,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. # Read more about iOS versioning at # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html -version: 1.2.0+5 +version: 1.3.0+6 environment: sdk: ">=2.7.0 <3.0.0" @@ -35,31 +35,33 @@ dependencies: tweetnacl: ^0.3.2 pointycastle: ^1.0.1 hex: ^0.1.2 - shared_preferences: ^0.5.12+4 - camera: ^0.7.0+2 + shared_preferences: ^2.0.0 + camera: ^0.8.0 firebase_ml_vision: ^0.9.10 web_socket_channel: ^1.1.0 intl: ^0.16.1 flutter_spinkit: "^4.1.1+1" firebase_analytics: ^5.0.11 - url_launcher: ^5.4.1 + url_launcher: ^6.0.2 flutter_hooks: ^0.15.0 - built_value: ^7.1.0 - built_collection: ^4.3.2 + built_value: ^8.0.0 + built_collection: ^5.0.0 dev_dependencies: flutter_test: sdk: flutter - build_runner: ^1.11.0 - built_value_generator: ^7.1.0 - json_serializable: ^3.5.1 + build_runner: ^1.11.2 + built_value_generator: ^8.0.0 + json_serializable: ^4.0.2 dependency_overrides: analyzer: 0.41.2 + quiver: ^3.0.0 + fixnum: ^1.0.0 # For information on the generic Dart part of this file, see the -# following page: https://dart.dev/tools/pub/pubspec +# following page: https://dart.dev/tools/pub/pubspec # The following section is specific to Flutter. flutter: