TypeError: Cannot read properties of undefined (reading 'toString') #1054
-
Once I click the connect wallet button this error is displayed : |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 30 replies
-
Is your getEntranceFee the same as this one? If not, copying the code below should fix it. Cheers! const { runContractFunction: getEntranceFee } = useWeb3Contract({
abi: abi,
contractAddress: raffleAddress, // specify the networkId
functionName: "getEntranceFee",
params: {},
}) |
Beta Was this translation helpful? Give feedback.
-
Promise returned by Could you include the code that shows what |
Beta Was this translation helpful? Give feedback.
-
@yatinkhandelwal go to |
Beta Was this translation helpful? Give feedback.
-
I got the same error. After doing a lot of logging and debugging, I got to know that chain id should be "31337", but in metamask, chain id is 1337 corresponding to my localhost network. So I changed it to 31337 ( by going into metamask settings -> Networks -> Localhost 8545 -> Chain ID ) And refreshed the page. |
Beta Was this translation helpful? Give feedback.
@yatinkhandelwal go to
constants/abi.json
file and then presscommand press
orcontrol press
and paste thisgetEntranceFee
. Let me know if you find it or not.