import React, { useState } from "react"; import { TouchableOpacity, View } from "react-native"; import { Button, Link, Typography } from "@mui/material"; import Dialog from "@mui/material/Dialog"; import DialogTitle from "@mui/material/DialogTitle"; import DialogContent from "@mui/material/DialogContent"; import DialogActions from "@mui/material/DialogActions"; import styles from "../styles/stylesheet"; import { getPathKey } from "../utils/misc"; import { useNetworks } from "../context/NetworksContext"; import { useAccounts } from "../context/AccountsContext"; const ShowPKDialog = () => { const { currentIndex } = useAccounts(); const { selectedNetwork } = useNetworks(); const [privateKey, setPrivateKey] = useState(); const [showPKDialog, setShowPKDialog] = useState(false); const handleShowPrivateKey = async () => { const pathKey = await getPathKey( `${selectedNetwork!.namespace}:${selectedNetwork!.chainId}`, currentIndex, ); setPrivateKey(pathKey.privKey); }; const hideShowPKDialog = () => { setShowPKDialog(false); setPrivateKey(undefined); }; return ( <> { setShowPKDialog(true); }} > Show Private Key {!privateKey ? ( Show Private Key? ) : ( Private Key )} {privateKey && ( {privateKey} )} Warning: Never disclose this key. Anyone with your private keys can steal any assets held in your account. {!privateKey ? ( <> ) : ( )} ); }; export default ShowPKDialog;