mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Fix migration 47 (#9014)
This migration had referred to the non-existent `TransactionsController` instead of `TransactionController`, so it effectively did nothing. Now it should work. This migration hasn't been included in any release yet, so we can fix it in-place instead of adding an additional corrected migration. The migration comment has also been updated, as it was inaccurate.
This commit is contained in:
parent
b97cd1dc04
commit
022ef13372
@ -2,9 +2,7 @@ const version = 47
|
|||||||
import { cloneDeep } from 'lodash'
|
import { cloneDeep } from 'lodash'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Stringify numbers:
|
* Stringify the `metamaskNetworkId` property of all transactions
|
||||||
* - PreferencesController.frequentRpcListDetail item chainId
|
|
||||||
* - TransactionsController.transactions item metamaskNetworkId
|
|
||||||
*/
|
*/
|
||||||
export default {
|
export default {
|
||||||
version,
|
version,
|
||||||
@ -18,7 +16,7 @@ export default {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function transformState (state) {
|
function transformState (state) {
|
||||||
const transactions = state?.TransactionsController?.transactions
|
const transactions = state?.TransactionController?.transactions
|
||||||
if (Array.isArray(transactions)) {
|
if (Array.isArray(transactions)) {
|
||||||
transactions.forEach((transaction) => {
|
transactions.forEach((transaction) => {
|
||||||
if (typeof transaction.metamaskNetworkId === 'number') {
|
if (typeof transaction.metamaskNetworkId === 'number') {
|
||||||
|
@ -20,7 +20,7 @@ describe('migration #47', function () {
|
|||||||
const oldStorage = {
|
const oldStorage = {
|
||||||
meta: {},
|
meta: {},
|
||||||
data: {
|
data: {
|
||||||
TransactionsController: {
|
TransactionController: {
|
||||||
transactions: [
|
transactions: [
|
||||||
{ foo: 'bar', metamaskNetworkId: 2 },
|
{ foo: 'bar', metamaskNetworkId: 2 },
|
||||||
{ foo: 'bar' },
|
{ foo: 'bar' },
|
||||||
@ -34,7 +34,7 @@ describe('migration #47', function () {
|
|||||||
|
|
||||||
const newStorage = await migration47.migrate(oldStorage)
|
const newStorage = await migration47.migrate(oldStorage)
|
||||||
assert.deepEqual(newStorage.data, {
|
assert.deepEqual(newStorage.data, {
|
||||||
TransactionsController: {
|
TransactionController: {
|
||||||
transactions: [
|
transactions: [
|
||||||
{ foo: 'bar', metamaskNetworkId: '2' },
|
{ foo: 'bar', metamaskNetworkId: '2' },
|
||||||
{ foo: 'bar' },
|
{ foo: 'bar' },
|
||||||
@ -50,7 +50,7 @@ describe('migration #47', function () {
|
|||||||
const oldStorage = {
|
const oldStorage = {
|
||||||
meta: {},
|
meta: {},
|
||||||
data: {
|
data: {
|
||||||
TransactionsController: {
|
TransactionController: {
|
||||||
transactions: [
|
transactions: [
|
||||||
{ foo: 'bar', metamaskNetworkId: '2' },
|
{ foo: 'bar', metamaskNetworkId: '2' },
|
||||||
{ foo: 'bar' },
|
{ foo: 'bar' },
|
||||||
@ -70,7 +70,7 @@ describe('migration #47', function () {
|
|||||||
const oldStorage = {
|
const oldStorage = {
|
||||||
meta: {},
|
meta: {},
|
||||||
data: {
|
data: {
|
||||||
TransactionsController: {
|
TransactionController: {
|
||||||
bar: 'baz',
|
bar: 'baz',
|
||||||
},
|
},
|
||||||
foo: 'bar',
|
foo: 'bar',
|
||||||
@ -85,7 +85,7 @@ describe('migration #47', function () {
|
|||||||
const oldStorage = {
|
const oldStorage = {
|
||||||
meta: {},
|
meta: {},
|
||||||
data: {
|
data: {
|
||||||
TransactionsController: {
|
TransactionController: {
|
||||||
transactions: [],
|
transactions: [],
|
||||||
bar: 'baz',
|
bar: 'baz',
|
||||||
},
|
},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user