Skip to content

Commit

Permalink
Merge pull request anoma#45 from heliaxdev/bug/44/stored-mnemonic
Browse files Browse the repository at this point in the history
bug/44 - Stored mnemonic issue
  • Loading branch information
jurevans authored May 3, 2022
2 parents d0bda43 + 7a6f3dd commit 8366fce
Showing 1 changed file with 3 additions and 13 deletions.
16 changes: 3 additions & 13 deletions packages/anoma-wallet/src/App/AccountCreation/AccountCreation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { Routes, Route, useNavigate, useLocation } from "react-router-dom";
import { AnimatePresence } from "framer-motion";
import { ThemeContext } from "styled-components";

import { Mnemonic, MnemonicLength } from "@anoma-apps/seed-management";
import { TopLevelRoute } from "App/types";
import { AccountCreationRoute, accountCreationSteps } from "./types";
import { Session, Wallet } from "lib";
Expand Down Expand Up @@ -265,27 +264,18 @@ function AccountCreation(): JSX.Element {
// bad UX by seeing a noticeable delay
if (
accountCreationDetails.password &&
accountCreationDetails.seedPhraseLength &&
accountCreationDetails.accountName
) {
const mnemonicLength =
accountCreationDetails.seedPhraseLength.length ===
12
? MnemonicLength.Twelve
: MnemonicLength.TwentyFour;

const mnemonic: Mnemonic =
await Mnemonic.fromMnemonic(mnemonicLength);

const mnemonic = seedPhrase?.join(" ") || "";
const account = await createAccount(
accountCreationDetails.accountName,
mnemonic.phrase
mnemonic
);

// Establish login session
const session = new Session();
session.setSession(accountCreationDetails.password);
await session.setSeed(mnemonic.phrase);
await session.setSeed(mnemonic);

setInitialAccount && setInitialAccount(account);
} else {
Expand Down

0 comments on commit 8366fce

Please sign in to comment.