docs: add MetaMask integration guide with USDC token setup#100
docs: add MetaMask integration guide with USDC token setup#100zkasuran wants to merge 2 commits into
Conversation
Adds comprehensive guide for integrating Arc Testnet with MetaMask, including the critical wallet_watchAsset call to register USDC. Without this step, users see no USDC balance in MetaMask after receiving tokens, causing confusion and making DApps appear broken. Includes: - Complete onboarding flow with wallet_addEthereumChain - wallet_watchAsset call for USDC token registration - Contract addresses and chain configuration - Why this matters section explaining the impact Fixes circlefin#97 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
Great guide — this addresses the exact pain point in #97. One more MetaMask behaviour on Arc Testnet that's worth documenting alongside the Even after the network has been added, calling // ❌ Unreliable on Arc Testnet — may resolve without actually switching
await window.ethereum.request({
method: 'wallet_switchEthereumChain',
params: [{ chainId: '0x4CEF52' }],
});
// ✅ Reliable — works whether network is already added or not
await window.ethereum.request({
method: 'wallet_addEthereumChain',
params: [{
chainId: '0x4CEF52',
chainName: 'Arc Testnet',
nativeCurrency: { name: 'Ether', symbol: 'ETH', decimals: 18 },
rpcUrls: ['https://rpc.drpc.testnet.arc.network'],
blockExplorerUrls: ['https://testnet.arcscan.app'],
}],
});Note the Also: the |
Three corrections to the MetaMask guide, all verified against the repo config, the MetaMask spec and the live testnet RPC: - chainId was 0x4CF252 (5042002 transposed to 5042770). The testnet chain id is 5042002, which is 0x4CEF52 (hardhat.config.ts, defaults.rs). - nativeCurrency was USDC/6 decimals. MetaMask only supports 18-decimal native currencies and rejects decimals != 18, so the add call has to use ETH/18 even though gas is paid in USDC (issue circlefin#95). The USDC ERC-20 watchAsset call keeps decimals: 6, which is correct. - rpcUrls was https://rpc.arc.network, which does not resolve. Switched to https://rpc.drpc.testnet.arc.network, which returns chain id 0x4cef52 and Access-Control-Allow-Origin: * for browser DApps (circlefin#90). Also documents that wallet_switchEthereumChain fails silently or throws 4902 on Arc Testnet, and that wallet_addEthereumChain should be used as both add and switch (issue circlefin#89).
|
Thanks @osr21, this was a good catch and it surfaced more than the switch-chain issue. I verified everything against the repo config, the MetaMask spec and the live testnet RPC, and pushed a fix. Three corrections plus your switch-chain note:
AI disclosure: these fixes were prepared with help from Claude (Anthropic). I verified each value against the repo, the MetaMask |
|
Thanks for the thorough fixes — the chainId, RPC, and nativeCurrency corrections all match what we see in a working implementation. Two small additions:
// ✅ Correct — await the chain switch first
await window.ethereum.request({ method: 'wallet_addEthereumChain', params: [arcConfig] });
await window.ethereum.request({ method: 'wallet_watchAsset', params: [usdcConfig] });Dead block explorer URLs — worth a note in the guide that |
Summary
Adds comprehensive MetaMask integration guide for Arc Testnet, including the critical
wallet_watchAssetcall to register USDC.Problem
Issue #97 identified that there's no documented way to add Arc Testnet USDC to MetaMask's token list. Without this:
Solution
New guide at
docs/metamask-integration.mdcovering:wallet_addEthereumChainwallet_watchAsset(the missing piece)Changes
docs/metamask-integration.mdREADME.mdto link to new guideTesting
Code examples follow MetaMask's official API documentation:
Impact
Every DApp on Arc Testnet that involves USDC transfers benefits from this documentation.
Fixes #97