If you want to test out mainnet functionality without having to actually use mainnet, you can use Anvil's forking feature and then import the local Anvil network and its generated accounts into MetaMask.
- Get your local dev build running and have MetaMask open in your browser.
- Run
yarn anvil --fork-url https://mainnet.infura.io/v3/INFURA_PROJECT_ID --chain-id 1withINFURA_PROJECT_IDreplaced by your own Infura project id. (If you have not yet installed Foundry'sanvilbinary, runyarn foundryupfirst.) - Anvil will output a list of account addresses, private keys and a "Mnemonic" (aka SRP, aka Secret Recovery Phrase).
- Import either the private keys or the SRP into MetaMask.
- Add the Anvil network as a custom network in MetaMask. The "New RPC URL" will need to be
http://127.0.0.1:8545, set the Chain Id as1, and the currency symbol toETH.
You should now be able to use MetaMask, and many dapps, as if you were using mainnet. Each generated account starts with a large pre-funded ETH balance you can spend on the local fork. Note that after significant time elapses since when you forked mainnet (i.e. ran step 2 above), interactions with many dapps and smart contracts may begin to have inconsistent behavior or failures.