mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
create safer isValidAddress method (#11089)
This commit is contained in:
parent
fac258a38a
commit
19ec45ef35
@ -11,11 +11,13 @@ jest.mock('../../../../helpers/utils/util', () => ({
|
||||
isDefaultMetaMaskChain: jest.fn().mockReturnValue(true),
|
||||
isEthNetwork: jest.fn().mockReturnValue(true),
|
||||
checkExistingAddresses: jest.fn().mockReturnValue(true),
|
||||
isValidDomainName: jest.requireActual('../../../../helpers/utils/util')
|
||||
.isValidDomainName,
|
||||
isOriginContractAddress: jest.requireActual('../../../../helpers/utils/util')
|
||||
.isOriginContractAddress,
|
||||
}));
|
||||
|
||||
jest.mock('../../../../../../shared/modules/hexstring-utils', () => ({
|
||||
jest.mock('../../../../../shared/modules/hexstring-utils', () => ({
|
||||
isValidHexAddress: jest.fn((to) =>
|
||||
Boolean(to.match(/^[0xabcdef123456798]+$/u)),
|
||||
),
|
||||
|
@ -9,12 +9,12 @@ import networkMap from 'ethereum-ens-network-map';
|
||||
import log from 'loglevel';
|
||||
import { isHexString } from 'ethereumjs-util';
|
||||
import { ellipsify } from '../../send.utils';
|
||||
import { isValidDomainName } from '../../../../helpers/utils/util';
|
||||
import { MAINNET_NETWORK_ID } from '../../../../../shared/constants/network';
|
||||
import {
|
||||
isBurnAddress,
|
||||
isValidHexAddress,
|
||||
} from '../../../../../shared/modules/hexstring-utils';
|
||||
import { isValidDomainName } from '../../../../helpers/utils/util';
|
||||
import { MAINNET_NETWORK_ID } from '../../../../../shared/constants/network';
|
||||
|
||||
// Local Constants
|
||||
const ZERO_ADDRESS = '0x0000000000000000000000000000000000000000';
|
||||
|
Loading…
Reference in New Issue
Block a user