Adding a Celo Network to MetaMask
To add a Celo Network to your dApp, you can use MetaMask’s RPC API’swallet_addEthereumChain
method. (See documentation).
Here is a JavaScript snippet you can use:
INSERT_NETWORK_PARAMS_HERE
, please replace with any of the following constants, depending on which network you’d like to connect to.
Mainnet
Celo Sepolia
Alfajores (deprecated)
Adding Tokens (e.g. cUSD, cEUR)
To watch an asset on a Celo network (e.g. cUSD, cEUR) in your dApp, you can use MetaMask’s RPC API’swallet_watchAsset
method. (See documentation).
Here is a JavaScript snippet you can use:
- Where it says
INSERT_ADDRESS_HERE
, please replace with any of the following constants, depending on which network and which asset you’d like to connect to. - Where it says
INSERT_SYMBOL_HERE
, please replace with the correct symbol for the asset you’d like to watch. For Celo Dollars, it’scUSD
and for Celo Euros, it’scEUR
.
View available token addresses for Celo assets to add to MetaMask here.
We strongly suggest that you disable your dApp’s functionality when MetaMask is connected to a non-Celo network. MetaMask has an API for determining what network/chain you’re connected to. See here for more documentation around that.