```ts copy filename="FormattedWalletConnectCode.tsx" import React from 'react'; import { Coin } from '@cosmjs/stargate'; import Button from '@mui/material/Button'; import Paper from '@mui/material/Paper'; import Box from '@mui/material/Box'; import Typography from '@mui/material/Typography'; import TextField from '@mui/material/TextField'; // Connect method on Parent Component const getSignerAccount = async () => { setAccountLoading(true); try { const signer = await signerAccount(mnemonic); const accounts = await signer.getAccounts(); if (accounts[0]) { setAccount(accounts[0].address); } } catch (error) { console.error(error); } setAccountLoading(false); }; // Get Balance on Parent Component const getBalance = useCallback(async () => { setBalanceLoading(true); try { const newBalance = await signerCosmosWasmClient?.getBalance(account, 'unym'); setBalance(newBalance); } catch (error) { console.error(error); } setBalanceLoading(false); }, [account, signerCosmosWasmClient]); const getClients = async () => { setClientLoading(true); try { setSignerCosmosWasmClient(await fetchSignerCosmosWasmClient(mnemonic)); setSignerClient(await fetchSignerClient(mnemonic)); } catch (error) { console.error(error); } setClientLoading(false); }; const connect = () => { getSignerAccount(); getClients(); }; // Get Signner Account on Parent Component const getSignerAccount = async () => { setAccountLoading(true); try { const signer = await signerAccount(mnemonic); const accounts = await signer.getAccounts(); if (accounts[0]) { setAccount(accounts[0].address); } } catch (error) { console.error(error); } setAccountLoading(false); }; export const ConnectWallet = ({ setMnemonic, connect, mnemonic, accountLoading, clientLoading, balanceLoading, account, balance, connectButtonText, }: { setMnemonic: (value: string) => void; connect: () => void; mnemonic: string; accountLoading: boolean; clientLoading: boolean; balanceLoading: boolean; account: string; balance: Coin; connectButtonText: string; }) => { return ( Connect to your account Your account Enter the mnemonic setMnemonic(e.target.value)} fullWidth multiline maxRows={4} sx={{ marginBottom: 3 }} /> {account && balance ? ( Address: {account} Balance: {balance?.amount} {balance?.denom} ) : ( Please, enter your mnemonic to receive your account information )} ); }; ```