@@ -3,19 +3,21 @@ import styles from "./styles.module.css";
33
44export default function ConnectButton ( ) {
55 const [ networkStatus , setNetworkStatus ] = useState ( "disconnected" ) ; // "disconnected" | "wrong_network" | "connected"
6- const CHAIN_ID_DECIMAL = 1264453517 ;
6+ const CHAIN_ID_DECIMAL = 10920 ;
77 const CHAIN_ID_HEX = `0x${ CHAIN_ID_DECIMAL . toString ( 16 ) } ` ;
88
99 const EMBER_TESTNET = {
1010 chainId : CHAIN_ID_HEX ,
1111 chainName : "Flash Testnet" ,
1212 nativeCurrency : {
13- name : "FUSE " ,
14- symbol : "FUSE " ,
13+ name : "ETH " ,
14+ symbol : "ETH " ,
1515 decimals : 18 ,
1616 } ,
17- rpcUrls : [ "https://rpc.flash.fuse.io" ] ,
18- blockExplorerUrls : [ "https://explorer.flash.fuse.io" ] ,
17+ rpcUrls : [
18+ "https://floral-green-gadget.fuse-flash.quiknode.pro/0b560e99d1a605b43771fc313dbc3e7054df160e/" ,
19+ ] ,
20+ blockExplorerUrls : [ "https://fuse-flash.explorer.quicknode.com/" ] ,
1921 } ;
2022
2123 const checkNetwork = async ( ) => {
@@ -54,8 +56,13 @@ export default function ConnectButton() {
5456 params : [ { chainId : EMBER_TESTNET . chainId } ] ,
5557 } ) ;
5658 } catch ( switchError ) {
57- // If network doesn't exist, add it
58- if ( switchError . code === 4902 ) {
59+ // Check both the top-level code and originalError.code
60+ if (
61+ switchError . code === 4902 ||
62+ ( switchError . data &&
63+ switchError . data . originalError &&
64+ switchError . data . originalError . code === 4902 )
65+ ) {
5966 try {
6067 await window . ethereum . request ( {
6168 method : "wallet_addEthereumChain" ,
0 commit comments