aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbitpshr <mail@bitpshr.net>2018-11-05 22:13:22 +0800
committerDan Finlay <542863+danfinlay@users.noreply.github.com>2018-11-06 07:07:09 +0800
commitb3f428fd1f2fd5c4041c03d55b38c6de298fc789 (patch)
treefdf6ffa94137aa71eeb18b55d751787668465948
parent879997af517b36cf701ec74c08ec4293a2206baa (diff)
downloadtangerine-wallet-browser-b3f428fd1f2fd5c4041c03d55b38c6de298fc789.tar
tangerine-wallet-browser-b3f428fd1f2fd5c4041c03d55b38c6de298fc789.tar.gz
tangerine-wallet-browser-b3f428fd1f2fd5c4041c03d55b38c6de298fc789.tar.bz2
tangerine-wallet-browser-b3f428fd1f2fd5c4041c03d55b38c6de298fc789.tar.lz
tangerine-wallet-browser-b3f428fd1f2fd5c4041c03d55b38c6de298fc789.tar.xz
tangerine-wallet-browser-b3f428fd1f2fd5c4041c03d55b38c6de298fc789.tar.zst
tangerine-wallet-browser-b3f428fd1f2fd5c4041c03d55b38c6de298fc789.zip
Move experimental provider augmentation
-rw-r--r--app/scripts/inpage.js26
1 files changed, 13 insertions, 13 deletions
diff --git a/app/scripts/inpage.js b/app/scripts/inpage.js
index e1948a522..327e25042 100644
--- a/app/scripts/inpage.js
+++ b/app/scripts/inpage.js
@@ -89,19 +89,6 @@ inpageProvider.enable = function ({ force } = {}) {
})
}
-// 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 ethereum.enable()
- }
- return originalMethod.apply(this, arguments)
- }
-}
-detectAccountRequest('send')
-detectAccountRequest('sendAsync')
-
// add metamask-specific convenience methods
inpageProvider._metamask = new Proxy({
/**
@@ -176,6 +163,19 @@ const proxiedInpageProvider = new Proxy(inpageProvider, {
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 originalMethod.apply(this, arguments)
+ }
+}
+detectAccountRequest('send')
+detectAccountRequest('sendAsync')
+
//
// setup web3
//