Skip to content

Lesson 8: TypeError when getBalance #1985

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

You must be logged in to vote

Hi @EngrPips, yes i have everything installed. Solved this after tinkering around in chatgpt for some time.

The problem was with index.js. It suggested that the issue is that in ethers v6 they changed some names or something. It said they renamed Web3Provider to BrowserProvider. There was also a problem with ethers.utils, so i changed the code there as well. Now everything works fine.

This is the final code of index.js:

import { ethers } from "./ethers-6.7.esm.min.js"
import { abi, contractAddress } from "./constants.js"

const connectButton = document.getElementById("connectButton")
const withdrawButton = document.getElementById("withdrawButton")
const fundButton = document.getElementById(

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@mskhno
Comment options

Answer selected by mskhno
@EngrPips
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
2 participants