I want users to login with just username and password and the option of authenticate() once inside the app
I say that because the logout() function is the same for crypto and non-crypto and so far once logged into app with username & then running authenticate() the user essentially changes
what would you expect to happen when someone is logged in and uses authenticate?
Well I want to be still logged into (non-crypto) username and THEN connect to metamask simultaneously to make transactions if that makes sense
web3 = await Moralis.enable()
may work without authenticate()
That worked without the ‘await’ keyword & ‘const’ but I had to import web3… there’s no Moralis.disable() function? Thanks anyways
the funny thing is I imported with a lowercase and i’m not even sure if it makes sense
import web3 from 'web3'
Okay ignore my previous 2 posts I finally found out what I needed (except for disconnect account function), I’m also not the only one on this site interested in how to tell if metamask account has the ability to make transactions or not on current page (window.ethereum is true on literally any webpage if youre logged into metamask i think)
import React from 'react'
import './Wallet.css'
import { Button } from 'react-bootstrap'
const Wallet = () => {
const Moralis = require('moralis')
const web3mm = async () =>{ await Moralis.enable()}
const web3wc = async () =>{ await Moralis.enable({provider: 'walletconnect'})}
const whichbutton = () => {
if (window.ethereum._state.accounts > ['']) {
return(
<Button variant="danger" >
Disconnect
</Button>
)} else {
return(
<div>
<Button className='meta' onClick={web3mm}>Metamask</Button> { }
<Button onClick={web3wc}>WalletConnect</Button>
</div>
)
}
}
return(
<div className="wallet-page">
<h1 className="main-card-title">Wallet: </h1>
<div className="walletmaincard">
<div className='walletdiv'>
<div className="wallet-card">
<h4>Current Wallet: </h4>
<ul>
<li>Provider: MetaMask </li>
<li>Address: #3242342423</li>
<li>Balance: $300,000</li>
<div className="gap-2">
<li><Button variant='dark' size='lg'><span>Token Switch</span></Button></li>
<li>{whichbutton()}</li>
</div>
</ul>
</div>
</div>
</div>
</div>
)
}
export default Wallet