aboutsummaryrefslogtreecommitdiffstats
path: root/app/scripts
diff options
context:
space:
mode:
authorbitpshr <mail@bitpshr.net>2018-11-08 00:31:21 +0800
committerDan Finlay <542863+danfinlay@users.noreply.github.com>2018-11-08 00:47:25 +0800
commit718393f89a1bf99ff15bdfe1aa5c4301fbd56621 (patch)
treee34cba1bc042508f2b30bb83e641e4458252dd27 /app/scripts
parenta224b71837a09af28213b5f6d3ac46a2416428e0 (diff)
downloadtangerine-wallet-browser-718393f89a1bf99ff15bdfe1aa5c4301fbd56621.tar
tangerine-wallet-browser-718393f89a1bf99ff15bdfe1aa5c4301fbd56621.tar.gz
tangerine-wallet-browser-718393f89a1bf99ff15bdfe1aa5c4301fbd56621.tar.bz2
tangerine-wallet-browser-718393f89a1bf99ff15bdfe1aa5c4301fbd56621.tar.lz
tangerine-wallet-browser-718393f89a1bf99ff15bdfe1aa5c4301fbd56621.tar.xz
tangerine-wallet-browser-718393f89a1bf99ff15bdfe1aa5c4301fbd56621.tar.zst
tangerine-wallet-browser-718393f89a1bf99ff15bdfe1aa5c4301fbd56621.zip
Cleanup
Diffstat (limited to 'app/scripts')
-rw-r--r--app/scripts/inpage.js28
1 files changed, 10 insertions, 18 deletions
diff --git a/app/scripts/inpage.js b/app/scripts/inpage.js
index 785237ff5..a7c0b0416 100644
--- a/app/scripts/inpage.js
+++ b/app/scripts/inpage.js
@@ -54,12 +54,12 @@ var inpageProvider = new MetamaskInpageProvider(metamaskStream)
inpageProvider.setMaxListeners(100)
// set up a listener for when MetaMask is locked
-onMessage('metamasksetlocked', ({ data: { type } }) => { isEnabled = false })
+onMessage('metamasksetlocked', () => { isEnabled = false })
// augment the provider with its enable method
inpageProvider.enable = function ({ force } = {}) {
return new Promise((resolve, reject) => {
- providerHandle = ({ data: { type, error } }) => {
+ providerHandle = ({ data: { error } }) => {
if (typeof error !== 'undefined') {
reject(error)
} else {
@@ -119,16 +119,12 @@ inpageProvider._metamask = new Proxy({
* @returns {Promise<boolean>} - Promise resolving to true if this domain has been previously approved
*/
isApproved: function() {
- return new Promise((resolve, reject) => {
- isApprovedHandle = ({ data: { caching, isApproved, error, type } }) => {
- if (typeof error !== 'undefined') {
- reject(error)
+ return new Promise((resolve) => {
+ isApprovedHandle = ({ data: { caching, isApproved } }) => {
+ if (caching) {
+ resolve(!!isApproved)
} else {
- if (caching) {
- resolve(!!isApproved)
- } else {
- resolve(false)
- }
+ resolve(false)
}
}
onMessage('ethereumisapproved', isApprovedHandle, true)
@@ -142,13 +138,9 @@ inpageProvider._metamask = new Proxy({
* @returns {Promise<boolean>} - Promise resolving to true if MetaMask is currently unlocked
*/
isUnlocked: function () {
- return new Promise((resolve, reject) => {
- isUnlockedHandle = ({ data: { isUnlocked, error, type } }) => {
- if (typeof error !== 'undefined') {
- reject(error)
- } else {
- resolve(!!isUnlocked)
- }
+ return new Promise((resolve) => {
+ isUnlockedHandle = ({ data: { isUnlocked } }) => {
+ resolve(!!isUnlocked)
}
onMessage('metamaskisunlocked', isUnlockedHandle, true)
window.postMessage({ type: 'METAMASK_IS_UNLOCKED' }, '*')