Comments (27)
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.
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.
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.
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.
@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.
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.
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.
I copied the changes you commited on your fork, @jdohm, and that fixed the issue for me. Thank you.
from eth-todo-list.
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.
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.
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.
I confirm, I got same error. I tried many things but same result...
Help please ? thanks
from eth-todo-list.
@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.
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.
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.
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.
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.
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.
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 latestI was able to get it working by
<script src="vendor/web3/dist/web3.js"></script>
. Try runningnpm 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.
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.
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.
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.
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.
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.
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.
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.
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)
- Metamask stopped injecting Web3 | (intermediate value).toBigNumber is not a function | The send transactions "from" field must be defined | Web3 is not a constructor HOT 1
- Uncaught (in promise) Error: The send transactions "from" field must be defined! HOT 2
- App.js not running properly on the client side HOT 5
- `npm sudo run dev` not working
- taskCount() is not a function error HOT 2
- On task completion, getting error "send transactions from field must be defined!" HOT 1
- A 'return' statement can only be used within a function body.
- Blockchain
- web3.min.js:1 Uncaught (in promise) Error: invalid address HOT 1
- I Get the 'Insufficient funds' message when I try to create a task HOT 1
- Did not detect a `bs-config.json` or `bs-config.js` override file. HOT 1
- Unable to get Metamask to sign off a transaction.
- Metamask not popping up to confirm the transaction HOT 2
- Updated working version HOT 3
- .deployed() is not a function HOT 10
- function createtask of the smart contract
- web3 no longer supported by Metamask HOT 1
- Truffle test error "TypeError: Cannot read properties of undefined (reading 'address')"
- TruffleContract is not define HOT 1
- uncaught (in promise) TypeError: Cannot set properties of undefined (setting 'TodoList')
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from eth-todo-list.