Skip to content
This repository was archived by the owner on Mar 5, 2025. It is now read-only.

Lesson 5: TypeError: "Cannot read properties of undefined (reading 'toHexString')” #7458

Answered by TatyOko28
houstonTaleubou asked this question in Q&A
Discussion options

You must be logged in to vote

This error means that an object you are trying to convert to hex (toHexString()) is undefined. Check that the variable is initialized before calling .toHexString():

const value = ethers.BigNumber.from("1000");
console.log(value.toHexString()); //  Works

If this happens with a transaction or a return value, ensure it is correctly assigned.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by houstonTaleubou
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants