mirror of
https://github.com/status-im/status-desktop.git
synced 2025-02-22 11:38:57 +00:00
fix(Wallet): derive accounts from imported mnemonic and store correctly
This commit address two bugs: 1. When importing a mnemonic, the resulting "master" account and its address was used as account to be stored as opposed to its derived default account 2. The account was stored in the wrong path, resulting in status not being able to locate accounts when sending transactions. Fixes #787
This commit is contained in:
parent
19e801bba8
commit
361c563a4b
@ -225,7 +225,7 @@ proc storeDerivedWallet*(account: GeneratedAccount, password: string, walletInde
|
|||||||
let hashedPassword = hashPassword(password)
|
let hashedPassword = hashPassword(password)
|
||||||
let multiAccount = %* {
|
let multiAccount = %* {
|
||||||
"accountID": account.id,
|
"accountID": account.id,
|
||||||
"paths": ["m/" & $walletIndex],
|
"paths": ["m/44'/60'/0'/0/" & $walletIndex],
|
||||||
"password": hashedPassword
|
"password": hashedPassword
|
||||||
}
|
}
|
||||||
let response = parseJson($nim_status.multiAccountStoreDerivedAccounts($multiAccount));
|
let response = parseJson($nim_status.multiAccountStoreDerivedAccounts($multiAccount));
|
||||||
|
@ -259,7 +259,8 @@ proc generateNewAccount*(self: WalletModel, password: string, accountName: strin
|
|||||||
|
|
||||||
proc addAccountsFromSeed*(self: WalletModel, seed: string, password: string, accountName: string, color: string): string =
|
proc addAccountsFromSeed*(self: WalletModel, seed: string, password: string, accountName: string, color: string): string =
|
||||||
let mnemonic = replace(seed, ',', ' ')
|
let mnemonic = replace(seed, ',', ' ')
|
||||||
let generatedAccount = status_accounts.multiAccountImportMnemonic(mnemonic)
|
var generatedAccount = status_accounts.multiAccountImportMnemonic(mnemonic)
|
||||||
|
generatedAccount.derived = status_accounts.deriveAccounts(generatedAccount.id)
|
||||||
return self.addNewGeneratedAccountWithPassword(generatedAccount, password, accountName, color, constants.SEED)
|
return self.addNewGeneratedAccountWithPassword(generatedAccount, password, accountName, color, constants.SEED)
|
||||||
|
|
||||||
proc addAccountsFromPrivateKey*(self: WalletModel, privateKey: string, password: string, accountName: string, color: string): string =
|
proc addAccountsFromPrivateKey*(self: WalletModel, privateKey: string, password: string, accountName: string, color: string): string =
|
||||||
|
Loading…
x
Reference in New Issue
Block a user