mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-22 01:47:00 +01:00
centralize min gas const (#12387)
This commit is contained in:
parent
d90ac2d8e6
commit
83d5eec2dc
@ -1,11 +1,11 @@
|
||||
import { addHexPrefix } from 'ethereumjs-util';
|
||||
import { MIN_GAS_LIMIT_HEX } from '../../ui/pages/send/send.constants';
|
||||
|
||||
const TWENTY_ONE_THOUSAND = 21000;
|
||||
const ONE_HUNDRED_THOUSAND = 100000;
|
||||
|
||||
export const GAS_LIMITS = {
|
||||
// maximum gasLimit of a simple send
|
||||
SIMPLE: addHexPrefix(TWENTY_ONE_THOUSAND.toString(16)),
|
||||
SIMPLE: addHexPrefix(MIN_GAS_LIMIT_HEX),
|
||||
// a base estimate for token transfers.
|
||||
BASE_TOKEN_ESTIMATE: addHexPrefix(ONE_HUNDRED_THOUSAND.toString(16)),
|
||||
};
|
||||
|
@ -51,6 +51,7 @@ import {
|
||||
} from '../../store/actions';
|
||||
|
||||
import Typography from '../../components/ui/typography/typography';
|
||||
import { MIN_GAS_LIMIT_DEC } from '../send/send.constants';
|
||||
|
||||
const renderHeartBeatIfNotInTest = () =>
|
||||
process.env.IN_TEST === 'true' ? null : <LoadingHeartBeat />;
|
||||
@ -232,7 +233,7 @@ export default class ConfirmTransactionBase extends Component {
|
||||
};
|
||||
}
|
||||
|
||||
if (hexToDecimal(customGas.gasLimit) < 21000) {
|
||||
if (hexToDecimal(customGas.gasLimit) < Number(MIN_GAS_LIMIT_DEC)) {
|
||||
return {
|
||||
valid: false,
|
||||
errorKey: GAS_LIMIT_TOO_LOW_ERROR_KEY,
|
||||
|
Loading…
Reference in New Issue
Block a user