Programatically override token symbol with MetaMask wallet_watchAsset

MetaMask does not allow to add custom tokens with a symbol of more than 11 characters. In order to do so, users need to customise the symbol manually and add it.

However, we would like to programatically change the symbol via the wallet_watchAsset API. However, when we try to simply change the symbol to be cut off at less than 11 characters we receive the following error:

The symbol in the request (SOME_TOKEN) does not match the symbol in the contract (SOME_TOKEN_SYMBOL)

Although it is now 9 characters long. Is there any way to programatically achieve the same as if a user would override the symbol manually?

1 Like

Hi @Nic did you find a solution, what repo are you working with mm extension, thanks for clarifying

@0xroo I do not have a solution yet and awaiting an answer to this thread with a potential solution.

There is an open issue about it, it would be best for you to wait till it’s resolved: Failed to add token name with 11+ characters in Metamask · Issue #1466 · blockscout/frontend · GitHub

@0xroo I am not sure how comparable these issues are. The underlying problem is the same, however here it is about that is possible to add a custom token with <= 11 characters by hand in MetaMask. And I would like to know if there is a way to do this programatically. The issue you are referencing is generally increasing the token max length allowed (which is also great).

1 Like

Just noting that the above link is to a blockscout issue, rather than a MetaMask issue.

The ask here is not for a fix to Failed to add token name with 11+ characters in Metamask · Issue #1466 · blockscout/frontend · GitHub, but rather for a workaround whereby the dApp can request the token to be given a shorter name under 12 characters. The issue has been around since 2020, so if there is some big blocker to simply increasing the token length limit (as seen in increase token symbol length to 64 by kyriediculous · Pull Request #23208 · MetaMask/metamask-extension · GitHub), then providing a timely workaround would be very helpful.

1 Like

Thanks for sharing @aspiers I didn’t know it was such an old issue, the only way to bump is directly on the issue & pr

@Nic I don’t know about the way to override it programmatically would you mind opening a conversation: https://support.metamask.io/ > click Start a Conversation Ask to connect you with tech support once you reached the agent

@0xroo thanks for this suggestion, I have reached out to the chat and now am in the process of a Zendesk issue, where someone from the higher technical team will reach out to me.

@Nico great thank you for confirming :raised_hands:

This topic was automatically closed after 30 days. New replies are no longer allowed.