Hello, I am getting a 400 anytime I try to use the Web3API, I am using hardhat local dev chain and am connected by proxy to the server but I cannot get anything to work. https://admin.moralis.io/web3Api queries work fine but anything from my react moralis app does not work.
authenticate() works fine with metamask
I am on Linux Mint as well if that matters.
import React, {createContext, useEffect, useState } from âreactâ;
import { useForm } from âreact-hook-formâ;
import { useMoralis,useMoralisWeb3Api, useMoralisWeb3ApiCall } from âreact-moralisâ
import {abi} from ââŚ/abi/abiâ
const CONTRACT_ADDRESS = â0xCD8a1C3ba11CF5ECfa6267617243239504a98d90â //deploy to hardhat after compile then add contractaddress here
const contractAbi = abi.abi //exported abi for now
export const ContractContext = createContext();
export function ContractProvider(props) {
const [contract, setContract] = useState()
const options = {
chain: "hardhat",
address: "0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266",
};
const {authenticate, logout,isInitialized, isAuthenticated,authError, hasAuthError,user, enableWeb3,isAuthenticating, isWeb3Enabled, Moralis, web3} = useMoralis()
const Web3API = useMoralisWeb3Api();
useEffect( ()=>{
if (isInitialized) {
enableWeb3();
setContract(new web3.eth.Contract(contractAbi, CONTRACT_ADDRESS))
const getPrice = async () => {
try{
await Web3API.token.getTokenPrice({address: "0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266", chain: "bsc"})
}catch(e){
console.log(e)
}
}
getPrice();
}
}, [isInitialized, Moralis]);
if (!isInitialized) {
return null;
}
return (
<ContractContext.Provider value={{contract}}>
{props.children}
</ContractContext.Provider>
)
}