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.