fix(@desktop/wallet): derivation path is not pre-selected by default when importing account in wallet

Closes: #10153
This commit is contained in:
Sale Djenic 2023-04-04 18:59:19 +02:00 committed by saledjenic
parent 894cb9eff3
commit a2f5d81f7f
2 changed files with 7 additions and 4 deletions

View File

@ -429,9 +429,11 @@ method changePrivateKey*[T](self: Module[T], privateKey: string) =
self.controller.fetchDetailsForAddresses(@[genAccDto.address]) self.controller.fetchDetailsForAddresses(@[genAccDto.address])
method changeSeedPhrase*[T](self: Module[T], seedPhrase: string) = method changeSeedPhrase*[T](self: Module[T], seedPhrase: string) =
let genAccDto = self.controller.createAccountFromSeedPhrase(seedPhrase)
self.view.setSelectedDerivedAddress(newDerivedAddressItem()) self.view.setSelectedDerivedAddress(newDerivedAddressItem())
if genAccDto.address.len == 0: if seedPhrase.len == 0:
return
let genAccDto = self.controller.createAccountFromSeedPhrase(seedPhrase)
if seedPhrase.len > 0 and genAccDto.address.len == 0:
error "unable to create an account from the provided seed phrase" error "unable to create an account from the provided seed phrase"
return return

View File

@ -208,16 +208,17 @@ QtObject {
root.addAccountModule.selectedEmoji !== "" root.addAccountModule.selectedEmoji !== ""
if (root.currentState.stateType === Constants.addAccountPopup.state.main) { if (root.currentState.stateType === Constants.addAccountPopup.state.main) {
if(derivationPathEditingNotValid) if(root.derivationPathEditingNotValid)
return false return false
if (root.selectedOrigin.pairType === Constants.addAccountPopup.keyPairType.profile || if (root.selectedOrigin.pairType === Constants.addAccountPopup.keyPairType.profile ||
root.selectedOrigin.pairType === Constants.addAccountPopup.keyPairType.seedImport) { root.selectedOrigin.pairType === Constants.addAccountPopup.keyPairType.seedImport) {
return valid && return valid &&
(!root.addAccountModule.actionAuthenticated ||
!!root.selectedDerivedAddress && !!root.selectedDerivedAddress &&
root.selectedDerivedAddress.loaded && root.selectedDerivedAddress.loaded &&
!root.selectedDerivedAddress.alreadyCreated && !root.selectedDerivedAddress.alreadyCreated &&
root.selectedDerivedAddress.address !== "" && root.selectedDerivedAddress.address !== "") &&
root.derivationPathRegEx.test(root.addAccountModule.derivationPath) && root.derivationPathRegEx.test(root.addAccountModule.derivationPath) &&
(!root.derivationPathOutOfTheDefaultStatusDerivationTree || (!root.derivationPathOutOfTheDefaultStatusDerivationTree ||
root.derivationPathOutOfTheDefaultStatusDerivationTreeConfirmed) root.derivationPathOutOfTheDefaultStatusDerivationTreeConfirmed)