forked from trent_larson/crowd-funder-for-time-pwa
fix linting
This commit is contained in:
@@ -81,7 +81,11 @@ import {
|
||||
} from "../libs/crypto";
|
||||
import { accountsDBPromise, db } from "../db/index";
|
||||
import { MASTER_SETTINGS_KEY } from "../db/tables/settings";
|
||||
import { retrieveAllAccountsMetadata, retrieveFullyDecryptedAccount, saveNewIdentity } from "../libs/util";
|
||||
import {
|
||||
retrieveAllAccountsMetadata,
|
||||
retrieveFullyDecryptedAccount,
|
||||
saveNewIdentity,
|
||||
} from "../libs/util";
|
||||
import { logger } from "../utils/logger";
|
||||
import { Account, AccountEncrypted } from "../db/tables/accounts";
|
||||
import { PlatformServiceFactory } from "@/services/PlatformServiceFactory";
|
||||
@@ -100,13 +104,20 @@ export default class ImportAccountView extends Vue {
|
||||
|
||||
async mounted() {
|
||||
const accounts: AccountEncrypted[] = await retrieveAllAccountsMetadata();
|
||||
const decryptedAccounts: (Account | undefined)[] = await Promise.all(accounts.map(async (account) => {
|
||||
return retrieveFullyDecryptedAccount(account.did);
|
||||
}));
|
||||
const filteredDecryptedAccounts: Account[] = decryptedAccounts.filter((account) => account !== undefined);
|
||||
const decryptedAccounts: (Account | undefined)[] = await Promise.all(
|
||||
accounts.map(async (account) => {
|
||||
return retrieveFullyDecryptedAccount(account.did);
|
||||
}),
|
||||
);
|
||||
const filteredDecryptedAccounts: Account[] = decryptedAccounts.filter(
|
||||
(account) => account !== undefined,
|
||||
);
|
||||
|
||||
// group by account.mnemonic
|
||||
const groupedAccounts: Record<string, Account[]> = R.groupBy((a) => a.mnemonic || "", filteredDecryptedAccounts) as Record<string, Account[]>;
|
||||
const groupedAccounts: Record<string, Account[]> = R.groupBy(
|
||||
(a) => a.mnemonic || "",
|
||||
filteredDecryptedAccounts,
|
||||
) as Record<string, Account[]>;
|
||||
|
||||
this.didArrays = groupedAccounts;
|
||||
if (Object.keys(this.didArrays).length > 0) {
|
||||
@@ -125,10 +136,13 @@ export default class ImportAccountView extends Vue {
|
||||
public async incrementDerivation() {
|
||||
// find the maximum derivation path for the selected DIDs
|
||||
const selectedArray: Array<Account> =
|
||||
Object.values(this.didArrays).find((dids) => dids[0].did === this.selectedArrayFirstDid) ||
|
||||
[];
|
||||
Object.values(this.didArrays).find(
|
||||
(dids) => dids[0].did === this.selectedArrayFirstDid,
|
||||
) || [];
|
||||
// extract the derivationPath array and sort it
|
||||
const derivationPaths = selectedArray.map((account) => account.derivationPath);
|
||||
const derivationPaths = selectedArray.map(
|
||||
(account) => account.derivationPath,
|
||||
);
|
||||
derivationPaths.sort((a, b) => {
|
||||
const aParts = a?.split("/");
|
||||
const aLast = aParts?.[aParts.length - 1];
|
||||
@@ -137,7 +151,9 @@ export default class ImportAccountView extends Vue {
|
||||
return parseInt(aLast || "0") - parseInt(bLast || "0");
|
||||
});
|
||||
// we're sure there's at least one
|
||||
const maxDerivPath: string = derivationPaths[derivationPaths.length - 1] as string;
|
||||
const maxDerivPath: string = derivationPaths[
|
||||
derivationPaths.length - 1
|
||||
] as string;
|
||||
|
||||
const newDerivPath = nextDerivationPath(maxDerivPath);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user