Skip to content

Lesson 7: TypeError: Cannot read properties of undefined (reading 'getBalance') #5967

Answered by Nlferu
TLBTrung-222 asked this question in Q&A
Discussion options

You must be logged in to vote

Hello @TLBTrung-222

First solution: downgrade your ethers to 5.x.x

Second Solution: Ethers version 6 uses getAddress() function to retrieve the contract address, while the previous version 5 uses .address property. If you are still using ethers 6 (seems like you do) then replace .address with .getAddress() and it should fix your issue.

Replies: 2 comments 9 replies

Comment options

You must be logged in to vote
6 replies
@Nlferu
Comment options

Answer selected by TLBTrung-222
@TLBTrung-222
Comment options

@Nlferu
Comment options

@TLBTrung-222
Comment options

@Nlferu
Comment options

Comment options

You must be logged in to vote
3 replies
@tai9856
Comment options

@shureedshazzad
Comment options

@dominicjin
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
6 participants