From 1e108fdd6deb64fc36f598964001b3f82748a6df Mon Sep 17 00:00:00 2001 From: Piyal Basu Date: Wed, 20 May 2020 10:55:33 -0400 Subject: [PATCH 1/3] router fix --- src/Router.tsx | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/Router.tsx b/src/Router.tsx index 7ef3287962..7b59a6b651 100644 --- a/src/Router.tsx +++ b/src/Router.tsx @@ -68,7 +68,6 @@ const HomeRoute = () => { }; const Routes = () => { - const applicationState = useSelector(applicationStateSelector); const dispatch = useDispatch(); useEffect(() => { dispatch(loadAccount()); @@ -99,13 +98,9 @@ const Routes = () => { - {applicationState !== APPLICATION_STATE.APPLICATION_STARTED ? ( - - ) : ( - - )} - + + ); From 24537a2db214956c22e5f279e294a0655264f73d Mon Sep 17 00:00:00 2001 From: Piyal Basu Date: Wed, 20 May 2020 16:56:43 -0400 Subject: [PATCH 2/3] Rename some folders; create error message and tooltip components; make some small adjustments to auth flow --- .../externalMessageListener/index.ts | 7 +- .../backgroundComponents/messageListener.ts | 2 +- public/contentScript.js | 2 +- src/Router.tsx | 4 +- src/{services => api}/external/index.ts | 4 +- src/{services/utils => api/helpers}/index.ts | 0 src/api/index.ts | 234 +++++++++++++++++- src/{services => api}/types/index.ts | 0 src/components/Tooltip/index.tsx | 23 ++ src/components/form/index.tsx | 15 ++ .../mnemonicPhrase/ConfirmMnemonicPhrase.tsx | 5 +- .../{primitives => basics}/CheckButton.tsx | 0 src/ducks/authServices.ts | 6 +- src/hooks/useMnemonicPhrase.ts | 2 +- src/{api => lyraApi}/connect/index.ts | 2 +- src/lyraApi/index.ts | 15 ++ .../submitTransaction/index.ts | 4 +- src/services/index.ts | 228 ----------------- src/views/Account/index.tsx | 24 +- src/views/GrantAccess/index.tsx | 2 +- src/views/RecoverAccount/index.tsx | 9 +- src/views/SignTransaction/index.tsx | 2 +- webpack.common.js | 2 +- 23 files changed, 332 insertions(+), 260 deletions(-) rename src/{services => api}/external/index.ts (86%) rename src/{services/utils => api/helpers}/index.ts (100%) rename src/{services => api}/types/index.ts (100%) create mode 100644 src/components/Tooltip/index.tsx create mode 100644 src/components/form/index.tsx rename src/components/mnemonicPhrase/{primitives => basics}/CheckButton.tsx (100%) rename src/{api => lyraApi}/connect/index.ts (80%) create mode 100644 src/lyraApi/index.ts rename src/{api => lyraApi}/submitTransaction/index.ts (68%) delete mode 100644 src/services/index.ts diff --git a/public/backgroundComponents/externalMessageListener/index.ts b/public/backgroundComponents/externalMessageListener/index.ts index fc378dfa6e..55a5bfcbee 100644 --- a/public/backgroundComponents/externalMessageListener/index.ts +++ b/public/backgroundComponents/externalMessageListener/index.ts @@ -1,11 +1,12 @@ import StellarSdk from "stellar-sdk"; -import { ExternalRequest as Request } from "../../../src/services/types"; +import { ExternalRequest as Request } from "../../../src/api/types"; import { Sender, SendResponseInterface } from "../types"; import { EXTERNAL_SERVICE_TYPES } from "../../../src/statics"; import { responseQueue, uiData, transactionQueue } from "../messageListener"; const WHITELIST_ID = "whitelist"; +const WINDOW_DIMENSIONS = "height=600,width=357"; export const externalMessageListener = ( request: Request, @@ -33,6 +34,8 @@ export const externalMessageListener = ( window.open( chrome.runtime.getURL(`/index.html#/grant-access?${encodeOrigin}`), + "Lyra: Connect", + WINDOW_DIMENSIONS, ); const response = (url?: string) => { @@ -71,6 +74,8 @@ export const externalMessageListener = ( chrome.runtime.getURL( `/index.html#/sign-transaction?${encodetransactionInfo}`, ), + "Lyra: Sign Transaction", + WINDOW_DIMENSIONS, ); const response = (transactionStatus: string) => { diff --git a/public/backgroundComponents/messageListener.ts b/public/backgroundComponents/messageListener.ts index 68ba22fa3a..abea1e81f6 100644 --- a/public/backgroundComponents/messageListener.ts +++ b/public/backgroundComponents/messageListener.ts @@ -8,7 +8,7 @@ import { APPLICATION_STATE, SERVER_URL, } from "../../src/statics"; -import { Response as Request } from "../../src/services/types"; +import { Response as Request } from "../../src/api/types"; import { Sender, SendResponseInterface } from "./types"; const server = new StellarSdk.Server(SERVER_URL); diff --git a/public/contentScript.js b/public/contentScript.js index 5ec342286c..9b67cffa49 100644 --- a/public/contentScript.js +++ b/public/contentScript.js @@ -1,4 +1,4 @@ -const url = chrome.extension.getURL("api.min.js"); +const url = chrome.extension.getURL("lyraApi.min.js"); const s = document.createElement("script"); s.src = url; (document.head || document.documentElement).appendChild(s); diff --git a/src/Router.tsx b/src/Router.tsx index 7b59a6b651..e7eed72f59 100644 --- a/src/Router.tsx +++ b/src/Router.tsx @@ -39,7 +39,7 @@ const ProtectedRoute = (props: RouteProps) => { return ( { - + diff --git a/src/services/external/index.ts b/src/api/external/index.ts similarity index 86% rename from src/services/external/index.ts rename to src/api/external/index.ts index e986147262..0feac52f91 100644 --- a/src/services/external/index.ts +++ b/src/api/external/index.ts @@ -1,6 +1,6 @@ import { EXTERNAL_SERVICE_TYPES } from "statics"; -import { sendMessageAndAwaitResponseExternal } from "services/utils"; -import { ExternalRequest } from "services/types"; +import { sendMessageAndAwaitResponseExternal } from "api/helpers"; +import { ExternalRequest } from "api/types"; export const requestAccess = async (): Promise<{ publicKey: string; diff --git a/src/services/utils/index.ts b/src/api/helpers/index.ts similarity index 100% rename from src/services/utils/index.ts rename to src/api/helpers/index.ts diff --git a/src/api/index.ts b/src/api/index.ts index 3eb9dd792e..9b7483ba44 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -1,15 +1,227 @@ -import connect from "./connect"; -import submitTransaction from "./submitTransaction"; +import StellarSdk from "stellar-sdk"; -const injectApi = () => ({ - connect, - submitTransaction, -}); +import { + EXTENSION_ID, + SERVER_URL, + SERVICE_TYPES, + DEVELOPMENT, + APPLICATION_STATE, +} from "statics"; +import { Response } from "./types"; -declare global { - interface Window { - lyra: any; +const server = new StellarSdk.Server(SERVER_URL); + +export const createAccount = async ( + password: string, +): Promise<{ publicKey: string }> => { + let publicKey = ""; + + try { + ({ publicKey } = await sendMessageAndAwaitResponse({ + password, + type: SERVICE_TYPES.CREATE_ACCOUNT, + })); + } catch (e) { + console.error(e); + } + + return { publicKey }; +}; + +export const loadAccount = async (): Promise<{ + publicKey: string; + applicationState: APPLICATION_STATE; +}> => { + let response = { + publicKey: "", + applicationState: APPLICATION_STATE.APPLICATION_STARTED, + }; + + try { + response = await sendMessageAndAwaitResponse({ + type: SERVICE_TYPES.LOAD_ACCOUNT, + }); + } catch (e) { + console.error(e); + } + return response; +}; + +export const getMnemonicPhrase = async (): Promise<{ + mnemonicPhrase: string; +}> => { + let response = { mnemonicPhrase: "" }; + + try { + response = await sendMessageAndAwaitResponse({ + type: SERVICE_TYPES.GET_MNEMONIC_PHRASE, + }); + } catch (e) { + console.error(e); + } + return response; +}; + +export const confirmMnemonicPhrase = async ( + mnemonicPhraseToConfirm: string, +): Promise<{ + isCorrectPhrase: boolean; + applicationState: APPLICATION_STATE; +}> => { + let response = { + isCorrectPhrase: false, + applicationState: APPLICATION_STATE.PASSWORD_CREATED, + }; + + try { + response = await sendMessageAndAwaitResponse({ + mnemonicPhraseToConfirm, + type: SERVICE_TYPES.CONFIRM_MNEMONIC_PHRASE, + }); + } catch (e) { + console.error(e); + } + return response; +}; + +export const recoverAccount = async ( + password: string, + recoverMnemonic: string, +): Promise<{ publicKey: string }> => { + let publicKey = ""; + + try { + ({ publicKey } = await sendMessageAndAwaitResponse({ + password, + recoverMnemonic, + type: SERVICE_TYPES.RECOVER_ACCOUNT, + })); + } catch (e) { + console.error(e); + } + + return { publicKey }; +}; + +export const confirmPassword = async ( + password: string, +): Promise<{ publicKey: string; applicationState: APPLICATION_STATE }> => { + let response = { + publicKey: "", + applicationState: APPLICATION_STATE.MNEMONIC_PHRASE_CONFIRMED, + }; + try { + response = await sendMessageAndAwaitResponse({ + password, + type: SERVICE_TYPES.CONFIRM_PASSWORD, + }); + } catch (e) { + console.error(e); } -} -window.lyra = injectApi(); + return response; +}; + +export const getAccountBalance = async ( + publicKey: string, +): Promise<{ + balance: string; +}> => { + let response = { balances: [] }; + + try { + response = await server.loadAccount(publicKey); + } catch (e) { + console.error(e); + } + return response.balances[0]; +}; + +export const getPublicKey = async (): Promise<{ publicKey: string }> => { + let publicKey = ""; + + try { + ({ publicKey } = await sendMessageAndAwaitResponsePublic({ + type: SERVICE_TYPES.LOAD_ACCOUNT, + })); + } catch (e) { + console.error(e); + } + return { publicKey }; +}; + +export const rejectAccess = async (): Promise => { + try { + await sendMessageAndAwaitResponse({ + type: SERVICE_TYPES.REJECT_ACCESS, + }); + } catch (e) { + console.error(e); + } +}; + +export const grantAccess = async (url: string): Promise => { + try { + await sendMessageAndAwaitResponse({ + url, + type: SERVICE_TYPES.GRANT_ACCESS, + }); + } catch (e) { + console.error(e); + } +}; + +export const signTransaction = async ({ + password, + transaction, +}: { + password: string; + transaction: {}; +}): Promise => { + try { + await sendMessageAndAwaitResponse({ + password, + transaction, + type: SERVICE_TYPES.SIGN_TRANSACTION, + }); + } catch (e) { + console.error(e); + } +}; + +export const signOut = async (): Promise<{ + publicKey: string; + applicationState: APPLICATION_STATE; +}> => { + let response = { + publicKey: "", + applicationState: APPLICATION_STATE.MNEMONIC_PHRASE_CONFIRMED, + }; + try { + response = await sendMessageAndAwaitResponse({ + type: SERVICE_TYPES.SIGN_OUT, + }); + } catch (e) { + console.error(e); + } + + return response; +}; + +export const sendMessageAndAwaitResponse = (msg: {}): Promise => + new Promise((resolve) => { + if (DEVELOPMENT) { + chrome.runtime.sendMessage(EXTENSION_ID, msg, (res: Response) => + resolve(res), + ); + } else { + chrome.runtime.sendMessage(msg, (res: Response) => resolve(res)); + } + }); + +export const sendMessageAndAwaitResponsePublic = (msg: {}): Promise => + new Promise((resolve) => { + chrome.runtime.sendMessage(EXTENSION_ID, msg, (res: Response) => + resolve(res), + ); + }); diff --git a/src/services/types/index.ts b/src/api/types/index.ts similarity index 100% rename from src/services/types/index.ts rename to src/api/types/index.ts diff --git a/src/components/Tooltip/index.tsx b/src/components/Tooltip/index.tsx new file mode 100644 index 0000000000..3894cbe2fc --- /dev/null +++ b/src/components/Tooltip/index.tsx @@ -0,0 +1,23 @@ +import React from "react"; +import styled from "styled-components"; + +const TooltipEl = styled.span` + background: yellow; + color: black; + font-size: 0.7em; + margin-top: -4em; + position: absolute; + visibility: hidden; + text-shadow: none; +`; + +interface TooltipProps { + className?: string; + text: string; +} + +const Tooltip = ({ className, text }: TooltipProps) => ( + {text} +); + +export default Tooltip; diff --git a/src/components/form/index.tsx b/src/components/form/index.tsx new file mode 100644 index 0000000000..7a864ed45b --- /dev/null +++ b/src/components/form/index.tsx @@ -0,0 +1,15 @@ +import React from "react"; +import styled from "styled-components"; + +const ErrorEl = styled.p` + color: red; + font-weight: bold; +`; + +interface ErrorMessageProps { + authError: string; +} + +export const ErrorMessage = ({ authError }: ErrorMessageProps) => ( + <>{authError ? {authError} : null} +); diff --git a/src/components/mnemonicPhrase/ConfirmMnemonicPhrase.tsx b/src/components/mnemonicPhrase/ConfirmMnemonicPhrase.tsx index 61e42f9e25..3378726107 100644 --- a/src/components/mnemonicPhrase/ConfirmMnemonicPhrase.tsx +++ b/src/components/mnemonicPhrase/ConfirmMnemonicPhrase.tsx @@ -3,7 +3,8 @@ import styled from "styled-components"; import { shuffle } from "lodash"; import { useDispatch, useSelector } from "react-redux"; import { confirmMnemonicPhrase, authErrorSelector } from "ducks/authServices"; -import CheckButton from "./primitives/CheckButton"; +import { ErrorMessage } from "components/form"; +import CheckButton from "./basics/CheckButton"; const ConfirmInput = styled.textarea` background: #d3d3d3; @@ -58,7 +59,7 @@ const ConfirmMnemonicPhrase = ({
- {authError ?

{authError}

: null} +
{wordBubbles()}
diff --git a/src/components/mnemonicPhrase/primitives/CheckButton.tsx b/src/components/mnemonicPhrase/basics/CheckButton.tsx similarity index 100% rename from src/components/mnemonicPhrase/primitives/CheckButton.tsx rename to src/components/mnemonicPhrase/basics/CheckButton.tsx diff --git a/src/ducks/authServices.ts b/src/ducks/authServices.ts index 98111a4ca3..d5dd14f5f0 100644 --- a/src/ducks/authServices.ts +++ b/src/ducks/authServices.ts @@ -12,7 +12,7 @@ import { loadAccount as loadAccountService, confirmPassword as confirmPasswordService, signOut as signOutService, -} from "services"; +} from "api"; interface ErrorMessage { errorMessage: string; @@ -186,7 +186,9 @@ const authSlice = createSlice({ const { publicKey } = action.payload || { publicKey: "" }; return { ...state, - applicationState: APPLICATION_STATE.PASSWORD_CREATED, + authenticated: true, + authError: "", + applicationState: APPLICATION_STATE.MNEMONIC_PHRASE_CONFIRMED, publicKey, }; }); diff --git a/src/hooks/useMnemonicPhrase.ts b/src/hooks/useMnemonicPhrase.ts index 5113d65ba6..18e2aceb61 100644 --- a/src/hooks/useMnemonicPhrase.ts +++ b/src/hooks/useMnemonicPhrase.ts @@ -1,5 +1,5 @@ import { useEffect, useState } from "react"; -import { getMnemonicPhrase } from "services"; +import { getMnemonicPhrase } from "api"; const useMnemonicPhrase = () => { const [mnemonicPhrase, setMnemonicPhrase] = useState(""); diff --git a/src/api/connect/index.ts b/src/lyraApi/connect/index.ts similarity index 80% rename from src/api/connect/index.ts rename to src/lyraApi/connect/index.ts index 9e8d2bbfc3..2d06cc8e61 100644 --- a/src/api/connect/index.ts +++ b/src/lyraApi/connect/index.ts @@ -1,4 +1,4 @@ -import { requestAccess } from "services/external"; +import { requestAccess } from "api/external"; const connect = async () => { let response = { publicKey: "", error: "" }; diff --git a/src/lyraApi/index.ts b/src/lyraApi/index.ts new file mode 100644 index 0000000000..3eb9dd792e --- /dev/null +++ b/src/lyraApi/index.ts @@ -0,0 +1,15 @@ +import connect from "./connect"; +import submitTransaction from "./submitTransaction"; + +const injectApi = () => ({ + connect, + submitTransaction, +}); + +declare global { + interface Window { + lyra: any; + } +} + +window.lyra = injectApi(); diff --git a/src/api/submitTransaction/index.ts b/src/lyraApi/submitTransaction/index.ts similarity index 68% rename from src/api/submitTransaction/index.ts rename to src/lyraApi/submitTransaction/index.ts index 6c5820d53f..e14295b479 100644 --- a/src/api/submitTransaction/index.ts +++ b/src/lyraApi/submitTransaction/index.ts @@ -1,5 +1,5 @@ -import { submitTransaction as submitTransactionService } from "services/external"; -import { ExternalRequest } from "services/types"; +import { submitTransaction as submitTransactionService } from "api/external"; +import { ExternalRequest } from "api/types"; const submitTransaction = async (params: ExternalRequest) => { let response = { transactionStatus: "", error: "" }; diff --git a/src/services/index.ts b/src/services/index.ts deleted file mode 100644 index 5dc8d7e094..0000000000 --- a/src/services/index.ts +++ /dev/null @@ -1,228 +0,0 @@ -import StellarSdk from "stellar-sdk"; - -import { - EXTENSION_ID, - SERVER_URL, - SERVICE_TYPES, - DEVELOPMENT, - APPLICATION_STATE, -} from "statics"; -import { Response } from "./types"; - -const server = new StellarSdk.Server(SERVER_URL); - -export const createAccount = async ( - password: string, -): Promise<{ publicKey: string }> => { - let publicKey = ""; - - try { - ({ publicKey } = await sendMessageAndAwaitResponse({ - password, - type: SERVICE_TYPES.CREATE_ACCOUNT, - })); - } catch (e) { - console.error(e); - } - - return { publicKey }; -}; - -export const loadAccount = async (): Promise<{ - publicKey: string; - applicationState: APPLICATION_STATE; -}> => { - let response = { - publicKey: "", - applicationState: APPLICATION_STATE.APPLICATION_STARTED, - }; - - try { - response = await sendMessageAndAwaitResponse({ - type: SERVICE_TYPES.LOAD_ACCOUNT, - }); - } catch (e) { - console.error(e); - } - return response; -}; - -export const getMnemonicPhrase = async (): Promise<{ - mnemonicPhrase: string; -}> => { - let response = { mnemonicPhrase: "" }; - - try { - response = await sendMessageAndAwaitResponse({ - type: SERVICE_TYPES.GET_MNEMONIC_PHRASE, - }); - } catch (e) { - console.error(e); - } - return response; -}; - -export const confirmMnemonicPhrase = async ( - mnemonicPhraseToConfirm: string, -): Promise<{ - isCorrectPhrase: boolean; - applicationState: APPLICATION_STATE; -}> => { - let response = { - isCorrectPhrase: false, - applicationState: APPLICATION_STATE.PASSWORD_CREATED, - }; - - try { - response = await sendMessageAndAwaitResponse({ - mnemonicPhraseToConfirm, - type: SERVICE_TYPES.CONFIRM_MNEMONIC_PHRASE, - }); - } catch (e) { - console.error(e); - } - return response; -}; - -export const recoverAccount = async ( - password: string, - recoverMnemonic: string, -): Promise<{ publicKey: string }> => { - let publicKey = ""; - - try { - ({ publicKey } = await sendMessageAndAwaitResponse({ - password, - recoverMnemonic, - type: SERVICE_TYPES.RECOVER_ACCOUNT, - })); - } catch (e) { - console.error(e); - } - - return { publicKey }; -}; - -export const confirmPassword = async ( - password: string, -): Promise<{ publicKey: string; applicationState: APPLICATION_STATE }> => { - let response = { - publicKey: "", - applicationState: APPLICATION_STATE.MNEMONIC_PHRASE_CONFIRMED, - }; - try { - response = await sendMessageAndAwaitResponse({ - password, - type: SERVICE_TYPES.CONFIRM_PASSWORD, - }); - } catch (e) { - console.error(e); - } - - return response; -}; - -export const getAccountBalance = async ( - publicKey: string, -): Promise<{ - balance: string; -}> => { - let response = { balances: [] }; - - try { - response = await server.loadAccount(publicKey); - } catch (e) { - console.error(e); - } - console.log(response); - return response.balances[0]; -}; - -export const getPublicKey = async (): Promise<{ publicKey: string }> => { - let publicKey = ""; - - try { - ({ publicKey } = await sendMessageAndAwaitResponsePublic({ - type: SERVICE_TYPES.LOAD_ACCOUNT, - })); - } catch (e) { - console.error(e); - } - return { publicKey }; -}; - -export const rejectAccess = async (): Promise => { - try { - await sendMessageAndAwaitResponse({ - type: SERVICE_TYPES.REJECT_ACCESS, - }); - } catch (e) { - console.error(e); - } -}; - -export const grantAccess = async (url: string): Promise => { - try { - await sendMessageAndAwaitResponse({ - url, - type: SERVICE_TYPES.GRANT_ACCESS, - }); - } catch (e) { - console.error(e); - } -}; - -export const signTransaction = async ({ - password, - transaction, -}: { - password: string; - transaction: {}; -}): Promise => { - try { - await sendMessageAndAwaitResponse({ - password, - transaction, - type: SERVICE_TYPES.SIGN_TRANSACTION, - }); - } catch (e) { - console.error(e); - } -}; - -export const signOut = async (): Promise<{ - publicKey: string; - applicationState: APPLICATION_STATE; -}> => { - let response = { - publicKey: "", - applicationState: APPLICATION_STATE.MNEMONIC_PHRASE_CONFIRMED, - }; - try { - response = await sendMessageAndAwaitResponse({ - type: SERVICE_TYPES.SIGN_OUT, - }); - } catch (e) { - console.error(e); - } - - return response; -}; - -export const sendMessageAndAwaitResponse = (msg: {}): Promise => - new Promise((resolve) => { - if (DEVELOPMENT) { - chrome.runtime.sendMessage(EXTENSION_ID, msg, (res: Response) => - resolve(res), - ); - } else { - chrome.runtime.sendMessage(msg, (res: Response) => resolve(res)); - } - }); - -export const sendMessageAndAwaitResponsePublic = (msg: {}): Promise => - new Promise((resolve) => { - chrome.runtime.sendMessage(EXTENSION_ID, msg, (res: Response) => - resolve(res), - ); - }); diff --git a/src/views/Account/index.tsx b/src/views/Account/index.tsx index bda7424a6e..4608d17fa9 100644 --- a/src/views/Account/index.tsx +++ b/src/views/Account/index.tsx @@ -3,15 +3,28 @@ import CopyToClipboard from "react-copy-to-clipboard"; import styled from "styled-components"; import { publicKeySelector } from "ducks/authServices"; import { useSelector } from "react-redux"; -import { getAccountBalance } from "services"; +import { getAccountBalance } from "api"; +import Tooltip from "components/Tooltip"; + +const StyledTooltip = styled(Tooltip)``; const PublicKeyDisplay = styled.p` + cursor: pointer; text-overflow: ellipsis; overflow: hidden; + color: ${({ isBlurred }: { isBlurred: boolean }) => + isBlurred ? "transparent" : "black"}; + text-shadow: ${({ isBlurred }: { isBlurred: boolean }) => + isBlurred ? "0 0 5px rgba(0, 0, 0, 0.5)" : "null"}; + + &:hover + ${StyledTooltip} { + visibility: visible; + } `; const Account = () => { const [accountBalance, setaccountBalance] = useState(""); + const [isBlurred, setIsBlurred] = useState(true); const publicKey = useSelector(publicKeySelector); useEffect(() => { @@ -31,7 +44,14 @@ const Account = () => { <>

Public Key:

- {publicKey} + + setIsBlurred(false)} + isBlurred={isBlurred} + > + {publicKey} + + {isBlurred ? : null} diff --git a/src/views/GrantAccess/index.tsx b/src/views/GrantAccess/index.tsx index acbbda478c..ed3525ea9d 100644 --- a/src/views/GrantAccess/index.tsx +++ b/src/views/GrantAccess/index.tsx @@ -1,6 +1,6 @@ import React from "react"; import { useLocation } from "react-router-dom"; -import { rejectAccess, grantAccess } from "services"; +import { rejectAccess, grantAccess } from "api"; const GrantAccess = () => { const location = useLocation(); diff --git a/src/views/RecoverAccount/index.tsx b/src/views/RecoverAccount/index.tsx index 21e1c69551..0ab3fc6e97 100644 --- a/src/views/RecoverAccount/index.tsx +++ b/src/views/RecoverAccount/index.tsx @@ -2,11 +2,17 @@ import React, { useEffect, useRef, useState, useCallback } from "react"; import { useDispatch, useSelector } from "react-redux"; import { Link } from "react-router-dom"; import { history } from "App"; -import { publicKeySelector, recoverAccount } from "ducks/authServices"; +import { + authErrorSelector, + publicKeySelector, + recoverAccount, +} from "ducks/authServices"; +import { ErrorMessage } from "components/form"; const RecoverAccount = () => { const firstRender = useRef(true); const publicKey = useSelector(publicKeySelector); + const authError = useSelector(authErrorSelector); const [password, setPassword] = useState(""); const [confirmPassword, setconfirmPassword] = useState(""); const [mnemonicPhrase, setMnemonicPhrase] = useState(""); @@ -92,6 +98,7 @@ const RecoverAccount = () => {
Go back
+ ); }; diff --git a/src/views/SignTransaction/index.tsx b/src/views/SignTransaction/index.tsx index 7ddca6ae37..bbd1a538d6 100644 --- a/src/views/SignTransaction/index.tsx +++ b/src/views/SignTransaction/index.tsx @@ -6,7 +6,7 @@ import { useSelector } from "react-redux"; import { publicKeySelector } from "ducks/authServices"; -import { rejectAccess, signTransaction } from "services"; +import { rejectAccess, signTransaction } from "api"; const SignTransaction = () => { const [password, setPassword] = useState(""); diff --git a/webpack.common.js b/webpack.common.js index 4dc4d9be39..5d3f9b1d31 100644 --- a/webpack.common.js +++ b/webpack.common.js @@ -13,7 +13,7 @@ const commonConfig = { path.resolve(__dirname, "./public/background.js"), ], index: ["babel-polyfill", path.resolve(__dirname, "./src/index.tsx")], - api: path.resolve(__dirname, "./src/api/index.ts"), + lyraApi: path.resolve(__dirname, "./src/lyraApi/index.ts"), contentScript: path.resolve(__dirname, "./public/contentScript.js"), }, output: { From a5d34316d1a271abc51135f5399af58f3d62e6f1 Mon Sep 17 00:00:00 2001 From: Piyal Basu Date: Wed, 20 May 2020 17:00:40 -0400 Subject: [PATCH 3/3] update manifest --- public/static/manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/static/manifest.json b/public/static/manifest.json index 5ca244dba4..3413ef86d9 100644 --- a/public/static/manifest.json +++ b/public/static/manifest.json @@ -16,7 +16,7 @@ "externally_connectable": { "matches": ["*://*.stellar.org/*", "*://*.lyraclient.com/*"] }, - "web_accessible_resources": ["api.min.js"], + "web_accessible_resources": ["lyraApi.min.js"], "page_action": { "default_popup": "index.html", "default_icon": {