diff --git a/app/scripts/migrations/048.js b/app/scripts/migrations/048.js index 070b12673..faf4d2a0a 100644 --- a/app/scripts/migrations/048.js +++ b/app/scripts/migrations/048.js @@ -92,7 +92,7 @@ function transformState (state = {}) { const addressBook = state.AddressBookController?.addressBook || {} Object.keys(addressBook).forEach((networkKey) => { if ((/^\d+$/ui).test(networkKey)) { - const chainId = `0x${networkKey.toString(16)}` + const chainId = `0x${parseInt(networkKey, 10).toString(16)}` updateChainIds(addressBook[networkKey], chainId) if (addressBook[chainId]) { diff --git a/test/unit/migrations/048-test.js b/test/unit/migrations/048-test.js index acc80e4b1..3fab3913b 100644 --- a/test/unit/migrations/048-test.js +++ b/test/unit/migrations/048-test.js @@ -237,8 +237,8 @@ describe('migration #48', function () { const newStorage = await migration48.migrate(oldStorage) assert.deepEqual( - { ...oldStorage.data, ...expectedPreferencesState }, - { ...newStorage.data, ...expectedPreferencesState }, + { ...expectedPreferencesState, ...oldStorage.data }, + { ...expectedPreferencesState, ...newStorage.data }, ) }) @@ -361,6 +361,12 @@ describe('migration #48', function () { foo: 'bar', }, }, + '100': { + 'address1': { + chainId: '100', + foo: 'bar', + }, + }, '0x2': { 'address2': { chainId: '0x2', @@ -387,6 +393,12 @@ describe('migration #48', function () { foo: 'bar', }, }, + '0x64': { + 'address1': { + chainId: '0x64', + foo: 'bar', + }, + }, '0x2': { 'address2': { chainId: '0x2',