@ -88,17 +88,9 @@ import { Router } from "vue-router"; 
			
		
	
		
		
			
				
					
 
			
		
	
		
		
			
				
					import  {  AppString ,  NotificationIface ,  USE_DEXIE_DB  }  from  "../constants/app" ; import  {  AppString ,  NotificationIface ,  USE_DEXIE_DB  }  from  "../constants/app" ;  
			
		
	
		
		
			
				
					import  *  as  databaseUtil  from  "../db/databaseUtil" ; import  *  as  databaseUtil  from  "../db/databaseUtil" ;  
			
		
	
		
		
			
				
					
					import  { import  {  retrieveSettingsForActiveAccount  }  from  "../db/index" ;  
			
				
				
			
		
	
		
		
			
				
					
					  accountsDBPromise , import  {  DEFAULT_ROOT_DERIVATION_PATH  }  from  "../libs/crypto" ;  
			
				
				
			
		
	
		
		
			
				
					
					  retrieveSettingsForActiveAccount , import  {  retrieveAccountCount ,  importFromMnemonic  }  from  "../libs/util" ;  
			
				
				
			
		
	
		
		
			
				
					}  from  "../db/index" ;  
			
		
	
		
		
			
				
					import  {  
			
		
	
		
		
			
				
					  DEFAULT_ROOT_DERIVATION_PATH ,  
			
		
	
		
		
			
				
					  deriveAddress ,  
			
		
	
		
		
			
				
					  newIdentifier ,  
			
		
	
		
		
			
				
					}  from  "../libs/crypto" ;  
			
		
	
		
		
			
				
					import  {  retrieveAccountCount ,  saveNewIdentity  }  from  "../libs/util" ;  
			
		
	
		
		
			
				
					import  {  PlatformServiceFactory  }  from  "@/services/PlatformServiceFactory" ;  
			
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					import  {  logger  }  from  "../utils/logger" ; import  {  logger  }  from  "../utils/logger" ;  
			
		
	
		
		
			
				
					
 
			
		
	
		
		
			
				
					@ Component ( { @ Component ( {  
			
		
	
	
		
		
			
				
					
						
						
						
							
								 
						
					 
					@ -115,12 +107,9 @@ export default class ImportAccountView extends Vue { 
			
		
	
		
		
			
				
					  $router ! :  Router ;   $router ! :  Router ;  
			
		
	
		
		
			
				
					
 
			
		
	
		
		
			
				
					  apiServer  =  "" ;   apiServer  =  "" ;  
			
		
	
		
		
			
				
					  address  =  "" ;  
			
		
	
		
		
			
				
					  derivationPath  =  DEFAULT_ROOT_DERIVATION_PATH ;   derivationPath  =  DEFAULT_ROOT_DERIVATION_PATH ;  
			
		
	
		
		
			
				
					  mnemonic  =  "" ;   mnemonic  =  "" ;  
			
		
	
		
		
			
				
					  numAccounts  =  0 ;   numAccounts  =  0 ;  
			
		
	
		
		
			
				
					  privateHex  =  "" ;  
			
		
	
		
		
			
				
					  publicHex  =  "" ;  
			
		
	
		
		
			
				
					  showAdvanced  =  false ;   showAdvanced  =  false ;  
			
		
	
		
		
			
				
					  shouldErase  =  false ;   shouldErase  =  false ;  
			
		
	
		
		
			
				
					
 
			
		
	
	
		
		
			
				
					
						
						
						
							
								 
						
					 
					@ -143,33 +132,16 @@ export default class ImportAccountView extends Vue { 
			
		
	
		
		
			
				
					  }   }  
			
		
	
		
		
			
				
					
 
			
		
	
		
		
			
				
					  public  async  fromMnemonic ( )  {   public  async  fromMnemonic ( )  {  
			
		
	
		
		
			
				
					    const  mne :  string  =  this . mnemonic . trim ( ) . toLowerCase ( ) ;  
			
		
	
		
		
			
				
					    try  {     try  {  
			
		
	
		
		
			
				
					
					      [ this . address ,  this . privateHex ,  this . publicHex ]  =  deriveAddress (       await  importFromMnemonic (  
			
				
				
			
		
	
		
		
			
				
					
					        mne ,         this . mnemonic  ,  
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					        this . derivationPath ,         this . derivationPath ,  
			
		
	
		
		
			
				
					        this . shouldErase ,  
			
		
	
		
		
			
				
					      ) ;       ) ;  
			
		
	
		
		
			
				
					
 
			
		
	
		
		
			
				
					      const  newId  =  newIdentifier (  
			
		
	
		
		
			
				
					        this . address ,  
			
		
	
		
		
			
				
					        this . publicHex ,  
			
		
	
		
		
			
				
					        this . privateHex ,  
			
		
	
		
		
			
				
					        this . derivationPath ,  
			
		
	
		
		
			
				
					      ) ;  
			
		
	
		
		
			
				
					
 
			
		
	
		
		
			
				
					      const  accountsDB  =  await  accountsDBPromise ;  
			
		
	
		
		
			
				
					      if  ( this . shouldErase )  {  
			
		
	
		
		
			
				
					        const  platformService  =  PlatformServiceFactory . getInstance ( ) ;  
			
		
	
		
		
			
				
					        await  platformService . dbExec ( "DELETE FROM accounts" ) ;  
			
		
	
		
		
			
				
					        if  ( USE_DEXIE_DB )  {  
			
		
	
		
		
			
				
					          await  accountsDB . accounts . clear ( ) ;  
			
		
	
		
		
			
				
					        }  
			
		
	
		
		
			
				
					      }  
			
		
	
		
		
			
				
					      await  saveNewIdentity ( newId ,  mne ,  this . derivationPath ) ;  
			
		
	
		
		
			
				
					      this . $router . push ( {  name :  "account"  } ) ;       this . $router . push ( {  name :  "account"  } ) ;  
			
		
	
		
		
			
				
					      / /   e s l i n t - d i s a b l e - n e x t - l i n e   @ t y p e s c r i p t - e s l i n t / n o - e x p l i c i t - a n y       / /   e s l i n t - d i s a b l e - n e x t - l i n e   @ t y p e s c r i p t - e s l i n t / n o - e x p l i c i t - a n y  
			
		
	
		
		
			
				
					    }  catch  ( err :  any )  {     }  catch  ( err :  any )  {  
			
		
	
		
		
			
				
					
					      logger . error ( "Error saving mnemonic & updating settings :" ,  err ) ;       logger . error ( "Error importing from mnemonic:" ,  err ) ;  
			
				
				
			
		
	
		
		
	
		
		
			
				
					      if  ( err  ==  "Error: invalid mnemonic" )  {       if  ( err  ==  "Error: invalid mnemonic" )  {  
			
		
	
		
		
			
				
					        this . $notify (         this . $notify (  
			
		
	
		
		
			
				
					          {           {