fix: MultiAccountImportMnemonic: Remove extra spaces in the entered mnemonic (#2476)

This commit is contained in:
Khushboo-dev-cpp 2022-01-05 15:43:39 +01:00 committed by GitHub
parent 5512e19d83
commit 9d3f2d82f1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 1 deletions

View File

@ -2,6 +2,7 @@ package statusgo
import (
"encoding/json"
"strings"
)
// MultiAccountGenerateParams are the params sent to MultiAccountGenerate.
@ -165,7 +166,10 @@ func MultiAccountImportMnemonic(paramsJSON string) string {
return makeJSONResponse(err)
}
resp, err := statusBackend.AccountManager().AccountsGenerator().ImportMnemonic(p.MnemonicPhrase, p.Bip39Passphrase)
// remove any duplicate whitespaces
mnemonicPhraseNoExtraSpaces := strings.Join(strings.Fields(p.MnemonicPhrase), " ")
resp, err := statusBackend.AccountManager().AccountsGenerator().ImportMnemonic(mnemonicPhraseNoExtraSpaces, p.Bip39Passphrase)
if err != nil {
return makeJSONResponse(err)
}