mirror of
https://github.com/status-im/status-desktop.git
synced 2025-01-18 02:21:17 +00:00
fix: initialize wallet paths and types, and disable deletion of non-watch accounts
This commit is contained in:
parent
92bd8a1b96
commit
239b95e9a2
@ -281,7 +281,7 @@ proc saveAccount*(account: GeneratedAccount, password: string, color: string, ac
|
||||
}]
|
||||
])
|
||||
|
||||
result = DerivedAccount(address: address, publicKey: publicKey)
|
||||
result = DerivedAccount(address: address, publicKey: publicKey, derivationPath: derivationPath)
|
||||
except:
|
||||
error "Error storing the new account. Bad password?"
|
||||
raise
|
||||
|
@ -34,6 +34,7 @@ type GasPricePrediction* = object
|
||||
type DerivedAccount* = object
|
||||
publicKey*: string
|
||||
address*: string
|
||||
derivationPath*: string
|
||||
|
||||
type MultiAccounts* = object
|
||||
whisper* {.serializedFieldName(PATH_WHISPER).}: DerivedAccount
|
||||
|
@ -188,9 +188,9 @@ proc populateAccount*(self: WalletModel, walletAccount: var WalletAccount, balan
|
||||
walletAccount.realFiatBalance = 0.0
|
||||
updateBalance(walletAccount, self.getDefaultCurrency(), refreshCache)
|
||||
|
||||
proc newAccount*(self: WalletModel, name: string, address: string, iconColor: string, balance: string, publicKey: string): WalletAccount =
|
||||
proc newAccount*(self: WalletModel, walletType: string, derivationPath: string, name: string, address: string, iconColor: string, balance: string, publicKey: string): WalletAccount =
|
||||
var assets: seq[Asset] = self.generateAccountConfiguredAssets(address)
|
||||
var account = WalletAccount(name: name, address: address, iconColor: iconColor, balance: fmt"{balance} {self.defaultCurrency}", assetList: assets, realFiatBalance: 0.0, publicKey: publicKey)
|
||||
var account = WalletAccount(name: name, path: derivationPath, walletType: walletType, address: address, iconColor: iconColor, balance: fmt"{balance} {self.defaultCurrency}", assetList: assets, realFiatBalance: 0.0, publicKey: publicKey)
|
||||
updateBalance(account, self.getDefaultCurrency())
|
||||
account
|
||||
|
||||
@ -226,7 +226,7 @@ proc addNewGeneratedAccount(self: WalletModel, generatedAccount: GeneratedAccoun
|
||||
try:
|
||||
generatedAccount.name = accountName
|
||||
var derivedAccount: DerivedAccount = status_accounts.saveAccount(generatedAccount, password, color, accountType, isADerivedAccount, walletIndex)
|
||||
var account = self.newAccount(accountName, derivedAccount.address, color, fmt"0.00 {self.defaultCurrency}", derivedAccount.publicKey)
|
||||
var account = self.newAccount(accountType, derivedAccount.derivationPath, accountName, derivedAccount.address, color, fmt"0.00 {self.defaultCurrency}", derivedAccount.publicKey)
|
||||
self.accounts.add(account)
|
||||
self.events.emit("newAccountAdded", AccountArgs(account: account))
|
||||
except Exception as e:
|
||||
|
@ -85,6 +85,7 @@ ModalPopup {
|
||||
|
||||
TextWithLabel {
|
||||
id: pathText
|
||||
visible: currentAccount.walletType !== Constants.watchWalletType && currentAccount.walletType !== Constants.keyWalletType
|
||||
//% "Derivation path"
|
||||
label: qsTrId("derivation-path")
|
||||
text: currentAccount.path
|
||||
@ -106,6 +107,7 @@ ModalPopup {
|
||||
footer: Item {
|
||||
anchors.fill: parent
|
||||
StyledButton {
|
||||
visible: currentAccount.walletType === Constants.watchWalletType
|
||||
anchors.top: parent.top
|
||||
anchors.right: saveBtn.left
|
||||
anchors.rightMargin: Style.current.padding
|
||||
|
Loading…
x
Reference in New Issue
Block a user