diff options
Diffstat (limited to 'app/scripts/inpage.js')
-rw-r--r-- | app/scripts/inpage.js | 11 |
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 |