/** * @deprecated */ import React, { useState } from 'react'; import Alert from './alert'; function MnemonicWallet(props: any) { const role = props.role; const [mnemonic, setMnemonic] = useState(''); const [mnemonicIndex, setMnemonicIndex] = useState(0); const [password, setPassword] = useState(''); const handleError = () => { Alert('error', 'Wallet Decrypt Error', 'Please ensure there are no carriage returns.'); } const handleMnemonic = (e: any) => { setMnemonic(e.target.value); } const handleMnemonicIndex = (e: any) => { setMnemonicIndex(parseInt(e.target.value)); } const handlePassword = (e:any) => { setPassword(e.target.value); } const unlockWallet = async () => { console.log("unlock by mnemonic"); // console.log("mnemonic: %o", mnemonic); // console.log("mnemonic index: %o", mnemonicIndex); // const address = await Account.addWalletByMnemonic(mnemonic, mnemonicIndex, password); // if (address !== "error") { // console.log("wallet add success: %o", address); // // show loading state // props.onWalletLoadingCallback(); // // update context // initParams(address, AccountType.MNEMONIC); // await updateRole(address, role); // updateAuth(); // // no error // // call parent function to redirect to dashboard // props.onSuccessCallback(); // } else { // handleError(); // } }; return (