You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
64 lines
1.9 KiB
64 lines
1.9 KiB
4 years ago
|
import {
|
||
|
conversionUtil,
|
||
|
multiplyCurrencies,
|
||
4 years ago
|
} from '../../helpers/utils/conversion-util';
|
||
4 years ago
|
import { addHexPrefix } from '../../../app/scripts/lib/util';
|
||
7 years ago
|
|
||
4 years ago
|
const MIN_GAS_PRICE_DEC = '0';
|
||
|
const MIN_GAS_PRICE_HEX = parseInt(MIN_GAS_PRICE_DEC, 10).toString(16);
|
||
|
const MIN_GAS_LIMIT_DEC = '21000';
|
||
|
const MIN_GAS_LIMIT_HEX = parseInt(MIN_GAS_LIMIT_DEC, 10).toString(16);
|
||
7 years ago
|
|
||
4 years ago
|
const MIN_GAS_PRICE_GWEI = addHexPrefix(
|
||
4 years ago
|
conversionUtil(MIN_GAS_PRICE_HEX, {
|
||
|
fromDenomination: 'WEI',
|
||
|
toDenomination: 'GWEI',
|
||
|
fromNumericBase: 'hex',
|
||
|
toNumericBase: 'hex',
|
||
|
numberOfDecimals: 1,
|
||
|
}),
|
||
4 years ago
|
);
|
||
7 years ago
|
|
||
|
const MIN_GAS_TOTAL = multiplyCurrencies(MIN_GAS_LIMIT_HEX, MIN_GAS_PRICE_HEX, {
|
||
|
toNumericBase: 'hex',
|
||
|
multiplicandBase: 16,
|
||
|
multiplierBase: 16,
|
||
4 years ago
|
});
|
||
7 years ago
|
|
||
4 years ago
|
const TOKEN_TRANSFER_FUNCTION_SIGNATURE = '0xa9059cbb';
|
||
7 years ago
|
|
||
4 years ago
|
const INSUFFICIENT_FUNDS_ERROR = 'insufficientFunds';
|
||
|
const INSUFFICIENT_TOKENS_ERROR = 'insufficientTokens';
|
||
|
const NEGATIVE_ETH_ERROR = 'negativeETH';
|
||
|
const INVALID_RECIPIENT_ADDRESS_ERROR = 'invalidAddressRecipient';
|
||
4 years ago
|
const INVALID_RECIPIENT_ADDRESS_NOT_ETH_NETWORK_ERROR =
|
||
4 years ago
|
'invalidAddressRecipientNotEthNetwork';
|
||
|
const REQUIRED_ERROR = 'required';
|
||
|
const KNOWN_RECIPIENT_ADDRESS_ERROR = 'knownAddressRecipient';
|
||
4 years ago
|
const CONTRACT_ADDRESS_ERROR = 'contractAddressError';
|
||
4 years ago
|
const CONFUSING_ENS_ERROR = 'confusingEnsDomain';
|
||
7 years ago
|
|
||
4 years ago
|
const SIMPLE_GAS_COST = '0x5208'; // Hex for 21000, cost of a simple send.
|
||
|
const BASE_TOKEN_GAS_COST = '0x186a0'; // Hex for 100000, a base estimate for token transfers.
|
||
7 years ago
|
|
||
5 years ago
|
export {
|
||
7 years ago
|
INSUFFICIENT_FUNDS_ERROR,
|
||
|
INSUFFICIENT_TOKENS_ERROR,
|
||
|
INVALID_RECIPIENT_ADDRESS_ERROR,
|
||
6 years ago
|
KNOWN_RECIPIENT_ADDRESS_ERROR,
|
||
4 years ago
|
CONTRACT_ADDRESS_ERROR,
|
||
6 years ago
|
INVALID_RECIPIENT_ADDRESS_NOT_ETH_NETWORK_ERROR,
|
||
7 years ago
|
MIN_GAS_LIMIT_DEC,
|
||
|
MIN_GAS_LIMIT_HEX,
|
||
|
MIN_GAS_PRICE_DEC,
|
||
7 years ago
|
MIN_GAS_PRICE_GWEI,
|
||
|
MIN_GAS_PRICE_HEX,
|
||
|
MIN_GAS_TOTAL,
|
||
7 years ago
|
NEGATIVE_ETH_ERROR,
|
||
|
REQUIRED_ERROR,
|
||
4 years ago
|
CONFUSING_ENS_ERROR,
|
||
7 years ago
|
SIMPLE_GAS_COST,
|
||
7 years ago
|
TOKEN_TRANSFER_FUNCTION_SIGNATURE,
|
||
7 years ago
|
BASE_TOKEN_GAS_COST,
|
||
4 years ago
|
};
|