Skip to content

rough in switchEthereumChain#10905

Merged
brad-decker merged 1 commit intodevelopfrom
wallet_switchEthereumChain
May 10, 2021
Merged

rough in switchEthereumChain#10905
brad-decker merged 1 commit intodevelopfrom
wallet_switchEthereumChain

Conversation

@brad-decker
Copy link
Copy Markdown
Contributor

@brad-decker brad-decker commented Apr 20, 2021

Implements basic swithEthereumChain feature for suggesting a user to switch to a specified chain that they already have added to MetaMask. This method will work with default networks like mainnet.

@metamaskbot
Copy link
Copy Markdown
Collaborator

Builds ready [1f6683b]
Page Load Metrics (596 ± 36 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint44715794
domContentLoaded3547285957436
load3567295967436
domInteractive3547275947436

@brad-decker brad-decker marked this pull request as ready for review April 26, 2021 19:59
@brad-decker brad-decker requested a review from a team as a code owner April 26, 2021 19:59
Copy link
Copy Markdown
Member

@rekmarks rekmarks left a comment

Choose a reason for hiding this comment

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

LGTM!

Comment on lines +56 to +62
if (!isSafeChainId(parseInt(_chainId, 16))) {
return end(
ethErrors.rpc.invalidParams({
message: `Invalid chain ID "${_chainId}": numerical value greater than max safe value. Received:\n${chainId}`,
}),
);
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I don't think this check is necessary for the purposes of this method, but it's nice from a "fail early and often" perspective.

@brad-decker brad-decker merged commit c188e3f into develop May 10, 2021
@brad-decker brad-decker deleted the wallet_switchEthereumChain branch May 10, 2021 19:14
@github-actions github-actions bot locked and limited conversation to collaborators May 10, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants