aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorbitpshr <mail@bitpshr.net>2018-10-18 05:45:21 +0800
committerDan Finlay <542863+danfinlay@users.noreply.github.com>2018-11-06 07:07:09 +0800
commit3a2ade4e8490fa754b66e8f342a8308879e2f9ed (patch)
treeabd98629e386464281517f9c705fedde98b82c21 /app
parentc6e9caed225ac395d22f184c6f7ee5d6b3d23c80 (diff)
downloadtangerine-wallet-browser-3a2ade4e8490fa754b66e8f342a8308879e2f9ed.tar
tangerine-wallet-browser-3a2ade4e8490fa754b66e8f342a8308879e2f9ed.tar.gz
tangerine-wallet-browser-3a2ade4e8490fa754b66e8f342a8308879e2f9ed.tar.bz2
tangerine-wallet-browser-3a2ade4e8490fa754b66e8f342a8308879e2f9ed.tar.lz
tangerine-wallet-browser-3a2ade4e8490fa754b66e8f342a8308879e2f9ed.tar.xz
tangerine-wallet-browser-3a2ade4e8490fa754b66e8f342a8308879e2f9ed.tar.zst
tangerine-wallet-browser-3a2ade4e8490fa754b66e8f342a8308879e2f9ed.zip
Update isEnabled check
Diffstat (limited to 'app')
-rw-r--r--app/scripts/inpage.js4
1 files changed, 3 insertions, 1 deletions
diff --git a/app/scripts/inpage.js b/app/scripts/inpage.js
index c5cbcc120..bfafc255d 100644
--- a/app/scripts/inpage.js
+++ b/app/scripts/inpage.js
@@ -29,6 +29,7 @@ var metamaskStream = new LocalMessageDuplexStream({
var inpageProvider = new MetamaskInpageProvider(metamaskStream)
// set a high max listener count to avoid unnecesary warnings
inpageProvider.setMaxListeners(100)
+var originApproved = false
// Augment the provider with its enable method
inpageProvider.enable = function () {
@@ -37,6 +38,7 @@ inpageProvider.enable = function () {
if (typeof detail.error !== 'undefined') {
reject(detail.error)
} else {
+ originApproved = true
inpageProvider.sendAsync({ method: 'eth_accounts', params: [] }, (error, response) => {
if (error) {
reject(error)
@@ -56,7 +58,7 @@ inpageProvider.isEnabled = function () {
if (typeof detail.error !== 'undefined') {
reject(detail.error)
} else {
- resolve(!!detail.isEnabled)
+ resolve(originApproved && !!detail.isEnabled)
}
})
window.postMessage({ type: 'ETHEREUM_QUERY_STATUS' }, '*')