-
-
Notifications
You must be signed in to change notification settings - Fork 775
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
[WIP] Added support for EIP-1102 #2548
Conversation
@owocki Can we get to know from the metamask team,
|
Codecov Report
@@ Coverage Diff @@
## master #2548 +/- ##
=========================================
- Coverage 28.65% 28.6% -0.05%
=========================================
Files 163 163
Lines 13097 13097
Branches 1753 1753
=========================================
- Hits 3753 3747 -6
- Misses 9244 9250 +6
Partials 100 100
Continue to review full report at Codecov.
|
Not sure if it makes more sense
cc @owocki
I think the code above would take care |
@thelostone-mc |
Relevant: https://github.com/portis-project/cryptoauth @thelostone-mc @SaptakS @owocki What does everything think of this repo? |
i donno, you could ask around or log an issue on their github issue board |
i could probably manage/create a list in localstorage |
@@ -63,6 +63,9 @@ | |||
<title>{% if title %}{{title}}{% else %}{% trans "Grow Open Source" %}{% endif %} | Gitcoin</title> | |||
{% include 'shared/favicon.html' %} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
from the metamask blog post about preparing your dapp for EIP 1102
Previously, dapps would access the MetaMask provider by using window.web3.currentProvider. While this will still work, the new, standard way to access the Ethereum provider in a Web browser is to use window.ethereum.
I dont see any updates for this in this repo...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, I completely missed this. Will make the updates.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@owocki where is web3.currentProvider used and for what purpose?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Searching 18920 files for "currentProvider"
/Users/kevinowocki/Sites/gitcoin/web/app/assets/ens/index.js:
4 var method = 'personal_sign';
5
6: web3.currentProvider.sendAsync({
7 method,
8 params,
/Users/kevinowocki/Sites/gitcoin/web/app/assets/onepager/js/web3alert.js:
25 };
26 var metaMaskWarning = function() {
27: if (typeof web3 == 'undefined' || !web3.currentProvider || !web3.currentProvider.isMetaMask) {
28 if (typeof document.suppressweb3alert != 'undefined') {
29 _alert({ message: gettext('You must install <a href=https://metamask.io/>Metamask</a> to use this tool.') }, 'info');
/Users/kevinowocki/Sites/gitcoin/web/app/assets/v2/js/truncate-hash.js:
70 new metamaskAddress();
71
72: web3.currentProvider.publicConfigStore.on('update', function(e) {
73 new metamaskAddress();
74 });
/Users/kevinowocki/Sites/gitcoin/web/app/assets/v2/js/pages/kudos_send.js:
561 }
562
563: // web3.currentProvider.publicConfigStore.on('update', function(e) {
564 var error;
565
...
572 var network = e ? e.networkVersion : web3.version.network;
573
574: console.log(web3.currentProvider);
575 if (network === '4' || network === '1') {
576 console.log(network);
/Users/kevinowocki/Sites/gitcoin/web/app/assets/v2/js/pages/wallet_estimate.js:
1 window.addEventListener('load', function() {
2: if (web3.currentProvider.isTrust) {
3 $('#trust_label').show();
4 } else {
You can find the answer by grepping the codebase. I dont know more about the 'why' than you do.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@owocki From my discussions with @PumpkingWok, It is most probably updated only in the below case:
if (window.ethereum) {
window.web3 = new Web3(window.ethereum) // updated case
try {
await window.ethereum.enable()
} catch (error) {
console.error(error)
console.error(`Refresh the page to approve/reject again`)
window.web3 = null
}
} else if(window.web3) { // for legacy dapp browsers
window.web3 = new Web3(window.web3.currentProvider)
}
This is also the only example given in the blog post as well.
Ah I was thinking of doing the same. |
yes i agree. we'll have to figure out a way to manage that... or move it into a v2 ticket |
Metamask has provided a way to check if a user has approved in metamask. It had a bug in the older build. Updating to latest build seems to solve it. I will get this done by tomorrow. |
Can we put this into the existing web3 listener? For now we can do simply:
|
@pinkiebell I am not entirely sure that we should do it that way. |
I think this is good to test now. |
@usmanmuhd DM-ed you a few changes ! Could you get that done too ? |
QA notes:
|
@thelostone-mc How do I handle the metamask connection request on kudos, tips and ens? |
@owocki @thelostone-mc I guess this is good to go (except for |
you can just use the same styles as exists on bounties, no? i think we need to handle this before shipping |
testing now |
@owocki I handled it using |
this is awesome! just tested and it seems really good.. merging now, will deploy monday |
Thanks, waiting to use it! |
Thanks man for updating the faucet banners ^_^ |
Fixes #1964