I seem to be experiencing a problem. When I run the following function whilst user is logged in, I keep getting the above error. The odd thing is that I am able to display the users’ address through alert(user.get('ethAddress'))
, hence it is not an authentication issue that I am having.
However, when I include const balance = await Moralis.Web3API.account.getNativeBalance()
in the function I keep getting 'TypeError: Cannot read properties of undefined (reading ‘account’) ’
async function abc() {
let user = Moralis.User.current();
alert(user.get('ethAddress'))
const balance = await Moralis.Web3API.account.getNativeBalance();
alert(balance.balance)
Some help would be appreciated