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

Add goerli, bsc, optimism, polygon, avalance, fantom, arbitrum network to query balances using BalanceChecker (#13846)

This commit is contained in:
Ayanami 2022-07-19 00:51:18 +09:00 committed by GitHub
parent 769b16eaa9
commit 6cd036e9a1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 77 additions and 0 deletions

View File

@ -6,3 +6,17 @@ export const SINGLE_CALL_BALANCES_ADDRESS_ROPSTEN =
'0xb8e671734ce5c8d7dfbbea5574fa4cf39f7a54a4';
export const SINGLE_CALL_BALANCES_ADDRESS_KOVAN =
'0xb1d3fbb2f83aecd196f474c16ca5d9cffa0d0ffc';
export const SINGLE_CALL_BALANCES_ADDRESS_GOERLI =
'0x9788C4E93f9002a7ad8e72633b11E8d1ecd51f9b';
export const SINGLE_CALL_BALANCES_ADDRESS_BSC =
'0x2352c63A83f9Fd126af8676146721Fa00924d7e4';
export const SINGLE_CALL_BALANCES_ADDRESS_OPTIMISM =
'0xB1c568e9C3E6bdaf755A60c7418C269eb11524FC';
export const SINGLE_CALL_BALANCES_ADDRESS_POLYGON =
'0x2352c63A83f9Fd126af8676146721Fa00924d7e4';
export const SINGLE_CALL_BALANCES_ADDRESS_AVALANCHE =
'0xD023D153a0DFa485130ECFdE2FAA7e612EF94818';
export const SINGLE_CALL_BALANCES_ADDRESS_FANTOM =
'0x07f697424ABe762bB808c109860c04eA488ff92B';
export const SINGLE_CALL_BALANCES_ADDRESS_ARBITRUM =
'0x151E24A486D7258dd7C33Fb67E4bB01919B7B32c';

View File

@ -19,6 +19,13 @@ import {
RINKEBY_CHAIN_ID,
ROPSTEN_CHAIN_ID,
KOVAN_CHAIN_ID,
GOERLI_CHAIN_ID,
BSC_CHAIN_ID,
OPTIMISM_CHAIN_ID,
POLYGON_CHAIN_ID,
AVALANCHE_CHAIN_ID,
FANTOM_CHAIN_ID,
ARBITRUM_CHAIN_ID,
} from '../../../shared/constants/network';
import {
@ -26,6 +33,13 @@ import {
SINGLE_CALL_BALANCES_ADDRESS_RINKEBY,
SINGLE_CALL_BALANCES_ADDRESS_ROPSTEN,
SINGLE_CALL_BALANCES_ADDRESS_KOVAN,
SINGLE_CALL_BALANCES_ADDRESS_GOERLI,
SINGLE_CALL_BALANCES_ADDRESS_BSC,
SINGLE_CALL_BALANCES_ADDRESS_OPTIMISM,
SINGLE_CALL_BALANCES_ADDRESS_POLYGON,
SINGLE_CALL_BALANCES_ADDRESS_AVALANCHE,
SINGLE_CALL_BALANCES_ADDRESS_FANTOM,
SINGLE_CALL_BALANCES_ADDRESS_ARBITRUM,
} from '../constants/contracts';
import { bnToHex } from './util';
@ -230,6 +244,55 @@ export default class AccountTracker {
);
break;
case GOERLI_CHAIN_ID:
await this._updateAccountsViaBalanceChecker(
addresses,
SINGLE_CALL_BALANCES_ADDRESS_GOERLI,
);
break;
case BSC_CHAIN_ID:
await this._updateAccountsViaBalanceChecker(
addresses,
SINGLE_CALL_BALANCES_ADDRESS_BSC,
);
break;
case OPTIMISM_CHAIN_ID:
await this._updateAccountsViaBalanceChecker(
addresses,
SINGLE_CALL_BALANCES_ADDRESS_OPTIMISM,
);
break;
case POLYGON_CHAIN_ID:
await this._updateAccountsViaBalanceChecker(
addresses,
SINGLE_CALL_BALANCES_ADDRESS_POLYGON,
);
break;
case AVALANCHE_CHAIN_ID:
await this._updateAccountsViaBalanceChecker(
addresses,
SINGLE_CALL_BALANCES_ADDRESS_AVALANCHE,
);
break;
case FANTOM_CHAIN_ID:
await this._updateAccountsViaBalanceChecker(
addresses,
SINGLE_CALL_BALANCES_ADDRESS_FANTOM,
);
break;
case ARBITRUM_CHAIN_ID:
await this._updateAccountsViaBalanceChecker(
addresses,
SINGLE_CALL_BALANCES_ADDRESS_ARBITRUM,
);
break;
default:
await Promise.all(addresses.map(this._updateAccount.bind(this)));
}