RootSoft / algorand-dart

Unofficial community SDK to interact with the Algorand network, for Dart & Flutter
MIT License
36 stars 16 forks source link

Can not Recover user wallet based on 25 words menemonic #37

Closed AteqEjaz closed 2 years ago

AteqEjaz commented 2 years ago

Hi,

Struggling to recover an account using 25 words menemonic. Please help.

--========---======- Sample Seed SEED ========= ["virus", "soccer", "garden", "clutch", "august", "joy", "slide", "prevent", "east", "royal", "anxiety", "boy", "load", "sadness", "connect", "assault", "awesome", "nephew", "casino", "front", "web", "reject", "bitter", "about", "flat"]

My code:

RecoverWallet(List seed) async { final algorand = Algorand( algodClient: algodClient, indexerClient: indexerClient, ); var restoredAccount = await algorand.restoreAccount(seed); }

Error:

I/flutter (20005): Menemonic==== :"virus" I/flutter (20005): index==== :-1 E/flutter (20005): [ERROR:flutter/lib/ui/ui_dart_state.cc(209)] Unhandled Exception: Instance of 'MnemonicException' E/flutter (20005): #0 WordList.findIndex (package:algorand_dart/src/mnemonic/word_list.dart:57:11) E/flutter (20005): #1 Mnemonic.words (package:algorand_dart/src/mnemonic/mnemonic.dart:118:30) E/flutter (20005): #2 Mnemonic.seed (package:algorand_dart/src/mnemonic/mnemonic.dart:82:10) E/flutter (20005): #3 Account.fromSeedPhrase (package:algorand_dart/src/models/accounts/account_model.dart:65:33) E/flutter (20005): #4 Algorand.restoreAccount (package:algorand_dart/src/algorand.dart:134:26) E/flutter (20005): #5 _UserSelectionScreenState.RecoverWallet (package:gtq/Screens/after_splash_screen_path.dart:80:44) E/flutter (20005): #6 _UserSelectionScreenState.show_menemonic_area. (package:gtq/Screens/after_splash_screen_path.dart:254:31)

RootSoft commented 2 years ago

@AteqEjaz I just tried importing the mnemonic on my device and did not receive a MnemonicException. The public address is CGGFIRPT2FF7WVJDU6XHCSPMPHPHQUZI4LJPHJUUVZYDJJ5H6S6CJJJ2IY.

Just to be sure, make sure your word does not include the quotes in the string.

final account = await Account.fromSeedPhrase(words);