> ## Documentation Index
> Fetch the complete documentation index at: https://docs.celo.org/llms.txt
> Use this file to discover all available pages before exploring further.

# Programmatic Setup

How dApp developers can use MetaMask to interact with the Celo network.

***

## Adding a Celo Network to MetaMask

To add a Celo Network to your dApp, you can use MetaMask's RPC API's `wallet_addEthereumChain` method. ([See documentation](https://docs.metamask.io/wallet/reference/json-rpc-methods/wallet_addethereumchain/)).

Here is a JavaScript snippet you can use:

```jsx theme={null}
await window.ethereum.request({
    method: 'wallet_addEthereumChain',
    params: [<INSERT_NETWORK_PARAMS_HERE>],
});
```

Where it says `INSERT_NETWORK_PARAMS_HERE`, please replace with any of the following constants, depending on which network you'd like to connect to.

### Mainnet

```jsx theme={null}
const CELO_PARAMS = {
  chainId: "0xa4ec",
  chainName: "Celo",
  nativeCurrency: { name: "Celo", symbol: "CELO", decimals: 18 },
  rpcUrls: ["https://forno.celo.org"],
  blockExplorerUrls: ["https://celo.blockscout.com/"],
  iconUrls: ["future"],
};
```

### Celo Sepolia

```jsx theme={null}
const CELO_SEPOLIA_PARAMS = {
  chainId: "0xAA044C",
  chainName: "Celo Sepolia",
  nativeCurrency: { name: "Celo", symbol: "CELO", decimals: 18 },
  rpcUrls: ["https://forno.celo-sepolia.celo-testnet.org/"],
  blockExplorerUrls: ["https://celo-sepolia.blockscout.com/"],
  iconUrls: ["future"],
};
```

## Adding Tokens (e.g. USDm, EURm)

To watch an asset on a Celo network (e.g. USDm, EURm) in your dApp, you can use MetaMask's RPC API's `wallet_watchAsset` method. ([See documentation](https://docs.metamask.io/wallet/reference/json-rpc-methods/wallet_watchasset/)).

Here is a JavaScript snippet you can use:

```jsx theme={null}
await window.ethereum.request({
  method: "wallet_watchAsset",
  params: {
    type: "ERC20",
    options: {
      address: "<INSERT_ADDRESS_HERE>",
      symbol: "<INSERT_SYMBOL_HERE>",
      decimals: 18,
    },
    iconUrls: ["future"],
  },
});
```

* 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 Mento Dollar, it's `USDm` and for Mento Euro, it's `EURm`.

<Tip>
  View available token addresses for Celo assets to add to MetaMask [here](/contracts/token-contracts).
</Tip>

<Warning>
  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](https://docs.metamask.io/guide/ethereum-provider.html#methods) for more documentation around that.
</Warning>
