Skip to content

Commit

Permalink
fix: Fix wallet_switchEthereumChain chainId validation (#8883)
Browse files Browse the repository at this point in the history
## **Description**

This PR makes `wallet_switchEthereumChain` chainId validation better

## **Related issues**

## **Manual testing steps**

## **Screenshots/Recordings**

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

### **Before**

### **After**

## **Pre-merge author checklist**

- [x] I’ve followed [MetaMask Coding
Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md).
- [x] I've clearly explained what problem this PR is solving and how it
is solved.
- [x] I've linked related issues
- [x] I've included manual testing steps
- [x] I've included screenshots/recordings if applicable
- [ ] I’ve included tests if applicable
- [x] I’ve documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [x] 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.
- [ ] I’ve properly set the pull request status:
  - [ ] In case it's not yet "ready for review", I've set it to "draft".
- [ ] In case it's "ready for review", I've changed it from "draft" to
"non-draft".

## **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.
  • Loading branch information
jiexi committed Mar 8, 2024
1 parent 75e1442 commit 1441829
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion app/util/regex/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export const regex: RegexTypes = {
nonNumber: /[^0-9.]/g,
number: /^(\d+(\.\d+)?)$/,
portfolioUrl: new RegExp(`${AppConstants.PORTFOLIO_URL}/(?![a-z])`),
prefixedFormattedHexString: /^0x[1-9a-f]+[0-9a-f]*$/iu,
prefixedFormattedHexString: /^0x[1-9a-f][0-9a-f]*$/iu,
privateCredentials: /"/g,
protocol: /^[a-z]*:\/\//,
replaceNetworkErrorSentry: /0x[A-Fa-f0-9]{40}/u,
Expand Down

0 comments on commit 1441829

Please sign in to comment.