From d8712215a4ecb214da1233eace6e91ed9384c0c3 Mon Sep 17 00:00:00 2001 From: Trent Larson Date: Mon, 11 Nov 2024 16:37:28 -0700 Subject: [PATCH] add way to quickly import test data when on a test instance --- src/views/ImportAccountView.vue | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/src/views/ImportAccountView.vue b/src/views/ImportAccountView.vue index 086680c..5c28aa3 100644 --- a/src/views/ImportAccountView.vue +++ b/src/views/ImportAccountView.vue @@ -53,6 +53,13 @@ + +
+ + +
@@ -79,8 +86,8 @@ import { Component, Vue } from "vue-facing-decorator"; import { Router } from "vue-router"; -import { NotificationIface } from "@/constants/app"; -import { accountsDB, db } from "@/db/index"; +import { AppString, NotificationIface } from "@/constants/app"; +import { accountsDB, db, retrieveSettingsForActiveAccount } from "@/db/index"; import { MASTER_SETTINGS_KEY } from "@/db/tables/settings"; import { DEFAULT_ROOT_DERIVATION_PATH, @@ -92,28 +99,40 @@ import { components: {}, }) 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'"; // for legacy imports, likely never used + AppString = AppString; + $notify!: (notification: NotificationIface, timeout?: number) => void; - mnemonic = ""; + apiServer = ""; address = ""; + derivationPath = DEFAULT_ROOT_DERIVATION_PATH; + mnemonic = ""; numAccounts = 0; privateHex = ""; publicHex = ""; - derivationPath = DEFAULT_ROOT_DERIVATION_PATH; showAdvanced = false; shouldErase = false; async created() { await accountsDB.open(); this.numAccounts = await accountsDB.accounts.count(); + // get the server, to help with import on the test server + const settings = await retrieveSettingsForActiveAccount(); + this.apiServer = settings.apiServer || ""; } public onCancelClick() { (this.$router as Router).back(); } + public isNotProdServer() { + return this.apiServer !== AppString.PROD_ENDORSER_API_SERVER; + } + public async fromMnemonic() { const mne: string = this.mnemonic.trim().toLowerCase(); try {