1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 01:39:44 +01:00

Turning OFF token detection for test nets (#12232)

This commit is contained in:
Niranjana Binoy 2021-09-29 14:53:56 -04:00 committed by GitHub
parent bf89226ca1
commit e238cbc568
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 1 deletions

View File

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

View File

@ -42,6 +42,7 @@ describe('DetectTokensController', function () {
'0x7e57e2',
'0xbc86727e770de68b1060c91f6bb6945c73e10388',
]);
preferences.setUseTokenDetection(true);
sandbox
.stub(network, 'getLatestBlock')
.callsFake(() => Promise.resolve({}));