-
Notifications
You must be signed in to change notification settings - Fork 390
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
Is there a way to get this to work? Cascading errors: web3.eth.Contract is not a constructor // TypeError: Cannot read properties of undefined (reading 'toWei') #40
Comments
I worked on it for a while and I think it's dead for now because they
deleted the command request from web3 so therefore the basis of the entire
search engine doesn't work because it can no longer use the command request
…On Wed, Jun 8, 2022, 8:16 PM noob1ing ***@***.***> wrote:
*When I try to npm run start this code I get this error:*
------------------------------
TypeError: web3.eth.Contract is not a constructor
at Object. (C:\Users\John\demos\DAAP university\TAKE
2\price-bot\index.js:31:27)
at Module._compile (node:internal/modules/cjs/loader:1105:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Function.executeUserEntryPoint [as runMain]
(node:internal/modules/run_main:77:12)
at node:internal/main/run_main_module:17:47
------------------------------
*If I change the constructor format from*
*const uniswapFactoryContract = new web3.eth.Contract(UNISWAP_FACTORY_ABI,
UNISWAP_FACTORY_ADDRESS)*
to
const uniswapFactoryContract = web3.eth.contract(UNISWAP_FACTORY_ABI,
UNISWAP_FACTORY_ADDRESS)
*then I get this error*
TypeError: Cannot read properties of undefined (reading 'toWei')
at monitorPrice (C:\Users\John\demos\DAAP university\TAKE
2\price-bot\index.js:73:31)
at Timeout._onTimeout (C:\Users\John\demos\DAAP university\TAKE
2\price-bot\index.js:112:48)
at listOnTimeout (node:internal/timers:559:17)
at processTimers (node:internal/timers:502:7)
is this tutorial dead or is there a way to make this code run?
—
Reply to this email directly, view it on GitHub
<#40>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AYFHBWJEMD356PZN523V6R3VOFHX5ANCNFSM5YIOLACQ>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
Thanks for your help |
For this Error: TypeError: Cannot read properties of undefined (reading 'toWei') Change all occurrences of web3.utils.toWei To web3.toWei |
I got it to work with this: https://web3js.readthedocs.io/en/v1.8.2/web3-eth-contract.html#eth-contract
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When I try to npm run start this code I get this error:
TypeError: web3.eth.Contract is not a constructor
at Object. (C:\Users\John\demos\DAAP university\TAKE 2\price-bot\index.js:31:27)
at Module._compile (node:internal/modules/cjs/loader:1105:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12)
at node:internal/main/run_main_module:17:47
If I change the constructor format from
const uniswapFactoryContract = new web3.eth.Contract(UNISWAP_FACTORY_ABI, UNISWAP_FACTORY_ADDRESS)
to
const uniswapFactoryContract = web3.eth.contract(UNISWAP_FACTORY_ABI, UNISWAP_FACTORY_ADDRESS)
then I get this error
TypeError: Cannot read properties of undefined (reading 'toWei')
at monitorPrice (C:\Users\John\demos\DAAP university\TAKE 2\price-bot\index.js:73:31)
at Timeout._onTimeout (C:\Users\John\demos\DAAP university\TAKE 2\price-bot\index.js:112:48)
at listOnTimeout (node:internal/timers:559:17)
at processTimers (node:internal/timers:502:7)
is this tutorial dead or is there a way to make this code run?
The text was updated successfully, but these errors were encountered: