@ -53,6 +53,13 @@
< input type = "checkbox" class = "mr-2" v -model = " shouldErase " / >
< input type = "checkbox" class = "mr-2" v -model = " shouldErase " / >
< label > Erase the previous identifier . < / label >
< label > Erase the previous identifier . < / label >
< / div >
< / div >
< div v-if ="isNotProdServer()" class="mt-4 text-blue-500" >
<!-- if they click this , fill in the mnemonic seed - input with the test mnemonic -- >
< button @ click = "mnemonic = TEST_USER_0_MNEMONIC" >
Use mnemonic for Test User # 0
< / button >
< / div >
< / div >
< / div >
< div class = "mt-8" >
< div class = "mt-8" >
@ -79,8 +86,8 @@
import { Component , Vue } from "vue-facing-decorator" ;
import { Component , Vue } from "vue-facing-decorator" ;
import { Router } from "vue-router" ;
import { Router } from "vue-router" ;
import { NotificationIface } from "@/constants/app" ;
import { AppString , NotificationIface } from "@/constants/app" ;
import { accountsDB , db } from "@/db/index" ;
import { accountsDB , db , retrieveSettingsForActiveAccount } from "@/db/index" ;
import { MASTER_SETTINGS_KEY } from "@/db/tables/settings" ;
import { MASTER_SETTINGS_KEY } from "@/db/tables/settings" ;
import {
import {
DEFAULT_ROOT_DERIVATION_PATH ,
DEFAULT_ROOT_DERIVATION_PATH ,
@ -92,28 +99,40 @@ import {
components : { } ,
components : { } ,
} )
} )
export default class ImportAccountView extends Vue {
export default class ImportAccountView extends Vue {
TEST_USER_0_MNEMONIC =
"rigid shrug mobile smart veteran half all pond toilet brave review universe ship congress found yard skate elite apology jar uniform subway slender luggage" ;
UPORT_DERIVATION_PATH = "m/7696500'/0'/0'/0'" ; / / f o r l e g a c y i m p o r t s , l i k e l y n e v e r u s e d
UPORT_DERIVATION_PATH = "m/7696500'/0'/0'/0'" ; / / f o r l e g a c y i m p o r t s , l i k e l y n e v e r u s e d
AppString = AppString ;
$notify ! : ( notification : NotificationIface , timeout ? : number ) => void ;
$notify ! : ( notification : NotificationIface , timeout ? : number ) => void ;
mnemonic = "" ;
apiServer = "" ;
address = "" ;
address = "" ;
derivationPath = DEFAULT_ROOT_DERIVATION_PATH ;
mnemonic = "" ;
numAccounts = 0 ;
numAccounts = 0 ;
privateHex = "" ;
privateHex = "" ;
publicHex = "" ;
publicHex = "" ;
derivationPath = DEFAULT_ROOT_DERIVATION_PATH ;
showAdvanced = false ;
showAdvanced = false ;
shouldErase = false ;
shouldErase = false ;
async created ( ) {
async created ( ) {
await accountsDB . open ( ) ;
await accountsDB . open ( ) ;
this . numAccounts = await accountsDB . accounts . count ( ) ;
this . numAccounts = await accountsDB . accounts . count ( ) ;
/ / g e t t h e s e r v e r , t o h e l p w i t h i m p o r t o n t h e t e s t s e r v e r
const settings = await retrieveSettingsForActiveAccount ( ) ;
this . apiServer = settings . apiServer || "" ;
}
}
public onCancelClick ( ) {
public onCancelClick ( ) {
( this . $router as Router ) . back ( ) ;
( this . $router as Router ) . back ( ) ;
}
}
public isNotProdServer ( ) {
return this . apiServer !== AppString . PROD_ENDORSER_API_SERVER ;
}
public async fromMnemonic ( ) {
public async fromMnemonic ( ) {
const mne : string = this . mnemonic . trim ( ) . toLowerCase ( ) ;
const mne : string = this . mnemonic . trim ( ) . toLowerCase ( ) ;
try {
try {