mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-22 09:57:02 +01:00
Turning OFF token detection for test nets (#12232)
This commit is contained in:
parent
bf89226ca1
commit
e238cbc568
@ -4,6 +4,7 @@ import SINGLE_CALL_BALANCES_ABI from 'single-call-balance-checker-abi';
|
||||
import { SINGLE_CALL_BALANCES_ADDRESS } from '../constants/contracts';
|
||||
import { MINUTE } from '../../../shared/constants/time';
|
||||
import { isEqualCaseInsensitive } from '../../../ui/helpers/utils/util';
|
||||
import { MAINNET_CHAIN_ID } from '../../../shared/constants/network';
|
||||
|
||||
// By default, poll every 3 minutes
|
||||
const DEFAULT_INTERVAL = MINUTE * 3;
|
||||
@ -79,7 +80,13 @@ export default class DetectTokensController {
|
||||
}
|
||||
|
||||
const { tokenList } = this._tokenList.state;
|
||||
if (Object.keys(tokenList).length === 0) {
|
||||
// since the token detection is currently enabled only on Mainnet
|
||||
// we can use the chainId check to ensure token detection is not triggered for any other network
|
||||
// but once the balance check contract for other networks are deploayed and ready to use, we need to update this check.
|
||||
if (
|
||||
this._network.store.getState().provider.chainId !== MAINNET_CHAIN_ID ||
|
||||
Object.keys(tokenList).length === 0
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -42,6 +42,7 @@ describe('DetectTokensController', function () {
|
||||
'0x7e57e2',
|
||||
'0xbc86727e770de68b1060c91f6bb6945c73e10388',
|
||||
]);
|
||||
preferences.setUseTokenDetection(true);
|
||||
sandbox
|
||||
.stub(network, 'getLatestBlock')
|
||||
.callsFake(() => Promise.resolve({}));
|
||||
|
Loading…
Reference in New Issue
Block a user