Skip to content

Commit 4ec8b2d

Browse files
committed
Support override if legacy gas fee
1 parent b6a6ee2 commit 4ec8b2d

File tree

2 files changed

+30
-2
lines changed

2 files changed

+30
-2
lines changed

packages/transaction-controller/src/utils/balance-changes.test.ts

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1022,6 +1022,33 @@ describe('Simulation Utils', () => {
10221022
);
10231023
});
10241024

1025+
it('legacy gas fee', async () => {
1026+
queryMock.mockResolvedValue('0xc1f3d');
1027+
1028+
await getBalanceChanges({
1029+
...REQUEST_MOCK,
1030+
txParams: {
1031+
...REQUEST_MOCK.txParams,
1032+
gasPrice: '0x123',
1033+
maxFeePerGas: undefined,
1034+
maxPriorityFeePerGas: undefined,
1035+
value: '0x0',
1036+
},
1037+
});
1038+
1039+
expect(simulateTransactionsMock).toHaveBeenCalledTimes(1);
1040+
expect(simulateTransactionsMock).toHaveBeenCalledWith(
1041+
expect.any(String),
1042+
expect.objectContaining({
1043+
overrides: {
1044+
[USER_ADDRESS_MOCK]: {
1045+
balance: '0xc1f3e',
1046+
},
1047+
},
1048+
}),
1049+
);
1050+
});
1051+
10251052
it('value', async () => {
10261053
queryMock.mockResolvedValue('0x122');
10271054

packages/transaction-controller/src/utils/balance-changes.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -697,8 +697,9 @@ async function baseRequest({
697697
data: txParams.data as Hex,
698698
from: txParams.from as Hex,
699699
gas: txParams.gas as Hex,
700-
maxFeePerGas: txParams.maxFeePerGas as Hex,
701-
maxPriorityFeePerGas: txParams.maxPriorityFeePerGas as Hex,
700+
maxFeePerGas: (txParams.maxFeePerGas ?? txParams.gasPrice) as Hex,
701+
maxPriorityFeePerGas: (txParams.maxPriorityFeePerGas ??
702+
txParams.gasPrice) as Hex,
702703
to: txParams.to as Hex,
703704
value: txParams.value as Hex,
704705
};

0 commit comments

Comments
 (0)