Skip to content

Commit f49bc58

Browse files
authored
Remove unused methods from the app/scripts/ (#7692)
1 parent f9eac81 commit f49bc58

File tree

9 files changed

+0
-110
lines changed

9 files changed

+0
-110
lines changed

app/scripts/controllers/network/network.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -254,9 +254,4 @@ module.exports = class NetworkController extends EventEmitter {
254254
this._provider = provider
255255
this._blockTracker = blockTracker
256256
}
257-
258-
_logBlock (block) {
259-
log.info(`BLOCK CHANGED: #${block.number.toString('hex')} 0x${block.hash.toString('hex')}`)
260-
this.verifyNetwork()
261-
}
262257
}

app/scripts/controllers/onboarding.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,6 @@ class OnboardingController {
5454
})
5555
}
5656

57-
getSeedPhraseBackedUp () {
58-
return this.store.getState().seedPhraseBackedUp
59-
}
60-
6157
/**
6258
* Registering a site as having initiated onboarding
6359
*

app/scripts/controllers/preferences.js

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -121,10 +121,6 @@ class PreferencesController {
121121
return metaMetricsId
122122
}
123123

124-
getMetaMetricsId () {
125-
return this.store.getState().metaMetricsId
126-
}
127-
128124
getParticipateInMetaMetrics () {
129125
return this.store.getState().participateInMetaMetrics
130126
}
@@ -133,10 +129,6 @@ class PreferencesController {
133129
this.store.updateState({ metaMetricsSendCount: val })
134130
}
135131

136-
getMetaMetricsSendCount () {
137-
return this.store.getState().metaMetricsSendCount
138-
}
139-
140132
/**
141133
* Setter for the `firstTimeFlowType` property
142134
*
@@ -210,26 +202,6 @@ class PreferencesController {
210202
}
211203
}
212204

213-
/**
214-
* Getter for the `useBlockie` property
215-
*
216-
* @returns {boolean} this.store.useBlockie
217-
*
218-
*/
219-
getUseBlockie () {
220-
return this.store.getState().useBlockie
221-
}
222-
223-
/**
224-
* Getter for the `getUseNonceField` property
225-
*
226-
* @returns {boolean} this.store.getUseNonceField
227-
*
228-
*/
229-
getUseNonceField () {
230-
return this.store.getState().useNonceField
231-
}
232-
233205
/**
234206
* Setter for the `currentLocale` property
235207
*
@@ -601,17 +573,6 @@ class PreferencesController {
601573
return Promise.resolve(updatedFeatureFlags)
602574
}
603575

604-
/**
605-
* A getter for the `featureFlags` property
606-
*
607-
* @returns {object} A key-boolean map, where keys refer to features and booleans to whether the
608-
* user wishes to see that feature
609-
*
610-
*/
611-
getFeatureFlags () {
612-
return this.store.getState().featureFlags
613-
}
614-
615576
/**
616577
* Updates the `preferences` property, which is an object. These are user-controlled features
617578
* found in the settings page.

app/scripts/controllers/recent-blocks.js

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -70,16 +70,6 @@ class RecentBlocksController {
7070
this.backfill()
7171
}
7272

73-
/**
74-
* Sets store.recentBlocks to an empty array
75-
*
76-
*/
77-
resetState () {
78-
this.store.updateState({
79-
recentBlocks: [],
80-
})
81-
}
82-
8373
/**
8474
* Receives a new block and modifies it with this.mapTransactionsToPrices. Then adds that block to the recentBlocks
8575
* array in storage. If the recentBlocks array contains the maximum number of blocks, the oldest block is removed.

app/scripts/controllers/threebox.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -232,10 +232,6 @@ class ThreeBoxController {
232232
return this.store.getState().threeBoxSyncingAllowed
233233
}
234234

235-
getThreeBoxAddress () {
236-
return this.store.getState().threeBoxAddress
237-
}
238-
239235
_registerUpdates () {
240236
if (!this.registeringUpdates) {
241237
const updatePreferences = this._update3Box.bind(this)

app/scripts/lib/stream-utils.js

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,10 @@
1-
const Through = require('through2')
21
const ObjectMultiplex = require('obj-multiplex')
32
const pump = require('pump')
43

54
module.exports = {
6-
jsonParseStream: jsonParseStream,
7-
jsonStringifyStream: jsonStringifyStream,
85
setupMultiplex: setupMultiplex,
96
}
107

11-
/**
12-
* Returns a stream transform that parses JSON strings passing through
13-
* @return {stream.Transform}
14-
*/
15-
function jsonParseStream () {
16-
return Through.obj(function (serialized, _, cb) {
17-
this.push(JSON.parse(serialized))
18-
cb()
19-
})
20-
}
21-
22-
/**
23-
* Returns a stream transform that calls {@code JSON.stringify}
24-
* on objects passing through
25-
* @return {stream.Transform} the stream transform
26-
*/
27-
function jsonStringifyStream () {
28-
return Through.obj(function (obj, _, cb) {
29-
this.push(JSON.stringify(obj))
30-
cb()
31-
})
32-
}
33-
348
/**
359
* Sets up stream multiplexing for the given stream
3610
* @param {any} connectionStream - the stream to mux

app/scripts/lib/util.js

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,6 @@ const {
1414
PLATFORM_BRAVE,
1515
} = require('./enums')
1616

17-
/**
18-
* Generates an example stack trace
19-
*
20-
* @returns {string} A stack trace
21-
*
22-
*/
23-
function getStack () {
24-
const stack = new Error('Stack trace generator - not an error').stack
25-
return stack
26-
}
27-
2817
/**
2918
* Used to determine the window type through which the app is being viewed.
3019
* - '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) {
133122
return targetBN.mul(numBN).div(denomBN)
134123
}
135124

136-
function applyListeners (listeners, emitter) {
137-
Object.keys(listeners).forEach((key) => {
138-
emitter.on(key, listeners[key])
139-
})
140-
}
141-
142125
function removeListeners (listeners, emitter) {
143126
Object.keys(listeners).forEach((key) => {
144127
emitter.removeListener(key, listeners[key])
@@ -177,9 +160,7 @@ function checkForError () {
177160

178161
module.exports = {
179162
removeListeners,
180-
applyListeners,
181163
getPlatform,
182-
getStack,
183164
getEnvironmentType,
184165
sufficientBalance,
185166
hexToBn,

test/unit/app/controllers/metamask-controller-test.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ const EthQuery = require('eth-query')
1111

1212
const threeBoxSpies = {
1313
init: sinon.spy(),
14-
getThreeBoxAddress: sinon.spy(),
1514
getThreeBoxSyncingState: sinon.stub().returns(true),
1615
turnThreeBoxSyncingOn: sinon.spy(),
1716
_registerUpdates: sinon.spy(),
@@ -25,7 +24,6 @@ class ThreeBoxControllerMock {
2524
getState: () => ({}),
2625
}
2726
this.init = threeBoxSpies.init
28-
this.getThreeBoxAddress = threeBoxSpies.getThreeBoxAddress
2927
this.getThreeBoxSyncingState = threeBoxSpies.getThreeBoxSyncingState
3028
this.turnThreeBoxSyncingOn = threeBoxSpies.turnThreeBoxSyncingOn
3129
this._registerUpdates = threeBoxSpies._registerUpdates

test/unit/ui/app/actions.spec.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ describe('Actions', () => {
5959

6060
metamaskController.threeBoxController = {
6161
new3Box: sinon.spy(),
62-
getThreeBoxAddress: sinon.spy(),
6362
getThreeBoxSyncingState: sinon.spy(),
6463
}
6564

0 commit comments

Comments
 (0)