Address feedback

This commit is contained in:
Andrea Maria Piana 2023-03-16 16:45:24 +00:00
parent 3d2fd26d80
commit 4be978a2fe
2 changed files with 7 additions and 3 deletions

View File

@ -19,6 +19,8 @@ const pathWalletRoot = "m/44'/60'/0'/0"
const pathEIP1581 = "m/43'/60'/1581'"
const pathDefaultChat = pathEIP1581 + "/0'/0"
const pathDefaultWallet = pathWalletRoot + "/0"
const defaultMnemonicLength = 12
const walletAccountDefaultName = "Ethereum account"
var paths = []string{pathWalletRoot, pathEIP1581, pathDefaultChat, pathDefaultWallet}
@ -26,6 +28,7 @@ func defaultSettings(generatedAccountInfo generator.GeneratedAccountInfo, derive
chatKeyString := derivedAddresses[pathDefaultChat].PublicKey
settings := &settings.Settings{}
settings.Mnemonic = &generatedAccountInfo.Mnemonic
settings.KeyUID = generatedAccountInfo.KeyUID
settings.Address = types.HexToAddress(generatedAccountInfo.Address)
settings.WalletRootAddress = types.HexToAddress(derivedAddresses[pathWalletRoot].Address)

View File

@ -715,7 +715,8 @@ func (b *GethStatusBackend) CreateAccountAndLogin(request *requests.CreateAccoun
generator := b.accountManager.AccountsGenerator()
generatedAccountInfos, err := generator.Generate(12, 1, "")
// generate 1(n) account with default mnemonic length and no passphrase
generatedAccountInfos, err := generator.Generate(defaultMnemonicLength, 1, "")
if err != nil {
return err
@ -756,7 +757,7 @@ func (b *GethStatusBackend) CreateAccountAndLogin(request *requests.CreateAccoun
Color: "",
Wallet: true,
Path: pathDefaultWallet,
Name: "Ethereum account",
Name: walletAccountDefaultName,
}
chatDerivedAccount := derivedAddresses[pathDefaultChat]
@ -770,7 +771,7 @@ func (b *GethStatusBackend) CreateAccountAndLogin(request *requests.CreateAccoun
}
accounts := []*accounts.Account{walletAccount, chatAccount}
err = b.StartNodeWithAccountAndInitialConfig(account, "", *settings, nodeConfig, accounts)
err = b.StartNodeWithAccountAndInitialConfig(account, request.Password, *settings, nodeConfig, accounts)
if err != nil {
b.log.Error("start node", err)
return err