Giter Site home page Giter Site logo

Comments (27)

jdohm avatar jdohm commented on July 16, 2024 29

install web3 (npm install web3) and add

<script src="vendor/web3/dist/web3.js"></script>

above

<script src="vendor/truffle-contract/dist/truffle-contract.js"></script>.

inside the index.html

This is necessary since metamask stopped injecting web3

I'll make a pr after verifying this works :)

from eth-todo-list.

ashubisht avatar ashubisht commented on July 16, 2024 14

install web3 (npm install web3) and add

<script src="vendor/web3/dist/web3.js"></script>

above

<script src="vendor/truffle-contract/dist/truffle-contract.js"></script>.

inside the index.html

This is necessary since metamask stopped injecting web3

I'll make a pr after verifying this works :)

I believe this should be <script src="vendor/web3/dist/web3.min.js"></script> as I still cant find web3.js inside dist of node modules/web3. Its using v1.3.5 while picking up the latest

from eth-todo-list.

jdohm avatar jdohm commented on July 16, 2024 6

okay took me a while but it seems to be necessary now to set the address which is used to send the transaction.
I did this by adding:
web3.eth.defaultAccount = web3.eth.accounts[0]
to the app.js inside the load function.

please keep in mind, I'm doing this tutorial to learn as well :) so my solution probably isn't perfect. I will add a pr and improve if necessary.

from eth-todo-list.

DamienA24 avatar DamienA24 commented on July 16, 2024 2

Hello jdohm,

It's working with version 0.20.6 and adding src in html ;) thanks

Why we use the last version web3, we got this error ?

from eth-todo-list.

jdohm avatar jdohm commented on July 16, 2024 2

@ashubisht as stated above please install version 0.20.6 instead of 1.xx.xx
Version 1.xx.xx is not compatible with this project

from eth-todo-list.

Npascetti avatar Npascetti commented on July 16, 2024 2

Thanks @jdohm for your fixes. I came up with the same solutions after debugging for a couple hours. Should have have just read this issue!! There is still an issue if you change your metamask address between page refreshes. I worked around it by adding window.ethereum.on("accountsChanged", function (accounts) { web3.eth.defaultAccount = accounts[0]; App.account = web3.eth.defaultAccount; });
in the loadAccount method of app.js

from eth-todo-list.

Arun-kc avatar Arun-kc commented on July 16, 2024 1

Ok, @jdohm.I'm pretty new to this, so I'm also learning all these new concepts and workflows. Thanks for sharing your views.

from eth-todo-list.

camerenisonfire avatar camerenisonfire commented on July 16, 2024 1

I copied the changes you commited on your fork, @jdohm, and that fixed the issue for me. Thank you.

from eth-todo-list.

jdohm avatar jdohm commented on July 16, 2024 1

If you want to make a PR feel free to include my work ( web3.eth.defaultAccount = web3.eth.accounts[0] would be better of in the loadAccount method a swell).
It seems however @gwmccubbin isn't that active on his repos.

from eth-todo-list.

evan-fannin avatar evan-fannin commented on July 16, 2024 1

install web3 (npm install web3) and add

<script src="vendor/web3/dist/web3.js"></script>

above

<script src="vendor/truffle-contract/dist/truffle-contract.js"></script>.

inside the index.html

This is necessary since metamask stopped injecting web3

I'll make a pr after verifying this works :)

Confirming that it works when adding this script after running "npm install [email protected]".

from eth-todo-list.

Sudhee-bsp avatar Sudhee-bsp commented on July 16, 2024 1

Confirm by installing this dependency:-

npm install [email protected]

Make sure the order for using it is:-

<script src="vendor/web3/dist/web3.js"></script>
<script src="vendor/truffle-contract/dist/truffle-contract.js"></script>

Then we can use (for address):-

web3.eth.defaultAccount = web3.eth.accounts[0];
console.log(App.account);

Works fine!

from eth-todo-list.

DamienA24 avatar DamienA24 commented on July 16, 2024

I confirm, I got same error. I tried many things but same result...

Help please ? thanks

from eth-todo-list.

Rich2020 avatar Rich2020 commented on July 16, 2024

@jdohm that was the first thing I did - add the web3.js script to the html. However, doing so resulted in another error. It looks like it is the wrong web3 version, but I'm using the one in the tutorial.

from eth-todo-list.

jdohm avatar jdohm commented on July 16, 2024

could you try to clone my fork and see if the same issue arises? I tried running the app and didn't get the #10 error.
As you can see in my pr #12 I used web3.js in version 0.20.6

from eth-todo-list.

jdohm avatar jdohm commented on July 16, 2024

Because it contains braking changes (see Semantic Versioning).

In this case, some functions called from truffle-contracts and in the tutorial code changed.

To use the newest web3 library you have to also update the tutorial code and the used truffle version.

See how to use newer versions in a newer tutorial: github dbank YouTube dbank tutorial

from eth-todo-list.

saraiyakush avatar saraiyakush commented on July 16, 2024

install web3 (npm install web3) and add

<script src="vendor/web3/dist/web3.js"></script>

above

<script src="vendor/truffle-contract/dist/truffle-contract.js"></script>.

inside the index.html

This is necessary since metamask stopped injecting web3

I'll make a pr after verifying this works :)

This worked for me.

from eth-todo-list.

saraiyakush avatar saraiyakush commented on July 16, 2024

okay took me a while but it seems to be necessary now to set the address which is used to send the transaction.
I did this by adding:
web3.eth.defaultAccount = web3.eth.accounts[0]
to the app.js inside the load function.

please keep in mind, I'm doing this tutorial to learn as well :) so my solution probably isn't perfect. I will add a pr and improve if necessary.

