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
              
            -
| 
         How do I fix "Cannot read properties of undefined (reading 'toHexString')" in Lesson 5?  | 
  
Beta Was this translation helpful? Give feedback.
      
      
          Answered by
          
            TatyOko28
          
      
      
        Feb 9, 2025 
      
    
    Replies: 1 comment
-
| 
         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()); //  WorksIf this happens with a transaction or a return value, ensure it is correctly assigned.  | 
  
Beta Was this translation helpful? Give feedback.
                  
                    0 replies
                  
                
            
      Answer selected by
        houstonTaleubou
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
        
    
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():
If this happens with a transaction or a return value, ensure it is correctly assigned.