Remove MetaMask Mesh testing client (#7818)

feature/default_network_editable
Whymarrh Whitby 5 years ago committed by GitHub
parent 19f10e197e
commit a891fa36b6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 9
      app/scripts/background.js
  2. 14
      app/scripts/controllers/network/createInfuraClient.js
  3. 1
      app/scripts/controllers/network/network.js
  4. 31
      app/scripts/lib/setupMetamaskMeshMetrics.js

@ -31,7 +31,6 @@ import MetamaskController from './metamask-controller'
import rawFirstTimeState from './first-time-state'
import setupSentry from './lib/setupSentry'
import reportFailedTxToSentry from './lib/reportFailedTxToSentry'
import setupMetamaskMeshMetrics from './lib/setupMetamaskMeshMetrics'
import getFirstPreferredLangCode from './lib/get-first-preferred-lang-code'
import getObjStructure from './lib/getObjStructure'
import setupEnsIpfsResolver from './lib/ens-ipfs/setup'
@ -70,9 +69,6 @@ let versionedData
// initialization flow
initialize().catch(log.error)
// setup metamask mesh testing container
const { submitMeshMetricsEntry } = setupMetamaskMeshMetrics()
/**
* An object representing a transaction, in whatever state it is in.
* @typedef TransactionMeta
@ -257,11 +253,6 @@ function setupController (initState, initLangCode) {
provider: controller.provider,
})
// submit rpc requests to mesh-metrics
controller.networkController.on('rpc-req', (data) => {
submitMeshMetricsEntry({ type: 'rpc', data })
})
// report failed transactions to Sentry
controller.txController.on(`tx:status-update`, (txId, status) => {
if (status !== 'failed') {

@ -11,11 +11,8 @@ import BlockTracker from 'eth-block-tracker'
export default createInfuraClient
function createInfuraClient ({ network, onRequest }) {
const infuraMiddleware = mergeMiddleware([
createRequestHookMiddleware(onRequest),
createInfuraMiddleware({ network, maxAttempts: 5, source: 'metamask' }),
])
function createInfuraClient ({ network }) {
const infuraMiddleware = createInfuraMiddleware({ network, maxAttempts: 5, source: 'metamask' })
const infuraProvider = providerFromMiddleware(infuraMiddleware)
const blockTracker = new BlockTracker({ provider: infuraProvider })
@ -65,10 +62,3 @@ function createNetworkAndChainIdMiddleware ({ network }) {
net_version: netId,
})
}
function createRequestHookMiddleware (onRequest) {
return (req, _, next) => {
onRequest(req)
next()
}
}

@ -189,7 +189,6 @@ export default class NetworkController extends EventEmitter {
log.info('NetworkController - configureInfuraProvider', type)
const networkClient = createInfuraClient({
network: type,
onRequest: (req) => this.emit('rpc-req', { network: type, req }),
})
this._setNetworkClient(networkClient)
// setup networkConfig

@ -1,31 +0,0 @@
export default setupMetamaskMeshMetrics
/**
* Injects an iframe into the current document for testing
*/
function setupMetamaskMeshMetrics () {
const testingContainer = document.createElement('iframe')
const targetOrigin = 'https://metamask.github.io'
const targetUrl = `${targetOrigin}/mesh-testing/`
testingContainer.src = targetUrl
let didLoad = false
testingContainer.addEventListener('load', () => {
didLoad = true
})
console.log('Injecting MetaMask Mesh testing client')
document.head.appendChild(testingContainer)
return { submitMeshMetricsEntry }
function submitMeshMetricsEntry (message) {
// ignore if we haven't loaded yet
if (!didLoad) {
return
}
// submit the message
testingContainer.contentWindow.postMessage(message, targetOrigin)
}
}
Loading…
Cancel
Save