Improve wallet generation; Add menu to change endpoint;
This commit is contained in:
parent
345a600599
commit
c5317f984d
|
@ -41,3 +41,7 @@ Color backgroundColor = const Color(0xFFF5F5F5);
|
||||||
|
|
||||||
// Substrate settings
|
// Substrate settings
|
||||||
const int ss58 = 42;
|
const int ss58 = 42;
|
||||||
|
String currencyName = 'Ğdev';
|
||||||
|
|
||||||
|
// Debug
|
||||||
|
const debugPin = true;
|
||||||
|
|
|
@ -86,7 +86,7 @@ class GenerateWalletsProvider with ChangeNotifier {
|
||||||
address: address,
|
address: address,
|
||||||
number: 0,
|
number: 0,
|
||||||
name: _name,
|
name: _name,
|
||||||
derivation: 3,
|
derivation: 2,
|
||||||
imageName: '0.png');
|
imageName: '0.png');
|
||||||
await walletBox.add(myWallet);
|
await walletBox.add(myWallet);
|
||||||
|
|
||||||
|
@ -297,9 +297,9 @@ class GenerateWalletsProvider with ChangeNotifier {
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<List<String>> generateWordList(BuildContext context) async {
|
Future<List<String>> generateWordList(BuildContext context) async {
|
||||||
SubstrateSdk _sdk = Provider.of<SubstrateSdk>(context, listen: false);
|
SubstrateSdk _sub = Provider.of<SubstrateSdk>(context, listen: false);
|
||||||
|
|
||||||
generatedMnemonic = await _sdk.generateMnemonic(lang: appLang);
|
generatedMnemonic = await _sub.generateMnemonic(lang: appLang);
|
||||||
List<String> _wordsList = [];
|
List<String> _wordsList = [];
|
||||||
String word;
|
String word;
|
||||||
int _nbr = 1;
|
int _nbr = 1;
|
||||||
|
|
|
@ -7,7 +7,6 @@ import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
import 'package:gecko/globals.dart';
|
import 'package:gecko/globals.dart';
|
||||||
import 'package:gecko/providers/substrate_sdk.dart';
|
|
||||||
import 'package:hive_flutter/hive_flutter.dart';
|
import 'package:hive_flutter/hive_flutter.dart';
|
||||||
import 'package:flutter/foundation.dart' show kIsWeb;
|
import 'package:flutter/foundation.dart' show kIsWeb;
|
||||||
import 'package:path_provider/path_provider.dart' as pp;
|
import 'package:path_provider/path_provider.dart' as pp;
|
||||||
|
@ -140,22 +139,6 @@ class HomeProvider with ChangeNotifier {
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
}
|
}
|
||||||
|
|
||||||
void snackNode(context) {
|
|
||||||
if (isFirstBuild) {
|
|
||||||
String _message;
|
|
||||||
if (endPointGVA == 'HS') {
|
|
||||||
_message =
|
|
||||||
"Aucun noeud Duniter disponible, veuillez réessayer ultérieurement";
|
|
||||||
} else {
|
|
||||||
_message = "Vous êtes connecté au noeud\n${SubstrateSdk().subNode}";
|
|
||||||
}
|
|
||||||
final snackBar = SnackBar(
|
|
||||||
content: Text(_message), duration: const Duration(seconds: 2));
|
|
||||||
isFirstBuild = false;
|
|
||||||
ScaffoldMessenger.of(context).showSnackBar(snackBar);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void rebuildWidget() {
|
void rebuildWidget() {
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,6 +23,12 @@ class MyWalletsProvider with ChangeNotifier {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool checkIfWalletExist() {
|
bool checkIfWalletExist() {
|
||||||
|
// configBox.delete('endpoint');
|
||||||
|
if (!configBox.containsKey('endpoint') || configBox.get('endpoint') == '') {
|
||||||
|
log.d('No endpoint, configure...');
|
||||||
|
configBox.put('endpoint', 'ws://192.168.1.72:9944');
|
||||||
|
}
|
||||||
|
|
||||||
if (chestBox.isEmpty) {
|
if (chestBox.isEmpty) {
|
||||||
log.i('No wallets detected');
|
log.i('No wallets detected');
|
||||||
return false;
|
return false;
|
||||||
|
@ -68,6 +74,7 @@ class MyWalletsProvider with ChangeNotifier {
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<int> deleteAllWallet(context) async {
|
Future<int> deleteAllWallet(context) async {
|
||||||
|
SubstrateSdk _sub = Provider.of<SubstrateSdk>(context, listen: false);
|
||||||
try {
|
try {
|
||||||
log.w('DELETE ALL WALLETS ?');
|
log.w('DELETE ALL WALLETS ?');
|
||||||
|
|
||||||
|
@ -76,9 +83,7 @@ class MyWalletsProvider with ChangeNotifier {
|
||||||
await walletBox.clear();
|
await walletBox.clear();
|
||||||
await chestBox.clear();
|
await chestBox.clear();
|
||||||
await configBox.delete('defaultWallet');
|
await configBox.delete('defaultWallet');
|
||||||
// await Future.delayed(const Duration(milliseconds: 50));
|
await _sub.deleteAllAccounts();
|
||||||
// notifyListeners();
|
|
||||||
|
|
||||||
await Navigator.of(context).pushNamedAndRemoveUntil(
|
await Navigator.of(context).pushNamedAndRemoveUntil(
|
||||||
'/',
|
'/',
|
||||||
ModalRoute.withName('/'),
|
ModalRoute.withName('/'),
|
||||||
|
@ -96,23 +101,42 @@ class MyWalletsProvider with ChangeNotifier {
|
||||||
barrierDismissible: true, // user must tap button!
|
barrierDismissible: true, // user must tap button!
|
||||||
builder: (BuildContext context) {
|
builder: (BuildContext context) {
|
||||||
return AlertDialog(
|
return AlertDialog(
|
||||||
title: const Text(
|
backgroundColor: backgroundColor,
|
||||||
'Êtes-vous sûr de vouloir supprimer tous vos trousseaux ?'),
|
content: const Text(
|
||||||
content: const SingleChildScrollView(child: Text('')),
|
'Êtes-vous sûr de vouloir oublier tous vos coffres ?',
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
style: TextStyle(fontSize: 18, fontWeight: FontWeight.w500),
|
||||||
|
),
|
||||||
actions: <Widget>[
|
actions: <Widget>[
|
||||||
TextButton(
|
Row(
|
||||||
child: const Text("Non"),
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
onPressed: () {
|
children: [
|
||||||
Navigator.pop(context, false);
|
TextButton(
|
||||||
},
|
key: const Key('confirmDeletingAllWallets'),
|
||||||
),
|
child: const Text(
|
||||||
TextButton(
|
"Oui",
|
||||||
key: const Key('confirmDeletingAllWallets'),
|
style: TextStyle(
|
||||||
child: const Text("Oui"),
|
fontSize: 20,
|
||||||
onPressed: () {
|
color: Color(0xffD80000),
|
||||||
Navigator.pop(context, true);
|
),
|
||||||
},
|
),
|
||||||
),
|
onPressed: () {
|
||||||
|
Navigator.pop(context, true);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
const SizedBox(width: 20),
|
||||||
|
TextButton(
|
||||||
|
child: const Text(
|
||||||
|
"Non",
|
||||||
|
style: TextStyle(fontSize: 20),
|
||||||
|
),
|
||||||
|
onPressed: () {
|
||||||
|
Navigator.pop(context, false);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
const SizedBox(height: 120)
|
||||||
|
],
|
||||||
|
)
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
@ -136,12 +160,12 @@ class MyWalletsProvider with ChangeNotifier {
|
||||||
MyWalletsProvider myWalletProvider =
|
MyWalletsProvider myWalletProvider =
|
||||||
Provider.of<MyWalletsProvider>(context, listen: false);
|
Provider.of<MyWalletsProvider>(context, listen: false);
|
||||||
|
|
||||||
SubstrateSdk _sdk = Provider.of<SubstrateSdk>(context, listen: false);
|
SubstrateSdk _sub = Provider.of<SubstrateSdk>(context, listen: false);
|
||||||
|
|
||||||
final int? _currentChestNumber = myWalletProvider.getCurrentChest();
|
final int? _currentChestNumber = myWalletProvider.getCurrentChest();
|
||||||
final ChestData _currentChest = chestBox.get(_currentChestNumber)!;
|
final ChestData _currentChest = chestBox.get(_currentChestNumber)!;
|
||||||
|
|
||||||
final address = await _sdk.derive(
|
final address = await _sub.derive(
|
||||||
context, _currentChest.address!, _newDerivationNbr, pinCode);
|
context, _currentChest.address!, _newDerivationNbr, pinCode);
|
||||||
|
|
||||||
WalletData newWallet = WalletData(
|
WalletData newWallet = WalletData(
|
||||||
|
|
|
@ -14,8 +14,6 @@ import 'package:polkawallet_sdk/storage/types/keyPairData.dart';
|
||||||
import 'package:truncate/truncate.dart';
|
import 'package:truncate/truncate.dart';
|
||||||
|
|
||||||
class SubstrateSdk with ChangeNotifier {
|
class SubstrateSdk with ChangeNotifier {
|
||||||
final List subNode = ['192.168.1.72:9944'];
|
|
||||||
final bool isSsl = false;
|
|
||||||
final int ss58 = 42;
|
final int ss58 = 42;
|
||||||
|
|
||||||
final WalletSDK sdk = WalletSDK();
|
final WalletSDK sdk = WalletSDK();
|
||||||
|
@ -26,6 +24,7 @@ class SubstrateSdk with ChangeNotifier {
|
||||||
bool nodeConnected = false;
|
bool nodeConnected = false;
|
||||||
bool importIsLoading = false;
|
bool importIsLoading = false;
|
||||||
int blocNumber = 0;
|
int blocNumber = 0;
|
||||||
|
bool isLoadingEndpoint = false;
|
||||||
|
|
||||||
TextEditingController jsonKeystore = TextEditingController();
|
TextEditingController jsonKeystore = TextEditingController();
|
||||||
TextEditingController keystorePassword = TextEditingController();
|
TextEditingController keystorePassword = TextEditingController();
|
||||||
|
@ -41,30 +40,45 @@ class SubstrateSdk with ChangeNotifier {
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> connectNode() async {
|
Future<void> connectNode(BuildContext ctx) async {
|
||||||
final String socketKind = isSsl ? 'wss' : 'ws';
|
|
||||||
List<NetworkParams> node = [];
|
List<NetworkParams> node = [];
|
||||||
for (final sn in subNode) {
|
final n = NetworkParams();
|
||||||
final n = NetworkParams();
|
n.name = currencyName;
|
||||||
n.name = 'duniter';
|
n.endpoint = configBox.get('endpoint');
|
||||||
n.endpoint = '$socketKind://$sn';
|
n.ss58 = ss58;
|
||||||
n.ss58 = ss58;
|
node.add(n);
|
||||||
node.add(n);
|
|
||||||
|
if (sdk.api.connectedNode?.endpoint != null) {
|
||||||
|
await sdk.api.setting.unsubscribeBestNumber();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
isLoadingEndpoint = true;
|
||||||
|
notifyListeners();
|
||||||
final res = await sdk.api.connectNode(keyring, node).timeout(
|
final res = await sdk.api.connectNode(keyring, node).timeout(
|
||||||
const Duration(seconds: 10),
|
const Duration(seconds: 7),
|
||||||
onTimeout: () => null,
|
onTimeout: () => null,
|
||||||
);
|
);
|
||||||
|
isLoadingEndpoint = false;
|
||||||
|
notifyListeners();
|
||||||
if (res != null) {
|
if (res != null) {
|
||||||
nodeConnected = true;
|
nodeConnected = true;
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
|
snackNode(ctx, true);
|
||||||
|
} else {
|
||||||
|
nodeConnected = false;
|
||||||
|
notifyListeners();
|
||||||
|
snackNode(ctx, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Subscribe bloc number
|
// Subscribe bloc number
|
||||||
sdk.api.setting.subscribeBestNumber((res) {
|
if (nodeConnected) {
|
||||||
blocNumber = int.parse(res.toString());
|
sdk.api.setting.subscribeBestNumber((res) {
|
||||||
notifyListeners();
|
blocNumber = int.parse(res.toString());
|
||||||
});
|
notifyListeners();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
log.d(sdk.api.connectedNode?.endpoint);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<String> importAccount(
|
Future<String> importAccount(
|
||||||
|
@ -177,7 +191,7 @@ class SubstrateSdk with ChangeNotifier {
|
||||||
|
|
||||||
int getDerivationNumber(String address) {
|
int getDerivationNumber(String address) {
|
||||||
final account = getKeypair(address);
|
final account = getKeypair(address);
|
||||||
final deriveNbr = account.name!.split('/')[1];
|
final deriveNbr = account.name!.split('//')[1];
|
||||||
return int.parse(deriveNbr);
|
return int.parse(deriveNbr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -290,11 +304,11 @@ class SubstrateSdk with ChangeNotifier {
|
||||||
print(seedMap);
|
print(seedMap);
|
||||||
|
|
||||||
if (seedMap?['type'] != 'mnemonic') return '';
|
if (seedMap?['type'] != 'mnemonic') return '';
|
||||||
final List seedList = seedMap!['seed'].split('/');
|
final List seedList = seedMap!['seed'].split('//');
|
||||||
generatedMnemonic = seedList[0];
|
generatedMnemonic = seedList[0];
|
||||||
int sourceDerivation = -1; // To get derivation number of this account
|
int sourceDerivation = -1; // To get derivation number of this account
|
||||||
if (seedList.length > 1) {
|
if (seedList.length > 1) {
|
||||||
sourceDerivation = int.parse(seedMap['seed'].split('/')[1]);
|
sourceDerivation = int.parse(seedList[1]);
|
||||||
}
|
}
|
||||||
print(generatedMnemonic);
|
print(generatedMnemonic);
|
||||||
print(sourceDerivation);
|
print(sourceDerivation);
|
||||||
|
@ -316,6 +330,20 @@ class AddressInfo {
|
||||||
AddressInfo({@required this.address, this.balance = 0});
|
AddressInfo({@required this.address, this.balance = 0});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void snackNode(BuildContext context, bool isConnected) {
|
||||||
|
String _message;
|
||||||
|
if (!isConnected) {
|
||||||
|
_message =
|
||||||
|
"Aucun noeud Duniter disponible, veuillez réessayer ultérieurement";
|
||||||
|
} else {
|
||||||
|
_message =
|
||||||
|
"Vous êtes connecté au noeud\n${configBox.get('endpoint').split('//')[1]}";
|
||||||
|
}
|
||||||
|
final snackBar =
|
||||||
|
SnackBar(content: Text(_message), duration: const Duration(seconds: 2));
|
||||||
|
ScaffoldMessenger.of(context).showSnackBar(snackBar);
|
||||||
|
}
|
||||||
|
|
||||||
String getShortPubkey(String pubkey) {
|
String getShortPubkey(String pubkey) {
|
||||||
List<int> pubkeyByte = Base58Decode(pubkey);
|
List<int> pubkeyByte = Base58Decode(pubkey);
|
||||||
Digest pubkeyS256 = sha256.convert(sha256.convert(pubkeyByte).bytes);
|
Digest pubkeyS256 = sha256.convert(sha256.convert(pubkeyByte).bytes);
|
||||||
|
|
|
@ -79,12 +79,13 @@ class WalletOptionsProvider with ChangeNotifier {
|
||||||
final bool? _answer = await (_confirmDeletingWallet(context, wallet.name));
|
final bool? _answer = await (_confirmDeletingWallet(context, wallet.name));
|
||||||
|
|
||||||
if (_answer!) {
|
if (_answer!) {
|
||||||
walletBox.delete(wallet.key);
|
await walletBox.delete(wallet.key);
|
||||||
|
|
||||||
Navigator.popUntil(
|
// Navigator.popUntil(
|
||||||
context,
|
// context,
|
||||||
ModalRoute.withName('/mywallets'),
|
// ModalRoute.withName('/mywallets'),
|
||||||
);
|
// );
|
||||||
|
Navigator.pop(context);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -346,7 +346,7 @@ class HistoryScreen extends StatelessWidget with ChangeNotifier {
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
trailing: Text("${repository[4]} Ğ1",
|
trailing: Text("${repository[4]} $currencyName",
|
||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
fontSize: 18, fontWeight: FontWeight.w500),
|
fontSize: 18, fontWeight: FontWeight.w500),
|
||||||
textAlign: TextAlign.justify),
|
textAlign: TextAlign.justify),
|
||||||
|
@ -466,7 +466,7 @@ class HistoryScreen extends StatelessWidget with ChangeNotifier {
|
||||||
return const Text('...');
|
return const Text('...');
|
||||||
}
|
}
|
||||||
return Text(
|
return Text(
|
||||||
"${_balance.data.toString()} Ğ1",
|
"${_balance.data.toString()} $currencyName",
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
fontSize: 22, fontWeight: FontWeight.w500),
|
fontSize: 22, fontWeight: FontWeight.w500),
|
||||||
|
|
|
@ -5,7 +5,6 @@ import 'package:gecko/providers/chest_provider.dart';
|
||||||
import 'package:gecko/providers/substrate_sdk.dart';
|
import 'package:gecko/providers/substrate_sdk.dart';
|
||||||
import 'package:gecko/providers/wallets_profiles.dart';
|
import 'package:gecko/providers/wallets_profiles.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:gecko/providers/home.dart';
|
|
||||||
import 'package:gecko/providers/my_wallets.dart';
|
import 'package:gecko/providers/my_wallets.dart';
|
||||||
import 'package:gecko/models/wallet_data.dart';
|
import 'package:gecko/models/wallet_data.dart';
|
||||||
import 'package:gecko/screens/myWallets/restore_chest.dart';
|
import 'package:gecko/screens/myWallets/restore_chest.dart';
|
||||||
|
@ -27,11 +26,12 @@ class HomeScreen extends StatelessWidget {
|
||||||
MyWalletsProvider _myWalletProvider =
|
MyWalletsProvider _myWalletProvider =
|
||||||
Provider.of<MyWalletsProvider>(context);
|
Provider.of<MyWalletsProvider>(context);
|
||||||
Provider.of<ChestProvider>(context);
|
Provider.of<ChestProvider>(context);
|
||||||
HomeProvider homeClass = HomeProvider();
|
|
||||||
SubstrateSdk _sub = Provider.of<SubstrateSdk>(context, listen: false);
|
SubstrateSdk _sub = Provider.of<SubstrateSdk>(context, listen: false);
|
||||||
|
|
||||||
final bool isWalletsExists = _myWalletProvider.checkIfWalletExist();
|
final bool isWalletsExists = _myWalletProvider.checkIfWalletExist();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
isTall = false;
|
isTall = false;
|
||||||
ratio = 1;
|
ratio = 1;
|
||||||
if (MediaQuery.of(context).size.height >= 930) {
|
if (MediaQuery.of(context).size.height >= 930) {
|
||||||
|
@ -103,9 +103,8 @@ class HomeScreen extends StatelessWidget {
|
||||||
WidgetsBinding.instance.addPostFrameCallback((_) async {
|
WidgetsBinding.instance.addPostFrameCallback((_) async {
|
||||||
if (!_sub.sdkReady && !_sub.sdkLoading) await _sub.initApi();
|
if (!_sub.sdkReady && !_sub.sdkLoading) await _sub.initApi();
|
||||||
if (_sub.sdkReady && !_sub.nodeConnected) {
|
if (_sub.sdkReady && !_sub.nodeConnected) {
|
||||||
await _sub.connectNode(); //kopa
|
await _sub.connectNode(ctx); //kopa
|
||||||
}
|
}
|
||||||
if (isWalletsExists) homeClass.snackNode(ctx);
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
child: isWalletsExists ? geckHome(context) : welcomeHome(context)
|
child: isWalletsExists ? geckHome(context) : welcomeHome(context)
|
||||||
|
@ -405,31 +404,30 @@ Widget welcomeHome(context) {
|
||||||
]),
|
]),
|
||||||
Padding(
|
Padding(
|
||||||
padding: EdgeInsets.only(top: 1 * ratio),
|
padding: EdgeInsets.only(top: 1 * ratio),
|
||||||
child: Row(
|
child:
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
Row(mainAxisAlignment: MainAxisAlignment.center, children: <Widget>[
|
||||||
children: const <Widget>[
|
Text(
|
||||||
Text(
|
"L’application de paiement $currencyName\nplus rapide qu’un reptile du Vietnam",
|
||||||
"L’application de paiement Ğ1\nplus rapide qu’un reptile du Vietnam",
|
textAlign: TextAlign.center,
|
||||||
textAlign: TextAlign.center,
|
style: const TextStyle(
|
||||||
style: TextStyle(
|
color: Colors.white,
|
||||||
color: Colors.white,
|
fontSize: 24,
|
||||||
fontSize: 24,
|
fontWeight: FontWeight.w700,
|
||||||
fontWeight: FontWeight.w700,
|
shadows: <Shadow>[
|
||||||
shadows: <Shadow>[
|
Shadow(
|
||||||
Shadow(
|
offset: Offset(0, 0),
|
||||||
offset: Offset(0, 0),
|
blurRadius: 20,
|
||||||
blurRadius: 20,
|
color: Colors.black,
|
||||||
color: Colors.black,
|
|
||||||
),
|
|
||||||
Shadow(
|
|
||||||
offset: Offset(0, 0),
|
|
||||||
blurRadius: 20,
|
|
||||||
color: Colors.black,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
)
|
Shadow(
|
||||||
]),
|
offset: Offset(0, 0),
|
||||||
|
blurRadius: 20,
|
||||||
|
color: Colors.black,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
)
|
||||||
|
]),
|
||||||
),
|
),
|
||||||
Expanded(
|
Expanded(
|
||||||
flex: 1,
|
flex: 1,
|
||||||
|
|
|
@ -25,7 +25,7 @@ class ChangePinScreen extends StatelessWidget with ChangeNotifier {
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
|
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
|
||||||
SubstrateSdk _sdk = Provider.of<SubstrateSdk>(context, listen: false);
|
SubstrateSdk _sub = Provider.of<SubstrateSdk>(context, listen: false);
|
||||||
|
|
||||||
return WillPopScope(
|
return WillPopScope(
|
||||||
onWillPop: () {
|
onWillPop: () {
|
||||||
|
@ -100,7 +100,8 @@ class ChangePinScreen extends StatelessWidget with ChangeNotifier {
|
||||||
),
|
),
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
final _chest = chestBox.get(configBox.get('currentChest'));
|
final _chest = chestBox.get(configBox.get('currentChest'));
|
||||||
_sdk.changePassword(_chest!.address!, walletProvider.pinCode, newPin.text);
|
_sub.changePassword(
|
||||||
|
_chest!.address!, walletProvider.pinCode, newPin.text);
|
||||||
newPin.text = '';
|
newPin.text = '';
|
||||||
walletProvider.pinCode = newPin.text;
|
walletProvider.pinCode = newPin.text;
|
||||||
},
|
},
|
||||||
|
|
|
@ -22,7 +22,7 @@ class ChooseWalletScreen extends StatelessWidget {
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
|
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
|
||||||
SubstrateSdk _sdk = Provider.of<SubstrateSdk>(context, listen: false);
|
SubstrateSdk _sub = Provider.of<SubstrateSdk>(context, listen: false);
|
||||||
WalletsProfilesProvider _walletViewProvider =
|
WalletsProfilesProvider _walletViewProvider =
|
||||||
Provider.of<WalletsProfilesProvider>(context, listen: false);
|
Provider.of<WalletsProfilesProvider>(context, listen: false);
|
||||||
// HomeProvider _homeProvider = Provider.of<HomeProvider>(context);
|
// HomeProvider _homeProvider = Provider.of<HomeProvider>(context);
|
||||||
|
@ -50,10 +50,10 @@ class ChooseWalletScreen extends StatelessWidget {
|
||||||
onPrimary: Colors.white, // foreground
|
onPrimary: Colors.white, // foreground
|
||||||
),
|
),
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
final acc = _sdk.getCurrentWallet();
|
final acc = _sub.getCurrentWallet();
|
||||||
log.d(
|
log.d(
|
||||||
"fromAddress: ${acc.address!},destAddress: ${_walletViewProvider.outputPubkey.text}, amount: ${double.parse(_walletViewProvider.payAmount.text)}, password: $pin");
|
"fromAddress: ${acc.address!},destAddress: ${_walletViewProvider.outputPubkey.text}, amount: ${double.parse(_walletViewProvider.payAmount.text)}, password: $pin");
|
||||||
final resultPay = await _sdk.pay(context,
|
final resultPay = await _sub.pay(context,
|
||||||
fromAddress: acc.address!,
|
fromAddress: acc.address!,
|
||||||
destAddress: _walletViewProvider.outputPubkey.text,
|
destAddress: _walletViewProvider.outputPubkey.text,
|
||||||
amount:
|
amount:
|
||||||
|
@ -79,13 +79,14 @@ class ChooseWalletScreen extends StatelessWidget {
|
||||||
MyWalletsProvider _myWalletProvider =
|
MyWalletsProvider _myWalletProvider =
|
||||||
Provider.of<MyWalletsProvider>(context);
|
Provider.of<MyWalletsProvider>(context);
|
||||||
final bool isWalletsExists = _myWalletProvider.checkIfWalletExist();
|
final bool isWalletsExists = _myWalletProvider.checkIfWalletExist();
|
||||||
SubstrateSdk _sdk = Provider.of<SubstrateSdk>(context, listen: false);
|
SubstrateSdk _sub = Provider.of<SubstrateSdk>(context, listen: false);
|
||||||
|
|
||||||
WalletData? defaultWallet =
|
WalletData? defaultWallet =
|
||||||
_myWalletProvider.getDefaultWallet(currentChest);
|
_myWalletProvider.getDefaultWallet(currentChest);
|
||||||
|
|
||||||
_selectedId ??= defaultWallet!.id();
|
_selectedId ??= defaultWallet!.id();
|
||||||
_derivation ??= defaultWallet!.derivation!;
|
_derivation ??= defaultWallet!.derivation!;
|
||||||
|
_sub.setCurrentWallet(defaultWallet!.address!);
|
||||||
_myWalletProvider.readAllWallets(currentChest);
|
_myWalletProvider.readAllWallets(currentChest);
|
||||||
|
|
||||||
if (!isWalletsExists) {
|
if (!isWalletsExists) {
|
||||||
|
@ -128,7 +129,7 @@ class ChooseWalletScreen extends StatelessWidget {
|
||||||
onTap: () {
|
onTap: () {
|
||||||
_derivation = _repository.derivation!;
|
_derivation = _repository.derivation!;
|
||||||
_selectedId = _repository.id();
|
_selectedId = _repository.id();
|
||||||
_sdk.setCurrentWallet(_repository.address!);
|
_sub.setCurrentWallet(_repository.address!);
|
||||||
_myWalletProvider.rebuildWidget();
|
_myWalletProvider.rebuildWidget();
|
||||||
},
|
},
|
||||||
child: ClipOvalShadow(
|
child: ClipOvalShadow(
|
||||||
|
@ -195,7 +196,7 @@ class ChooseWalletScreen extends StatelessWidget {
|
||||||
onTap: () {
|
onTap: () {
|
||||||
_derivation = _repository.derivation!;
|
_derivation = _repository.derivation!;
|
||||||
_selectedId = _repository.id();
|
_selectedId = _repository.id();
|
||||||
_sdk.setCurrentWallet(_repository.address!);
|
_sub.setCurrentWallet(_repository.address!);
|
||||||
_myWalletProvider.rebuildWidget();
|
_myWalletProvider.rebuildWidget();
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
@ -209,13 +210,15 @@ class ChooseWalletScreen extends StatelessWidget {
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<bool?> paymentsResult(context, String resultPay) {
|
Future<bool?> paymentsResult(context, String resultPay) {
|
||||||
if (resultPay != "success") log.e(resultPay);
|
final bool isValid = resultPay == "confirmed";
|
||||||
|
if (!isValid) log.e(resultPay);
|
||||||
|
|
||||||
return showDialog<bool>(
|
return showDialog<bool>(
|
||||||
context: context,
|
context: context,
|
||||||
barrierDismissible: true, // user must tap button!
|
barrierDismissible: true, // user must tap button!
|
||||||
builder: (BuildContext context) {
|
builder: (BuildContext context) {
|
||||||
return AlertDialog(
|
return AlertDialog(
|
||||||
title: Text(resultPay == "confirmed"
|
title: Text(isValid
|
||||||
? 'Paiement effecuté avec succès !'
|
? 'Paiement effecuté avec succès !'
|
||||||
: "Une erreur s'est produite lors du paiement:\n$resultPay"),
|
: "Une erreur s'est produite lors du paiement:\n$resultPay"),
|
||||||
content: const SingleChildScrollView(child: Text('')),
|
content: const SingleChildScrollView(child: Text('')),
|
||||||
|
@ -223,7 +226,7 @@ Future<bool?> paymentsResult(context, String resultPay) {
|
||||||
TextButton(
|
TextButton(
|
||||||
child: const Text("OK"),
|
child: const Text("OK"),
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
resultPay == "confirmed"
|
isValid
|
||||||
? await Navigator.of(context).pushNamedAndRemoveUntil(
|
? await Navigator.of(context).pushNamedAndRemoveUntil(
|
||||||
'/',
|
'/',
|
||||||
ModalRoute.withName('/'),
|
ModalRoute.withName('/'),
|
||||||
|
|
|
@ -33,7 +33,7 @@ class ConfirmStoreWallet extends StatelessWidget with ChangeNotifier {
|
||||||
MyWalletsProvider _myWalletProvider =
|
MyWalletsProvider _myWalletProvider =
|
||||||
Provider.of<MyWalletsProvider>(context);
|
Provider.of<MyWalletsProvider>(context);
|
||||||
final int? _currentChest = _myWalletProvider.getCurrentChest();
|
final int? _currentChest = _myWalletProvider.getCurrentChest();
|
||||||
SubstrateSdk _sdk = Provider.of<SubstrateSdk>(context, listen: false);
|
SubstrateSdk _sub = Provider.of<SubstrateSdk>(context, listen: false);
|
||||||
|
|
||||||
_mnemonicController.text = generatedMnemonic!;
|
_mnemonicController.text = generatedMnemonic!;
|
||||||
return WillPopScope(
|
return WillPopScope(
|
||||||
|
@ -136,13 +136,13 @@ class ConfirmStoreWallet extends StatelessWidget with ChangeNotifier {
|
||||||
.isAskedWordValid &&
|
.isAskedWordValid &&
|
||||||
walletName.text != '')
|
walletName.text != '')
|
||||||
? () async {
|
? () async {
|
||||||
final address = await _sdk.importAccount(
|
final address = await _sub.importAccount(
|
||||||
fromMnemonic: true,
|
fromMnemonic: true,
|
||||||
mnemonic: _generateWalletProvider
|
mnemonic: _generateWalletProvider
|
||||||
.generatedMnemonic!,
|
.generatedMnemonic!,
|
||||||
password:
|
password:
|
||||||
_generateWalletProvider.pin.text,
|
_generateWalletProvider.pin.text,
|
||||||
derivePath: '/3');
|
derivePath: '//2');
|
||||||
await _generateWalletProvider.storeHDWChest(
|
await _generateWalletProvider.storeHDWChest(
|
||||||
address,
|
address,
|
||||||
'Mon portefeuille courant',
|
'Mon portefeuille courant',
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import 'package:durt/durt.dart';
|
import 'package:durt/durt.dart';
|
||||||
|
import 'package:flutter/foundation.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'package:gecko/globals.dart';
|
import 'package:gecko/globals.dart';
|
||||||
import 'package:gecko/providers/generate_wallets.dart';
|
import 'package:gecko/providers/generate_wallets.dart';
|
||||||
|
@ -25,7 +26,9 @@ class GenerateFastChestScreen extends StatelessWidget {
|
||||||
GenerateWalletsProvider _generateWalletProvider =
|
GenerateWalletsProvider _generateWalletProvider =
|
||||||
Provider.of<GenerateWalletsProvider>(context, listen: false);
|
Provider.of<GenerateWalletsProvider>(context, listen: false);
|
||||||
|
|
||||||
_generateWalletProvider.changePinCode(reload: false);
|
_generateWalletProvider.pin.text = kDebugMode && debugPin
|
||||||
|
? 'AAAAA'
|
||||||
|
: _generateWalletProvider.changePinCode(reload: false);
|
||||||
|
|
||||||
return WillPopScope(
|
return WillPopScope(
|
||||||
onWillPop: () {
|
onWillPop: () {
|
||||||
|
|
|
@ -145,7 +145,7 @@ class UnlockingWallet extends StatelessWidget {
|
||||||
MyWalletsProvider _myWalletProvider =
|
MyWalletsProvider _myWalletProvider =
|
||||||
Provider.of<MyWalletsProvider>(context);
|
Provider.of<MyWalletsProvider>(context);
|
||||||
|
|
||||||
SubstrateSdk _sdk = Provider.of<SubstrateSdk>(context, listen: false);
|
SubstrateSdk _sub = Provider.of<SubstrateSdk>(context, listen: false);
|
||||||
|
|
||||||
FocusNode pinFocus = FocusNode();
|
FocusNode pinFocus = FocusNode();
|
||||||
|
|
||||||
|
@ -200,7 +200,7 @@ class UnlockingWallet extends StatelessWidget {
|
||||||
log.d("Completed");
|
log.d("Completed");
|
||||||
_myWalletProvider.pinCode = _pin.toUpperCase();
|
_myWalletProvider.pinCode = _pin.toUpperCase();
|
||||||
|
|
||||||
final isValid = await _sdk.checkPassword(
|
final isValid = await _sub.checkPassword(
|
||||||
currentChest.address!, _pin.toUpperCase());
|
currentChest.address!, _pin.toUpperCase());
|
||||||
|
|
||||||
if (!isValid) {
|
if (!isValid) {
|
||||||
|
@ -227,7 +227,7 @@ class UnlockingWallet extends StatelessWidget {
|
||||||
MaterialPageRoute(builder: (context) {
|
MaterialPageRoute(builder: (context) {
|
||||||
return const WalletsHome();
|
return const WalletsHome();
|
||||||
}),
|
}),
|
||||||
).then((value) => _myWalletProvider.cesiumSeed.clear());
|
);
|
||||||
} else if (action == "pay") {
|
} else if (action == "pay") {
|
||||||
Navigator.push(
|
Navigator.push(
|
||||||
context,
|
context,
|
||||||
|
|
|
@ -32,11 +32,9 @@ class WalletOptions extends StatelessWidget {
|
||||||
|
|
||||||
final int _currentChest = _myWalletProvider.getCurrentChest()!;
|
final int _currentChest = _myWalletProvider.getCurrentChest()!;
|
||||||
|
|
||||||
//TODO: Debug multichest
|
|
||||||
|
|
||||||
// final currentWallet = _myWalletProvider.getDefaultWallet(_currentChest);
|
// final currentWallet = _myWalletProvider.getDefaultWallet(_currentChest);
|
||||||
// log.d(_walletOptions.getAddress(_currentChest, 3));
|
// log.d(_walletOptions.getAddress(_currentChest, 3));
|
||||||
// log.d("Wallet options: $_currentChest:${wallet.number}");
|
log.d("Wallet options: $_currentChest:${wallet.derivation}");
|
||||||
|
|
||||||
return WillPopScope(
|
return WillPopScope(
|
||||||
onWillPop: () {
|
onWillPop: () {
|
||||||
|
@ -240,13 +238,13 @@ class WalletOptions extends StatelessWidget {
|
||||||
fontSize: isTall ? 20 : 18,
|
fontSize: isTall ? 20 : 18,
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
balanceCache = "${_balance.data.toString()} Ğ1";
|
balanceCache = "${_balance.data.toString()} $currencyName";
|
||||||
return ImageFiltered(
|
return ImageFiltered(
|
||||||
imageFilter: ImageFilter.blur(
|
imageFilter: ImageFilter.blur(
|
||||||
sigmaX: walletProvider.isBalanceBlur ? 6 : 0,
|
sigmaX: walletProvider.isBalanceBlur ? 6 : 0,
|
||||||
sigmaY: walletProvider.isBalanceBlur ? 5 : 0),
|
sigmaY: walletProvider.isBalanceBlur ? 5 : 0),
|
||||||
child: Text(
|
child: Text(
|
||||||
_balance.data.toString() + ' Ğ1',
|
balanceCache,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: isTall ? 20 : 18,
|
fontSize: isTall ? 20 : 18,
|
||||||
),
|
),
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
// ignore_for_file: file_names
|
// ignore_for_file: file_names
|
||||||
|
import 'package:flutter/foundation.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:gecko/globals.dart';
|
import 'package:gecko/globals.dart';
|
||||||
|
@ -21,8 +22,10 @@ class OnboardingStepThirteen extends StatelessWidget {
|
||||||
// MyWalletsProvider myWalletProvider =
|
// MyWalletsProvider myWalletProvider =
|
||||||
// Provider.of<MyWalletsProvider>(context);
|
// Provider.of<MyWalletsProvider>(context);
|
||||||
CommonElements common = CommonElements();
|
CommonElements common = CommonElements();
|
||||||
_generateWalletProvider.pin.text =
|
|
||||||
_generateWalletProvider.changePinCode(reload: false);
|
_generateWalletProvider.pin.text = kDebugMode && debugPin
|
||||||
|
? 'AAAAA'
|
||||||
|
: _generateWalletProvider.changePinCode(reload: false);
|
||||||
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
extendBodyBehindAppBar: true,
|
extendBodyBehindAppBar: true,
|
||||||
|
|
|
@ -45,7 +45,7 @@ class OnboardingStepFourteen extends StatelessWidget {
|
||||||
textKey: const Key('step12'),
|
textKey: const Key('step12'),
|
||||||
),
|
),
|
||||||
SizedBox(height: isTall ? 80 : 10),
|
SizedBox(height: isTall ? 80 : 10),
|
||||||
pinForm(context, _walletOptions, _pinLenght, 1, 3)
|
pinForm(context, _walletOptions, _pinLenght, 1, 2)
|
||||||
]),
|
]),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
@ -61,7 +61,7 @@ class OnboardingStepFourteen extends StatelessWidget {
|
||||||
Provider.of<MyWalletsProvider>(context);
|
Provider.of<MyWalletsProvider>(context);
|
||||||
GenerateWalletsProvider _generateWalletProvider =
|
GenerateWalletsProvider _generateWalletProvider =
|
||||||
Provider.of<GenerateWalletsProvider>(context);
|
Provider.of<GenerateWalletsProvider>(context);
|
||||||
SubstrateSdk _sdk = Provider.of<SubstrateSdk>(context, listen: false);
|
SubstrateSdk _sub = Provider.of<SubstrateSdk>(context, listen: false);
|
||||||
|
|
||||||
final int? _currentChest = _myWalletProvider.getCurrentChest();
|
final int? _currentChest = _myWalletProvider.getCurrentChest();
|
||||||
|
|
||||||
|
@ -118,10 +118,10 @@ class OnboardingStepFourteen extends StatelessWidget {
|
||||||
log.d(_pin + ' || ' + _generateWalletProvider.pin.text);
|
log.d(_pin + ' || ' + _generateWalletProvider.pin.text);
|
||||||
if (_pin.toUpperCase() == _generateWalletProvider.pin.text) {
|
if (_pin.toUpperCase() == _generateWalletProvider.pin.text) {
|
||||||
pinColor = Colors.green[500];
|
pinColor = Colors.green[500];
|
||||||
final address = await _sdk.importAccount(
|
final address = await _sub.importAccount(
|
||||||
fromMnemonic: true,
|
fromMnemonic: true,
|
||||||
mnemonic: _generateWalletProvider.generatedMnemonic!,
|
mnemonic: _generateWalletProvider.generatedMnemonic!,
|
||||||
derivePath: '/3',
|
derivePath: '//2',
|
||||||
password: _generateWalletProvider.pin.text);
|
password: _generateWalletProvider.pin.text);
|
||||||
await _generateWalletProvider.storeHDWChest(
|
await _generateWalletProvider.storeHDWChest(
|
||||||
address, 'Mon portefeuille courant', context);
|
address, 'Mon portefeuille courant', context);
|
||||||
|
|
|
@ -57,9 +57,9 @@ class SearchResultScreen extends StatelessWidget {
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 40),
|
const SizedBox(height: 40),
|
||||||
const Text(
|
Text(
|
||||||
'Dans la blockchain Ğ1',
|
'Dans la blockchain $currencyName',
|
||||||
style: TextStyle(fontSize: 20),
|
style: const TextStyle(fontSize: 20),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 20),
|
const SizedBox(height: 20),
|
||||||
FutureBuilder(
|
FutureBuilder(
|
||||||
|
|
|
@ -2,11 +2,13 @@ import 'package:flutter/material.dart';
|
||||||
import 'package:durt/durt.dart';
|
import 'package:durt/durt.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'package:gecko/providers/my_wallets.dart';
|
import 'package:gecko/providers/my_wallets.dart';
|
||||||
|
import 'package:gecko/providers/substrate_sdk.dart';
|
||||||
import 'package:gecko/screens/myWallets/generate_wallets.dart';
|
import 'package:gecko/screens/myWallets/generate_wallets.dart';
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
// import 'package:gecko/screens/myWallets/import_cesium_wallet.dart';
|
// import 'package:gecko/screens/myWallets/import_cesium_wallet.dart';
|
||||||
import 'package:gecko/globals.dart';
|
import 'package:gecko/globals.dart';
|
||||||
import 'package:gecko/screens/myWallets/restore_chest.dart';
|
import 'package:gecko/screens/myWallets/restore_chest.dart';
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
// ignore: must_be_immutable
|
// ignore: must_be_immutable
|
||||||
class SettingsScreen extends StatelessWidget {
|
class SettingsScreen extends StatelessWidget {
|
||||||
|
@ -28,108 +30,123 @@ class SettingsScreen extends StatelessWidget {
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
|
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
|
||||||
|
SubstrateSdk _sub = Provider.of<SubstrateSdk>(context, listen: false);
|
||||||
|
|
||||||
|
const double buttonHigh = 50;
|
||||||
|
const double buttonWidth = 240;
|
||||||
|
const double fontSize = 16;
|
||||||
|
TextEditingController _endpointController =
|
||||||
|
TextEditingController(text: configBox.get('endpoint'));
|
||||||
|
|
||||||
// getAppDirectory();
|
// getAppDirectory();
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
toolbarHeight: 60 * ratio,
|
toolbarHeight: 60 * ratio,
|
||||||
title: const SizedBox(
|
title: const SizedBox(
|
||||||
height: 22,
|
height: 22,
|
||||||
child: Text('Paramètres'),
|
child: Text('Paramètres'),
|
||||||
)),
|
)),
|
||||||
body: Column(children: <Widget>[
|
body: Column(
|
||||||
const SizedBox(height: 40),
|
// crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
SizedBox(
|
children: <Widget>[
|
||||||
height: 70,
|
const SizedBox(height: 60),
|
||||||
width: 500,
|
Row(children: [
|
||||||
child: ElevatedButton(
|
Text(' Noeud $currencyName :'),
|
||||||
style: ElevatedButton.styleFrom(
|
const SizedBox(width: 20),
|
||||||
elevation: 5,
|
SizedBox(
|
||||||
primary: yellowC, // background
|
width: 200,
|
||||||
onPrimary: Colors.black, // foreground
|
height: 50,
|
||||||
|
child: TextField(
|
||||||
|
controller: _endpointController,
|
||||||
|
autocorrect: false,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
onPressed: null,
|
const Spacer(),
|
||||||
// () => Navigator.push(
|
Consumer<SubstrateSdk>(builder: (context, _sub, _) {
|
||||||
// context,
|
return _sub.isLoadingEndpoint
|
||||||
// MaterialPageRoute(builder: (context) {
|
? CircularProgressIndicator(color: orangeC)
|
||||||
// return const ImportWalletScreen();
|
: IconButton(
|
||||||
// }),
|
icon: Icon(
|
||||||
// ).then((value) => {
|
Icons.send,
|
||||||
// if (value == true) {Navigator.pop(context)}
|
color: orangeC,
|
||||||
// }),
|
size: 40,
|
||||||
child: const Text(
|
),
|
||||||
"Importer un portefeuille Cesium",
|
onPressed: () async {
|
||||||
style: TextStyle(fontSize: 16),
|
configBox.put('endpoint', _endpointController.text);
|
||||||
|
await _sub.connectNode(context);
|
||||||
|
});
|
||||||
|
}),
|
||||||
|
const Spacer(),
|
||||||
|
]),
|
||||||
|
SizedBox(height: isTall ? 50 : 20),
|
||||||
|
SizedBox(
|
||||||
|
height: buttonHigh,
|
||||||
|
width: buttonWidth,
|
||||||
|
child: ElevatedButton(
|
||||||
|
key: const Key('generateKeychain'),
|
||||||
|
style: ElevatedButton.styleFrom(
|
||||||
|
elevation: 5,
|
||||||
|
primary: yellowC, // background
|
||||||
|
onPrimary: Colors.black, // foreground
|
||||||
|
),
|
||||||
|
onPressed: () => Navigator.push(
|
||||||
|
context,
|
||||||
|
MaterialPageRoute(builder: (context) {
|
||||||
|
return GenerateFastChestScreen();
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
child: const Text(
|
||||||
|
"Générer un trousseau",
|
||||||
|
style: TextStyle(fontSize: fontSize),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
const SizedBox(height: 20),
|
||||||
const SizedBox(height: 30),
|
SizedBox(
|
||||||
SizedBox(
|
height: buttonHigh,
|
||||||
height: 70,
|
width: buttonWidth,
|
||||||
width: 500,
|
child: ElevatedButton(
|
||||||
child: ElevatedButton(
|
key: const Key('generateKeychain'),
|
||||||
key: const Key('generateKeychain'),
|
style: ElevatedButton.styleFrom(
|
||||||
style: ElevatedButton.styleFrom(
|
elevation: 5,
|
||||||
elevation: 5,
|
primary: yellowC, // background
|
||||||
primary: yellowC, // background
|
onPrimary: Colors.black, // foreground
|
||||||
onPrimary: Colors.black, // foreground
|
),
|
||||||
),
|
onPressed: () => Navigator.push(
|
||||||
onPressed: () => Navigator.push(
|
context,
|
||||||
context,
|
MaterialPageRoute(builder: (context) {
|
||||||
MaterialPageRoute(builder: (context) {
|
return const RestoreChest();
|
||||||
return GenerateFastChestScreen();
|
}),
|
||||||
}),
|
),
|
||||||
),
|
child: const Text(
|
||||||
child: const Text(
|
"Restaurer un coffre",
|
||||||
"Générer un nouveau trousseau",
|
style: TextStyle(fontSize: fontSize),
|
||||||
style: TextStyle(fontSize: 16),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
const SizedBox(height: 25),
|
||||||
const SizedBox(height: 30),
|
SizedBox(
|
||||||
SizedBox(
|
height: buttonHigh,
|
||||||
height: 70,
|
width: buttonWidth,
|
||||||
width: 500,
|
child: Center(
|
||||||
child: ElevatedButton(
|
child: InkWell(
|
||||||
key: const Key('generateKeychain'),
|
key: const Key('deleteChest'),
|
||||||
style: ElevatedButton.styleFrom(
|
onTap: () async {
|
||||||
elevation: 5,
|
log.i('Oublier tous mes coffres');
|
||||||
primary: yellowC, // background
|
await _myWallets.deleteAllWallet(context);
|
||||||
onPrimary: Colors.black, // foreground
|
},
|
||||||
),
|
child: const Text(
|
||||||
onPressed: () => Navigator.push(
|
'Oublier tous mes coffres',
|
||||||
context,
|
style: TextStyle(
|
||||||
MaterialPageRoute(builder: (context) {
|
fontSize: fontSize + 3,
|
||||||
return const RestoreChest();
|
color: Color(0xffD80000),
|
||||||
}),
|
fontWeight: FontWeight.w500,
|
||||||
),
|
),
|
||||||
child: const Text(
|
),
|
||||||
"Restaurer un coffre",
|
),
|
||||||
style: TextStyle(fontSize: 16),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
]),
|
||||||
Expanded(
|
);
|
||||||
child: Align(
|
|
||||||
alignment: Alignment.bottomCenter,
|
|
||||||
child: SizedBox(
|
|
||||||
height: 100,
|
|
||||||
width: 500,
|
|
||||||
child: ElevatedButton(
|
|
||||||
key: const Key('deleteAllWallets'),
|
|
||||||
style: ElevatedButton.styleFrom(
|
|
||||||
elevation: 5,
|
|
||||||
primary: Colors.redAccent, // background
|
|
||||||
onPrimary: Colors.black, // foreground
|
|
||||||
),
|
|
||||||
onPressed: () async => {
|
|
||||||
log.i('Suppression de tous les wallets'),
|
|
||||||
await _myWallets.deleteAllWallet(context),
|
|
||||||
await _sub.deleteAllAccounts()
|
|
||||||
},
|
|
||||||
child: const Text("EFFACER TOUS MES PORTEFEUILLES",
|
|
||||||
style: TextStyle(fontSize: 20)))))),
|
|
||||||
const SizedBox(height: 50),
|
|
||||||
]));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,10 +33,10 @@ class SubstrateSandBox extends StatelessWidget {
|
||||||
Text('js-api chargé ?: ${_sub.sdkReady}'),
|
Text('js-api chargé ?: ${_sub.sdkReady}'),
|
||||||
InkWell(
|
InkWell(
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
await _sub.connectNode();
|
await _sub.connectNode(context);
|
||||||
},
|
},
|
||||||
child: Text(
|
child: Text(
|
||||||
'Noeud connecté ?: ${_sub.nodeConnected} (${_sub.subNode})')),
|
'Noeud connecté ?: ${_sub.nodeConnected} (${configBox.get('endpoint')})')),
|
||||||
if (_sub.nodeConnected)
|
if (_sub.nodeConnected)
|
||||||
Text(
|
Text(
|
||||||
'Noeud "${_sub.sdk.api.connectedNode!.name}", bloc N°${_sub.blocNumber}'),
|
'Noeud "${_sub.sdk.api.connectedNode!.name}", bloc N°${_sub.blocNumber}'),
|
||||||
|
@ -56,46 +56,49 @@ class SubstrateSandBox extends StatelessWidget {
|
||||||
),
|
),
|
||||||
const SizedBox(width: 10),
|
const SizedBox(width: 10),
|
||||||
]),
|
]),
|
||||||
// FutureBuilder(
|
FutureBuilder(
|
||||||
// future: _sub.getKeyStoreAddress(),
|
future: _sub.getKeyStoreAddress(),
|
||||||
// builder: (BuildContext context,
|
builder: (BuildContext context,
|
||||||
// AsyncSnapshot<List<AddressInfo>> _data) {
|
AsyncSnapshot<List<AddressInfo>> _data) {
|
||||||
// return Column(children: [
|
return Column(children: [
|
||||||
// if (_data.data != null)
|
if (_data.data != null)
|
||||||
// for (final AddressInfo addressInfo in _data.data!)
|
for (final AddressInfo addressInfo in _data.data!)
|
||||||
// Row(children: [
|
Row(children: [
|
||||||
// InkWell(
|
InkWell(
|
||||||
// onTap: () => _sub.keyring.setCurrent(_sub
|
onTap: () => _sub.keyring.setCurrent(_sub
|
||||||
// .keyring.keyPairs
|
.keyring.keyPairs
|
||||||
// .firstWhere((element) =>
|
.firstWhere((element) =>
|
||||||
// element.address == addressInfo.address!)),
|
element.address ==
|
||||||
// child: Text(
|
addressInfo.address!)),
|
||||||
// getShortPubkey(addressInfo.address!),
|
child: Text(
|
||||||
// style: const TextStyle(
|
getShortPubkey(addressInfo.address!),
|
||||||
// fontFamily: 'Monospace'),
|
style: const TextStyle(
|
||||||
// ),
|
fontFamily: 'Monospace'),
|
||||||
// ),
|
),
|
||||||
// const SizedBox(width: 20),
|
),
|
||||||
// InkWell(
|
const SizedBox(width: 20),
|
||||||
// onTap: () async => await _sub.pay(
|
// InkWell(
|
||||||
// context,
|
// onTap: () async => await _sub.pay(
|
||||||
// addressInfo.address!,
|
// context,
|
||||||
// 10,
|
// addressInfo.address!,
|
||||||
// _sub.keystorePassword.text),
|
// 10,
|
||||||
// child: Text("${addressInfo.balance.toString()} ğdev"),
|
// _sub.keystorePassword.text),
|
||||||
// ),
|
// child:
|
||||||
// const SizedBox(width: 20),
|
Text(
|
||||||
// InkWell(
|
"${addressInfo.balance.toString()} $currencyName"),
|
||||||
// onTap: () async => await _sub.derive(
|
// ),
|
||||||
// context,
|
const SizedBox(width: 20),
|
||||||
// addressInfo.address!,
|
InkWell(
|
||||||
// 3,
|
onTap: () async => await _sub.derive(
|
||||||
// _sub.keystorePassword.text),
|
context,
|
||||||
// child: const Text("Dériver"),
|
addressInfo.address!,
|
||||||
// )
|
2,
|
||||||
// ])
|
_sub.keystorePassword.text),
|
||||||
// ]);
|
child: const Text("Dériver"),
|
||||||
// }),
|
)
|
||||||
|
])
|
||||||
|
]);
|
||||||
|
}),
|
||||||
const SizedBox(height: 20),
|
const SizedBox(height: 20),
|
||||||
const Text('Mot de passe du trousseau:'),
|
const Text('Mot de passe du trousseau:'),
|
||||||
TextField(
|
TextField(
|
||||||
|
|
|
@ -255,7 +255,7 @@ class WalletViewScreen extends StatelessWidget {
|
||||||
// onChanged: (v) => _searchProvider.rebuildWidget(),
|
// onChanged: (v) => _searchProvider.rebuildWidget(),
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
hintText: '0.00',
|
hintText: '0.00',
|
||||||
suffix: const Text('Ğ1'),
|
suffix: Text(currencyName),
|
||||||
filled: true,
|
filled: true,
|
||||||
fillColor: Colors.transparent,
|
fillColor: Colors.transparent,
|
||||||
// border: OutlineInputBorder(
|
// border: OutlineInputBorder(
|
||||||
|
|
|
@ -5,7 +5,7 @@ description: Pay with G1.
|
||||||
# pub.dev using `pub publish`. This is preferred for private packages.
|
# pub.dev using `pub publish`. This is preferred for private packages.
|
||||||
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
|
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
|
||||||
|
|
||||||
version: 0.0.5+1
|
version: 0.0.5+2
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: '>=2.12.0 <3.0.0'
|
sdk: '>=2.12.0 <3.0.0'
|
||||||
|
|
Loading…
Reference in New Issue