Add infos about current scan in last import screen
This commit is contained in:
parent
edb8735109
commit
3fad0f03f0
|
@ -173,6 +173,6 @@
|
||||||
"contactsManagement": "My contacts",
|
"contactsManagement": "My contacts",
|
||||||
"noContacts": "You don't have any contact",
|
"noContacts": "You don't have any contact",
|
||||||
"addContact": "Add\nto contacts",
|
"addContact": "Add\nto contacts",
|
||||||
"removeContact": "Remove\nthis contact"
|
"removeContact": "Remove\nthis contact",
|
||||||
|
"derivationsScanProgress": "Scan address {}/{}"
|
||||||
}
|
}
|
|
@ -173,5 +173,6 @@
|
||||||
"contactsManagement": "My contacts",
|
"contactsManagement": "My contacts",
|
||||||
"noContacts": "You don't have any contact",
|
"noContacts": "You don't have any contact",
|
||||||
"addContact": "Add\nto contacts",
|
"addContact": "Add\nto contacts",
|
||||||
"removeContact": "Remove\nthis contact"
|
"removeContact": "Remove\nthis contact",
|
||||||
|
"derivationsScanProgress": "Scan address {}/{}"
|
||||||
}
|
}
|
|
@ -174,6 +174,6 @@
|
||||||
"contactsManagement": "Mes contacts",
|
"contactsManagement": "Mes contacts",
|
||||||
"noContacts": "Vous n'avez aucun contact",
|
"noContacts": "Vous n'avez aucun contact",
|
||||||
"addContact": "Ajouter\naux contacts",
|
"addContact": "Ajouter\naux contacts",
|
||||||
"removeContact": "Supprimer\nce contact"
|
"removeContact": "Supprimer\nce contact",
|
||||||
|
"derivationsScanProgress": "Scan de l'adresse {}/{}"
|
||||||
}
|
}
|
|
@ -23,7 +23,9 @@ class GenerateWalletsProvider with ChangeNotifier {
|
||||||
FocusNode walletNameFocus = FocusNode();
|
FocusNode walletNameFocus = FocusNode();
|
||||||
Color? askedWordColor = Colors.black;
|
Color? askedWordColor = Colors.black;
|
||||||
bool isAskedWordValid = false;
|
bool isAskedWordValid = false;
|
||||||
|
int scanedValidWalletNumber = -1;
|
||||||
int scanedWalletNumber = -1;
|
int scanedWalletNumber = -1;
|
||||||
|
int numberScan = 20;
|
||||||
|
|
||||||
late int nbrWord;
|
late int nbrWord;
|
||||||
String? nbrWordAlpha;
|
String? nbrWordAlpha;
|
||||||
|
@ -366,11 +368,11 @@ class GenerateWalletsProvider with ChangeNotifier {
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<bool> scanDerivations(BuildContext context,
|
Future<bool> scanDerivations(BuildContext context) async {
|
||||||
{int numberScan = 20}) async {
|
|
||||||
SubstrateSdk sub = Provider.of<SubstrateSdk>(context, listen: false);
|
SubstrateSdk sub = Provider.of<SubstrateSdk>(context, listen: false);
|
||||||
final currentChestNumber = configBox.get('currentChest');
|
final currentChestNumber = configBox.get('currentChest');
|
||||||
bool isAlive = false;
|
bool isAlive = false;
|
||||||
|
scanedValidWalletNumber = 0;
|
||||||
scanedWalletNumber = 0;
|
scanedWalletNumber = 0;
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
|
|
||||||
|
@ -379,8 +381,10 @@ class GenerateWalletsProvider with ChangeNotifier {
|
||||||
}
|
}
|
||||||
|
|
||||||
final hasRoot = await scanRootBalance(sub, currentChestNumber);
|
final hasRoot = await scanRootBalance(sub, currentChestNumber);
|
||||||
|
scanedWalletNumber = 1;
|
||||||
|
notifyListeners();
|
||||||
if (hasRoot) {
|
if (hasRoot) {
|
||||||
scanedWalletNumber = 1;
|
scanedValidWalletNumber = 1;
|
||||||
isAlive = true;
|
isAlive = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -401,9 +405,9 @@ class GenerateWalletsProvider with ChangeNotifier {
|
||||||
"${addressData.address!}: ${balance['transferableBalance']} $currencyName");
|
"${addressData.address!}: ${balance['transferableBalance']} $currencyName");
|
||||||
if (balance['transferableBalance'] != 0) {
|
if (balance['transferableBalance'] != 0) {
|
||||||
isAlive = true;
|
isAlive = true;
|
||||||
String walletName = scanedWalletNumber == 0
|
String walletName = scanedValidWalletNumber == 0
|
||||||
? 'currentWallet'.tr()
|
? 'currentWallet'.tr()
|
||||||
: '${'wallet'.tr()} ${scanedWalletNumber + 1}';
|
: '${'wallet'.tr()} ${scanedValidWalletNumber + 1}';
|
||||||
await sub.importAccount(
|
await sub.importAccount(
|
||||||
mnemonic: '',
|
mnemonic: '',
|
||||||
fromMnemonic: true,
|
fromMnemonic: true,
|
||||||
|
@ -414,15 +418,19 @@ class GenerateWalletsProvider with ChangeNotifier {
|
||||||
version: dataVersion,
|
version: dataVersion,
|
||||||
chest: currentChestNumber,
|
chest: currentChestNumber,
|
||||||
address: addressData.address!,
|
address: addressData.address!,
|
||||||
number: scanedWalletNumber,
|
number: scanedValidWalletNumber,
|
||||||
name: walletName,
|
name: walletName,
|
||||||
derivation: derivationNbr,
|
derivation: derivationNbr,
|
||||||
imageDefaultPath: '${scanedWalletNumber % 4}.png');
|
imageDefaultPath: '${scanedValidWalletNumber % 4}.png');
|
||||||
await walletBox.add(myWallet);
|
await walletBox.add(myWallet);
|
||||||
scanedWalletNumber = scanedWalletNumber + 1;
|
scanedValidWalletNumber = scanedValidWalletNumber + 1;
|
||||||
}
|
}
|
||||||
|
scanedWalletNumber = scanedWalletNumber + 1;
|
||||||
|
notifyListeners();
|
||||||
}
|
}
|
||||||
|
log.d(scanedWalletNumber);
|
||||||
scanedWalletNumber = -1;
|
scanedWalletNumber = -1;
|
||||||
|
scanedValidWalletNumber = -1;
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
return isAlive;
|
return isAlive;
|
||||||
}
|
}
|
||||||
|
@ -436,8 +444,9 @@ class GenerateWalletsProvider with ChangeNotifier {
|
||||||
onTimeout: () => {},
|
onTimeout: () => {},
|
||||||
);
|
);
|
||||||
|
|
||||||
log.d(balance);
|
log.d(
|
||||||
if (balance != {}) {
|
"${addressData.address!}: ${balance['transferableBalance']} $currencyName");
|
||||||
|
if (balance['transferableBalance'] != 0) {
|
||||||
String walletName = 'myRootWallet'.tr();
|
String walletName = 'myRootWallet'.tr();
|
||||||
await sub.importAccount(
|
await sub.importAccount(
|
||||||
mnemonic: '', fromMnemonic: true, password: pin.text);
|
mnemonic: '', fromMnemonic: true, password: pin.text);
|
||||||
|
|
|
@ -56,16 +56,26 @@ class OnboardingStepTen extends StatelessWidget {
|
||||||
common.buildText("geckoWillCheckPassword".tr()),
|
common.buildText("geckoWillCheckPassword".tr()),
|
||||||
SizedBox(height: isTall ? 80 : 20),
|
SizedBox(height: isTall ? 80 : 20),
|
||||||
Visibility(
|
Visibility(
|
||||||
visible: generateWalletProvider.scanedWalletNumber != -1,
|
visible: generateWalletProvider.scanedValidWalletNumber != -1,
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.only(bottom: 15),
|
padding: const EdgeInsets.only(bottom: 15),
|
||||||
child: SizedBox(
|
child: Row(
|
||||||
height: 22,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
width: 22,
|
children: [
|
||||||
child: CircularProgressIndicator(
|
Text("derivationsScanProgress".tr(args: [
|
||||||
color: orangeC,
|
'${generateWalletProvider.scanedWalletNumber}',
|
||||||
strokeWidth: 3,
|
'${generateWalletProvider.numberScan + 1}'
|
||||||
),
|
])),
|
||||||
|
const SizedBox(width: 10),
|
||||||
|
SizedBox(
|
||||||
|
height: 22,
|
||||||
|
width: 22,
|
||||||
|
child: CircularProgressIndicator(
|
||||||
|
color: orangeC,
|
||||||
|
strokeWidth: 3,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -188,8 +198,8 @@ class OnboardingStepTen extends StatelessWidget {
|
||||||
await generateWalletProvider.storeHDWChest(context);
|
await generateWalletProvider.storeHDWChest(context);
|
||||||
bool isAlive = false;
|
bool isAlive = false;
|
||||||
if (scanDerivation) {
|
if (scanDerivation) {
|
||||||
isAlive = await generateWalletProvider
|
isAlive =
|
||||||
.scanDerivations(context, numberScan: 20);
|
await generateWalletProvider.scanDerivations(context);
|
||||||
}
|
}
|
||||||
if (!isAlive) {
|
if (!isAlive) {
|
||||||
final address = await sub.importAccount(
|
final address = await sub.importAccount(
|
||||||
|
|
Loading…
Reference in New Issue