wip: try to import existing wallets
This commit is contained in:
parent
a1767d289f
commit
d7fcf0636f
|
@ -10,6 +10,7 @@ import 'package:gecko/models/wallet_data.dart';
|
|||
import 'package:gecko/providers/substrate_sdk.dart';
|
||||
import 'package:pdf/pdf.dart';
|
||||
import 'package:pdf/widgets.dart' as pw;
|
||||
import 'package:polkawallet_sdk/api/apiKeyring.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import "package:unorm_dart/unorm_dart.dart" as unorm;
|
||||
|
||||
|
@ -361,4 +362,26 @@ class GenerateWalletsProvider with ChangeNotifier {
|
|||
void reloadBuild() {
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
Future scanDerivations(BuildContext context, {int number = 10}) async {
|
||||
SubstrateSdk _sub = Provider.of<SubstrateSdk>(context, listen: false);
|
||||
final ss58 = _sub.ss58;
|
||||
|
||||
// for ()
|
||||
// final addressData = await _sub.sdk.api.keyring.addressFromMnemonic(ss58,
|
||||
// cryptoType: CryptoType.sr25519,
|
||||
// mnemonic: generatedMnemonic!,
|
||||
// derivePath: '//4');
|
||||
|
||||
// final balance = await _sub.getBalance(addressData.address!);
|
||||
|
||||
// log.d(balance);
|
||||
// if (balance != 0) {
|
||||
// await _sub.importAccount(
|
||||
// mnemonic: '',
|
||||
// fromMnemonic: true,
|
||||
// derivePath: '//4',
|
||||
// password: pin.text);
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -102,8 +102,8 @@ class RestoreChest extends StatelessWidget {
|
|||
context,
|
||||
FaderTransition(
|
||||
page: skipIntro
|
||||
? const OnboardingStepNine()
|
||||
: const OnboardingStepSeven(),
|
||||
? const OnboardingStepNine(scanDerivation: true)
|
||||
: const OnboardingStepSeven(scanDerivation: true),
|
||||
isFast: true),
|
||||
);
|
||||
} else {
|
||||
|
|
|
@ -15,10 +15,10 @@ import 'package:provider/provider.dart';
|
|||
|
||||
// ignore: must_be_immutable
|
||||
class OnboardingStepTen extends StatelessWidget {
|
||||
OnboardingStepTen({
|
||||
Key? validationKey,
|
||||
}) : super(key: validationKey);
|
||||
OnboardingStepTen({Key? validationKey, this.scanDerivation = false})
|
||||
: super(key: validationKey);
|
||||
|
||||
final bool scanDerivation;
|
||||
final formKey = GlobalKey<FormState>();
|
||||
Color? pinColor = const Color(0xFFA4B600);
|
||||
bool hasError = false;
|
||||
|
@ -161,10 +161,11 @@ class OnboardingStepTen extends StatelessWidget {
|
|||
await _generateWalletProvider.storeHDWChest(
|
||||
address, 'Mon portefeuille courant', context);
|
||||
_myWalletProvider.readAllWallets(_currentChest);
|
||||
// scheduleMicrotask(() {
|
||||
// _walletOptions.reloadBuild();
|
||||
_myWalletProvider.rebuildWidget();
|
||||
// });
|
||||
|
||||
await _generateWalletProvider.scanDerivations(context,
|
||||
number: 20);
|
||||
|
||||
_generateWalletProvider.generatedMnemonic = '';
|
||||
_myWalletProvider.resetPinCode();
|
||||
Navigator.push(
|
||||
|
|
|
@ -6,7 +6,8 @@ import 'package:gecko/screens/common_elements.dart';
|
|||
import 'package:gecko/screens/onBoarding/8.dart';
|
||||
|
||||
class OnboardingStepSeven extends StatelessWidget {
|
||||
const OnboardingStepSeven({Key? key}) : super(key: key);
|
||||
const OnboardingStepSeven({Key? key, this.scanDerivation = false}) : super(key: key);
|
||||
final bool scanDerivation;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
@ -35,7 +36,7 @@ class OnboardingStepSeven extends StatelessWidget {
|
|||
],
|
||||
'coffre-fort-code-secret-dans-telephone.png',
|
||||
'>',
|
||||
const OnboardingStepEight(),
|
||||
OnboardingStepEight(scanDerivation: scanDerivation),
|
||||
6,
|
||||
boxHeight: 400),
|
||||
),
|
||||
|
|
|
@ -6,7 +6,9 @@ import 'package:gecko/screens/common_elements.dart';
|
|||
import 'package:gecko/screens/onBoarding/9.dart';
|
||||
|
||||
class OnboardingStepEight extends StatelessWidget {
|
||||
const OnboardingStepEight({Key? key}) : super(key: key);
|
||||
const OnboardingStepEight({Key? key, this.scanDerivation = false})
|
||||
: super(key: key);
|
||||
final bool scanDerivation;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
@ -41,7 +43,7 @@ class OnboardingStepEight extends StatelessWidget {
|
|||
],
|
||||
'coffre-fort-protege-les-portefeuilles.png',
|
||||
'>',
|
||||
const OnboardingStepNine(),
|
||||
OnboardingStepNine(scanDerivation: scanDerivation),
|
||||
7),
|
||||
),
|
||||
);
|
||||
|
|
|
@ -9,7 +9,9 @@ import 'package:provider/provider.dart';
|
|||
|
||||
// ignore: must_be_immutable
|
||||
class OnboardingStepNine extends StatelessWidget {
|
||||
const OnboardingStepNine({Key? key}) : super(key: key);
|
||||
const OnboardingStepNine({Key? key, this.scanDerivation = false})
|
||||
: super(key: key);
|
||||
final bool scanDerivation;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
@ -103,7 +105,7 @@ class OnboardingStepNine extends StatelessWidget {
|
|||
))),
|
||||
SizedBox(height: 22 * ratio),
|
||||
common.nextButton(context, "J'ai noté mon code secret",
|
||||
OnboardingStepTen(), false),
|
||||
OnboardingStepTen(scanDerivation: scanDerivation), false),
|
||||
SizedBox(height: 35 * ratio),
|
||||
]),
|
||||
));
|
||||
|
|
Loading…
Reference in New Issue