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
feature/default_network_editable
Dan J Miller 3 years ago committed by ryanml
parent 1a01172d93
commit f6cd702f1b
  1. 2
      ui/hooks/useGasFeeInputs.js
  2. 7
      ui/hooks/useGasFeeInputs.test.js

@ -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);

@ -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);
});
});

Loading…
Cancel
Save