diff --git a/app/scripts/controllers/permissions/permissionsLog.js b/app/scripts/controllers/permissions/permissionsLog.js index caa369a2e9e6..7a9149a1c1f7 100644 --- a/app/scripts/controllers/permissions/permissionsLog.js +++ b/app/scripts/controllers/permissions/permissionsLog.js @@ -1,5 +1,5 @@ -import clone from 'clone' +import { cloneDeep } from 'lodash' import { isValidAddress } from 'ethereumjs-util' import { CAVEAT_NAMES, @@ -374,7 +374,7 @@ function cloneObj (obj) { for (let i = 3; i > 1; i--) { try { - return clone(obj, false, i) + return cloneDeep(obj, false, i) } catch (_) {} } return { ...obj } diff --git a/app/scripts/controllers/transactions/lib/tx-state-history-helper.js b/app/scripts/controllers/transactions/lib/tx-state-history-helper.js index c658e6a874f9..753957fc4920 100644 --- a/app/scripts/controllers/transactions/lib/tx-state-history-helper.js +++ b/app/scripts/controllers/transactions/lib/tx-state-history-helper.js @@ -1,5 +1,5 @@ import jsonDiffer from 'fast-json-patch' -import clone from 'clone' +import { cloneDeep } from 'lodash' /** @module*/ export default { @@ -57,10 +57,8 @@ function generateHistoryEntry (previousState, newState, note) { @returns {Object} */ function replayHistory (_shortHistory) { - const shortHistory = clone(_shortHistory) - return shortHistory.reduce( - (val, entry) => jsonDiffer.applyPatch(val, entry).newDocument - ) + const shortHistory = cloneDeep(_shortHistory) + return shortHistory.reduce((val, entry) => jsonDiffer.applyPatch(val, entry).newDocument) } /** @@ -69,7 +67,7 @@ function replayHistory (_shortHistory) { */ function snapshotFromTxMeta (txMeta) { // create txMeta snapshot for history - const snapshot = clone(txMeta) + const snapshot = cloneDeep(txMeta) // dont include previous history in this snapshot delete snapshot.history return snapshot diff --git a/app/scripts/lib/getObjStructure.js b/app/scripts/lib/getObjStructure.js index 20b4d12631c9..785eadc9b2f8 100644 --- a/app/scripts/lib/getObjStructure.js +++ b/app/scripts/lib/getObjStructure.js @@ -1,4 +1,4 @@ -import clone from 'clone' +import { cloneDeep } from 'lodash' export default getObjStructure @@ -24,8 +24,8 @@ export default getObjStructure * */ function getObjStructure (obj) { - const structure = clone(obj) - return deepMap(structure, value => { + const structure = cloneDeep(obj) + return deepMap(structure, (value) => { return value === null ? 'null' : typeof value }) } diff --git a/app/scripts/migrations/002.js b/app/scripts/migrations/002.js index c5c2be18dac7..68520a378b45 100644 --- a/app/scripts/migrations/002.js +++ b/app/scripts/migrations/002.js @@ -1,12 +1,12 @@ const version = 2 -import clone from 'clone' +import { cloneDeep } from 'lodash' export default { version, migrate: function (originalVersionedData) { - const versionedData = clone(originalVersionedData) + const versionedData = cloneDeep(originalVersionedData) versionedData.meta.version = version try { if (versionedData.data.config.provider.type === 'etherscan') { diff --git a/app/scripts/migrations/003.js b/app/scripts/migrations/003.js index 0bfe382be025..15c9b20706ef 100644 --- a/app/scripts/migrations/003.js +++ b/app/scripts/migrations/003.js @@ -2,13 +2,13 @@ const version = 3 const oldTestRpc = 'https://rawtestrpc.metamask.io/' const newTestRpc = 'https://testrpc.metamask.io/' -import clone from 'clone' +import { cloneDeep } from 'lodash' export default { version, migrate: function (originalVersionedData) { - const versionedData = clone(originalVersionedData) + const versionedData = cloneDeep(originalVersionedData) versionedData.meta.version = version try { if (versionedData.data.config.provider.rpcTarget === oldTestRpc) { diff --git a/app/scripts/migrations/004.js b/app/scripts/migrations/004.js index 5c1a5aaffe79..358cbbea7b82 100644 --- a/app/scripts/migrations/004.js +++ b/app/scripts/migrations/004.js @@ -1,12 +1,12 @@ const version = 4 -import clone from 'clone' +import { cloneDeep } from 'lodash' export default { version, migrate: function (versionedData) { - const safeVersionedData = clone(versionedData) + const safeVersionedData = cloneDeep(versionedData) safeVersionedData.meta.version = version try { if (safeVersionedData.data.config.provider.type !== 'rpc') { diff --git a/app/scripts/migrations/005.js b/app/scripts/migrations/005.js index d9edf0e384ff..90f6e46efef4 100644 --- a/app/scripts/migrations/005.js +++ b/app/scripts/migrations/005.js @@ -6,13 +6,13 @@ This migration moves state from the flat state trie into KeyringController subst */ -import clone from 'clone' +import { cloneDeep } from 'lodash' export default { version, migrate: function (originalVersionedData) { - const versionedData = clone(originalVersionedData) + const versionedData = cloneDeep(originalVersionedData) versionedData.meta.version = version try { const state = versionedData.data diff --git a/app/scripts/migrations/006.js b/app/scripts/migrations/006.js index 66a8e1605747..b53015315d6e 100644 --- a/app/scripts/migrations/006.js +++ b/app/scripts/migrations/006.js @@ -6,13 +6,13 @@ This migration moves KeyringController.selectedAddress to PreferencesController. */ -import clone from 'clone' +import { cloneDeep } from 'lodash' export default { version, migrate: function (originalVersionedData) { - const versionedData = clone(originalVersionedData) + const versionedData = cloneDeep(originalVersionedData) versionedData.meta.version = version try { const state = versionedData.data diff --git a/app/scripts/migrations/007.js b/app/scripts/migrations/007.js index 42539eae4bdc..bacf005fa551 100644 --- a/app/scripts/migrations/007.js +++ b/app/scripts/migrations/007.js @@ -6,13 +6,13 @@ This migration breaks out the TransactionManager substate */ -import clone from 'clone' +import { cloneDeep } from 'lodash' export default { version, migrate: function (originalVersionedData) { - const versionedData = clone(originalVersionedData) + const versionedData = cloneDeep(originalVersionedData) versionedData.meta.version = version try { const state = versionedData.data diff --git a/app/scripts/migrations/008.js b/app/scripts/migrations/008.js index c0e1ba56eb1e..a4537ae9b3f6 100644 --- a/app/scripts/migrations/008.js +++ b/app/scripts/migrations/008.js @@ -6,13 +6,13 @@ This migration breaks out the NoticeController substate */ -import clone from 'clone' +import { cloneDeep } from 'lodash' export default { version, migrate: function (originalVersionedData) { - const versionedData = clone(originalVersionedData) + const versionedData = cloneDeep(originalVersionedData) versionedData.meta.version = version try { const state = versionedData.data diff --git a/app/scripts/migrations/009.js b/app/scripts/migrations/009.js index 103321522978..3fddf7aa94af 100644 --- a/app/scripts/migrations/009.js +++ b/app/scripts/migrations/009.js @@ -6,15 +6,13 @@ This migration breaks out the CurrencyController substate */ -import { merge } from 'lodash' - -import clone from 'clone' +import { cloneDeep, merge } from 'lodash' export default { version, migrate: function (originalVersionedData) { - const versionedData = clone(originalVersionedData) + const versionedData = cloneDeep(originalVersionedData) versionedData.meta.version = version try { const state = versionedData.data diff --git a/app/scripts/migrations/010.js b/app/scripts/migrations/010.js index b97dd04d906b..c8dd42aafee8 100644 --- a/app/scripts/migrations/010.js +++ b/app/scripts/migrations/010.js @@ -6,15 +6,13 @@ This migration breaks out the ShapeShiftController substate */ -import { merge } from 'lodash' - -import clone from 'clone' +import { cloneDeep, merge } from 'lodash' export default { version, migrate: function (originalVersionedData) { - const versionedData = clone(originalVersionedData) + const versionedData = cloneDeep(originalVersionedData) versionedData.meta.version = version try { const state = versionedData.data diff --git a/app/scripts/migrations/011.js b/app/scripts/migrations/011.js index e845c0d215d9..d465bf5a6bd2 100644 --- a/app/scripts/migrations/011.js +++ b/app/scripts/migrations/011.js @@ -6,13 +6,13 @@ This migration removes the discaimer state from our app, which was integrated in */ -import clone from 'clone' +import { cloneDeep } from 'lodash' export default { version, migrate: function (originalVersionedData) { - const versionedData = clone(originalVersionedData) + const versionedData = cloneDeep(originalVersionedData) versionedData.meta.version = version try { const state = versionedData.data diff --git a/app/scripts/migrations/012.js b/app/scripts/migrations/012.js index ec7a996e7584..3159ccd6b0d6 100644 --- a/app/scripts/migrations/012.js +++ b/app/scripts/migrations/012.js @@ -6,13 +6,13 @@ This migration modifies our notices to delete their body after being read. */ -import clone from 'clone' +import { cloneDeep } from 'lodash' export default { version, migrate: function (originalVersionedData) { - const versionedData = clone(originalVersionedData) + const versionedData = cloneDeep(originalVersionedData) versionedData.meta.version = version try { const state = versionedData.data diff --git a/app/scripts/migrations/013.js b/app/scripts/migrations/013.js index a6f9fd414471..433face729a7 100644 --- a/app/scripts/migrations/013.js +++ b/app/scripts/migrations/013.js @@ -6,13 +6,13 @@ This migration modifies the network config from ambiguous 'testnet' to explicit */ -import clone from 'clone' +import { cloneDeep } from 'lodash' export default { version, migrate: function (originalVersionedData) { - const versionedData = clone(originalVersionedData) + const versionedData = cloneDeep(originalVersionedData) versionedData.meta.version = version try { const state = versionedData.data diff --git a/app/scripts/migrations/014.js b/app/scripts/migrations/014.js index ebb86b057586..e7a7b8c991c5 100644 --- a/app/scripts/migrations/014.js +++ b/app/scripts/migrations/014.js @@ -6,13 +6,13 @@ This migration removes provider from config and moves it too NetworkController. */ -import clone from 'clone' +import { cloneDeep } from 'lodash' export default { version, migrate: function (originalVersionedData) { - const versionedData = clone(originalVersionedData) + const versionedData = cloneDeep(originalVersionedData) versionedData.meta.version = version try { const state = versionedData.data diff --git a/app/scripts/migrations/015.js b/app/scripts/migrations/015.js index e77d5eb8dabd..09441c40df39 100644 --- a/app/scripts/migrations/015.js +++ b/app/scripts/migrations/015.js @@ -7,13 +7,13 @@ to a 'failed' stated */ -import clone from 'clone' +import { cloneDeep } from 'lodash' export default { version, migrate: function (originalVersionedData) { - const versionedData = clone(originalVersionedData) + const versionedData = cloneDeep(originalVersionedData) versionedData.meta.version = version try { const state = versionedData.data diff --git a/app/scripts/migrations/016.js b/app/scripts/migrations/016.js index d5c509a4755d..7ac26c328194 100644 --- a/app/scripts/migrations/016.js +++ b/app/scripts/migrations/016.js @@ -7,13 +7,13 @@ to a 'failed' stated */ -import clone from 'clone' +import { cloneDeep } from 'lodash' export default { version, migrate: function (originalVersionedData) { - const versionedData = clone(originalVersionedData) + const versionedData = cloneDeep(originalVersionedData) versionedData.meta.version = version try { const state = versionedData.data diff --git a/app/scripts/migrations/017.js b/app/scripts/migrations/017.js index fa18a07208a2..d9a565609125 100644 --- a/app/scripts/migrations/017.js +++ b/app/scripts/migrations/017.js @@ -6,13 +6,13 @@ This migration sets transactions who were retried and marked as failed to submit */ -import clone from 'clone' +import { cloneDeep } from 'lodash' export default { version, migrate: function (originalVersionedData) { - const versionedData = clone(originalVersionedData) + const versionedData = cloneDeep(originalVersionedData) versionedData.meta.version = version try { const state = versionedData.data diff --git a/app/scripts/migrations/018.js b/app/scripts/migrations/018.js index 0e3345f621eb..6aed55ba2cf3 100644 --- a/app/scripts/migrations/018.js +++ b/app/scripts/migrations/018.js @@ -6,7 +6,7 @@ This migration updates "transaction state history" to diffs style */ -import clone from 'clone' +import { cloneDeep } from 'lodash' import txStateHistoryHelper from '../controllers/transactions/lib/tx-state-history-helper' @@ -14,7 +14,7 @@ export default { version, migrate: function (originalVersionedData) { - const versionedData = clone(originalVersionedData) + const versionedData = cloneDeep(originalVersionedData) versionedData.meta.version = version try { const state = versionedData.data diff --git a/app/scripts/migrations/019.js b/app/scripts/migrations/019.js index 603b7123950f..2deae61b379f 100644 --- a/app/scripts/migrations/019.js +++ b/app/scripts/migrations/019.js @@ -7,13 +7,13 @@ whos nonce is too high */ -import clone from 'clone' +import { cloneDeep } from 'lodash' export default { version, migrate: function (originalVersionedData) { - const versionedData = clone(originalVersionedData) + const versionedData = cloneDeep(originalVersionedData) versionedData.meta.version = version try { const state = versionedData.data diff --git a/app/scripts/migrations/020.js b/app/scripts/migrations/020.js index 74caa6e7e131..82023d8da513 100644 --- a/app/scripts/migrations/020.js +++ b/app/scripts/migrations/020.js @@ -8,13 +8,13 @@ so that we can version notices in the future. */ -import clone from 'clone' +import { cloneDeep } from 'lodash' export default { version, migrate: function (originalVersionedData) { - const versionedData = clone(originalVersionedData) + const versionedData = cloneDeep(originalVersionedData) versionedData.meta.version = version try { const state = versionedData.data diff --git a/app/scripts/migrations/021.js b/app/scripts/migrations/021.js index be8fdd1560ac..c98c6580b73a 100644 --- a/app/scripts/migrations/021.js +++ b/app/scripts/migrations/021.js @@ -6,13 +6,13 @@ This migration removes the BlackListController from disk state */ -import clone from 'clone' +import { cloneDeep } from 'lodash' export default { version, migrate: function (originalVersionedData) { - const versionedData = clone(originalVersionedData) + const versionedData = cloneDeep(originalVersionedData) versionedData.meta.version = version try { const state = versionedData.data diff --git a/app/scripts/migrations/022.js b/app/scripts/migrations/022.js index 13faad1dd380..62dd4d893cd6 100644 --- a/app/scripts/migrations/022.js +++ b/app/scripts/migrations/022.js @@ -6,13 +6,13 @@ This migration adds submittedTime to the txMeta if it is not their */ -import clone from 'clone' +import { cloneDeep } from 'lodash' export default { version, migrate: function (originalVersionedData) { - const versionedData = clone(originalVersionedData) + const versionedData = cloneDeep(originalVersionedData) versionedData.meta.version = version try { const state = versionedData.data diff --git a/app/scripts/migrations/023.js b/app/scripts/migrations/023.js index acf425237cf7..c49971028757 100644 --- a/app/scripts/migrations/023.js +++ b/app/scripts/migrations/023.js @@ -6,13 +6,13 @@ This migration removes transactions that are no longer usefull down to 40 total */ -import clone from 'clone' +import { cloneDeep } from 'lodash' export default { version, migrate: function (originalVersionedData) { - const versionedData = clone(originalVersionedData) + const versionedData = cloneDeep(originalVersionedData) versionedData.meta.version = version try { const state = versionedData.data diff --git a/app/scripts/migrations/024.js b/app/scripts/migrations/024.js index 5fe28d84fef7..171cb21ad059 100644 --- a/app/scripts/migrations/024.js +++ b/app/scripts/migrations/024.js @@ -7,13 +7,13 @@ all unapproved transactions */ -import clone from 'clone' +import { cloneDeep } from 'lodash' export default { version, migrate: async function (originalVersionedData) { - const versionedData = clone(originalVersionedData) + const versionedData = cloneDeep(originalVersionedData) versionedData.meta.version = version const state = versionedData.data const newState = transformState(state) diff --git a/app/scripts/migrations/025.js b/app/scripts/migrations/025.js index 05f0105045c9..07a9ee15eb10 100644 --- a/app/scripts/migrations/025.js +++ b/app/scripts/migrations/025.js @@ -8,13 +8,13 @@ normalizes txParams on unconfirmed txs */ import ethUtil from 'ethereumjs-util' -import clone from 'clone' +import { cloneDeep } from 'lodash' export default { version, migrate: async function (originalVersionedData) { - const versionedData = clone(originalVersionedData) + const versionedData = cloneDeep(originalVersionedData) versionedData.meta.version = version const state = versionedData.data const newState = transformState(state) diff --git a/app/scripts/migrations/026.js b/app/scripts/migrations/026.js index ac0af9d32801..bf90b1bb1800 100644 --- a/app/scripts/migrations/026.js +++ b/app/scripts/migrations/026.js @@ -7,12 +7,12 @@ This migration moves the identities stored in the KeyringController */ -import clone from 'clone' +import { cloneDeep } from 'lodash' export default { version, migrate (originalVersionedData) { - const versionedData = clone(originalVersionedData) + const versionedData = cloneDeep(originalVersionedData) versionedData.meta.version = version try { const state = versionedData.data diff --git a/app/scripts/migrations/027.js b/app/scripts/migrations/027.js index a9701a249763..7653357f2208 100644 --- a/app/scripts/migrations/027.js +++ b/app/scripts/migrations/027.js @@ -6,13 +6,13 @@ const version = 27 normalizes txParams on unconfirmed txs */ -import clone from 'clone' +import { cloneDeep } from 'lodash' export default { version, migrate: async function (originalVersionedData) { - const versionedData = clone(originalVersionedData) + const versionedData = cloneDeep(originalVersionedData) versionedData.meta.version = version const state = versionedData.data const newState = transformState(state) diff --git a/app/scripts/migrations/028.js b/app/scripts/migrations/028.js index 67961bb18f21..0643c187e071 100644 --- a/app/scripts/migrations/028.js +++ b/app/scripts/migrations/028.js @@ -6,13 +6,13 @@ const version = 28 normalizes txParams on unconfirmed txs */ -import clone from 'clone' +import { cloneDeep } from 'lodash' export default { version, migrate: async function (originalVersionedData) { - const versionedData = clone(originalVersionedData) + const versionedData = cloneDeep(originalVersionedData) versionedData.meta.version = version const state = versionedData.data const newState = transformState(state) diff --git a/app/scripts/migrations/030.js b/app/scripts/migrations/030.js index 940d16ea4ff1..fe76d225b6ca 100644 --- a/app/scripts/migrations/030.js +++ b/app/scripts/migrations/030.js @@ -7,13 +7,13 @@ removes invalid chaids from preferences and networkController for custom rpcs */ -import clone from 'clone' +import { cloneDeep } from 'lodash' export default { version, migrate: async function (originalVersionedData) { - const versionedData = clone(originalVersionedData) + const versionedData = cloneDeep(originalVersionedData) versionedData.meta.version = version const state = versionedData.data const newState = transformState(state) diff --git a/app/scripts/migrations/031.js b/app/scripts/migrations/031.js index dd29b82055d5..6d6bd203d074 100644 --- a/app/scripts/migrations/031.js +++ b/app/scripts/migrations/031.js @@ -1,6 +1,6 @@ // next version number const version = 31 -import clone from 'clone' +import { cloneDeep } from 'lodash' /* * The purpose of this migration is to properly set the completedOnboarding flag based on the state @@ -10,7 +10,7 @@ export default { version, migrate: async function (originalVersionedData) { - const versionedData = clone(originalVersionedData) + const versionedData = cloneDeep(originalVersionedData) versionedData.meta.version = version const state = versionedData.data const newState = transformState(state) diff --git a/app/scripts/migrations/032.js b/app/scripts/migrations/032.js index 6ad21fad734c..4f807617de9f 100644 --- a/app/scripts/migrations/032.js +++ b/app/scripts/migrations/032.js @@ -1,5 +1,5 @@ const version = 32 -import clone from 'clone' +import { cloneDeep } from 'lodash' /** * The purpose of this migration is to set the {@code completedUiMigration} flag based on the user's UI preferences @@ -7,7 +7,7 @@ import clone from 'clone' export default { version, migrate: async function (originalVersionedData) { - const versionedData = clone(originalVersionedData) + const versionedData = cloneDeep(originalVersionedData) versionedData.meta.version = version const state = versionedData.data versionedData.data = transformState(state) diff --git a/app/scripts/migrations/033.js b/app/scripts/migrations/033.js index 9a1f3f48aa7a..70710e793c55 100644 --- a/app/scripts/migrations/033.js +++ b/app/scripts/migrations/033.js @@ -7,13 +7,13 @@ Cleans up notices and assocated notice controller code */ -import clone from 'clone' +import { cloneDeep } from 'lodash' export default { version, migrate: async function (originalVersionedData) { - const versionedData = clone(originalVersionedData) + const versionedData = cloneDeep(originalVersionedData) versionedData.meta.version = version const state = versionedData.data const newState = transformState(state) diff --git a/app/scripts/migrations/034.js b/app/scripts/migrations/034.js index 93235b28af95..f8851047b1cd 100644 --- a/app/scripts/migrations/034.js +++ b/app/scripts/migrations/034.js @@ -1,5 +1,5 @@ const version = 34 -import clone from 'clone' +import { cloneDeep } from 'lodash' /** * The purpose of this migration is to enable the {@code privacyMode} feature flag and set the user as being migrated @@ -8,7 +8,7 @@ import clone from 'clone' export default { version, migrate: async function (originalVersionedData) { - const versionedData = clone(originalVersionedData) + const versionedData = cloneDeep(originalVersionedData) versionedData.meta.version = version const state = versionedData.data versionedData.data = transformState(state) diff --git a/app/scripts/migrations/035.js b/app/scripts/migrations/035.js index 4e3e8880153b..ab80aac3352d 100644 --- a/app/scripts/migrations/035.js +++ b/app/scripts/migrations/035.js @@ -7,13 +7,13 @@ Removes the deprecated 'seedWords' state */ -import clone from 'clone' +import { cloneDeep } from 'lodash' export default { version, migrate: async function (originalVersionedData) { - const versionedData = clone(originalVersionedData) + const versionedData = cloneDeep(originalVersionedData) versionedData.meta.version = version versionedData.data = transformState(versionedData.data) return versionedData diff --git a/app/scripts/migrations/036.js b/app/scripts/migrations/036.js index 186ff2623201..0ba0bc035de9 100644 --- a/app/scripts/migrations/036.js +++ b/app/scripts/migrations/036.js @@ -1,5 +1,5 @@ const version = 36 -import clone from 'clone' +import { cloneDeep } from 'lodash' /** * The purpose of this migration is to remove the {@code privacyMode} feature flag. @@ -7,7 +7,7 @@ import clone from 'clone' export default { version, migrate: async function (originalVersionedData) { - const versionedData = clone(originalVersionedData) + const versionedData = cloneDeep(originalVersionedData) versionedData.meta.version = version const state = versionedData.data versionedData.data = transformState(state) diff --git a/app/scripts/migrations/037.js b/app/scripts/migrations/037.js index 9db4deb5bc3c..6b4dd8796de9 100644 --- a/app/scripts/migrations/037.js +++ b/app/scripts/migrations/037.js @@ -1,5 +1,5 @@ const version = 37 -import clone from 'clone' +import { cloneDeep } from 'lodash' import { util } from 'gaba' /** @@ -10,7 +10,7 @@ import { util } from 'gaba' export default { version, migrate: async function (originalVersionedData) { - const versionedData = clone(originalVersionedData) + const versionedData = cloneDeep(originalVersionedData) versionedData.meta.version = version const state = versionedData.data versionedData.data = transformState(state) diff --git a/app/scripts/migrations/038.js b/app/scripts/migrations/038.js index d6ca5a741072..e0670d2c9d6e 100644 --- a/app/scripts/migrations/038.js +++ b/app/scripts/migrations/038.js @@ -1,5 +1,5 @@ const version = 38 -import clone from 'clone' +import { cloneDeep } from 'lodash' import ABTestController from '../controllers/ab-test' import { getRandomArrayItem } from '../lib/util' @@ -9,7 +9,7 @@ import { getRandomArrayItem } from '../lib/util' export default { version, migrate: async function (originalVersionedData) { - const versionedData = clone(originalVersionedData) + const versionedData = cloneDeep(originalVersionedData) versionedData.meta.version = version const state = versionedData.data versionedData.data = transformState(state) diff --git a/app/scripts/migrations/039.js b/app/scripts/migrations/039.js index 5b16eb1bc7b2..81405e25dff9 100644 --- a/app/scripts/migrations/039.js +++ b/app/scripts/migrations/039.js @@ -1,5 +1,5 @@ const version = 39 -import clone from 'clone' +import { cloneDeep } from 'lodash' import ethUtil from 'ethereumjs-util' const DAI_V1_CONTRACT_ADDRESS = '0x89d24A6b4CcB1B6fAA2625fE562bDD9a23260359' @@ -25,7 +25,7 @@ function isOldDai (token = {}) { export default { version, migrate: async function (originalVersionedData) { - const versionedData = clone(originalVersionedData) + const versionedData = cloneDeep(originalVersionedData) versionedData.meta.version = version const state = versionedData.data versionedData.data = transformState(state) diff --git a/app/scripts/migrations/040.js b/app/scripts/migrations/040.js index 19fa2bf16a87..ca243e4aa940 100644 --- a/app/scripts/migrations/040.js +++ b/app/scripts/migrations/040.js @@ -1,5 +1,5 @@ const version = 40 -import clone from 'clone' +import { cloneDeep } from 'lodash' /** * Site connections are now managed by the PermissionsController, and the @@ -9,7 +9,7 @@ import clone from 'clone' export default { version, migrate: async function (originalVersionedData) { - const versionedData = clone(originalVersionedData) + const versionedData = cloneDeep(originalVersionedData) versionedData.meta.version = version const state = versionedData.data versionedData.data = transformState(state) diff --git a/app/scripts/migrations/041.js b/app/scripts/migrations/041.js index a4b640a3da5b..f5016fad40ef 100644 --- a/app/scripts/migrations/041.js +++ b/app/scripts/migrations/041.js @@ -1,5 +1,5 @@ const version = 41 -import clone from 'clone' +import { cloneDeep } from 'lodash' /** * PreferencesController.autoLogoutTimeLimit -> autoLockTimeLimit @@ -7,7 +7,7 @@ import clone from 'clone' export default { version, migrate: async function (originalVersionedData) { - const versionedData = clone(originalVersionedData) + const versionedData = cloneDeep(originalVersionedData) versionedData.meta.version = version const state = versionedData.data versionedData.data = transformState(state) diff --git a/app/scripts/migrations/fail-tx.js b/app/scripts/migrations/fail-tx.js index 1bc274add7e3..bd4ed6e62617 100644 --- a/app/scripts/migrations/fail-tx.js +++ b/app/scripts/migrations/fail-tx.js @@ -1,8 +1,8 @@ -import clone from 'clone' +import { cloneDeep } from 'lodash' export default function failTxsThat (version, reason, condition) { return function (originalVersionedData) { - const versionedData = clone(originalVersionedData) + const versionedData = cloneDeep(originalVersionedData) versionedData.meta.version = version try { const state = versionedData.data diff --git a/app/scripts/migrations/template.js b/app/scripts/migrations/template.js index bff71aa33ad6..c9e3b795b1b3 100644 --- a/app/scripts/migrations/template.js +++ b/app/scripts/migrations/template.js @@ -7,13 +7,13 @@ description of migration and what it does */ -import clone from 'clone' +import { cloneDeep } from 'lodash' export default { version, migrate: async function (originalVersionedData) { - const versionedData = clone(originalVersionedData) + const versionedData = cloneDeep(originalVersionedData) versionedData.meta.version = version const state = versionedData.data const newState = transformState(state) diff --git a/development/version-bump.js b/development/version-bump.js index 301eb64d7b63..514408be11f5 100644 --- a/development/version-bump.js +++ b/development/version-bump.js @@ -1,7 +1,7 @@ -const clone = require('clone') +const { cloneDeep } = require('lodash') async function versionBump (bumpType, changelog, oldManifest) { - const manifest = clone(oldManifest) + const manifest = cloneDeep(oldManifest) const newVersion = newVersionFrom(manifest, bumpType) manifest.version = newVersion diff --git a/package.json b/package.json index 3873e6f6f135..21a7a73771ce 100644 --- a/package.json +++ b/package.json @@ -98,7 +98,6 @@ "c3": "^0.7.10", "cfx-fc-abi": "^1.0.0", "classnames": "^2.2.6", - "clone": "^2.1.2", "content-hash": "^2.5.0", "copy-to-clipboard": "^3.0.8", "currency-formatter": "^1.4.2", diff --git a/test/unit/app/controllers/metamask-controller-test.js b/test/unit/app/controllers/metamask-controller-test.js index 720b21d83f53..237dfb293bfa 100644 --- a/test/unit/app/controllers/metamask-controller-test.js +++ b/test/unit/app/controllers/metamask-controller-test.js @@ -1,6 +1,6 @@ import assert from 'assert' import sinon from 'sinon' -import clone from 'clone' +import { cloneDeep } from 'lodash' import nock from 'nock' import ethUtil from 'ethereumjs-util' import { obj as createThoughStream } from 'through2' @@ -104,7 +104,7 @@ describe('MetaMaskController', function () { return Promise.resolve(this.object) }, }, - initState: clone(firstTimeState), + initState: cloneDeep(firstTimeState), platform: { showTransactionNotification: () => {} }, }) // disable diagnostics diff --git a/test/unit/app/seed-phrase-verifier-test.js b/test/unit/app/seed-phrase-verifier-test.js index bd3bb1372e6c..95592592689a 100644 --- a/test/unit/app/seed-phrase-verifier-test.js +++ b/test/unit/app/seed-phrase-verifier-test.js @@ -1,5 +1,5 @@ import assert from 'assert' -import clone from 'clone' +import { cloneDeep } from 'lodash' import KeyringController from 'eth-keyring-controller' import firstTimeState from '../../../app/scripts/first-time-state' import seedPhraseVerifier from '../../../app/scripts/lib/seed-phrase-verifier' @@ -15,7 +15,7 @@ describe('SeedPhraseVerifier', function () { beforeEach(async function () { keyringController = new KeyringController({ - initState: clone(firstTimeState), + initState: cloneDeep(firstTimeState), encryptor: mockEncryptor, }) diff --git a/test/unit/migrations/migrator-test.js b/test/unit/migrations/migrator-test.js index 202baacddce9..70986eb7ffc7 100644 --- a/test/unit/migrations/migrator-test.js +++ b/test/unit/migrations/migrator-test.js @@ -1,6 +1,6 @@ import fs from 'fs' import assert from 'assert' -import clone from 'clone' +import { cloneDeep } from 'lodash' import pify from 'pify' import Migrator from '../../../app/scripts/lib/migrator' import liveMigrations from '../../../app/scripts/migrations' @@ -10,23 +10,23 @@ const stubMigrations = [ version: 1, migrate: data => { // clone the data just like we do in migrations - const clonedData = clone(data) + const clonedData = cloneDeep(data) clonedData.meta.version = 1 return Promise.resolve(clonedData) }, }, { version: 2, - migrate: data => { - const clonedData = clone(data) + migrate: (data) => { + const clonedData = cloneDeep(data) clonedData.meta.version = 2 return Promise.resolve(clonedData) }, }, { version: 3, - migrate: data => { - const clonedData = clone(data) + migrate: (data) => { + const clonedData = cloneDeep(data) clonedData.meta.version = 3 return Promise.resolve(clonedData) }, diff --git a/test/unit/ui/app/actions.spec.js b/test/unit/ui/app/actions.spec.js index 6353f6e3596a..9f477740137d 100644 --- a/test/unit/ui/app/actions.spec.js +++ b/test/unit/ui/app/actions.spec.js @@ -4,7 +4,7 @@ // import util from 'util' import assert from 'assert' import sinon from 'sinon' -import clone from 'clone' +import { cloneDeep } from 'lodash' import nock from 'nock' import fetchMock from 'fetch-mock' import configureStore from 'redux-mock-store' @@ -53,7 +53,7 @@ describe('Actions', () => { return Promise.resolve(this.object) }, }, - initState: clone(firstTimeState), + initState: cloneDeep(firstTimeState), }) metamaskController.threeBoxController = { diff --git a/ui/app/ducks/index.js b/ui/app/ducks/index.js index 3ceb529c1969..4786584b87fc 100644 --- a/ui/app/ducks/index.js +++ b/ui/app/ducks/index.js @@ -1,4 +1,4 @@ -import clone from 'clone' +import { cloneDeep } from 'lodash' import copyToClipboard from 'copy-to-clipboard' // @@ -57,7 +57,7 @@ function rootReducer (state, action) { } window.getCleanAppState = function () { - const state = clone(window.METAMASK_CACHED_LOG_STATE) + const state = cloneDeep(window.METAMASK_CACHED_LOG_STATE) // append additional information state.version = global.platform.getVersion() state.browser = window.navigator.userAgent