diff --git a/app/scripts/inpage.js b/app/scripts/inpage.js index 31e6a1f49..ec88243a4 100644 --- a/app/scripts/inpage.js +++ b/app/scripts/inpage.js @@ -174,27 +174,6 @@ log.debug('MetaMask - injected web3') setupDappAutoReload(web3, inpageProvider.publicConfigStore) -// export global web3, with usage-detection and deprecation warning - -/* TODO: Uncomment this area once auto-reload.js has been deprecated: -let hasBeenWarned = false -global.web3 = new Proxy(web3, { - get: (_web3, key) => { - // show warning once on web3 access - if (!hasBeenWarned && key !== 'currentProvider') { - console.warn('MetaMask: web3 will be deprecated in the near future in favor of the ethereumProvider \nhttps://github.com/MetaMask/faq/blob/master/detecting_metamask.md#web3-deprecation') - hasBeenWarned = true - } - // return value normally - return _web3[key] - }, - set: (_web3, key, value) => { - // set value normally - _web3[key] = value - }, -}) -*/ - // set web3 defaultAccount inpageProvider.publicConfigStore.subscribe(function (state) { web3.eth.defaultAccount = state.selectedAddress diff --git a/app/scripts/lib/auto-reload.js b/app/scripts/lib/auto-reload.js index 44fbe847c..fd209c230 100644 --- a/app/scripts/lib/auto-reload.js +++ b/app/scripts/lib/auto-reload.js @@ -5,11 +5,17 @@ function setupDappAutoReload (web3, observable) { let reloadInProgress = false let lastTimeUsed let lastSeenNetwork + let hasBeenWarned = false global.web3 = new Proxy(web3, { get: (_web3, key) => { // get the time of use lastTimeUsed = Date.now() + // show warning once on web3 access + if (!hasBeenWarned && key !== 'currentProvider') { + console.warn('MetaMask: web3 will be deprecated in the near future in favor of the ethereumProvider\nhttps://medium.com/metamask/4a899ad6e59e') + hasBeenWarned = true + } // return value normally return _web3[key] },