Open noob1ing opened 2 years ago
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 https://github.com/dappuniversity/price-bot/issues/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
Contract.setProvider(process.env.RPC_URL);
after Line const web3 = new Web3(process.env.RPC_URL)
web3.eth.Contract(
to new Contract(
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_FACTORYADDRESS) 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?