Hey I am trying to init a contract using
await window.tronWeb.contract().at(“TUVXi6oCYEy3mya2UxBBMBMc1A4G5Hqdpk”)
I am using code in useEffect and it gives me
create:1 Uncaught (in promise) Unknown error: {}
any idea earlier it was working
Hey I am trying to init a contract using
await window.tronWeb.contract().at(“TUVXi6oCYEy3mya2UxBBMBMc1A4G5Hqdpk”)
I am using code in useEffect and it gives me
create:1 Uncaught (in promise) Unknown error: {}
any idea earlier it was working
I am using reference form here
Here is a useEffect code
// Init Contract
const [nusicContract, setNusicContract] = useState();
useEffect(() => {
(async () => {
setNusicContract(
await window.tronWeb.contract().at(nusicContractAddress)
);
})();
return () => {
console.log("Cleanup");
};
}, [nusicContract]);
@admin.hackathon @support.hackathon Might be able to help you.
I need some helps guys. this error breaks my flow
Here is the answer for this when you deploy you contract on testnets but your wallet is in mainnet
then we can’t load the contract but I guess TRON not returns right error message
so whenever you are using above code PLEASE remember that you are on Right NETWORK
in my case my deployed contract are on NILE Testnets and my wallet is in MAINNET
I fix this issue by using this code
if (!nusicContract) {
toast.error(“Please switch to NILE testnet”);
setLoading(false);
return;
}
change message according to you use case
you can always ping me over here or twitter if you need any help