{"action":"created","comment":{"url":"https://api.github.com/repos/poanetwork/bridge-ui/pulls/comments/224196983","pull_request_review_id":163505572,"id":224196983,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIyNDE5Njk4Mw==","diff_hunk":"@@ -4,31 +4,24 @@ import Web3Utils from 'web3-utils'\n const getWeb3 = () => {\n   return new Promise(function (resolve, reject) {\n     // Wait for loading completion to avoid race conditions with web3 injection timing.\n-    window.addEventListener('load', function () {\n+    window.addEventListener('load',async function () {\n       let web3 = window.web3\n+      const { ethereum } = window\n \n-      // Checking if Web3 has been injected by the browser (Mist/MetaMask)\n-      if (typeof web3 !== 'undefined') {\n-        // Use Mist/MetaMask's provider.\n+      if (ethereum) {\n+        web3 = new window.Web3(ethereum)\n+        try {\n+          // Request account access\n+          await ethereum.enable()\n+          processWeb3(web3, resolve,  reject)\n+        } catch (error) {\n+          console.log(error)\n+          const errorMsg = `Metamask account rejected by user`\n+          reject({message: errorMsg})\n+        }\n+      } else if (typeof web3 !== 'undefined') {\n         web3 = new window.Web3(web3.currentProvider)\n-        web3.version.getNetwork((err, netId) => {\n-          const netIdName = getNetworkName(netId)\n-          console.log(`This is ${netIdName} network.`, netId)\n-          document.title = `${netIdName} - Bridge UI dApp`\n-          const defaultAccount = web3.eth.defaultAccount || null;\n-          if(defaultAccount === null){\n-            reject({message: 'Please unlock your metamask and refresh the page'})\n-          }\n-          const results = {\n-            web3Instance: new Web3(web3.currentProvider),\n-            netIdName,\n-            netId,\n-            injectedWeb3: true,\n-            defaultAccount\n-          }\n-          resolve(results)\n-        })\n-\n+        processWeb3(web3, resolve,  reject)\n       } else {\n         // Fallback to localhost if no web3 injection.\n         const errorMsg = `Metamask is not installed. Please go to","path":"src/stores/utils/web3.js","position":46,"original_position":46,"commit_id":"b85a7897306891db0633092b44117a5d26841b02","original_commit_id":"b85a7897306891db0633092b44117a5d26841b02","user":{"login":"patitonar","id":4614574,"node_id":"MDQ6VXNlcjQ2MTQ1NzQ=","avatar_url":"https://avatars0.githubusercontent.com/u/4614574?v=4","gravatar_id":"","url":"https://api.github.com/users/patitonar","html_url":"https://github.com/patitonar","followers_url":"https://api.github.com/users/patitonar/followers","following_url":"https://api.github.com/users/patitonar/following{/other_user}","gists_url":"https://api.github.com/users/patitonar/gists{/gist_id}","starred_url":"https://api.github.com/users/patitonar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/patitonar/subscriptions","organizations_url":"https://api.github.com/users/patitonar/orgs","repos_url":"https://api.github.com/users/patitonar/repos","events_url":"https://api.github.com/users/patitonar/events{/privacy}","received_events_url":"https://api.github.com/users/patitonar/received_events","type":"User","site_admin":false},"body":"All the `metamask` references (except the new included in this PRs) were addressed on https://github.com/poanetwork/bridge-ui/pull/138/commits/e5edd4dec3e94834f84346c81a1a1b340e786892 on PR https://github.com/poanetwork/bridge-ui/pull/138. So after that PR is merged, this will be solved.","created_at":"2018-10-10T18:42:51Z","updated_at":"2018-10-10T18:42:51Z","html_url":"https://github.com/poanetwork/bridge-ui/pull/142#discussion_r224196983","pull_request_url":"https://api.github.com/repos/poanetwork/bridge-ui/pulls/142","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/poanetwork/bridge-ui/pulls/comments/224196983"},"html":{"href":"https://github.com/poanetwork/bridge-ui/pull/142#discussion_r224196983"},"pull_request":{"href":"https://api.github.com/repos/poanetwork/bridge-ui/pulls/142"}},"in_reply_to_id":224189912},"pull_request":{"url":"https://api.github.com/repos/poanetwork/bridge-ui/pulls/142","id":221094379,"node_id":"MDExOlB1bGxSZXF1ZXN0MjIxMDk0Mzc5","html_url":"https://github.com/poanetwork/bridge-ui/pull/142","diff_url":"https://github.com/poanetwork/bridge-ui/pull/142.diff","patch_url":"https://github.com/poanetwork/bridge-ui/pull/142.patch","issue_url":"https://api.github.com/repos/poanetwork/bridge-ui/issues/142","number":142,"state":"open","locked":false,"title":"Support Metamask changes","user":{"login":"patitonar","id":4614574,"node_id":"MDQ6VXNlcjQ2MTQ1NzQ=","avatar_url":"https://avatars0.githubusercontent.com/u/4614574?v=4","gravatar_id":"","url":"https://api.github.com/users/patitonar","html_url":"https://github.com/patitonar","followers_url":"https://api.github.com/users/patitonar/followers","following_url":"https://api.github.com/users/patitonar/following{/other_user}","gists_url":"https://api.github.com/users/patitonar/gists{/gist_id}","starred_url":"https://api.github.com/users/patitonar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/patitonar/subscriptions","organizations_url":"https://api.github.com/users/patitonar/orgs","repos_url":"https://api.github.com/users/patitonar/repos","events_url":"https://api.github.com/users/patitonar/events{/privacy}","received_events_url":"https://api.github.com/users/patitonar/received_events","type":"User","site_admin":false},"body":"- Add support for new Metamask window.ethereum global variable\r\n- Ignore internal error triggered by web3 (only on new metamask build) that affected the UI.\r\n- Minor fix on Loading screen, after `waiting for block confirmation` message dissapear, also numbers of block confirmation (`8/8`) are removed too  \r\n\r\nCloses #139 ","created_at":"2018-10-08T12:11:51Z","updated_at":"2018-10-10T18:42:51Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b16711d384deef6ac7d1e5ed660ae601a5f86a3b","assignee":{"login":"patitonar","id":4614574,"node_id":"MDQ6VXNlcjQ2MTQ1NzQ=","avatar_url":"https://avatars0.githubusercontent.com/u/4614574?v=4","gravatar_id":"","url":"https://api.github.com/users/patitonar","html_url":"https://github.com/patitonar","followers_url":"https://api.github.com/users/patitonar/followers","following_url":"https://api.github.com/users/patitonar/following{/other_user}","gists_url":"https://api.github.com/users/patitonar/gists{/gist_id}","starred_url":"https://api.github.com/users/patitonar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/patitonar/subscriptions","organizations_url":"https://api.github.com/users/patitonar/orgs","repos_url":"https://api.github.com/users/patitonar/repos","events_url":"https://api.github.com/users/patitonar/events{/privacy}","received_events_url":"https://api.github.com/users/patitonar/received_events","type":"User","site_admin":false},"assignees":[{"login":"patitonar","id":4614574,"node_id":"MDQ6VXNlcjQ2MTQ1NzQ=","avatar_url":"https://avatars0.githubusercontent.com/u/4614574?v=4","gravatar_id":"","url":"https://api.github.com/users/patitonar","html_url":"https://github.com/patitonar","followers_url":"https://api.github.com/users/patitonar/followers","following_url":"https://api.github.com/users/patitonar/following{/other_user}","gists_url":"https://api.github.com/users/patitonar/gists{/gist_id}","starred_url":"https://api.github.com/users/patitonar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/patitonar/subscriptions","organizations_url":"https://api.github.com/users/patitonar/orgs","repos_url":"https://api.github.com/users/patitonar/repos","events_url":"https://api.github.com/users/patitonar/events{/privacy}","received_events_url":"https://api.github.com/users/patitonar/received_events","type":"User","site_admin":false}],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":1025409951,"node_id":"MDU6TGFiZWwxMDI1NDA5OTUx","url":"https://api.github.com/repos/poanetwork/bridge-ui/labels/review","name":"review","color":"ededed","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/poanetwork/bridge-ui/pulls/142/commits","review_comments_url":"https://api.github.com/repos/poanetwork/bridge-ui/pulls/142/comments","review_comment_url":"https://api.github.com/repos/poanetwork/bridge-ui/pulls/comments{/number}","comments_url":"https://api.github.com/repos/poanetwork/bridge-ui/issues/142/comments","statuses_url":"https://api.github.com/repos/poanetwork/bridge-ui/statuses/b85a7897306891db0633092b44117a5d26841b02","head":{"label":"poanetwork:support-metamask-change-#139","ref":"support-metamask-change-#139","sha":"b85a7897306891db0633092b44117a5d26841b02","user":{"login":"poanetwork","id":28943015,"node_id":"MDEyOk9yZ2FuaXphdGlvbjI4OTQzMDE1","avatar_url":"https://avatars2.githubusercontent.com/u/28943015?v=4","gravatar_id":"","url":"https://api.github.com/users/poanetwork","html_url":"https://github.com/poanetwork","followers_url":"https://api.github.com/users/poanetwork/followers","following_url":"https://api.github.com/users/poanetwork/following{/other_user}","gists_url":"https://api.github.com/users/poanetwork/gists{/gist_id}","starred_url":"https://api.github.com/users/poanetwork/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/poanetwork/subscriptions","organizations_url":"https://api.github.com/users/poanetwork/orgs","repos_url":"https://api.github.com/users/poanetwork/repos","events_url":"https://api.github.com/users/poanetwork/events{/privacy}","received_events_url":"https://api.github.com/users/poanetwork/received_events","type":"Organization","site_admin":false},"repo":{"id":121836511,"node_id":"MDEwOlJlcG9zaXRvcnkxMjE4MzY1MTE=","name":"bridge-ui","full_name":"poanetwork/bridge-ui","private":false,"owner":{"login":"poanetwork","id":28943015,"node_id":"MDEyOk9yZ2FuaXphdGlvbjI4OTQzMDE1","avatar_url":"https://avatars2.githubusercontent.com/u/28943015?v=4","gravatar_id":"","url":"https://api.github.com/users/poanetwork","html_url":"https://github.com/poanetwork","followers_url":"https://api.github.com/users/poanetwork/followers","following_url":"https://api.github.com/users/poanetwork/following{/other_user}","gists_url":"https://api.github.com/users/poanetwork/gists{/gist_id}","starred_url":"https://api.github.com/users/poanetwork/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/poanetwork/subscriptions","organizations_url":"https://api.github.com/users/poanetwork/orgs","repos_url":"https://api.github.com/users/poanetwork/repos","events_url":"https://api.github.com/users/poanetwork/events{/privacy}","received_events_url":"https://api.github.com/users/poanetwork/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/poanetwork/bridge-ui","description":"UI for TokenBridge, an interoperability solution between Ethereum networks for native and ERC tokens","fork":false,"url":"https://api.github.com/repos/poanetwork/bridge-ui","forks_url":"https://api.github.com/repos/poanetwork/bridge-ui/forks","keys_url":"https://api.github.com/repos/poanetwork/bridge-ui/keys{/key_id}","collaborators_url":"https://api.github.com/repos/poanetwork/bridge-ui/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/poanetwork/bridge-ui/teams","hooks_url":"https://api.github.com/repos/poanetwork/bridge-ui/hooks","issue_events_url":"https://api.github.com/repos/poanetwork/bridge-ui/issues/events{/number}","events_url":"https://api.github.com/repos/poanetwork/bridge-ui/events","assignees_url":"https://api.github.com/repos/poanetwork/bridge-ui/assignees{/user}","branches_url":"https://api.github.com/repos/poanetwork/bridge-ui/branches{/branch}","tags_url":"https://api.github.com/repos/poanetwork/bridge-ui/tags","blobs_url":"https://api.github.com/repos/poanetwork/bridge-ui/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/poanetwork/bridge-ui/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/poanetwork/bridge-ui/git/refs{/sha}","trees_url":"https://api.github.com/repos/poanetwork/bridge-ui/git/trees{/sha}","statuses_url":"https://api.github.com/repos/poanetwork/bridge-ui/statuses/{sha}","languages_url":"https://api.github.com/repos/poanetwork/bridge-ui/languages","stargazers_url":"https://api.github.com/repos/poanetwork/bridge-ui/stargazers","contributors_url":"https://api.github.com/repos/poanetwork/bridge-ui/contributors","subscribers_url":"https://api.github.com/repos/poanetwork/bridge-ui/subscribers","subscription_url":"https://api.github.com/repos/poanetwork/bridge-ui/subscription","commits_url":"https://api.github.com/repos/poanetwork/bridge-ui/commits{/sha}","git_commits_url":"https://api.github.com/repos/poanetwork/bridge-ui/git/commits{/sha}","comments_url":"https://api.github.com/repos/poanetwork/bridge-ui/comments{/number}","issue_comment_url":"https://api.github.com/repos/poanetwork/bridge-ui/issues/comments{/number}","contents_url":"https://api.github.com/repos/poanetwork/bridge-ui/contents/{+path}","compare_url":"https://api.github.com/repos/poanetwork/bridge-ui/compare/{base}...{head}","merges_url":"https://api.github.com/repos/poanetwork/bridge-ui/merges","archive_url":"https://api.github.com/repos/poanetwork/bridge-ui/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/poanetwork/bridge-ui/downloads","issues_url":"https://api.github.com/repos/poanetwork/bridge-ui/issues{/number}","pulls_url":"https://api.github.com/repos/poanetwork/bridge-ui/pulls{/number}","milestones_url":"https://api.github.com/repos/poanetwork/bridge-ui/milestones{/number}","notifications_url":"https://api.github.com/repos/poanetwork/bridge-ui/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/poanetwork/bridge-ui/labels{/name}","releases_url":"https://api.github.com/repos/poanetwork/bridge-ui/releases{/id}","deployments_url":"https://api.github.com/repos/poanetwork/bridge-ui/deployments","created_at":"2018-02-17T07:36:26Z","updated_at":"2018-10-09T15:08:04Z","pushed_at":"2018-10-10T12:58:05Z","git_url":"git://github.com/poanetwork/bridge-ui.git","ssh_url":"git@github.com:poanetwork/bridge-ui.git","clone_url":"https://github.com/poanetwork/bridge-ui.git","svn_url":"https://github.com/poanetwork/bridge-ui","homepage":"https://bridge.poa.net/","size":45108,"stargazers_count":24,"watchers_count":24,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":27,"mirror_url":null,"archived":false,"open_issues_count":14,"license":{"key":"gpl-3.0","name":"GNU General Public License v3.0","spdx_id":"GPL-3.0","url":"https://api.github.com/licenses/gpl-3.0","node_id":"MDc6TGljZW5zZTk="},"forks":27,"open_issues":14,"watchers":24,"default_branch":"master"}},"base":{"label":"poanetwork:develop","ref":"develop","sha":"f619a4f49ad512d0eb861696bb67858e4c9d30b8","user":{"login":"poanetwork","id":28943015,"node_id":"MDEyOk9yZ2FuaXphdGlvbjI4OTQzMDE1","avatar_url":"https://avatars2.githubusercontent.com/u/28943015?v=4","gravatar_id":"","url":"https://api.github.com/users/poanetwork","html_url":"https://github.com/poanetwork","followers_url":"https://api.github.com/users/poanetwork/followers","following_url":"https://api.github.com/users/poanetwork/following{/other_user}","gists_url":"https://api.github.com/users/poanetwork/gists{/gist_id}","starred_url":"https://api.github.com/users/poanetwork/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/poanetwork/subscriptions","organizations_url":"https://api.github.com/users/poanetwork/orgs","repos_url":"https://api.github.com/users/poanetwork/repos","events_url":"https://api.github.com/users/poanetwork/events{/privacy}","received_events_url":"https://api.github.com/users/poanetwork/received_events","type":"Organization","site_admin":false},"repo":{"id":121836511,"node_id":"MDEwOlJlcG9zaXRvcnkxMjE4MzY1MTE=","name":"bridge-ui","full_name":"poanetwork/bridge-ui","private":false,"owner":{"login":"poanetwork","id":28943015,"node_id":"MDEyOk9yZ2FuaXphdGlvbjI4OTQzMDE1","avatar_url":"https://avatars2.githubusercontent.com/u/28943015?v=4","gravatar_id":"","url":"https://api.github.com/users/poanetwork","html_url":"https://github.com/poanetwork","followers_url":"https://api.github.com/users/poanetwork/followers","following_url":"https://api.github.com/users/poanetwork/following{/other_user}","gists_url":"https://api.github.com/users/poanetwork/gists{/gist_id}","starred_url":"https://api.github.com/users/poanetwork/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/poanetwork/subscriptions","organizations_url":"https://api.github.com/users/poanetwork/orgs","repos_url":"https://api.github.com/users/poanetwork/repos","events_url":"https://api.github.com/users/poanetwork/events{/privacy}","received_events_url":"https://api.github.com/users/poanetwork/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/poanetwork/bridge-ui","description":"UI for TokenBridge, an interoperability solution between Ethereum networks for native and ERC tokens","fork":false,"url":"https://api.github.com/repos/poanetwork/bridge-ui","forks_url":"https://api.github.com/repos/poanetwork/bridge-ui/forks","keys_url":"https://api.github.com/repos/poanetwork/bridge-ui/keys{/key_id}","collaborators_url":"https://api.github.com/repos/poanetwork/bridge-ui/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/poanetwork/bridge-ui/teams","hooks_url":"https://api.github.com/repos/poanetwork/bridge-ui/hooks","issue_events_url":"https://api.github.com/repos/poanetwork/bridge-ui/issues/events{/number}","events_url":"https://api.github.com/repos/poanetwork/bridge-ui/events","assignees_url":"https://api.github.com/repos/poanetwork/bridge-ui/assignees{/user}","branches_url":"https://api.github.com/repos/poanetwork/bridge-ui/branches{/branch}","tags_url":"https://api.github.com/repos/poanetwork/bridge-ui/tags","blobs_url":"https://api.github.com/repos/poanetwork/bridge-ui/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/poanetwork/bridge-ui/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/poanetwork/bridge-ui/git/refs{/sha}","trees_url":"https://api.github.com/repos/poanetwork/bridge-ui/git/trees{/sha}","statuses_url":"https://api.github.com/repos/poanetwork/bridge-ui/statuses/{sha}","languages_url":"https://api.github.com/repos/poanetwork/bridge-ui/languages","stargazers_url":"https://api.github.com/repos/poanetwork/bridge-ui/stargazers","contributors_url":"https://api.github.com/repos/poanetwork/bridge-ui/contributors","subscribers_url":"https://api.github.com/repos/poanetwork/bridge-ui/subscribers","subscription_url":"https://api.github.com/repos/poanetwork/bridge-ui/subscription","commits_url":"https://api.github.com/repos/poanetwork/bridge-ui/commits{/sha}","git_commits_url":"https://api.github.com/repos/poanetwork/bridge-ui/git/commits{/sha}","comments_url":"https://api.github.com/repos/poanetwork/bridge-ui/comments{/number}","issue_comment_url":"https://api.github.com/repos/poanetwork/bridge-ui/issues/comments{/number}","contents_url":"https://api.github.com/repos/poanetwork/bridge-ui/contents/{+path}","compare_url":"https://api.github.com/repos/poanetwork/bridge-ui/compare/{base}...{head}","merges_url":"https://api.github.com/repos/poanetwork/bridge-ui/merges","archive_url":"https://api.github.com/repos/poanetwork/bridge-ui/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/poanetwork/bridge-ui/downloads","issues_url":"https://api.github.com/repos/poanetwork/bridge-ui/issues{/number}","pulls_url":"https://api.github.com/repos/poanetwork/bridge-ui/pulls{/number}","milestones_url":"https://api.github.com/repos/poanetwork/bridge-ui/milestones{/number}","notifications_url":"https://api.github.com/repos/poanetwork/bridge-ui/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/poanetwork/bridge-ui/labels{/name}","releases_url":"https://api.github.com/repos/poanetwork/bridge-ui/releases{/id}","deployments_url":"https://api.github.com/repos/poanetwork/bridge-ui/deployments","created_at":"2018-02-17T07:36:26Z","updated_at":"2018-10-09T15:08:04Z","pushed_at":"2018-10-10T12:58:05Z","git_url":"git://github.com/poanetwork/bridge-ui.git","ssh_url":"git@github.com:poanetwork/bridge-ui.git","clone_url":"https://github.com/poanetwork/bridge-ui.git","svn_url":"https://github.com/poanetwork/bridge-ui","homepage":"https://bridge.poa.net/","size":45108,"stargazers_count":24,"watchers_count":24,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":27,"mirror_url":null,"archived":false,"open_issues_count":14,"license":{"key":"gpl-3.0","name":"GNU General Public License v3.0","spdx_id":"GPL-3.0","url":"https://api.github.com/licenses/gpl-3.0","node_id":"MDc6TGljZW5zZTk="},"forks":27,"open_issues":14,"watchers":24,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/poanetwork/bridge-ui/pulls/142"},"html":{"href":"https://github.com/poanetwork/bridge-ui/pull/142"},"issue":{"href":"https://api.github.com/repos/poanetwork/bridge-ui/issues/142"},"comments":{"href":"https://api.github.com/repos/poanetwork/bridge-ui/issues/142/comments"},"review_comments":{"href":"https://api.github.com/repos/poanetwork/bridge-ui/pulls/142/comments"},"review_comment":{"href":"https://api.github.com/repos/poanetwork/bridge-ui/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/poanetwork/bridge-ui/pulls/142/commits"},"statuses":{"href":"https://api.github.com/repos/poanetwork/bridge-ui/statuses/b85a7897306891db0633092b44117a5d26841b02"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"patitonar"}}