mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Remove unused methods from the app/scripts/ (#7692)
This commit is contained in:
parent
f9eac81a85
commit
f49bc58c09
@ -254,9 +254,4 @@ module.exports = class NetworkController extends EventEmitter {
|
|||||||
this._provider = provider
|
this._provider = provider
|
||||||
this._blockTracker = blockTracker
|
this._blockTracker = blockTracker
|
||||||
}
|
}
|
||||||
|
|
||||||
_logBlock (block) {
|
|
||||||
log.info(`BLOCK CHANGED: #${block.number.toString('hex')} 0x${block.hash.toString('hex')}`)
|
|
||||||
this.verifyNetwork()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -54,10 +54,6 @@ class OnboardingController {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
getSeedPhraseBackedUp () {
|
|
||||||
return this.store.getState().seedPhraseBackedUp
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Registering a site as having initiated onboarding
|
* Registering a site as having initiated onboarding
|
||||||
*
|
*
|
||||||
|
@ -121,10 +121,6 @@ class PreferencesController {
|
|||||||
return metaMetricsId
|
return metaMetricsId
|
||||||
}
|
}
|
||||||
|
|
||||||
getMetaMetricsId () {
|
|
||||||
return this.store.getState().metaMetricsId
|
|
||||||
}
|
|
||||||
|
|
||||||
getParticipateInMetaMetrics () {
|
getParticipateInMetaMetrics () {
|
||||||
return this.store.getState().participateInMetaMetrics
|
return this.store.getState().participateInMetaMetrics
|
||||||
}
|
}
|
||||||
@ -133,10 +129,6 @@ class PreferencesController {
|
|||||||
this.store.updateState({ metaMetricsSendCount: val })
|
this.store.updateState({ metaMetricsSendCount: val })
|
||||||
}
|
}
|
||||||
|
|
||||||
getMetaMetricsSendCount () {
|
|
||||||
return this.store.getState().metaMetricsSendCount
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Setter for the `firstTimeFlowType` property
|
* Setter for the `firstTimeFlowType` property
|
||||||
*
|
*
|
||||||
@ -210,26 +202,6 @@ class PreferencesController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Getter for the `useBlockie` property
|
|
||||||
*
|
|
||||||
* @returns {boolean} this.store.useBlockie
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
getUseBlockie () {
|
|
||||||
return this.store.getState().useBlockie
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Getter for the `getUseNonceField` property
|
|
||||||
*
|
|
||||||
* @returns {boolean} this.store.getUseNonceField
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
getUseNonceField () {
|
|
||||||
return this.store.getState().useNonceField
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Setter for the `currentLocale` property
|
* Setter for the `currentLocale` property
|
||||||
*
|
*
|
||||||
@ -601,17 +573,6 @@ class PreferencesController {
|
|||||||
return Promise.resolve(updatedFeatureFlags)
|
return Promise.resolve(updatedFeatureFlags)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* A getter for the `featureFlags` property
|
|
||||||
*
|
|
||||||
* @returns {object} A key-boolean map, where keys refer to features and booleans to whether the
|
|
||||||
* user wishes to see that feature
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
getFeatureFlags () {
|
|
||||||
return this.store.getState().featureFlags
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Updates the `preferences` property, which is an object. These are user-controlled features
|
* Updates the `preferences` property, which is an object. These are user-controlled features
|
||||||
* found in the settings page.
|
* found in the settings page.
|
||||||
|
@ -70,16 +70,6 @@ class RecentBlocksController {
|
|||||||
this.backfill()
|
this.backfill()
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets store.recentBlocks to an empty array
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
resetState () {
|
|
||||||
this.store.updateState({
|
|
||||||
recentBlocks: [],
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Receives a new block and modifies it with this.mapTransactionsToPrices. Then adds that block to the recentBlocks
|
* Receives a new block and modifies it with this.mapTransactionsToPrices. Then adds that block to the recentBlocks
|
||||||
* array in storage. If the recentBlocks array contains the maximum number of blocks, the oldest block is removed.
|
* array in storage. If the recentBlocks array contains the maximum number of blocks, the oldest block is removed.
|
||||||
|
@ -232,10 +232,6 @@ class ThreeBoxController {
|
|||||||
return this.store.getState().threeBoxSyncingAllowed
|
return this.store.getState().threeBoxSyncingAllowed
|
||||||
}
|
}
|
||||||
|
|
||||||
getThreeBoxAddress () {
|
|
||||||
return this.store.getState().threeBoxAddress
|
|
||||||
}
|
|
||||||
|
|
||||||
_registerUpdates () {
|
_registerUpdates () {
|
||||||
if (!this.registeringUpdates) {
|
if (!this.registeringUpdates) {
|
||||||
const updatePreferences = this._update3Box.bind(this)
|
const updatePreferences = this._update3Box.bind(this)
|
||||||
|
@ -1,36 +1,10 @@
|
|||||||
const Through = require('through2')
|
|
||||||
const ObjectMultiplex = require('obj-multiplex')
|
const ObjectMultiplex = require('obj-multiplex')
|
||||||
const pump = require('pump')
|
const pump = require('pump')
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
jsonParseStream: jsonParseStream,
|
|
||||||
jsonStringifyStream: jsonStringifyStream,
|
|
||||||
setupMultiplex: setupMultiplex,
|
setupMultiplex: setupMultiplex,
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns a stream transform that parses JSON strings passing through
|
|
||||||
* @return {stream.Transform}
|
|
||||||
*/
|
|
||||||
function jsonParseStream () {
|
|
||||||
return Through.obj(function (serialized, _, cb) {
|
|
||||||
this.push(JSON.parse(serialized))
|
|
||||||
cb()
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns a stream transform that calls {@code JSON.stringify}
|
|
||||||
* on objects passing through
|
|
||||||
* @return {stream.Transform} the stream transform
|
|
||||||
*/
|
|
||||||
function jsonStringifyStream () {
|
|
||||||
return Through.obj(function (obj, _, cb) {
|
|
||||||
this.push(JSON.stringify(obj))
|
|
||||||
cb()
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets up stream multiplexing for the given stream
|
* Sets up stream multiplexing for the given stream
|
||||||
* @param {any} connectionStream - the stream to mux
|
* @param {any} connectionStream - the stream to mux
|
||||||
|
@ -14,17 +14,6 @@ const {
|
|||||||
PLATFORM_BRAVE,
|
PLATFORM_BRAVE,
|
||||||
} = require('./enums')
|
} = require('./enums')
|
||||||
|
|
||||||
/**
|
|
||||||
* Generates an example stack trace
|
|
||||||
*
|
|
||||||
* @returns {string} A stack trace
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
function getStack () {
|
|
||||||
const stack = new Error('Stack trace generator - not an error').stack
|
|
||||||
return stack
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used to determine the window type through which the app is being viewed.
|
* Used to determine the window type through which the app is being viewed.
|
||||||
* - 'popup' refers to the extension opened through the browser app icon (in top right corner in chrome and firefox)
|
* - 'popup' refers to the extension opened through the browser app icon (in top right corner in chrome and firefox)
|
||||||
@ -133,12 +122,6 @@ function BnMultiplyByFraction (targetBN, numerator, denominator) {
|
|||||||
return targetBN.mul(numBN).div(denomBN)
|
return targetBN.mul(numBN).div(denomBN)
|
||||||
}
|
}
|
||||||
|
|
||||||
function applyListeners (listeners, emitter) {
|
|
||||||
Object.keys(listeners).forEach((key) => {
|
|
||||||
emitter.on(key, listeners[key])
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
function removeListeners (listeners, emitter) {
|
function removeListeners (listeners, emitter) {
|
||||||
Object.keys(listeners).forEach((key) => {
|
Object.keys(listeners).forEach((key) => {
|
||||||
emitter.removeListener(key, listeners[key])
|
emitter.removeListener(key, listeners[key])
|
||||||
@ -177,9 +160,7 @@ function checkForError () {
|
|||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
removeListeners,
|
removeListeners,
|
||||||
applyListeners,
|
|
||||||
getPlatform,
|
getPlatform,
|
||||||
getStack,
|
|
||||||
getEnvironmentType,
|
getEnvironmentType,
|
||||||
sufficientBalance,
|
sufficientBalance,
|
||||||
hexToBn,
|
hexToBn,
|
||||||
|
@ -11,7 +11,6 @@ const EthQuery = require('eth-query')
|
|||||||
|
|
||||||
const threeBoxSpies = {
|
const threeBoxSpies = {
|
||||||
init: sinon.spy(),
|
init: sinon.spy(),
|
||||||
getThreeBoxAddress: sinon.spy(),
|
|
||||||
getThreeBoxSyncingState: sinon.stub().returns(true),
|
getThreeBoxSyncingState: sinon.stub().returns(true),
|
||||||
turnThreeBoxSyncingOn: sinon.spy(),
|
turnThreeBoxSyncingOn: sinon.spy(),
|
||||||
_registerUpdates: sinon.spy(),
|
_registerUpdates: sinon.spy(),
|
||||||
@ -25,7 +24,6 @@ class ThreeBoxControllerMock {
|
|||||||
getState: () => ({}),
|
getState: () => ({}),
|
||||||
}
|
}
|
||||||
this.init = threeBoxSpies.init
|
this.init = threeBoxSpies.init
|
||||||
this.getThreeBoxAddress = threeBoxSpies.getThreeBoxAddress
|
|
||||||
this.getThreeBoxSyncingState = threeBoxSpies.getThreeBoxSyncingState
|
this.getThreeBoxSyncingState = threeBoxSpies.getThreeBoxSyncingState
|
||||||
this.turnThreeBoxSyncingOn = threeBoxSpies.turnThreeBoxSyncingOn
|
this.turnThreeBoxSyncingOn = threeBoxSpies.turnThreeBoxSyncingOn
|
||||||
this._registerUpdates = threeBoxSpies._registerUpdates
|
this._registerUpdates = threeBoxSpies._registerUpdates
|
||||||
|
@ -59,7 +59,6 @@ describe('Actions', () => {
|
|||||||
|
|
||||||
metamaskController.threeBoxController = {
|
metamaskController.threeBoxController = {
|
||||||
new3Box: sinon.spy(),
|
new3Box: sinon.spy(),
|
||||||
getThreeBoxAddress: sinon.spy(),
|
|
||||||
getThreeBoxSyncingState: sinon.spy(),
|
getThreeBoxSyncingState: sinon.spy(),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user