fix: sentry 3334937784
This commit is contained in:
parent
eaf81aa701
commit
b546078c8f
|
@ -409,10 +409,7 @@ class GenerateWalletsProvider with ChangeNotifier {
|
||||||
? 'currentWallet'.tr()
|
? 'currentWallet'.tr()
|
||||||
: '${'wallet'.tr()} ${scanedValidWalletNumber + 1}';
|
: '${'wallet'.tr()} ${scanedValidWalletNumber + 1}';
|
||||||
await sub.importAccount(
|
await sub.importAccount(
|
||||||
mnemonic: '',
|
derivePath: '//$derivationNbr', password: pin.text);
|
||||||
fromMnemonic: true,
|
|
||||||
derivePath: '//$derivationNbr',
|
|
||||||
password: pin.text);
|
|
||||||
|
|
||||||
WalletData myWallet = WalletData(
|
WalletData myWallet = WalletData(
|
||||||
version: dataVersion,
|
version: dataVersion,
|
||||||
|
@ -448,8 +445,7 @@ class GenerateWalletsProvider with ChangeNotifier {
|
||||||
"${addressData.address!}: ${balance['transferableBalance']} $currencyName");
|
"${addressData.address!}: ${balance['transferableBalance']} $currencyName");
|
||||||
if (balance['transferableBalance'] != 0) {
|
if (balance['transferableBalance'] != 0) {
|
||||||
String walletName = 'myRootWallet'.tr();
|
String walletName = 'myRootWallet'.tr();
|
||||||
await sub.importAccount(
|
await sub.importAccount(password: pin.text);
|
||||||
mnemonic: '', fromMnemonic: true, password: pin.text);
|
|
||||||
|
|
||||||
WalletData myWallet = WalletData(
|
WalletData myWallet = WalletData(
|
||||||
version: dataVersion,
|
version: dataVersion,
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
import 'package:easy_localization/easy_localization.dart';
|
import 'package:easy_localization/easy_localization.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
|
||||||
import 'package:gecko/globals.dart';
|
import 'package:gecko/globals.dart';
|
||||||
import 'package:gecko/models/chest_data.dart';
|
import 'package:gecko/models/chest_data.dart';
|
||||||
import 'package:gecko/models/wallet_data.dart';
|
import 'package:gecko/models/wallet_data.dart';
|
||||||
|
@ -30,9 +29,6 @@ class SubstrateSdk with ChangeNotifier {
|
||||||
String transactionStatus = '';
|
String transactionStatus = '';
|
||||||
int ss58 = 42;
|
int ss58 = 42;
|
||||||
|
|
||||||
TextEditingController jsonKeystore = TextEditingController();
|
|
||||||
TextEditingController keystorePassword = TextEditingController();
|
|
||||||
|
|
||||||
/////////////////////////////////////
|
/////////////////////////////////////
|
||||||
////////// 1: API METHODS ///////////
|
////////// 1: API METHODS ///////////
|
||||||
/////////////////////////////////////
|
/////////////////////////////////////
|
||||||
|
@ -374,40 +370,18 @@ class SubstrateSdk with ChangeNotifier {
|
||||||
|
|
||||||
Future<String> importAccount(
|
Future<String> importAccount(
|
||||||
{String mnemonic = '',
|
{String mnemonic = '',
|
||||||
bool fromMnemonic = false,
|
|
||||||
String derivePath = '',
|
String derivePath = '',
|
||||||
String password = ''}) async {
|
required String password}) async {
|
||||||
// toy exercise immense month enter answer table prefer speed cycle gold phone
|
const keytype = KeyType.mnemonic;
|
||||||
final clipboardData = await Clipboard.getData(Clipboard.kTextPlain);
|
if (mnemonic != '') generatedMnemonic = mnemonic;
|
||||||
if (mnemonic != '') {
|
|
||||||
fromMnemonic = true;
|
|
||||||
generatedMnemonic = mnemonic;
|
|
||||||
} else if (clipboardData!.text!.split(' ').length == 12) {
|
|
||||||
fromMnemonic = true;
|
|
||||||
generatedMnemonic = clipboardData.text!;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (password == '') {
|
|
||||||
password = keystorePassword.text;
|
|
||||||
}
|
|
||||||
|
|
||||||
final KeyType keytype;
|
|
||||||
final String keyToImport;
|
|
||||||
if (fromMnemonic) {
|
|
||||||
keytype = KeyType.mnemonic;
|
|
||||||
keyToImport = generatedMnemonic;
|
|
||||||
} else {
|
|
||||||
keytype = KeyType.keystore;
|
|
||||||
keyToImport = jsonKeystore.text.replaceAll("'", "\\'");
|
|
||||||
}
|
|
||||||
|
|
||||||
importIsLoading = true;
|
importIsLoading = true;
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
if (clipboardData?.text != null) jsonKeystore.text = clipboardData!.text!;
|
|
||||||
var json = await sdk.api.keyring
|
final json = await sdk.api.keyring
|
||||||
.importAccount(keyring,
|
.importAccount(keyring,
|
||||||
keyType: keytype,
|
keyType: keytype,
|
||||||
key: keyToImport,
|
key: generatedMnemonic,
|
||||||
name: derivePath,
|
name: derivePath,
|
||||||
password: password,
|
password: password,
|
||||||
derivePath: derivePath,
|
derivePath: derivePath,
|
||||||
|
@ -543,7 +517,6 @@ class SubstrateSdk with ChangeNotifier {
|
||||||
|
|
||||||
return await importAccount(
|
return await importAccount(
|
||||||
mnemonic: generatedMnemonic,
|
mnemonic: generatedMnemonic,
|
||||||
fromMnemonic: true,
|
|
||||||
derivePath: '//$number',
|
derivePath: '//$number',
|
||||||
password: password);
|
password: password);
|
||||||
}
|
}
|
||||||
|
@ -558,7 +531,7 @@ class SubstrateSdk with ChangeNotifier {
|
||||||
final List seedList = seedMap!['seed'].split('//');
|
final List seedList = seedMap!['seed'].split('//');
|
||||||
generatedMnemonic = seedList[0];
|
generatedMnemonic = seedList[0];
|
||||||
|
|
||||||
return await importAccount(fromMnemonic: true, password: password);
|
return await importAccount(password: password);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<bool> isMnemonicValid(String mnemonic) async {
|
Future<bool> isMnemonicValid(String mnemonic) async {
|
||||||
|
|
|
@ -203,7 +203,6 @@ class OnboardingStepTen extends StatelessWidget {
|
||||||
}
|
}
|
||||||
if (!isAlive) {
|
if (!isAlive) {
|
||||||
final address = await sub.importAccount(
|
final address = await sub.importAccount(
|
||||||
fromMnemonic: true,
|
|
||||||
mnemonic: generateWalletProvider.generatedMnemonic!,
|
mnemonic: generateWalletProvider.generatedMnemonic!,
|
||||||
derivePath: '//2',
|
derivePath: '//2',
|
||||||
password: generateWalletProvider.pin.text);
|
password: generateWalletProvider.pin.text);
|
||||||
|
|
Loading…
Reference in New Issue