I am trying to authenticate and check the current chain balance. but I am getting errors.
const connect = async () => {
if (!isAuthenticated) {
await Moralis.authenticate({
signingMessage: "Log in using Moralis",
})
.then( function (user) {
console.log("logged in user:", user);
setNewaccount(user.get('accounts')[0])
console.log(user.get('accounts')[0])
if (user.get('accounts')[0]) {
try {
const options = { chain: "mumbai", address:user.get('accounts')[0] };
const balances = Moralis.Web3API.account.getTokenBalances(options)
console.log(balances)
} catch (error) {
console.log(error)
}
}
})
.catch(function (error) {
console.log(error);
toast.error(error.message);
});
}
}