1
0
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 ()

* 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:
Dan J Miller 2021-08-02 12:17:42 -02:30 committed by GitHub
parent 4ce6994a6c
commit 668fd2db66
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1508,6 +1508,7 @@ export function signTransaction() {
draftTransaction: { id, txParams },
recipient: { address },
amount: { value },
eip1559support,
} = state[name];
if (stage === SEND_STAGES.EDIT) {
// 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
// we can send that to the background to update the transaction in 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 editingTx = {
...unapprovedTx,
txParams: Object.assign(unapprovedTx.txParams, txParams),
txParams: Object.assign(
unapprovedTx.txParams,
eip1559support ? eip1559OnlyTxParamsToUpdate : txParams,
),
};
dispatch(updateTransaction(editingTx));
} else if (asset.type === ASSET_TYPES.TOKEN) {