1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00

Dont default gas limit in gas popover when non is available on transaction params (#11872)

* Dont default gas limit when non is available on transaction params

* Fix unit tests
This commit is contained in:
Dan J Miller 2021-08-18 07:24:53 -02:30 committed by GitHub
parent d1d6f0531e
commit 05fa7961f1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 2 deletions

View File

@ -229,7 +229,7 @@ export function useGasFeeInputs(
initialGasPrice && initialFeeParamsAreCustom ? initialGasPrice : null,
);
const [gasLimit, setGasLimit] = useState(
Number(hexToDecimal(transaction?.txParams?.gas ?? minimumGasLimit)),
Number(hexToDecimal(transaction?.txParams?.gas ?? '0x0')),
);
const userPrefersAdvancedGas = useSelector(getAdvancedInlineGasShown);

View File

@ -323,7 +323,12 @@ describe('useGasFeeInputs', () => {
});
it('should return true', () => {
const { result } = renderHook(() => useGasFeeInputs());
const { result } = renderHook(() =>
useGasFeeInputs(null, {
userFeeLevel: 'medium',
txParams: { gas: '0x5208' },
}),
);
expect(result.current.balanceError).toBe(true);
});
});