Greetings, Iām working on a side a project involving Moralis and React-Moralis iām using latest versions
hereās my package.json details
āmoralisā: ā^0.0.37ā,
āreact-moralisā: ā^0.2.1ā
Iām using yarn for package management and I made sure that i have upgraded properly from 0.2.0 to 0.2.1 same goes for the moralis package.
Just to be sure i even removed them and re-added them using the appropriate yarn commands still didnāt resolve my issue.
Hereās an example component which I created to test the new functionality which was nicely provided, much appreceated.
Both getNativeBalanceQuery.fetch() and Moralis.Web3API.account.getNativeBalance() fail with the same error
{ācodeā:141,āerrorā:āInvalid function: āgetNativeBalanceāā}
Any help will be highly appreciated, thanks in advance.
import React from 'react'
import { useMoralis,useMoralisWeb3Api, useMoralisWeb3ApiCall } from "react-moralis"
const Charts = () => {
const { native: { getBlock }, account: { getNativeBalance } } = useMoralisWeb3Api();
const getNativeBalanceQuery = useMoralisWeb3ApiCall(getNativeBalance, {
address:"0xaA44AAEf36D866BA4fe9Def5d11426B9A87115E1",
});
const {authenticate, logout, isAuthenticated,authError, hasAuthError,user, enableWeb3,isAuthenticating, isWeb3Enabled, Moralis, web3} = useMoralis()
return (
{isAuthenticated && isWeb3Enabled ?
<>
<button onClick={ async ()=>{
console.log(Moralis.Web3API);
//Neither this worked
console.log(await Moralis.Web3API.account.getNativeBalance({chain:"0x61",address:"0xaA44AAEf36D866BA4fe9Def5d11426B9A87115E1"}))
//Or this worked both result in same error.
getNativeBalanceQuery.fetch()
}}>Test func
</>
: null}
)
}
export default Charts