Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1181,7 +1181,18 @@ describe('TokenDetectionController', () => {
await advanceTime({ clock, duration: 1 });

expect(mockTokens).toHaveBeenNthCalledWith(1, {
chainIds: ['0x1', '0xaa36a7', '0xe705', '0xe708', '0x2105'],
chainIds: [
'0x1',
'0xaa36a7',
'0xe705',
'0xe708',
'0x2105',
'0xa4b1',
'0x38',
'0xa',
'0x89',
'0x531',
],
selectedAddress: secondSelectedAccount.address,
});
},
Expand Down
11 changes: 11 additions & 0 deletions packages/controller-utils/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Added

- Arbitrum, BSC, Optimism, Polygon, and Sei networks to Infura networks ([#6972](https://github.com/MetaMask/core/pull/6972))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we mark this as a breaking change?
Technically this is an addition, however I remember adding base-mainnet as a default network caused cascading changes on other controllers/clients.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed that these changes look innocuous. Also these changes make it so that these can be used as default networks but don't change the set of default networks themselves. I would expect that we would do that by changing network-controller. Do we anticipate also doing that in a separate PR?

That said, if have concerns, perhaps we could confirm by publishing a preview build and updating the clients as a preemptive measure?

@salimtb salimtb Oct 29, 2025 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mcmire this has been tested on the client side already , a PR for it has been merged MetaMask/metamask-extension#37172 using a patch , it was test by QA and all works as expected
let me know if this answer your concerns

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we applied a patch since core releases was blocked, and we needed this change to be included in the current release cut.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh perfect, okay, no problem then!

- Add `arbitrum-one`, `bsc-mainnet`, `optimism-mainnet`, `polygon-mainnet`, `sei-mainnet` to `BUILT_IN_NETWORKS`
- Add `arbitrum-one`, `bsc-mainnet`, `optimism-mainnet`, `polygon-mainnet`, `sei-mainnet` to `InfuraNetworkType`
- Add `ArbitrumOne`, `BscMainnet`, `OptimismMainnet`, `PolygonMainnet`, `SeiMainnet` to `BuiltInNetworkName` enum
- Add corresponding chain IDs to `ChainId` type (0xa4b1, 0x38, 0xa, 0x89, 0x531)
- Add `ETG`, `BNB`, `ETH`, `POL`, `SEI` tickers to `NetworksTicker` enum
- Add block explorer URLs to `BlockExplorerUrl` quasi-enum
- Add network nicknames to `NetworkNickname` quasi-enum

## [11.14.1]

### Changed
Expand Down
35 changes: 35 additions & 0 deletions packages/controller-utils/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,41 @@ export const BUILT_IN_NETWORKS = {
blockExplorerUrl: BlockExplorerUrl['base-mainnet'],
},
},
[NetworkType['arbitrum-mainnet']]: {
chainId: ChainId['arbitrum-mainnet'],
ticker: NetworksTicker['arbitrum-mainnet'],
rpcPrefs: {
blockExplorerUrl: BlockExplorerUrl['arbitrum-mainnet'],
},
},
[NetworkType['bsc-mainnet']]: {
chainId: ChainId['bsc-mainnet'],
ticker: NetworksTicker['bsc-mainnet'],
rpcPrefs: {
blockExplorerUrl: BlockExplorerUrl['bsc-mainnet'],
},
},
[NetworkType['optimism-mainnet']]: {
chainId: ChainId['optimism-mainnet'],
ticker: NetworksTicker['optimism-mainnet'],
rpcPrefs: {
blockExplorerUrl: BlockExplorerUrl['optimism-mainnet'],
},
},
[NetworkType['polygon-mainnet']]: {
chainId: ChainId['polygon-mainnet'],
ticker: NetworksTicker['polygon-mainnet'],
rpcPrefs: {
blockExplorerUrl: BlockExplorerUrl['polygon-mainnet'],
},
},
[NetworkType['sei-mainnet']]: {
chainId: ChainId['sei-mainnet'],
ticker: NetworksTicker['sei-mainnet'],
rpcPrefs: {
blockExplorerUrl: BlockExplorerUrl['sei-mainnet'],
},
},
[NetworkType.rpc]: {
chainId: undefined,
blockExplorerUrl: undefined,
Expand Down
32 changes: 32 additions & 0 deletions packages/controller-utils/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ export const InfuraNetworkType = {
'linea-sepolia': 'linea-sepolia',
'linea-mainnet': 'linea-mainnet',
'base-mainnet': 'base-mainnet',
'arbitrum-mainnet': 'arbitrum-mainnet',
'bsc-mainnet': 'bsc-mainnet',
'optimism-mainnet': 'optimism-mainnet',
'polygon-mainnet': 'polygon-mainnet',
'sei-mainnet': 'sei-mainnet',
} as const;

export type InfuraNetworkType =
Expand Down Expand Up @@ -80,6 +85,11 @@ export enum BuiltInNetworkName {
MegaETHTestnet = 'megaeth-testnet',
MonadTestnet = 'monad-testnet',
BaseMainnet = 'base-mainnet',
ArbitrumOne = 'arbitrum-mainnet',
BscMainnet = 'bsc-mainnet',
OptimismMainnet = 'optimism-mainnet',
PolygonMainnet = 'polygon-mainnet',
SeiMainnet = 'sei-mainnet',
}

/**
Expand All @@ -98,6 +108,11 @@ export const ChainId = {
[BuiltInNetworkName.MegaETHTestnet]: '0x18c6', // toHex(6342)
[BuiltInNetworkName.MonadTestnet]: '0x279f', // toHex(10143)
[BuiltInNetworkName.BaseMainnet]: '0x2105', // toHex(8453)
[BuiltInNetworkName.ArbitrumOne]: '0xa4b1', // toHex(42161)
[BuiltInNetworkName.BscMainnet]: '0x38', // toHex(56)
[BuiltInNetworkName.OptimismMainnet]: '0xa', // toHex(10)
[BuiltInNetworkName.PolygonMainnet]: '0x89', // toHex(137)
[BuiltInNetworkName.SeiMainnet]: '0x531', // toHex(1329)
} as const;
export type ChainId = (typeof ChainId)[keyof typeof ChainId];

Expand All @@ -114,6 +129,13 @@ export enum NetworksTicker {
'monad-testnet' = 'MON',
// eslint-disable-next-line @typescript-eslint/no-duplicate-enum-values
'base-mainnet' = 'ETH',
// eslint-disable-next-line @typescript-eslint/no-duplicate-enum-values

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ooh, this rule is not very useful, is it. I will look into disabling this.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 on this , i don't think it's really useful actually

'arbitrum-mainnet' = 'ETH',
'bsc-mainnet' = 'BNB',
// eslint-disable-next-line @typescript-eslint/no-duplicate-enum-values
'optimism-mainnet' = 'ETH',
'polygon-mainnet' = 'POL',
'sei-mainnet' = 'SEI',
rpc = '',
}

Expand All @@ -127,6 +149,11 @@ export const BlockExplorerUrl = {
[BuiltInNetworkName.MegaETHTestnet]: 'https://megaexplorer.xyz',
[BuiltInNetworkName.MonadTestnet]: 'https://testnet.monadexplorer.com',
[BuiltInNetworkName.BaseMainnet]: 'https://basescan.org',
[BuiltInNetworkName.ArbitrumOne]: 'https://arbiscan.io',
[BuiltInNetworkName.BscMainnet]: 'https://bscscan.com',
[BuiltInNetworkName.OptimismMainnet]: 'https://optimistic.etherscan.io',
[BuiltInNetworkName.PolygonMainnet]: 'https://polygonscan.com',
[BuiltInNetworkName.SeiMainnet]: 'https://seitrace.com',
} as const satisfies Record<BuiltInNetworkType, string>;
export type BlockExplorerUrl =
(typeof BlockExplorerUrl)[keyof typeof BlockExplorerUrl];
Expand All @@ -141,6 +168,11 @@ export const NetworkNickname = {
[BuiltInNetworkName.MegaETHTestnet]: 'Mega Testnet',
[BuiltInNetworkName.MonadTestnet]: 'Monad Testnet',
[BuiltInNetworkName.BaseMainnet]: 'Base Mainnet',
[BuiltInNetworkName.ArbitrumOne]: 'Arbitrum One',
[BuiltInNetworkName.BscMainnet]: 'BSC Mainnet',
[BuiltInNetworkName.OptimismMainnet]: 'Optimism Mainnet',
[BuiltInNetworkName.PolygonMainnet]: 'Polygon Mainnet',
[BuiltInNetworkName.SeiMainnet]: 'Sei Mainnet',
} as const satisfies Record<BuiltInNetworkType, string>;
export type NetworkNickname =
(typeof NetworkNickname)[keyof typeof NetworkNickname];
Expand Down
Loading
Loading