diff options
author | Hsuan Lee <hsuan@cobinhood.com> | 2018-12-12 10:33:40 +0800 |
---|---|---|
committer | Hsuan Lee <hsuan@cobinhood.com> | 2018-12-12 10:34:08 +0800 |
commit | d78372b965ed18684eed3b0b24431c84e3292d14 (patch) | |
tree | c949a01354ca2374e0651b137673e305442a70ae | |
parent | b3b0e0b4513ace2f0ede81ab7a7dc2429f8dc68b (diff) | |
download | dexon-wallet-d78372b965ed18684eed3b0b24431c84e3292d14.tar.gz dexon-wallet-d78372b965ed18684eed3b0b24431c84e3292d14.tar.zst dexon-wallet-d78372b965ed18684eed3b0b24431c84e3292d14.zip |
Remove metamask objects
-rw-r--r-- | CHANGELOG.md | 2 | ||||
-rw-r--r-- | app/manifest.json | 2 | ||||
-rw-r--r-- | app/scripts/contentscript.js | 12 | ||||
-rw-r--r-- | app/scripts/controllers/provider-approval.js | 6 | ||||
-rw-r--r-- | app/scripts/inpage.js | 20 |
5 files changed, 21 insertions, 21 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 4587e018..220aeb2a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ## Current Develop Branch +## 1.2.2 Wed Dec 12 2018 + ## 1.2.1 Tue Dec 11 2018 ## 1.2.0 Mon Dec 10 2018 diff --git a/app/manifest.json b/app/manifest.json index 3d9967d1..d87e35f9 100644 --- a/app/manifest.json +++ b/app/manifest.json @@ -1,7 +1,7 @@ { "name": "__MSG_appName__", "short_name": "__MSG_appName__", - "version": "1.2.1", + "version": "1.2.2", "manifest_version": 2, "author": "https://dexon.org", "description": "__MSG_appDescription__", diff --git a/app/scripts/contentscript.js b/app/scripts/contentscript.js index 0e59d73a..9d0808d9 100644 --- a/app/scripts/contentscript.js +++ b/app/scripts/contentscript.js @@ -161,12 +161,12 @@ function listenForProviderRequest () { window.postMessage({ type: 'dexonprovider', error: 'User rejected provider access' }, '*') break case 'answer-is-approved': - window.postMessage({ type: 'ethereumisapproved', isApproved, caching }, '*') + window.postMessage({ type: 'dexonisapproved', isApproved, caching }, '*') break case 'answer-is-unlocked': - window.postMessage({ type: 'metamaskisunlocked', isUnlocked }, '*') + window.postMessage({ type: 'dekusanisunlocked', isUnlocked }, '*') break - case 'metamask-set-locked': + case 'dekusan-set-locked': isEnabled = false window.postMessage({ type: 'dekusansetlocked' }, '*') break @@ -175,8 +175,8 @@ function listenForProviderRequest () { } /** - * Checks if MetaMask is currently operating in "privacy mode", meaning - * dapps must call ethereum.enable in order to access user accounts + * Checks if DekuSan is currently operating in "privacy mode", meaning + * dapps must call dexon.enable in order to access user accounts */ function checkPrivacyMode () { extension.runtime.sendMessage({ action: 'init-privacy-request' }) @@ -189,7 +189,7 @@ function checkPrivacyMode () { * @param {Error} err Stream connection error */ function logStreamDisconnectWarning (remoteLabel, err) { - let warningMsg = `MetamaskContentscript - lost connection to ${remoteLabel}` + let warningMsg = `DekuSanContentscript - lost connection to ${remoteLabel}` if (err) warningMsg += '\n' + err.stack console.warn(warningMsg) } diff --git a/app/scripts/controllers/provider-approval.js b/app/scripts/controllers/provider-approval.js index 893ddec8..6c83acb7 100644 --- a/app/scripts/controllers/provider-approval.js +++ b/app/scripts/controllers/provider-approval.js @@ -77,7 +77,7 @@ class ProviderApprovalController { } /** - * Called by a tab to determine if MetaMask is currently locked or unlocked + * Called by a tab to determine if DekuSan is currently locked or unlocked */ _handleIsUnlocked () { const isUnlocked = this.keyringController.memStore.getState().isUnlocked @@ -149,11 +149,11 @@ class ProviderApprovalController { } /** - * Tells all tabs that MetaMask is now locked. This is primarily used to set + * Tells all tabs that DekuSan is now locked. This is primarily used to set * internal flags in the contentscript and inpage script. */ setLocked () { - this.platform.sendMessage({ action: 'metamask-set-locked' }) + this.platform.sendMessage({ action: 'dekusan-set-locked' }) } } diff --git a/app/scripts/inpage.js b/app/scripts/inpage.js index 1adeb683..7acde545 100644 --- a/app/scripts/inpage.js +++ b/app/scripts/inpage.js @@ -38,7 +38,7 @@ var inpageProvider = new DekuSanInpageProvider(dekusanStream) // set a high max listener count to avoid unnecesary warnings inpageProvider.setMaxListeners(100) -// set up a listener for when MetaMask is locked +// set up a listener for when DekuSan is locked onMessage('dekusansetlocked', () => { isEnabled = false }) // set up a listener for privacy mode responses @@ -102,30 +102,30 @@ inpageProvider._dekusan = new Proxy({ resolve(false) } } - onMessage('ethereumisapproved', isApprovedHandle, true) + onMessage('dexonisapproved', isApprovedHandle, true) window.postMessage({ type: 'DEXON_IS_APPROVED' }, '*') }) }, /** - * Determines if MetaMask is unlocked by the user + * Determines if DekuSan is unlocked by the user * - * @returns {Promise<boolean>} - Promise resolving to true if MetaMask is currently unlocked + * @returns {Promise<boolean>} - Promise resolving to true if DekuSan is currently unlocked */ isUnlocked: function () { return new Promise((resolve) => { isUnlockedHandle = ({ data: { isUnlocked } }) => { resolve(!!isUnlocked) } - onMessage('metamaskisunlocked', isUnlockedHandle, true) + onMessage('dekusanisunlocked', isUnlockedHandle, true) window.postMessage({ type: 'DEKUSAN_IS_UNLOCKED' }, '*') }) }, }, { get: function (obj, prop) { - !warned && console.warn('Heads up! ethereum._metamask exposes methods that have ' + + !warned && console.warn('Heads up! dexon._dekusan exposes methods that have ' + 'not been standardized yet. This means that these methods may not be implemented ' + - 'in other dapp browsers and may be removed from MetaMask in the future.') + 'in other dapp browsers and may be removed from DekuSan in the future.') warned = true return obj[prop] }, @@ -139,14 +139,12 @@ const proxiedInpageProvider = new Proxy(inpageProvider, { deleteProperty: () => true, }) -window.ethereum = proxiedInpageProvider - // detect eth_requestAccounts and pipe to enable for now function detectAccountRequest (method) { const originalMethod = inpageProvider[method] inpageProvider[method] = function ({ method }) { if (method === 'eth_requestAccounts') { - return window.ethereum.enable() + return window.dexon.enable() } return originalMethod.apply(this, arguments) } @@ -156,7 +154,7 @@ detectAccountRequest('sendAsync') // set web3 defaultAccount inpageProvider.publicConfigStore.subscribe(function (state) { - web3.eth.defaultAccount = state.selectedAddress + window.dexon.defaultAccount = state.selectedAddress }) // expose provider |