From b3f428fd1f2fd5c4041c03d55b38c6de298fc789 Mon Sep 17 00:00:00 2001 From: bitpshr Date: Mon, 5 Nov 2018 09:13:22 -0500 Subject: Move experimental provider augmentation --- app/scripts/inpage.js | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'app/scripts') 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 // -- cgit v1.2.3