metamask-extension icon indicating copy to clipboard operation
metamask-extension copied to clipboard

[Bug]: Unable to add a network with 'wallet_addEthereumChain' with token symbol length less than 2

Open KlausKidman opened this issue 1 year ago • 2 comments

Describe the bug

When adding a network using the JSON-RPC API request "wallet_addEthereumChain", I get the following error.

Expected 2-6 character string 'nativeCurrency.symbol'. Received: Q

We tried to get around this limitation by adding a space after sybol "Q ". In the latest update, this message appeared in the latest updates

Screenshot 2023-12-25 at 11 50 06

Also, you can enter 1 character in the UI and it won't give an error.

Screenshot 2023-12-25 at 11 55 59

You can also use this request to check that the network is registered with 1 character. chainId: 35441

Expected behavior

When adding a network using 'wallet_addEthereumChain' there should be no error if the token symbol length is 1.

Screenshots/Recordings

No response

Steps to reproduce

provider.send('wallet_addEthereumChain', [
  {
    chainId: '0x8A71',
    chainName: 'Q Mainnet',
    nativeCurrency: {
      name: 'Q token',
      symbol: 'Q',
      decimals: 18,
    },
    rpcUrls: ['https://rpc.q.org'],
    blockExplorerUrls: ['https://explorer.q.org'],
  },
])

Error messages or log output

No response

Version

11.7.2

Build type

None

Browser

Chrome

Operating system

MacOS

Hardware wallet

No response

Additional context

This error can be fixed for expansion on this section of code.

Suggestion for correction:

(typeof ticker !== 'string' || ticker.length < 1 || ticker.length > 6)

Also, it would be nice to add this change to the mobile app as well.

Severity

No response

KlausKidman avatar Dec 25 '23 10:12 KlausKidman

Hello, @KlausKidman. Thanks for reporting! I will pass this on to the appropriate team so they can look into this issue. Happy New Year!

anaamolnar avatar Dec 31 '23 10:12 anaamolnar

This issue has been automatically marked as stale because it has not had recent activity in the last 90 days. It will be closed in 45 days if there is no further activity. The MetaMask team intends on reviewing this issue before close, and removing the stale label if it is still a bug. We welcome new comments on this issue. We do not intend on closing issues if they report bugs that are still reproducible. Thank you for your contributions.

github-actions[bot] avatar May 09 '24 14:05 github-actions[bot]

This issue was closed because there has been no follow up activity in the last 45 days. If you feel this was closed in error, please reopen and provide evidence on the latest release of the extension. Thank you for your contributions.

github-actions[bot] avatar Jun 23 '24 14:06 github-actions[bot]