Skip to content

Commit

Permalink
fix evm account import&delete
Browse files Browse the repository at this point in the history
  • Loading branch information
RomeroYang committed Aug 7, 2024
1 parent 1e4f4e8 commit f928eaf
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
3 changes: 2 additions & 1 deletion lib/pages/account/import/importAccountFromRawSeed.dart
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,8 @@ class _ImportAccountFromRawSeedState extends State<ImportAccountFromRawSeed> {
passed = true;
}
} else {
if (input.startsWith('0x') && input.length == 66) {
if ((input.startsWith('0x') && input.length == 66) ||
(!input.startsWith('0x') && input.length == 64)) {
passed = true;
}
}
Expand Down
16 changes: 10 additions & 6 deletions lib/pages/profile/account/accountManagePage.dart
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ class _AccountManagePageState extends State<AccountManagePage> {
BiometricStorageFile _authStorage;

Future<void> _onDeleteAccount(BuildContext context) async {
final password = await widget.service.account
.getPassword(context, widget.service.keyring.current);
if (password != null) {
if (widget.service.store.account.accountType == AccountType.Substrate) {
if (widget.service.store.account.accountType == AccountType.Substrate) {
final password = await widget.service.account
.getPassword(context, widget.service.keyring.current);
if (password != null) {
widget.service.plugin.sdk.api.keyring
.deleteAccount(
widget.service.keyring, widget.service.keyring.current)
Expand All @@ -50,7 +50,11 @@ class _AccountManagePageState extends State<AccountManagePage> {
widget.service.account
.handleAccountChanged(widget.service.keyring.current);
});
} else {
}
} else {
final password = await widget.service.account
.getEvmPassword(context, widget.service.keyringEVM.current);
if (password != null) {
widget.service.plugin.sdk.api.eth.keyring
.deleteAccount(
widget.service.keyringEVM, widget.service.keyringEVM.current)
Expand All @@ -59,8 +63,8 @@ class _AccountManagePageState extends State<AccountManagePage> {
widget.service.keyringEVM.current.toKeyPairData());
});
}
Navigator.of(context).pop();
}
Navigator.of(context).pop();
}

Future<void> _updateBiometricAuth(bool enable) async {
Expand Down

0 comments on commit f928eaf

Please sign in to comment.