Skip to content

Lesson 10: {entranceFee} displays as [object Promise] in localhost browser #4579

Answered by StroupZ
StroupZ asked this question in Q&A
Discussion options

You must be logged in to vote

Hey guys,

I was able to solve it after some more troubleshooting. I was missing a set of parentheses in my LotteryEntrance.js. I needed to turn this:
async function updateUI() { const entranceFeeFromCall = await getEntranceFee().toString() setEntranceFee(ethers.utils.formatUnits(entranceFeeFromCall, "ether")) }

into this:
async function updateUI() { const entranceFeeFromCall = (await getEntranceFee()).toString() setEntranceFee(ethers.utils.formatUnits(entranceFeeFromCall, "ether")) }

Thank you to all those who took the time to look at this.

Replies: 1 comment

Comment options

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