mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Ensure that gas fee/prices params are not updated while in send edit stage/mode (#11620)
* Ensure that gas fee/prices params are not updated while in send edit stage/mode * Allow editing of txparams gas price when not on eip1559 network, in send flow
This commit is contained in:
parent
4ce6994a6c
commit
668fd2db66
@ -1508,6 +1508,7 @@ export function signTransaction() {
|
|||||||
draftTransaction: { id, txParams },
|
draftTransaction: { id, txParams },
|
||||||
recipient: { address },
|
recipient: { address },
|
||||||
amount: { value },
|
amount: { value },
|
||||||
|
eip1559support,
|
||||||
} = state[name];
|
} = state[name];
|
||||||
if (stage === SEND_STAGES.EDIT) {
|
if (stage === SEND_STAGES.EDIT) {
|
||||||
// When dealing with the edit flow there is already a transaction in
|
// When dealing with the edit flow there is already a transaction in
|
||||||
@ -1516,10 +1517,21 @@ export function signTransaction() {
|
|||||||
// merge in the modified txParams. Once the transaction has been modified
|
// merge in the modified txParams. Once the transaction has been modified
|
||||||
// we can send that to the background to update the transaction in state.
|
// we can send that to the background to update the transaction in state.
|
||||||
const unapprovedTxs = getUnapprovedTxs(state);
|
const unapprovedTxs = getUnapprovedTxs(state);
|
||||||
|
// We only update the tx params that can be changed via the edit flow UX
|
||||||
|
const eip1559OnlyTxParamsToUpdate = {
|
||||||
|
data: txParams.data,
|
||||||
|
from: txParams.from,
|
||||||
|
to: txParams.to,
|
||||||
|
value: txParams.value,
|
||||||
|
gas: txParams.gas,
|
||||||
|
};
|
||||||
const unapprovedTx = unapprovedTxs[id];
|
const unapprovedTx = unapprovedTxs[id];
|
||||||
const editingTx = {
|
const editingTx = {
|
||||||
...unapprovedTx,
|
...unapprovedTx,
|
||||||
txParams: Object.assign(unapprovedTx.txParams, txParams),
|
txParams: Object.assign(
|
||||||
|
unapprovedTx.txParams,
|
||||||
|
eip1559support ? eip1559OnlyTxParamsToUpdate : txParams,
|
||||||
|
),
|
||||||
};
|
};
|
||||||
dispatch(updateTransaction(editingTx));
|
dispatch(updateTransaction(editingTx));
|
||||||
} else if (asset.type === ASSET_TYPES.TOKEN) {
|
} else if (asset.type === ASSET_TYPES.TOKEN) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user