I think this should be a separate issue. This issue occurs when invoking the functions in the contract. It has nothing to do with Web3 not available. Anyway, the solution you specified here works i.e. a defaultAccount is needed to be set before calling eth.sendTransaction.

from eth-todo-list.

saraiyakush avatar saraiyakush commented on July 16, 2024

install web3 (npm install web3) and add
<script src="vendor/web3/dist/web3.js"></script>
above
<script src="vendor/truffle-contract/dist/truffle-contract.js"></script>.
inside the index.html
This is necessary since metamask stopped injecting web3
I'll make a pr after verifying this works :)

I believe this should be <script src="vendor/web3/dist/web3.min.js"></script> as I still cant find web3.js inside dist of node modules/web3. Its using v1.3.5 while picking up the latest

I was able to get it working by <script src="vendor/web3/dist/web3.js"></script> . Try running npm ls web3 and verify the dependency is installed.

from eth-todo-list.

ashubisht avatar ashubisht commented on July 16, 2024

install web3 (npm install web3) and add
<script src="vendor/web3/dist/web3.js"></script>
above
<script src="vendor/truffle-contract/dist/truffle-contract.js"></script>.
inside the index.html
This is necessary since metamask stopped injecting web3
I'll make a pr after verifying this works :)

I believe this should be <script src="vendor/web3/dist/web3.min.js"></script> as I still cant find web3.js inside dist of node modules/web3. Its using v1.3.5 while picking up the latest

I was able to get it working by <script src="vendor/web3/dist/web3.js"></script> . Try running npm ls web3 and verify the dependency is installed.

Yes I have already placed in package json. Running the command outputs the web3 presence:

[email protected] /Users/utkarshbisht/block8/eth-todo
├─┬ @truffle/[email protected]
│ ├─┬ @truffle/[email protected]
│ │ └── [email protected] deduped
│ ├─┬ [email protected]
│ │ └── [email protected] deduped
│ └── [email protected] deduped
├─┬ [email protected]
│ ├─┬ @truffle/[email protected]
│ │ └─┬ @truffle/[email protected]
│ │ └─┬ @truffle/[email protected]
│ │ └── [email protected] deduped
│ └─┬ @truffle/[email protected]
│ └── [email protected] deduped
└── [email protected]

from eth-todo-list.

Arun-kc avatar Arun-kc commented on July 16, 2024

okay took me a while but it seems to be necessary now to set the address which is used to send the transaction.
I did this by adding:
web3.eth.defaultAccount = web3.eth.accounts[0]
to the app.js inside the load function.

please keep in mind, I'm doing this tutorial to learn as well :) so my solution probably isn't perfect. I will add a pr and improve if necessary.

This really helped. Thanks @jdohm 👍
Any idea on why this issue occurred?

from eth-todo-list.

jdohm avatar jdohm commented on July 16, 2024

My guess would be that in the past metamask not only injected web3 but also set the default account. But I toke a quick look at the metamask code and couldn't find such a thing so I'm not sure.

from eth-todo-list.

csillabeg avatar csillabeg commented on July 16, 2024

If you want to make a PR feel free to include my work ( web3.eth.defaultAccount = web3.eth.accounts[0] would be better of in the loadAccount method a swell).
It seems however @gwmccubbin isn't that active on his repos.

Hello,

This works for "Uncaught (in promise) error: invalid address" also. Dankeee @jdohm :D

from eth-todo-list.

AnonDeveano avatar AnonDeveano commented on July 16, 2024

Can confirm the web3.eth.defaultAccount = web3.eth.accounts[0] solution works for getting rid of the invalid address error. Now having an issue making the added tasks actually show up but I don't think it's related to this...yet.

Dev error: I didn't redeploy the smart contract which is why the txn were counted in Ganache but literally not showing up on the page. I didn't see the checkbox for the Dapp University task but didn't put it together.

from eth-todo-list.

davappler avatar davappler commented on July 16, 2024

I was having the same issue, I did this command => npm install [email protected]
and added this => <script src="vendor/web3/dist/web3.min.js"></script>
in html file above => <script src="vendor/truffle-contract/dist/truffle-contract.js"></script>
and it worked for me

from eth-todo-list.

MustafaCQN avatar MustafaCQN commented on July 16, 2024

install web3 (npm install web3) and add

<script src="vendor/web3/dist/web3.js"></script>

above

<script src="vendor/truffle-contract/dist/truffle-contract.js"></script>.

inside the index.html

This is necessary since metamask stopped injecting web3

I'll make a pr after verifying this works :)

check if you use web3.js or web3.min.js

from eth-todo-list.

cuongrep avatar cuongrep commented on July 16, 2024

install web3 (npm install web3) and add
<script src="vendor/web3/dist/web3.js"></script>
above
<script src="vendor/truffle-contract/dist/truffle-contract.js"></script>.
inside the index.html
This is necessary since metamask stopped injecting web3
I'll make a pr after verifying this works :)

I believe this should be <script src="vendor/web3/dist/web3.min.js"></script> as I still cant find web3.js inside dist of node modules/web3. Its using v1.3.5 while picking up the latest

This worked for me.

from eth-todo-list.

alok-marathe avatar alok-marathe commented on July 16, 2024

Confirm by installing this dependency:-

npm install [email protected]

Make sure the order for using it is:-

<script src="vendor/web3/dist/web3.js"></script> <script src="vendor/truffle-contract/dist/truffle-contract.js"></script>

Then we can use (for address):-

web3.eth.defaultAccount = web3.eth.accounts[0];
console.log(App.account);

Works fine!

Here you will have to change the console log command to the following:

web3.eth.defaultAccount = web3.eth.accounts[0];
console.log(web3.eth.defaultAccount);

It's obvious, though just telling to make coding more faster :)

from eth-todo-list.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.