diff --git a/src/App.tsx b/src/App.tsx index c8a3e22..8237a7b 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -21,32 +21,31 @@ import { Tooltip, Typography, } from "@mui/material"; -import { JsonView, allExpanded, darkStyles } from 'react-json-view-lite'; -import 'react-json-view-lite/dist/index.css'; +import { JsonView, allExpanded, darkStyles } from "react-json-view-lite"; +import "react-json-view-lite/dist/index.css"; import { decryptStoredWallet } from "./utils/decryptWallet"; import { CountdownCircleTimer } from "react-countdown-circle-timer"; import Logo1Dark from "./assets/svgs/Logo1Dark.svg"; import RefreshIcon from "@mui/icons-material/Refresh"; import Copy from "./assets/svgs/Copy.svg"; import ltcLogo from "./assets/ltc.png"; -import PersonSearchIcon from '@mui/icons-material/PersonSearch'; +import PersonSearchIcon from "@mui/icons-material/PersonSearch"; import qortLogo from "./assets/qort.png"; import { CopyToClipboard } from "react-copy-to-clipboard"; import Download from "./assets/svgs/Download.svg"; import Logout from "./assets/svgs/Logout.svg"; import Return from "./assets/svgs/Return.svg"; -import WarningIcon from '@mui/icons-material/Warning'; +import WarningIcon from "@mui/icons-material/Warning"; import Success from "./assets/svgs/Success.svg"; import CloseIcon from "@mui/icons-material/Close"; -import './utils/seedPhrase/RandomSentenceGenerator'; -import EngineeringIcon from '@mui/icons-material/Engineering'; -import AccountBalanceWalletIcon from '@mui/icons-material/AccountBalanceWallet'; +import "./utils/seedPhrase/RandomSentenceGenerator"; +import EngineeringIcon from "@mui/icons-material/Engineering"; +import AccountBalanceWalletIcon from "@mui/icons-material/AccountBalanceWallet"; import { createAccount, saveFileToDisk, saveSeedPhraseToDisk, } from "./utils/generateWallet/generateWallet"; -import { kdf } from "./deps/kdf"; import { crypto, walletVersion } from "./constants/decryptWallet"; import PhraseWallet from "./utils/generateWallet/phrase-wallet"; import { @@ -70,7 +69,7 @@ import { TaskManager } from "./components/TaskManager/TaskManger"; import { useModal } from "./common/useModal"; import { CustomizedSnackbars } from "./components/Snackbar/Snackbar"; import SettingsIcon from "@mui/icons-material/Settings"; -import HelpIcon from '@mui/icons-material/Help'; +import HelpIcon from "@mui/icons-material/Help"; import { cleanUrl, @@ -133,6 +132,7 @@ import { RegisterName } from "./components/RegisterName"; import { BuyQortInformation } from "./components/BuyQortInformation"; import { QortPayment } from "./components/QortPayment"; import { GeneralNotifications } from "./components/GeneralNotifications"; +import ThemeSelector from "./components/Theme/ThemeSelector"; type extStates = | "not-authenticated" @@ -220,7 +220,6 @@ const controlAllQueues = (action) => { }); }; - export const clearAllQueues = () => { Object.keys(allQueues).forEach((key) => { const val = allQueues[key]; @@ -251,13 +250,13 @@ export const resumeAllQueues = () => { }); }; - const defaultValuesGlobal = { openTutorialModal: null, - setOpenTutorialModal: ()=> {} -} + setOpenTutorialModal: () => {}, +}; export const MyContext = createContext(defaultValues); -export const GlobalContext = createContext(defaultValuesGlobal); +export const GlobalContext = + createContext(defaultValuesGlobal); export let globalApiKey: string | null = null; @@ -347,11 +346,17 @@ function App() { const [hasSettingsChanged, setHasSettingsChanged] = useRecoilState( hasSettingsChangedAtom ); - const balanceSetIntervalRef = useRef(null) - const {downloadResource} = useFetchResources() + const balanceSetIntervalRef = useRef(null); + const { downloadResource } = useFetchResources(); const holdRefExtState = useRef("not-authenticated"); const isFocusedRef = useRef(true); - const {showTutorial, openTutorialModal, shownTutorialsInitiated, setOpenTutorialModal, hasSeenGettingStarted} = useHandleTutorials() + const { + showTutorial, + openTutorialModal, + shownTutorialsInitiated, + setOpenTutorialModal, + hasSeenGettingStarted, + } = useHandleTutorials(); const { isShow, onCancel, onOk, show, message } = useModal(); const { isShow: isShowUnsavedChanges, @@ -367,7 +372,7 @@ function App() { show: showInfo, message: messageInfo, } = useModal(); - + const { onCancel: onCancelQortalRequest, onOk: onOkQortalRequest, @@ -383,43 +388,46 @@ function App() { message: messageQortalRequestExtension, } = useModal(); - const [isRunningPublicNode, setIsRunningPublicNode] = useState(false) + const [isRunningPublicNode, setIsRunningPublicNode] = useState(false); const [infoSnack, setInfoSnack] = useState(null); const [openSnack, setOpenSnack] = useState(false); const [hasLocalNode, setHasLocalNode] = useState(false); const [isOpenDrawerProfile, setIsOpenDrawerProfile] = useState(false); - const [isOpenDrawerLookup, setIsOpenDrawerLookup] = useState(false) + const [isOpenDrawerLookup, setIsOpenDrawerLookup] = useState(false); const [apiKey, setApiKey] = useState(""); const [isOpenSendQort, setIsOpenSendQort] = useState(false); const [isOpenSendQortSuccess, setIsOpenSendQortSuccess] = useState(false); const [rootHeight, setRootHeight] = useState("100%"); - const {isUserBlocked, + const { + isUserBlocked, addToBlockList, - removeBlockFromList, getAllBlockedUsers} = useBlockedAddresses() - const [currentNode, setCurrentNode] = useState({ - url: "http://127.0.0.1:12391", - }); - const [useLocalNode, setUseLocalNode] = useState(false); - + removeBlockFromList, + getAllBlockedUsers, + } = useBlockedAddresses(); + const [currentNode, setCurrentNode] = useState({ + url: "http://127.0.0.1:12391", + }); + const [useLocalNode, setUseLocalNode] = useState(false); + const [isSettingsOpen, setIsSettingsOpen] = useState(false); - const [showSeed, setShowSeed] = useState(false) - const [creationStep, setCreationStep] = useState(1) - const {getIndividualUserInfo} = useHandleUserInfo() + const [showSeed, setShowSeed] = useState(false); + const [creationStep, setCreationStep] = useState(1); + const { getIndividualUserInfo } = useHandleUserInfo(); const qortalRequestCheckbox1Ref = useRef(null); useRetrieveDataLocalStorage(userInfo?.address); useQortalGetSaveSettings(userInfo?.name, extState === "authenticated"); const [fullScreen, setFullScreen] = useRecoilState(fullScreenAtom); const [isEnabledDevMode, setIsEnabledDevMode] = useRecoilState(enabledDevModeAtom); - const setIsDisabledEditorEnter = useSetRecoilState(isDisabledEditorEnterAtom) - const [isOpenMinting, setIsOpenMinting] = useState(false) + const setIsDisabledEditorEnter = useSetRecoilState(isDisabledEditorEnterAtom); + const [isOpenMinting, setIsOpenMinting] = useState(false); const { toggleFullScreen } = useAppFullScreen(setFullScreen); - const generatorRef = useRef(null) - const exportSeedphrase = ()=> { - const seedPhrase = generatorRef.current.parsedString - saveSeedPhraseToDisk(seedPhrase) - } + const generatorRef = useRef(null); + const exportSeedphrase = () => { + const seedPhrase = generatorRef.current.parsedString; + saveSeedPhraseToDisk(seedPhrase); + }; const passwordRef = useRef(null); useEffect(() => { if (extState === "wallet-dropped" && passwordRef.current) { @@ -433,24 +441,26 @@ function App() { } }, []); - useEffect(()=> { - isRunningGateway().then((res)=> { - setIsRunningPublicNode(res) - }).catch((error)=> { - console.error(error) + useEffect(() => { + isRunningGateway() + .then((res) => { + setIsRunningPublicNode(res); }) - }, [extState]) + .catch((error) => { + console.error(error); + }); + }, [extState]); - useEffect(()=> { - if(!shownTutorialsInitiated) return - if(extState === 'not-authenticated'){ - showTutorial('create-account') - } else if(extState === "create-wallet" && walletToBeDownloaded){ - showTutorial('important-information') - } else if(extState === "authenticated"){ - showTutorial('getting-started') + useEffect(() => { + if (!shownTutorialsInitiated) return; + if (extState === "not-authenticated") { + showTutorial("create-account"); + } else if (extState === "create-wallet" && walletToBeDownloaded) { + showTutorial("important-information"); + } else if (extState === "authenticated") { + showTutorial("getting-started"); } - }, [extState, walletToBeDownloaded, shownTutorialsInitiated]) + }, [extState, walletToBeDownloaded, shownTutorialsInitiated]); useEffect(() => { // Attach a global event listener for double-click @@ -473,7 +483,9 @@ function App() { const resetAtomSortablePinnedAppsAtom = useResetRecoilState( sortablePinnedAppsAtom ); - const resetAtomIsUsingImportExportSettingsAtom = useResetRecoilState(isUsingImportExportSettingsAtom) + const resetAtomIsUsingImportExportSettingsAtom = useResetRecoilState( + isUsingImportExportSettingsAtom + ); const resetAtomCanSaveSettingToQdnAtom = useResetRecoilState( canSaveSettingToQdnAtom ); @@ -484,22 +496,25 @@ function App() { settingsLocalLastUpdatedAtom ); const resetAtomOldPinnedAppsAtom = useResetRecoilState(oldPinnedAppsAtom); - const resetAtomQMailLastEnteredTimestampAtom = useResetRecoilState(qMailLastEnteredTimestampAtom) - const resetAtomMailsAtom = useResetRecoilState(mailsAtom) - const resetGroupPropertiesAtom = useResetRecoilState(groupsPropertiesAtom) - const resetLastPaymentSeenTimestampAtom = useResetRecoilState(lastPaymentSeenTimestampAtom) + const resetAtomQMailLastEnteredTimestampAtom = useResetRecoilState( + qMailLastEnteredTimestampAtom + ); + const resetAtomMailsAtom = useResetRecoilState(mailsAtom); + const resetGroupPropertiesAtom = useResetRecoilState(groupsPropertiesAtom); + const resetLastPaymentSeenTimestampAtom = useResetRecoilState( + lastPaymentSeenTimestampAtom + ); const resetAllRecoil = () => { resetAtomSortablePinnedAppsAtom(); resetAtomCanSaveSettingToQdnAtom(); resetAtomSettingsQDNLastUpdatedAtom(); resetAtomSettingsLocalLastUpdatedAtom(); resetAtomOldPinnedAppsAtom(); - resetAtomIsUsingImportExportSettingsAtom() - resetAtomQMailLastEnteredTimestampAtom() - resetAtomMailsAtom() - resetGroupPropertiesAtom() - resetLastPaymentSeenTimestampAtom() - + resetAtomIsUsingImportExportSettingsAtom(); + resetAtomQMailLastEnteredTimestampAtom(); + resetAtomMailsAtom(); + resetGroupPropertiesAtom(); + resetLastPaymentSeenTimestampAtom(); }; useEffect(() => { if (!isMobile) return; @@ -533,48 +548,46 @@ function App() { try { setIsLoading(true); window - .sendMessage("getApiKey") - .then((response) => { - if (response) { - handleSetGlobalApikey(response); - setApiKey(response); - } - }) - .catch((error) => { - console.error( - "Failed to get API key:", - error?.message || "An error occurred" - ); - }).finally(()=> { - window - .sendMessage("getWalletInfo") + .sendMessage("getApiKey") .then((response) => { - if (response && response?.walletInfo) { - setRawWallet(response?.walletInfo); - if ( - holdRefExtState.current === "web-app-request-payment" || - holdRefExtState.current === "web-app-request-connection" || - holdRefExtState.current === "web-app-request-buy-order" - ) - return; - if (response?.hasKeyPair) { - setExtstate("authenticated"); - } else { - setExtstate("wallet-dropped"); - } + if (response) { + handleSetGlobalApikey(response); + setApiKey(response); } }) .catch((error) => { - console.error("Failed to get wallet info:", error); + console.error( + "Failed to get API key:", + error?.message || "An error occurred" + ); + }) + .finally(() => { + window + .sendMessage("getWalletInfo") + .then((response) => { + if (response && response?.walletInfo) { + setRawWallet(response?.walletInfo); + if ( + holdRefExtState.current === "web-app-request-payment" || + holdRefExtState.current === "web-app-request-connection" || + holdRefExtState.current === "web-app-request-buy-order" + ) + return; + if (response?.hasKeyPair) { + setExtstate("authenticated"); + } else { + setExtstate("wallet-dropped"); + } + } + }) + .catch((error) => { + console.error("Failed to get wallet info:", error); + }); }); - }) } catch (error) { - } finally { setIsLoading(false); - } - }, []); useEffect(() => { if (extState) { @@ -582,19 +595,17 @@ function App() { } }, [extState]); - useEffect(()=> { + useEffect(() => { try { - const val = localStorage.getItem('settings-disable-editor-enter'); - if(val){ - const parsedVal = JSON.parse(val) - if(parsedVal === false || parsedVal === true){ - setIsDisabledEditorEnter(parsedVal) + const val = localStorage.getItem("settings-disable-editor-enter"); + if (val) { + const parsedVal = JSON.parse(val); + if (parsedVal === false || parsedVal === true) { + setIsDisabledEditorEnter(parsedVal); } } - } catch (error) { - - } - }, []) + } catch (error) {} + }, []); useEffect(() => { isFocusedRef.current = isFocused; @@ -697,34 +708,33 @@ function App() { }; }; - - const balanceSetInterval = ()=> { + const balanceSetInterval = () => { try { - if(balanceSetIntervalRef?.current){ + if (balanceSetIntervalRef?.current) { clearInterval(balanceSetIntervalRef?.current); } let isCalling = false; - balanceSetIntervalRef.current = setInterval(async () => { + balanceSetIntervalRef.current = setInterval(async () => { if (isCalling) return; isCalling = true; window - .sendMessage("balance") - .then((response) => { - if (!response?.error && !isNaN(+response)) { - setBalance(response); - } - isCalling = false; - }) - .catch((error) => { - console.error("Failed to get balance:", error); - isCalling = false; - }); + .sendMessage("balance") + .then((response) => { + if (!response?.error && !isNaN(+response)) { + setBalance(response); + } + isCalling = false; + }) + .catch((error) => { + console.error("Failed to get balance:", error); + isCalling = false; + }); }, 40000); } catch (error) { - console.error(error) + console.error(error); } - } + }; const getBalanceFunc = () => { setQortBalanceLoading(true); @@ -734,14 +744,15 @@ function App() { if (!response?.error && !isNaN(+response)) { setBalance(response); } - + setQortBalanceLoading(false); }) .catch((error) => { console.error("Failed to get balance:", error); setQortBalanceLoading(false); - }).finally(()=> { - balanceSetInterval() + }) + .finally(() => { + balanceSetInterval(); }); }; const getLtcBalanceFunc = () => { @@ -759,7 +770,6 @@ function App() { setLtcBalanceLoading(false); }); }; - const clearAllStates = () => { setRequestConnection(null); @@ -878,7 +888,6 @@ function App() { // REMOVED FOR MOBILE APP }; - const getUserInfo = useCallback(async (useTimer?: boolean) => { try { if (useTimer) { @@ -957,25 +966,26 @@ function App() { } }; - const saveWalletToLocalStorage = async (newWallet)=> { + const saveWalletToLocalStorage = async (newWallet) => { try { - getWallets().then((res)=> { - - if(res && Array.isArray(res)){ - const wallets = [...res, newWallet] - storeWallets(wallets) - } else { - storeWallets([newWallet]) - } - setIsLoading(false) - }).catch((error)=> { - console.error(error) - setIsLoading(false) - }) + getWallets() + .then((res) => { + if (res && Array.isArray(res)) { + const wallets = [...res, newWallet]; + storeWallets(wallets); + } else { + storeWallets([newWallet]); + } + setIsLoading(false); + }) + .catch((error) => { + console.error(error); + setIsLoading(false); + }); } catch (error) { - console.error(error) + console.error(error); } - } + }; const createAccountFunc = async () => { try { @@ -1013,7 +1023,7 @@ function App() { .then((response) => { if (response && !response.error) { setRawWallet(wallet); - saveWalletToLocalStorage(wallet) + saveWalletToLocalStorage(wallet); setWalletToBeDownloaded({ wallet, qortAddress: wallet.address0, @@ -1055,10 +1065,9 @@ function App() { message: "Your settings have changed. If you logout you will lose your changes. Click on the save button in the header to keep your changed settings.", }); - } else if(extState === 'authenticated') { + } else if (extState === "authenticated") { await showUnsavedChanges({ - message: - "Are you sure you would like to logout?", + message: "Are you sure you would like to logout?", }); } window @@ -1087,8 +1096,8 @@ function App() { setCountdown(null); setWalletToBeDownloaded(null); setWalletToBeDownloadedPassword(""); - setShowSeed(false) - setCreationStep(1) + setShowSeed(false); + setCreationStep(1); setExtstate("authenticated"); setIsOpenSendQort(false); setIsOpenSendQortSuccess(false); @@ -1114,8 +1123,8 @@ function App() { setCountdown(null); setWalletToBeDownloaded(null); setWalletToBeDownloadedPassword(""); - setShowSeed(false) - setCreationStep(1) + setShowSeed(false); + setCreationStep(1); setWalletToBeDownloadedPasswordConfirm(""); setWalletToBeDownloadedError(""); @@ -1124,7 +1133,7 @@ function App() { setTxList([]); setMemberGroups([]); resetAllRecoil(); - if(balanceSetIntervalRef?.current){ + if (balanceSetIntervalRef?.current) { clearInterval(balanceSetIntervalRef?.current); } }; @@ -1254,7 +1263,7 @@ function App() { setOpenSnack(true); setInfoSnack({ type, - message + message, }); }; @@ -1281,244 +1290,261 @@ function App() { }; }, []); - - - const renderProfileLeft = ()=> { - - return - - - {authenticatedMode === "qort" && ( - LITECOIN WALLET} - placement="left" - arrow - sx={{ fontSize: "24" }} - slotProps={{ - tooltip: { - sx: { - color: "#ffffff", - backgroundColor: "#444444", - }, + const renderProfileLeft = () => { + return ( + + + + {authenticatedMode === "qort" && ( + + LITECOIN WALLET + + } + placement="left" + arrow + sx={{ fontSize: "24" }} + slotProps={{ + tooltip: { + sx: { + color: "#ffffff", + backgroundColor: "#444444", }, - arrow: { - sx: { - color: "#444444", - }, + }, + arrow: { + sx: { + color: "#444444", }, + }, + }} + > + { + setAuthenticatedMode("ltc"); + }} + src={ltcLogo} + style={{ + cursor: "pointer", + width: "20px", + height: "auto", + }} + /> + + )} + {authenticatedMode === "ltc" && ( + + QORTAL WALLET + + } + placement="left" + arrow + sx={{ fontSize: "24" }} + slotProps={{ + tooltip: { + sx: { + color: "#ffffff", + backgroundColor: "#444444", + }, + }, + arrow: { + sx: { + color: "#444444", + }, + }, + }} + > + { + setAuthenticatedMode("qort"); + }} + src={qortLogo} + style={{ + cursor: "pointer", + width: "20px", + height: "auto", + }} + /> + + )} + + + + {authenticatedMode === "ltc" ? ( + <> + + + + + {rawWallet?.ltcAddress?.slice(0, 6)}... + {rawWallet?.ltcAddress?.slice(-4)} + + + + {ltcBalanceLoading && ( + + )} + {!isNaN(+ltcBalance) && !ltcBalanceLoading && ( + - { - - setAuthenticatedMode("ltc"); + + {ltcBalance} LTC + + - + )} - {authenticatedMode === "ltc" && ( - QORTAL WALLET} - placement="left" - arrow - sx={{ fontSize: "24" }} - slotProps={{ - tooltip: { - sx: { - color: "#ffffff", - backgroundColor: "#444444", - }, - }, - arrow: { - sx: { - color: "#444444", - }, - }, - }} - > - { - setAuthenticatedMode("qort"); - }} - src={qortLogo} - style={{ - cursor: "pointer", - width: "20px", - height: "auto", - }} - /> - - )} - - - - {authenticatedMode === "ltc" ? ( - <> - - - - - {rawWallet?.ltcAddress?.slice(0, 6)}... - {rawWallet?.ltcAddress?.slice(-4)} - - - - {ltcBalanceLoading && ( - - )} - {!isNaN(+ltcBalance) && !ltcBalanceLoading && ( - + + + ) : ( + <> + + - {ltcBalance} LTC + {userInfo?.name} - + + + {rawWallet?.address0?.slice(0, 6)}... + {rawWallet?.address0?.slice(-4)} + + + + {qortBalanceLoading && ( + + )} + {!qortBalanceLoading && balance >= 0 && ( + + + {balance?.toFixed(2)} QORT + + + + )} + + + {userInfo && !userInfo?.name && ( + { + executeEvent("openRegisterName", {}); + }} + > + REGISTER NAME + + )} + + { + setIsOpenSendQort(true); + // setExtstate("send-qort"); + setIsOpenDrawerProfile(false); }} - /> - + > + Transfer QORT + + + )} - - - ) : ( - <> - - { + executeEvent("addTab", { + data: { service: "APP", name: "q-trade" }, + }); + executeEvent("open-apps-mode", {}); }} > - {userInfo?.name} + Get QORT at Q-Trade - - - - {rawWallet?.address0?.slice(0, 6)}... - {rawWallet?.address0?.slice(-4)} - - - - {qortBalanceLoading && ( - - )} - {!qortBalanceLoading && balance >= 0 && ( - - - {balance?.toFixed(2)} QORT - - - - )} - - - {userInfo && !userInfo?.name && ( - { - executeEvent('openRegisterName', {}) - }} - > - REGISTER NAME - - )} - - { - setIsOpenSendQort(true); - // setExtstate("send-qort"); - setIsOpenDrawerProfile(false); - }} - > - Transfer QORT - - - - )} - { - executeEvent("addTab", { - data: { service: "APP", name: "q-trade" }, - }); - executeEvent("open-apps-mode", {}); - }} - > - Get QORT at Q-Trade - - - } + + ); + }; const renderProfile = () => { return ( @@ -1551,11 +1577,7 @@ function App() { )} {desktopViewMode !== "apps" && desktopViewMode !== "dev" && - desktopViewMode !== "chat" && ( - <> - {renderProfileLeft()} - - )} + desktopViewMode !== "chat" && <>{renderProfileLeft()}} @@ -1577,7 +1599,17 @@ function App() { <> LOG OUT} + title={ + + LOG OUT + + } placement="left" arrow sx={{ fontSize: "24" }} @@ -1603,8 +1635,8 @@ function App() { }} style={{ cursor: "pointer", - width: '20px', - height: 'auto' + width: "20px", + height: "auto", }} /> @@ -1618,7 +1650,17 @@ function App() { }} > SETTINGS} + title={ + + SETTINGS + + } placement="left" arrow sx={{ fontSize: "24" }} @@ -1652,7 +1694,17 @@ function App() { }} > USER LOOKUP} + title={ + + USER LOOKUP + + } placement="left" arrow sx={{ fontSize: "24" }} @@ -1682,11 +1734,21 @@ function App() { { - executeEvent('openWalletsApp', {}) + executeEvent("openWalletsApp", {}); }} > WALLETS} + title={ + + WALLETS + + } placement="left" arrow sx={{ fontSize: "24" }} @@ -1711,110 +1773,131 @@ function App() { /> - - {desktopViewMode !== 'home' && ( + + {desktopViewMode !== "home" && ( <> - - YOUR ACCOUNT} - placement="left" - arrow - sx={{ fontSize: "24" }} - slotProps={{ - tooltip: { - sx: { - color: "#ffffff", - backgroundColor: "#444444", - }, - }, - arrow: { - sx: { - color: "#444444", - }, - }, - }} - > - { - setIsOpenDrawerProfile(true); - }}> - - - - + + YOUR ACCOUNT + + } + placement="left" + arrow + sx={{ fontSize: "24" }} + slotProps={{ + tooltip: { + sx: { + color: "#ffffff", + backgroundColor: "#444444", + }, + }, + arrow: { + sx: { + color: "#444444", + }, + }, + }} + > + { + setIsOpenDrawerProfile(true); + }} + > + + + )} - - + - - {extState === 'authenticated' && ( + + {extState === "authenticated" && ( )} - {extState === "authenticated" && isMainWindow && ( - - - - - + + + + )} - - { - try { - const res = await isRunningGateway() - if(res) throw new Error('Cannot view minting details on the gateway') - setIsOpenMinting(true) - - } catch (error) { - setOpenSnack(true) - setInfoSnack({ - type: 'error', - message: error?.message - }) - } - }}> + + { + try { + const res = await isRunningGateway(); + if (res) + throw new Error( + "Cannot view minting details on the gateway" + ); + setIsOpenMinting(true); + } catch (error) { + setOpenSnack(true); + setInfoSnack({ + type: "error", + message: error?.message, + }); + } + }} + > MINTING STATUS} + title={ + + MINTING STATUS + + } placement="left" arrow sx={{ fontSize: "24" }} @@ -1832,77 +1915,95 @@ function App() { }, }} > - + - + {(desktopViewMode === "apps" || desktopViewMode === "home") && ( - { - if(desktopViewMode === "apps"){ - showTutorial('qapps', true) - } else { - showTutorial('getting-started', true) - } - }} > - TUTORIAL} - placement="left" - arrow - sx={{ fontSize: "24" }} - slotProps={{ - tooltip: { - sx: { - color: "#ffffff", - backgroundColor: "#444444", - }, + { + if (desktopViewMode === "apps") { + showTutorial("qapps", true); + } else { + showTutorial("getting-started", true); + } + }} + > + + TUTORIAL + + } + placement="left" + arrow + sx={{ fontSize: "24" }} + slotProps={{ + tooltip: { + sx: { + color: "#ffffff", + backgroundColor: "#444444", }, - arrow: { - sx: { - color: "#444444", - }, + }, + arrow: { + sx: { + color: "#444444", }, - }} - > - - - - )} - - - BACKUP WALLET} - placement="left" - arrow - sx={{ fontSize: "24" }} - slotProps={{ - tooltip: { - sx: { - color: "#ffffff", - backgroundColor: "#444444", - }, - }, - arrow: { - sx: { - color: "#444444", - }, - }, - }} - > - { - setExtstate("download-wallet"); - setIsOpenDrawerProfile(false); + }, + }} + > + + + + )} + + + + BACKUP WALLET + + } + placement="left" + arrow + sx={{ fontSize: "24" }} + slotProps={{ + tooltip: { + sx: { + color: "#ffffff", + backgroundColor: "#444444", + }, + }, + arrow: { + sx: { + color: "#444444", + }, + }, }} - src={Download} - style={{ - cursor: "pointer", - width: '20px' - }} - /> - + > + { + setExtstate("download-wallet"); + setIsOpenDrawerProfile(false); + }} + src={Download} + style={{ + cursor: "pointer", + width: "20px", + }} + /> + - + ); @@ -1918,1292 +2019,134 @@ function App() { // backgroundRepeat: desktopViewMode === "apps" && "no-repeat", }} > - - - {extState === "not-authenticated" && ( - - )} - {/* {extState !== "not-authenticated" && ( + + + {extState === "not-authenticated" && ( + + )} + {/* {extState !== "not-authenticated" && ( )} */} - {extState === "authenticated" && isMainWindow && ( - - - - {!isMobile && renderProfile()} - - - - - )} - {isOpenSendQort && isMainWindow && ( - - - - - - - { - setIsOpenSendQort(false); - setIsOpenSendQortSuccess(true); - }} - defaultPaymentTo={paymentTo} - /> - - )} - - {isShowQortalRequest && !isMainWindow && ( - <> - - - - {messageQortalRequest?.text1} - - - {messageQortalRequest?.text2 && ( - <> - - - - {messageQortalRequest?.text2} - - - - - )} - {messageQortalRequest?.text3 && ( - <> - - - {messageQortalRequest?.text3} - - - - - )} - - {messageQortalRequest?.text4 && ( + + {!isMobile && renderProfile()} + + + )} + {isOpenSendQort && isMainWindow && ( + + - - {messageQortalRequest?.text4} - - - )} - - {messageQortalRequest?.html && ( -
- )} - - - - {messageQortalRequest?.highlightedText} - - - {messageQortalRequest?.fee && ( - <> - - - - {"Fee: "} - {messageQortalRequest?.fee} - {" QORT"} - - - - )} - {messageQortalRequest?.checkbox1 && ( - - { - qortalRequestCheckbox1Ref.current = e.target.checked; - }} - edge="start" - tabIndex={-1} - disableRipple - defaultChecked={messageQortalRequest?.checkbox1?.value} - sx={{ - "&.Mui-checked": { - color: "white", // Customize the color when checked - }, - "& .MuiSvgIcon-root": { - color: "white", - }, - }} - /> - - - {messageQortalRequest?.checkbox1?.label} - - - )} - - - - onOkQortalRequest("accepted")} - > - accept - - onCancelQortalRequest()} - > - decline - - - {sendPaymentError} - - )} - {extState === "web-app-request-buy-order" && !isMainWindow && ( - <> - - - - The Application

{" "} - {requestBuyOrder?.hostname}

- - is requesting {requestBuyOrder?.crosschainAtInfo?.length}{" "} - {`buy order${ - requestBuyOrder?.crosschainAtInfo.length === 1 ? "" : "s" - }`} - -
- - - {requestBuyOrder?.crosschainAtInfo?.reduce((latest, cur) => { - return latest + +cur?.qortAmount; - }, 0)}{" "} - QORT - - - - FOR - - - - {roundUpToDecimals( - requestBuyOrder?.crosschainAtInfo?.reduce((latest, cur) => { - return latest + +cur?.expectedForeignAmount; - }, 0) - )} - {` ${requestBuyOrder?.crosschainAtInfo?.[0]?.foreignBlockchain}`} - - {/* - - - Confirm Wallet Password - - - setPaymentPassword(e.target.value)} - /> */} - - - confirmBuyOrder(false)} - > - accept - - confirmBuyOrder(true)} - > - decline - - - {sendPaymentError} - - )} - - {extState === "web-app-request-payment" && !isMainWindow && ( - <> - - - - The Application

{" "} - {sendqortState?.hostname}

- is requesting a payment -
- - - {sendqortState?.description} - - - - {sendqortState?.amount} QORT - - {/* - - - Confirm Wallet Password - - - setPaymentPassword(e.target.value)} - /> */} - - - confirmPayment(false)} - > - accept - - confirmPayment(true)} - > - decline - - - {sendPaymentError} - - )} - {extState === "web-app-request-connection" && !isMainWindow && ( - <> - -
- -
- - - The Application

{" "} - {requestConnection?.hostname}

- is requestion a connection -
- - - - responseToConnectionRequest( - true, - requestConnection?.hostname, - requestConnection.interactionId - ) - } - > - accept - - - responseToConnectionRequest( - false, - requestConnection?.hostname, - requestConnection.interactionId - ) - } - > - decline - - - - )} - {extState === "web-app-request-authentication" && !isMainWindow && ( - <> - -
- -
- - - The Application

{" "} - {requestConnection?.hostname}

- requests authentication -
- - - - - - Authenticate - - - { - setExtstate("create-wallet"); - }} - > - Create account - - - )} - {extState === "wallets" && ( - <> - - - { - setRawWallet(null); - setExtstate("not-authenticated"); - logoutFunc(); - }} - src={Return} - /> - - - - - )} - {rawWallet && extState === "wallet-dropped" && ( - <> - - - { - setRawWallet(null); - setExtstate("wallets"); - logoutFunc(); - }} - src={Return} - /> - - -
- -
- - - {rawWallet?.name ? rawWallet?.name : rawWallet?.address0} - - - Authenticate - - - - - <> - - Wallet Password - - - setAuthenticatePassword(e.target.value)} - onKeyDown={(e) => { - if (e.key === "Enter") { - authenticateWallet(); - } - }} - ref={passwordRef} - /> - {useLocalNode ? ( - <> - - - {"Using node: "} {currentNode?.url} - - - ) : ( - <> - - - {"Using public node"} - - - )} - - - - Authenticate - - {walletToBeDecryptedError} - - - )} - {extState === "download-wallet" && ( - <> - - - - - -
- -
- - - - Download Account - - - - {!walletToBeDownloaded && ( - <> - - Confirm Wallet Password - - - - setWalletToBeDownloadedPassword(e.target.value) - - } - /> - - - Confirm password - - {walletToBeDownloadedError} - - )} - - {walletToBeDownloaded && ( - <> - { - await saveFileToDiskFunc(); - await showInfo({ - message: `Keep your account file secure.`, - }); - }} - > - Download account - - - )} - - )} - {extState === "create-wallet" && ( - <> - {!walletToBeDownloaded && ( - <> - - - { - if(creationStep === 2){ - setCreationStep(1) - return - } - setExtstate("not-authenticated"); - setShowSeed(false) - setCreationStep(1) - setWalletToBeDownloadedPasswordConfirm('') - setWalletToBeDownloadedPassword('') - }} - src={Return} - /> - - -
- -
- - - Set up your Qortal account - - - - - - A ‘ { - setShowSeed(true) - }} style={{ - fontSize: '14px', - color: 'steelblue', - cursor: 'pointer' - }}>SEEDPHRASE ’ has been randomly generated in the background. - - - - - If you wish to VIEW THE SEEDPHRASE, click the word 'SEEDPHRASE' in this text. Seedphrases are used to generate the private key for your Qortal account. For security by default, seedphrases are NOT displayed unless specifically chosen. - - - Create your Qortal account by clicking NEXT below. - - - - { - setCreationStep(2) - }}> - Next - - -
- -
- - - - Your seedphrase - - - {generatorRef.current?.parsedString} - - - - Export Seedphrase - - - - - - - - - - -
- - - - Wallet Password - - - - setWalletToBeDownloadedPassword(e.target.value) - } + onClick={returnToMain} + src={Return} /> - - - Confirm Wallet Password - - - - setWalletToBeDownloadedPasswordConfirm(e.target.value) - } - /> - - There is no minimum length requirement - + + + { + setIsOpenSendQort(false); + setIsOpenSendQortSuccess(true); + }} + defaultPaymentTo={paymentTo} + /> + + )} - - Create Account - - - {walletToBeDownloadedError} - - )} - - {walletToBeDownloaded && ( - <> - - - - - Congrats, you’re all set up! - - - - - Save your account in a place where you will remember it! - - - { - await saveFileToDiskFunc(); - returnToMain(); - await showInfo({ - message: `Keep your wallet file secure.`, - }); - }} - > - Backup Account - - - )} - - )} - {isOpenSendQortSuccess && ( - - - - - - The transfer was succesful! - - - { - returnToMain(); - }} - > - Continue - - - )} - {extState === "transfer-success-request" && ( - <> - - - - - The transfer was succesful! - - - { - window.close(); - }} - > - Continue - - - )} - {extState === "buy-order-submitted" && ( - <> - - - - - Your buy order was submitted - - - { - window.close(); - }} - > - Close - - - )} - {countdown && ( - - {/* */} - { - window.close(); - }} - size={75} - strokeWidth={8} - > - {({ remainingTime }) => {remainingTime}} - - - )} - {isLoading && } - {isShow && ( - - {message.paymentFee ? "Payment" : "Publish"} - - - {message.message} - - {message?.paymentFee && ( - - payment fee: {message.paymentFee} - - )} - {message?.publishFee && ( - - publish fee: {message.publishFee} - - )} - - - - - - - - )} - {isShowInfo && ( - - {"Important Info"} - - - {messageInfo.message} - - - - - - - )} - {isShowUnsavedChanges && ( - - {"LOGOUT"} - - - {messageUnsavedChanges.message} - - - - - - - - )} - {isShowQortalRequestExtension && isMainWindow && ( - - { - onCancelQortalRequestExtension(); - }} - size={50} - strokeWidth={5} - > - {({ remainingTime }) => {remainingTime}} - - + {isShowQortalRequest && !isMainWindow && ( + <> + - {messageQortalRequestExtension?.text1} + {messageQortalRequest?.text1} - {messageQortalRequestExtension?.text2 && ( + {messageQortalRequest?.text2 && ( <> - {messageQortalRequestExtension?.text2} + {messageQortalRequest?.text2} )} - {messageQortalRequestExtension?.text3 && ( + {messageQortalRequest?.text3 && ( <> - {messageQortalRequestExtension?.text3} + {messageQortalRequest?.text3} )} - {messageQortalRequestExtension?.text4 && ( + {messageQortalRequest?.text4 && ( - {messageQortalRequestExtension?.text4} + {messageQortalRequest?.text4} )} - {messageQortalRequestExtension?.html && ( + {messageQortalRequest?.html && (
)} @@ -3305,20 +2246,10 @@ function App() { maxWidth: "90%", }} > - {messageQortalRequestExtension?.highlightedText} + {messageQortalRequest?.highlightedText} - {messageQortalRequestExtension?.json && ( - <> - - - - - - - )} - - {messageQortalRequestExtension?.fee && ( + {messageQortalRequest?.fee && ( <> @@ -3332,53 +2263,17 @@ function App() { }} > {"Fee: "} - {messageQortalRequestExtension?.fee} + {messageQortalRequest?.fee} {" QORT"} )} - {messageQortalRequestExtension?.appFee && ( - <> - - {"App Fee: "} - {messageQortalRequestExtension?.appFee} - {" QORT"} - - - - )} - {messageQortalRequestExtension?.foreignFee && ( - <> - - - - {"Foreign Fee: "} - {messageQortalRequestExtension?.foreignFee} - - - - )} - {messageQortalRequestExtension?.checkbox1 && ( + {messageQortalRequest?.checkbox1 && ( - {messageQortalRequestExtension?.checkbox1?.label} + {messageQortalRequest?.checkbox1?.label} )} @@ -3423,66 +2316,1368 @@ function App() { gap: "14px", }} > - onOkQortalRequestExtension("accepted")} + onClick={() => onOkQortalRequest("accepted")} > accept - - + onCancelQortalRequestExtension()} + onClick={() => onCancelQortalRequest()} > decline - + {sendPaymentError} + + )} + {extState === "web-app-request-buy-order" && !isMainWindow && ( + <> + + + + The Application

{" "} + {requestBuyOrder?.hostname}

+ + is requesting {requestBuyOrder?.crosschainAtInfo?.length}{" "} + {`buy order${ + requestBuyOrder?.crosschainAtInfo.length === 1 ? "" : "s" + }`} + +
+ + + {requestBuyOrder?.crosschainAtInfo?.reduce((latest, cur) => { + return latest + +cur?.qortAmount; + }, 0)}{" "} + QORT + + + + FOR + + + + {roundUpToDecimals( + requestBuyOrder?.crosschainAtInfo?.reduce((latest, cur) => { + return latest + +cur?.expectedForeignAmount; + }, 0) + )} + {` ${requestBuyOrder?.crosschainAtInfo?.[0]?.foreignBlockchain}`} + + {/* + + + Confirm Wallet Password + + + setPaymentPassword(e.target.value)} + /> */} + + + confirmBuyOrder(false)} + > + accept + + confirmBuyOrder(true)} + > + decline + + + {sendPaymentError} + + )} + + {extState === "web-app-request-payment" && !isMainWindow && ( + <> + + + + The Application

{" "} + {sendqortState?.hostname}

+ is requesting a payment +
+ + + {sendqortState?.description} + + + + {sendqortState?.amount} QORT + + {/* + + + Confirm Wallet Password + + + setPaymentPassword(e.target.value)} + /> */} + + + confirmPayment(false)} + > + accept + + confirmPayment(true)} + > + decline + + + {sendPaymentError} + + )} + {extState === "web-app-request-connection" && !isMainWindow && ( + <> + +
+ +
+ + + The Application

{" "} + {requestConnection?.hostname}

+ is requestion a connection +
+ + + + responseToConnectionRequest( + true, + requestConnection?.hostname, + requestConnection.interactionId + ) + } + > + accept + + + responseToConnectionRequest( + false, + requestConnection?.hostname, + requestConnection.interactionId + ) + } + > + decline + + + + )} + {extState === "web-app-request-authentication" && !isMainWindow && ( + <> + +
+ +
+ + + The Application

{" "} + {requestConnection?.hostname}

+ requests authentication +
+ + + + + + Authenticate + + + { + setExtstate("create-wallet"); + }} + > + Create account + + + )} + {extState === "wallets" && ( + <> + + + { + setRawWallet(null); + setExtstate("not-authenticated"); + logoutFunc(); + }} + src={Return} + /> + + + + )} + {rawWallet && extState === "wallet-dropped" && ( + <> + + + { + setRawWallet(null); + setExtstate("wallets"); + logoutFunc(); + }} + src={Return} + /> + + +
+ +
+ + + + {rawWallet?.name ? rawWallet?.name : rawWallet?.address0} + + + + Authenticate + + + + + <> + + Wallet Password + + + setAuthenticatePassword(e.target.value)} + onKeyDown={(e) => { + if (e.key === "Enter") { + authenticateWallet(); + } + }} + ref={passwordRef} + /> + {useLocalNode ? ( + <> + + + {"Using node: "} {currentNode?.url} + + + ) : ( + <> + + + {"Using public node"} + + + )} + + + + Authenticate + + {walletToBeDecryptedError} + + + )} + {extState === "download-wallet" && ( + <> + + + + + +
+ +
+ + + + Download Account + + + + {!walletToBeDownloaded && ( + <> + + Confirm Wallet Password + + + + setWalletToBeDownloadedPassword(e.target.value) + } + /> + + + Confirm password + + {walletToBeDownloadedError} + + )} + + {walletToBeDownloaded && ( + <> + { + await saveFileToDiskFunc(); + await showInfo({ + message: `Keep your account file secure.`, + }); + }} + > + Download account + + + )} + + )} + {extState === "create-wallet" && ( + <> + {!walletToBeDownloaded && ( + <> + + + { + if (creationStep === 2) { + setCreationStep(1); + return; + } + setExtstate("not-authenticated"); + setShowSeed(false); + setCreationStep(1); + setWalletToBeDownloadedPasswordConfirm(""); + setWalletToBeDownloadedPassword(""); + }} + src={Return} + /> + + +
+ +
+ + + Set up your Qortal account + + + + + + A ‘{" "} + { + setShowSeed(true); + }} + style={{ + fontSize: "14px", + color: "steelblue", + cursor: "pointer", + }} + > + SEEDPHRASE + {" "} + ’ has been randomly generated in the background. + + + If you wish to VIEW THE SEEDPHRASE, click the word + 'SEEDPHRASE' in this text. Seedphrases are used to + generate the private key for your Qortal account. For + security by default, seedphrases are NOT displayed unless + specifically chosen. + + + Create your Qortal account by clicking{" "} + + NEXT + {" "} + below. + + + { + setCreationStep(2); + }} + > + Next + + +
+ +
+ + + + + Your seedphrase + + + + {generatorRef.current?.parsedString} + + + + Export Seedphrase + + + + + + + +
+ + + + Wallet Password + + + + setWalletToBeDownloadedPassword(e.target.value) + } + /> + + + Confirm Wallet Password + + + + setWalletToBeDownloadedPasswordConfirm(e.target.value) + } + /> + + + There is no minimum length requirement + + + + + Create Account + + + {walletToBeDownloadedError} + + )} + + {walletToBeDownloaded && ( + <> + + + + + Congrats, you’re all set up! + + + + + + Save your account in a place where you will remember it! + + + + { + await saveFileToDiskFunc(); + returnToMain(); + await showInfo({ + message: `Keep your wallet file secure.`, + }); + }} + > + Backup Account + + + )} + + )} + {isOpenSendQortSuccess && ( + + + + + + The transfer was succesful! + + + { + returnToMain(); + }} + > + Continue + -
- )} - {isSettingsOpen && ( - - )} - - - {renderProfileLeft()} - - - - + )} + {extState === "transfer-success-request" && ( + <> + + + + + The transfer was succesful! + + + { + window.close(); + }} + > + Continue + + + )} + {extState === "buy-order-submitted" && ( + <> + + + + + Your buy order was submitted + + + { + window.close(); + }} + > + Close + + + )} + {countdown && ( + + {/* */} + { + window.close(); + }} + size={75} + strokeWidth={8} + > + {({ remainingTime }) => {remainingTime}} + + + )} + {isLoading && } + {isShow && ( + + + {message.paymentFee ? "Payment" : "Publish"} + + + + {message.message} + + {message?.paymentFee && ( + + payment fee: {message.paymentFee} + + )} + {message?.publishFee && ( + + publish fee: {message.publishFee} + + )} + + + + + + + )} + {isShowInfo && ( + + + {"Important Info"} + + + + {messageInfo.message} + + + + + + + )} + {isShowUnsavedChanges && ( + + {"LOGOUT"} + + + {messageUnsavedChanges.message} + + + + + + + + )} + {isShowQortalRequestExtension && isMainWindow && ( + + { + onCancelQortalRequestExtension(); + }} + size={50} + strokeWidth={5} + > + {({ remainingTime }) => {remainingTime}} + + + + + {messageQortalRequestExtension?.text1} + + + {messageQortalRequestExtension?.text2 && ( + <> + + + + {messageQortalRequestExtension?.text2} + + + + + )} + {messageQortalRequestExtension?.text3 && ( + <> + + + {messageQortalRequestExtension?.text3} + + + + + )} + + {messageQortalRequestExtension?.text4 && ( + + + {messageQortalRequestExtension?.text4} + + + )} + + {messageQortalRequestExtension?.html && ( +
+ )} + + + + {messageQortalRequestExtension?.highlightedText} + + + {messageQortalRequestExtension?.json && ( + <> + + + + + + )} + + {messageQortalRequestExtension?.fee && ( + <> + + + + {"Fee: "} + {messageQortalRequestExtension?.fee} + {" QORT"} + + + + )} + {messageQortalRequestExtension?.appFee && ( + <> + + {"App Fee: "} + {messageQortalRequestExtension?.appFee} + {" QORT"} + + + + )} + {messageQortalRequestExtension?.foreignFee && ( + <> + + + + {"Foreign Fee: "} + {messageQortalRequestExtension?.foreignFee} + + + + )} + {messageQortalRequestExtension?.checkbox1 && ( + + { + qortalRequestCheckbox1Ref.current = e.target.checked; + }} + edge="start" + tabIndex={-1} + disableRipple + defaultChecked={ + messageQortalRequestExtension?.checkbox1?.value + } + sx={{ + "&.Mui-checked": { + color: "white", // Customize the color when checked + }, + "& .MuiSvgIcon-root": { + color: "white", + }, + }} + /> + + + {messageQortalRequestExtension?.checkbox1?.label} + + + )} + + + + onOkQortalRequestExtension("accepted")} + > + accept + + onCancelQortalRequestExtension()} + > + decline + + + {sendPaymentError} + +
+ )} + {isSettingsOpen && ( + + )} + + + {renderProfileLeft()} + + + + {extState === "create-wallet" && walletToBeDownloaded && ( - { - showTutorial('important-information', true) - }} sx={{ - position: 'fixed', - bottom: '25px', - right: '25px' - }}> - - + { + showTutorial("important-information", true); + }} + sx={{ + position: "fixed", + bottom: "25px", + right: "25px", + }} + > + + )} - {isOpenMinting && ( - - )} + {isOpenMinting && ( + + )} + ); }