Skip to content

[pull] main from MetaMask:main#131

Merged
pull[bot] merged 1 commit into
Reality2byte:mainfrom
MetaMask:main
Sep 6, 2025
Merged

[pull] main from MetaMask:main#131
pull[bot] merged 1 commit into
Reality2byte:mainfrom
MetaMask:main

Conversation

@pull

@pull pull Bot commented Sep 6, 2025

Copy link
Copy Markdown

See Commits and Changes for more details.


Created by pull[bot] (v2.0.0-alpha.3)

Can you help keep this open source service alive? 💖 Please sponsor : )

#18958)

<!--
Please submit this PR as a draft initially.
Do not mark it as "Ready for review" until the template has been
completely filled out, and PR status checks have passed at least once.
-->

## **Description**

<!--
Write a short description of the changes included in this pull request,
also include relevant motivation and context. Have in mind the following
questions:
1. What is the reason for the change?
2. What is the improvement/solution?
-->
`wallet_addEthereumChain` was throwing when trying to add any "default
chains", in the sense of chains that are present by default when
installing MetaMask Mobile. These default chains, like Base, can however
be removed by users, so `wallet_addEthereumChain` shouldn't throw.

~This PR updates `wallet_addEthereumChain` to fail only for chains that
can't be removed by users, like Ethereum Mainnet, Linea Mainnet and
default testnets.~

This PR removes the out of date conditional where
`wallet_addEthereumChain` can't be called with some chainIds. This API
can be called with any `chainId` and will prompt the user to update the
default `rpcUrl` for an enabled networks (including "default networks")

## **Changelog**

<!--
If this PR is not End-User-Facing and should not show up in the
CHANGELOG, you can choose to either:
1. Write `CHANGELOG entry: null`
2. Label with `no-changelog`

If this PR is End-User-Facing, please write a short User-Facing
description in the past tense like:
`CHANGELOG entry: Added a new tab for users to see their NFTs`
`CHANGELOG entry: Fixed a bug that was causing some NFTs to flicker`

(This helps the Release Engineer do their job more quickly and
accurately)
-->

CHANGELOG entry: `wallet_addEthereumChain` no longer throws an error
when called with "default network" chainIds. This API can be called with
any `chainId` and will prompt the user to update the default `rpcUrl`
for an enabled networks (including "default networks").

## **Related issues**

Fixes:
[WAPI-408](https://consensyssoftware.atlassian.net/browse/WAPI-408)

## **Manual testing steps**

```gherkin
Feature: Add default chain

  Scenario: user tries to add a default chain previously removed
    Given a default chain (i.g. Base Mainnet) isn't part of the user's known networks

    When user visit an app that tries to switch to Base Mainnet
    Then it should correctly prompt to add Base Mainnet network
```

## **Screenshots/Recordings**

<!-- If applicable, add screenshots and/or recordings to visualize the
before and after of your change. -->

### **Before**

<!-- [screenshots/recordings] -->

### **After**

<!-- [screenshots/recordings] -->

## **Pre-merge author checklist**

- [ ] I’ve followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile
Coding
Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md).
- [ ] I've completed the PR template to the best of my ability
- [ ] I’ve included tests if applicable
- [ ] I’ve documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [ ] I’ve applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.

## **Pre-merge reviewer checklist**

- [ ] I've manually tested the PR (e.g. pull and build branch, run the
app, test code being changed).
- [ ] I confirm that this PR addresses all acceptance criteria described
in the ticket it closes and includes the necessary testing evidence such
as recordings and or screenshots.


[WAPI-408]:
https://consensyssoftware.atlassian.net/browse/WAPI-408?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ

---------

Co-authored-by: Alex Donesky <adonesky@gmail.com>
@pull pull Bot locked and limited conversation to collaborators Sep 6, 2025
@pull pull Bot added the ⤵️ pull label Sep 6, 2025
@pull pull Bot merged commit e624efc into Reality2byte:main Sep 6, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant