Skip to content
Open
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 @@ -1192,6 +1192,7 @@ describe('TokenDetectionController', () => {
'0xa',
'0x89',
'0x531',
'0x279f',
],
selectedAddress: secondSelectedAccount.address,
});
Expand Down
4 changes: 4 additions & 0 deletions packages/controller-utils/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Changed

- Add `monad-testnet` to `InfuraNetworkType` ([#7067](https://github.com/MetaMask/core/pull/7067))

## [11.15.0]

### Added
Expand Down
4 changes: 4 additions & 0 deletions packages/controller-utils/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export const InfuraNetworkType = {
'optimism-mainnet': 'optimism-mainnet',
'polygon-mainnet': 'polygon-mainnet',
'sei-mainnet': 'sei-mainnet',
'monad-testnet': 'monad-testnet',
} as const;

export type InfuraNetworkType =
Expand All @@ -24,6 +25,9 @@ export type InfuraNetworkType =
*/
export const CustomNetworkType = {
'megaeth-testnet': 'megaeth-testnet',
/**
Copy link
Contributor Author

Choose a reason for hiding this comment

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

we dont remove monad here to avoid breaking change

as controller utils is share everywhere

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, good call.

* @deprecated `monad-testnet` is supported on InfuraNetworkType instead.
*/
Copy link

Choose a reason for hiding this comment

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

Bug: Network Type Conflict Causes Classification Ambiguity

The monad-testnet entry remains in CustomNetworkType despite being moved to InfuraNetworkType. This causes monad-testnet to be a valid value for both types simultaneously. When NetworkType spreads both objects, the duplicate key creates ambiguity about whether monad-testnet is an Infura or custom network. Type guards like isInfuraNetworkType and runtime checks against CustomNetworkType will produce conflicting results, breaking the intended migration from custom to Infura network classification.

Fix in Cursor Fix in Web

'monad-testnet': 'monad-testnet',
} as const;
export type CustomNetworkType =
Expand Down
90 changes: 90 additions & 0 deletions packages/network-controller/tests/NetworkController.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -508,6 +508,21 @@ describe('NetworkController', () => {
},
],
},
"0x279f": Object {
Copy link
Contributor

Choose a reason for hiding this comment

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

Since this affects the default set of networks for NetworkController, what are your thoughts on adding a changelog entry for this package? Perhaps we could add an entry to Changed such as:

### Changed

- Update the default set of Infura networks to include Monad Testnet ([#7067](https://github.com/MetaMask/core/pull/7067))

Copy link
Contributor Author

@stanleyyconsensys stanleyyconsensys Nov 11, 2025

Choose a reason for hiding this comment

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

i think we only need that when network controller bump up? otherwise it seem still remain the same?
shall we only do it when i do the bump up?

Copy link
Contributor

Choose a reason for hiding this comment

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

We generally encourage updating changelogs as changes are made to packages, not at release time. As it stands your change affects NetworkController now, not when the release is created. (You can tell because the tests changed.) That's why I suggested updating the network-controller changelog in this PR rather than later.

"blockExplorerUrls": Array [],
"chainId": "0x279f",
"defaultRpcEndpointIndex": 0,
"name": "Monad Testnet",
"nativeCurrency": "MON",
"rpcEndpoints": Array [
Object {
"failoverUrls": Array [],
"networkClientId": "monad-testnet",
"type": "infura",
"url": "https://monad-testnet.infura.io/v3/{infuraProjectId}",
},
],
},
"0x38": Object {
"blockExplorerUrls": Array [],
"chainId": "0x38",
Expand Down Expand Up @@ -695,6 +710,21 @@ describe('NetworkController', () => {
},
],
},
"0x279f": Object {
"blockExplorerUrls": Array [],
"chainId": "0x279f",
"defaultRpcEndpointIndex": 0,
"name": "Monad Testnet",
"nativeCurrency": "MON",
"rpcEndpoints": Array [
Object {
"failoverUrls": Array [],
"networkClientId": "monad-testnet",
"type": "infura",
"url": "https://monad-testnet.infura.io/v3/{infuraProjectId}",
},
],
},
"0x38": Object {
"blockExplorerUrls": Array [],
"chainId": "0x38",
Expand Down Expand Up @@ -2001,6 +2031,21 @@ describe('NetworkController', () => {
enableRpcFailover: expect.any(Function),
disableRpcFailover: expect.any(Function),
},
'monad-testnet': {
blockTracker: expect.anything(),
configuration: {
type: NetworkClientType.Infura,
failoverRpcUrls: [],
infuraProjectId,
chainId: '0x279f',
ticker: 'MON',
network: InfuraNetworkType['monad-testnet'],
},
provider: expect.anything(),
destroy: expect.any(Function),
enableRpcFailover: expect.any(Function),
disableRpcFailover: expect.any(Function),
},
'optimism-mainnet': {
blockTracker: expect.anything(),
configuration: {
Expand Down Expand Up @@ -14793,6 +14838,21 @@ describe('NetworkController', () => {
},
],
},
"0x279f": Object {
"blockExplorerUrls": Array [],
"chainId": "0x279f",
"defaultRpcEndpointIndex": 0,
"name": "Monad Testnet",
"nativeCurrency": "MON",
"rpcEndpoints": Array [
Object {
"failoverUrls": Array [],
"networkClientId": "monad-testnet",
"type": "infura",
"url": "https://monad-testnet.infura.io/v3/{infuraProjectId}",
},
],
},
"0x38": Object {
"blockExplorerUrls": Array [],
"chainId": "0x38",
Expand Down Expand Up @@ -14962,6 +15022,21 @@ describe('NetworkController', () => {
},
],
},
"0x279f": Object {
"blockExplorerUrls": Array [],
"chainId": "0x279f",
"defaultRpcEndpointIndex": 0,
"name": "Monad Testnet",
"nativeCurrency": "MON",
"rpcEndpoints": Array [
Object {
"failoverUrls": Array [],
"networkClientId": "monad-testnet",
"type": "infura",
"url": "https://monad-testnet.infura.io/v3/{infuraProjectId}",
},
],
},
"0x38": Object {
"blockExplorerUrls": Array [],
"chainId": "0x38",
Expand Down Expand Up @@ -15131,6 +15206,21 @@ describe('NetworkController', () => {
},
],
},
"0x279f": Object {
"blockExplorerUrls": Array [],
"chainId": "0x279f",
"defaultRpcEndpointIndex": 0,
"name": "Monad Testnet",
"nativeCurrency": "MON",
"rpcEndpoints": Array [
Object {
"failoverUrls": Array [],
"networkClientId": "monad-testnet",
"type": "infura",
"url": "https://monad-testnet.infura.io/v3/{infuraProjectId}",
},
],
},
"0x38": Object {
"blockExplorerUrls": Array [],
"chainId": "0x38",
Expand Down
Loading