aboutsummaryrefslogtreecommitdiffstats
path: root/app/scripts/inpage.js
diff options
context:
space:
mode:
Diffstat (limited to 'app/scripts/inpage.js')
-rw-r--r--app/scripts/inpage.js11
1 files changed, 10 insertions, 1 deletions
diff --git a/app/scripts/inpage.js b/app/scripts/inpage.js
index 88831c0cc..72f7033f9 100644
--- a/app/scripts/inpage.js
+++ b/app/scripts/inpage.js
@@ -71,7 +71,16 @@ inpageProvider.isApproved = function () {
}
inpageProvider.isUnlocked = function () {
-
+ return new Promise((resolve, reject) => {
+ window.addEventListener('metamaskunlockstatus', ({ detail }) => {
+ if (typeof detail.error !== 'undefined') {
+ reject(detail.error)
+ } else {
+ resolve(!!detail.isUnlocked)
+ }
+ })
+ window.postMessage({ type: 'METAMASK_UNLOCK_STATUS' }, '*')
+ })
}
// Work around for web3@1.0 deleting the bound `sendAsync` but not the unbound