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._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
|
||||
*
|
||||
|
@ -121,10 +121,6 @@ class PreferencesController {
|
||||
return metaMetricsId
|
||||
}
|
||||
|
||||
getMetaMetricsId () {
|
||||
return this.store.getState().metaMetricsId
|
||||
}
|
||||
|
||||
getParticipateInMetaMetrics () {
|
||||
return this.store.getState().participateInMetaMetrics
|
||||
}
|
||||
@ -133,10 +129,6 @@ class PreferencesController {
|
||||
this.store.updateState({ metaMetricsSendCount: val })
|
||||
}
|
||||
|
||||
getMetaMetricsSendCount () {
|
||||
return this.store.getState().metaMetricsSendCount
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
*
|
||||
@ -601,17 +573,6 @@ class PreferencesController {
|
||||
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
|
||||
* found in the settings page.
|
||||
|
@ -70,16 +70,6 @@ class RecentBlocksController {
|
||||
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
|
||||
* 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
|
||||
}
|
||||
|
||||
getThreeBoxAddress () {
|
||||
return this.store.getState().threeBoxAddress
|
||||
}
|
||||
|
||||
_registerUpdates () {
|
||||
if (!this.registeringUpdates) {
|
||||
const updatePreferences = this._update3Box.bind(this)
|
||||
|
@ -1,36 +1,10 @@
|
||||
const Through = require('through2')
|
||||
const ObjectMultiplex = require('obj-multiplex')
|
||||
const pump = require('pump')
|
||||
|
||||
module.exports = {
|
||||
jsonParseStream: jsonParseStream,
|
||||
jsonStringifyStream: jsonStringifyStream,
|
||||
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
|
||||
* @param {any} connectionStream - the stream to mux
|
||||
|
@ -14,17 +14,6 @@ const {
|
||||
PLATFORM_BRAVE,
|
||||
} = 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.
|
||||
* - '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)
|
||||
}
|
||||
|
||||
function applyListeners (listeners, emitter) {
|
||||
Object.keys(listeners).forEach((key) => {
|
||||
emitter.on(key, listeners[key])
|
||||
})
|
||||
}
|
||||
|
||||
function removeListeners (listeners, emitter) {
|
||||
Object.keys(listeners).forEach((key) => {
|
||||
emitter.removeListener(key, listeners[key])
|
||||
@ -177,9 +160,7 @@ function checkForError () {
|
||||
|
||||
module.exports = {
|
||||
removeListeners,
|
||||
applyListeners,
|
||||
getPlatform,
|
||||
getStack,
|
||||
getEnvironmentType,
|
||||
sufficientBalance,
|
||||
hexToBn,
|
||||
|
@ -11,7 +11,6 @@ const EthQuery = require('eth-query')
|
||||
|
||||
const threeBoxSpies = {
|
||||
init: sinon.spy(),
|
||||
getThreeBoxAddress: sinon.spy(),
|
||||
getThreeBoxSyncingState: sinon.stub().returns(true),
|
||||
turnThreeBoxSyncingOn: sinon.spy(),
|
||||
_registerUpdates: sinon.spy(),
|
||||
@ -25,7 +24,6 @@ class ThreeBoxControllerMock {
|
||||
getState: () => ({}),
|
||||
}
|
||||
this.init = threeBoxSpies.init
|
||||
this.getThreeBoxAddress = threeBoxSpies.getThreeBoxAddress
|
||||
this.getThreeBoxSyncingState = threeBoxSpies.getThreeBoxSyncingState
|
||||
this.turnThreeBoxSyncingOn = threeBoxSpies.turnThreeBoxSyncingOn
|
||||
this._registerUpdates = threeBoxSpies._registerUpdates
|
||||
|
@ -59,7 +59,6 @@ describe('Actions', () => {
|
||||
|
||||
metamaskController.threeBoxController = {
|
||||
new3Box: sinon.spy(),
|
||||
getThreeBoxAddress: sinon.spy(),
|
||||
getThreeBoxSyncingState: sinon.spy(),
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user