On mobile programmatically switch network and add a token


I have been trying to switch the default network to polygon-mainet and add a custom token programmatically for a while now…
I was able to achieve this using window.ethereum and also using moralis on desktop.
However, It seems to me that on mobile we can use as a provider only walletconnect. And metamask.
With walletconnect im not able to switch the user network or add a custom token to his wallet.

I made a VueJs public repo here : https://github.com/romain130492/moralli-test-2-vue-to-delete
I followed that ticket to switch between network : Programatically switch the selected Metamask network (works on desktop bc using metamask)

Does anyone know how i can do that kind of thing on mobile use wallet connect?

My goal again:

  • To have polygon-mainet as network once the user login
  • To add a custom token to my user wallet, on polygon-manet


I followed that ticket to add a custom token (works on desktop bc using metamask) : Add a BEP20 token to metamask

to set the initial network on login on mobile you can provide the chain in Moralis.authenticate as a parameter, I don’t know if it is possible to add a token with wallet connect

how would you do this ? thanks

 const user = await $moralis.Web3.authenticate({provider:"walletconnect"})

I see, its not switching to polygon network when using const user = await $moralis.Web3.authenticate({provider:"walletconnect", chainId:137 })

but anyway whats important to me is to add my custom token on polygon-mainnet,
thats something i can easily do on desktop using window.ethereum,

but on mobile, the only way i can achieve that is to ask my user to use the browser of their metamask wallet… which is insane…


Hi @romain130492

You can not add custom tokens to a really big number of wallets. Because they have their own white list of supported tokens. The mobile wallets with WalletConnect work a bit different way than desktop Metamask for example. I’m now working on adding more features for the WalletConnect integration, but it seems to me some features are simply not supported by WC

hmmm I see,
even though my token will be an ERC-20? quite a standard protocol,
So do you know if there is another way, may be by not using WC, to add a token on metamask using a mobile device?
(without using metamask browser, with any browser)
thank you