Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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
1 change: 1 addition & 0 deletions packages/controller-utils/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- Update `normalizeEnsName` regex to allow ENS names with 3 or more characters (previously required 7 or more) ([#8510](https://github.com/MetaMask/core/pull/8510))
- Update default Sei Mainnet block explorer URL from `seitrace.com` to `seiscan.io` ([#8545](https://github.com/MetaMask/core/pull/8545))
- Update `InfuraNetworkType`, `ChainId`, `NetworksTicker`, `BlockExplorerUrl`, and `NetworkNickname` to include missing Infura networks ([#8680](https://github.com/MetaMask/core/pull/8680))

## [11.20.0]

Expand Down
22 changes: 22 additions & 0 deletions packages/controller-utils/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@
'optimism-mainnet': 'optimism-mainnet',
'polygon-mainnet': 'polygon-mainnet',
'sei-mainnet': 'sei-mainnet',
'monad-mainnet': 'monad-mainnet',
'megaeth-mainnet': 'megaeth-mainnet',
'avalanche-mainnet': 'avalanche-mainnet',
'zksync-mainnet': 'zksync-mainnet',

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

BUILT_IN_NETWORKS missing new Infura network entries

Medium Severity

Four new networks (monad-mainnet, megaeth-mainnet, avalanche-mainnet, zksync-mainnet) are added to InfuraNetworkType but the publicly exported BUILT_IN_NETWORKS constant in constants.ts is not updated with corresponding entries. This object is documented as "Map of all build-in Infura networks" and every previous Infura network has an entry. The test helper in packages/network-controller/tests/network-client/helpers.ts accesses BUILT_IN_NETWORKS[infuraNetwork] where infuraNetwork is typed as InfuraNetworkType — passing any of the new networks would return undefined, causing a runtime crash when accessing .chainId or .ticker.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit bd05e8d. Configure here.

} as const;

export type InfuraNetworkType =
Expand Down Expand Up @@ -99,6 +103,9 @@
PolygonMainnet = 'polygon-mainnet',
SeiMainnet = 'sei-mainnet',
MegaETHMainnet = 'megaeth-mainnet',
MonadMainnet = 'monad-mainnet',
AvalancheMainnet = 'avalanche-mainnet',
ZksyncMainnet = 'zksync-mainnet',
}

/**
Expand Down Expand Up @@ -127,6 +134,9 @@
[BuiltInNetworkName.PolygonMainnet]: '0x89', // toHex(137)
[BuiltInNetworkName.SeiMainnet]: '0x531', // toHex(1329)
[BuiltInNetworkName.MegaETHMainnet]: '0x10e6', // toHex(4326)
[BuiltInNetworkName.MonadMainnet]: '0x8f', // toHex(143)
[BuiltInNetworkName.AvalancheMainnet]: '0xa86a', // toHex(43114)
[BuiltInNetworkName.ZksyncMainnet]: '0x144', // toHex(324)
} as const;
export type ChainId = (typeof ChainId)[keyof typeof ChainId];

Expand Down Expand Up @@ -156,6 +166,10 @@
'optimism-mainnet' = 'ETH',
'polygon-mainnet' = 'POL',
'sei-mainnet' = 'SEI',
'megaeth-mainnet' = 'MEGAETH',
Comment thread
mikesposito marked this conversation as resolved.
Outdated
'monad-mainnet' = 'MON',

Check failure on line 170 in packages/controller-utils/src/types.ts

View workflow job for this annotation

GitHub Actions / Lint, build, and test / Lint (lint:eslint)

Duplicate enum member value MON
'avalanche-mainnet' = 'AVAX',
'zksync-mainnet' = 'ETH',

Check failure on line 172 in packages/controller-utils/src/types.ts

View workflow job for this annotation

GitHub Actions / Lint, build, and test / Lint (lint:eslint)

Duplicate enum member value ETH
rpc = '',
}
/* eslint-enable @typescript-eslint/naming-convention */
Expand All @@ -180,6 +194,10 @@
[BuiltInNetworkName.OptimismMainnet]: 'https://optimistic.etherscan.io',
[BuiltInNetworkName.PolygonMainnet]: 'https://polygonscan.com',
[BuiltInNetworkName.SeiMainnet]: 'https://seiscan.io',
[BuiltInNetworkName.MegaETHMainnet]: 'https://megaeth.blockscout.com',
[BuiltInNetworkName.MonadMainnet]: 'https://explorer.monad.com',
Comment thread
cursor[bot] marked this conversation as resolved.
Outdated
[BuiltInNetworkName.AvalancheMainnet]: 'https://snowtrace.io',
[BuiltInNetworkName.ZksyncMainnet]: 'https://zkscan.io',
Comment thread
cursor[bot] marked this conversation as resolved.
Outdated
} as const satisfies Record<BuiltInNetworkType, string>;
export type BlockExplorerUrl =
(typeof BlockExplorerUrl)[keyof typeof BlockExplorerUrl];
Expand All @@ -203,6 +221,10 @@
[BuiltInNetworkName.OptimismMainnet]: 'Optimism Mainnet',
[BuiltInNetworkName.PolygonMainnet]: 'Polygon Mainnet',
[BuiltInNetworkName.SeiMainnet]: 'Sei Mainnet',
[BuiltInNetworkName.MegaETHMainnet]: 'MegaETH Mainnet',
[BuiltInNetworkName.MonadMainnet]: 'Monad Mainnet',
[BuiltInNetworkName.AvalancheMainnet]: 'Avalanche Mainnet',
[BuiltInNetworkName.ZksyncMainnet]: 'Zksync Mainnet',
} as const satisfies Record<BuiltInNetworkType, string>;
export type NetworkNickname =
(typeof NetworkNickname)[keyof typeof NetworkNickname];
Expand Down
Loading
Loading