mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Fix migration 048 chainId conversion (#9567)
This commit is contained in:
parent
31d373e62c
commit
f9e0c64abe
@ -92,7 +92,7 @@ function transformState (state = {}) {
|
|||||||
const addressBook = state.AddressBookController?.addressBook || {}
|
const addressBook = state.AddressBookController?.addressBook || {}
|
||||||
Object.keys(addressBook).forEach((networkKey) => {
|
Object.keys(addressBook).forEach((networkKey) => {
|
||||||
if ((/^\d+$/ui).test(networkKey)) {
|
if ((/^\d+$/ui).test(networkKey)) {
|
||||||
const chainId = `0x${networkKey.toString(16)}`
|
const chainId = `0x${parseInt(networkKey, 10).toString(16)}`
|
||||||
updateChainIds(addressBook[networkKey], chainId)
|
updateChainIds(addressBook[networkKey], chainId)
|
||||||
|
|
||||||
if (addressBook[chainId]) {
|
if (addressBook[chainId]) {
|
||||||
|
@ -237,8 +237,8 @@ describe('migration #48', function () {
|
|||||||
|
|
||||||
const newStorage = await migration48.migrate(oldStorage)
|
const newStorage = await migration48.migrate(oldStorage)
|
||||||
assert.deepEqual(
|
assert.deepEqual(
|
||||||
{ ...oldStorage.data, ...expectedPreferencesState },
|
{ ...expectedPreferencesState, ...oldStorage.data },
|
||||||
{ ...newStorage.data, ...expectedPreferencesState },
|
{ ...expectedPreferencesState, ...newStorage.data },
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -361,6 +361,12 @@ describe('migration #48', function () {
|
|||||||
foo: 'bar',
|
foo: 'bar',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
'100': {
|
||||||
|
'address1': {
|
||||||
|
chainId: '100',
|
||||||
|
foo: 'bar',
|
||||||
|
},
|
||||||
|
},
|
||||||
'0x2': {
|
'0x2': {
|
||||||
'address2': {
|
'address2': {
|
||||||
chainId: '0x2',
|
chainId: '0x2',
|
||||||
@ -387,6 +393,12 @@ describe('migration #48', function () {
|
|||||||
foo: 'bar',
|
foo: 'bar',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
'0x64': {
|
||||||
|
'address1': {
|
||||||
|
chainId: '0x64',
|
||||||
|
foo: 'bar',
|
||||||
|
},
|
||||||
|
},
|
||||||
'0x2': {
|
'0x2': {
|
||||||
'address2': {
|
'address2': {
|
||||||
chainId: '0x2',
|
chainId: '0x2',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user