Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: web3.eth.contract is not a function #8

Open
Rexdomine opened this issue May 16, 2022 · 1 comment
Open

TypeError: web3.eth.contract is not a function #8

Rexdomine opened this issue May 16, 2022 · 1 comment

Comments

@Rexdomine
Copy link

when I run node server.js I get the error below please how can I solve it

Talking with a geth server undefined

/Volumes/Untitled/Conterfix/AuthentiFi/server.js:420
const contract = web3.eth.contract(abiArray);
^

TypeError: web3.eth.contract is not a function
at Object. (/Volumes/Untitled/Conterfix/AuthentiFi/server.js:420:27)
at Module._compile (internal/modules/cjs/loader.js:1063:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
at Module.load (internal/modules/cjs/loader.js:928:32)
at Function.Module._load (internal/modules/cjs/loader.js:769:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)
at internal/main/run_main_module.js:17:47

@MrAnayDongre
Copy link

Try using this :
MyContract = new web3.eth.Contract(abi)

Check out the Docs
When using version 1.0.x you need to pass in the Application Binary Interface, i.e. abi. And use the new keyword.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants