1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-22 17:33:23 +01:00

avoid mutation of state in signTransaction action (#17772)

Co-authored-by: ryanml <ryanlanese@gmail.com>
This commit is contained in:
Brad Decker 2023-02-23 12:16:55 -06:00 committed by GitHub
parent 88b8da79d5
commit df0ca5a43f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,7 +1,7 @@
import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
import BigNumber from 'bignumber.js';
import { addHexPrefix } from 'ethereumjs-util';
import { debounce } from 'lodash';
import { cloneDeep, debounce } from 'lodash';
import { v4 as uuidv4 } from 'uuid';
import {
decimalToHex,
@ -2270,7 +2270,7 @@ export function signTransaction() {
// merge in the modified txParams. Once the transaction has been modified
// we can send that to the background to update the transaction in state.
const unapprovedTxs = getUnapprovedTxs(state);
const unapprovedTx = unapprovedTxs[draftTransaction.id];
const unapprovedTx = cloneDeep(unapprovedTxs[draftTransaction.id]);
// We only update the tx params that can be changed via the edit flow UX
const eip1559OnlyTxParamsToUpdate = {
data: txParams.data,