Skip to content

Commit 4affb24

Browse files
authored
Merge pull request #22 from nftlabs/am/fixes
Add network switch network
2 parents a965aff + 351e0cf commit 4affb24

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

Diff for: src/shared/commonRPCUrls.ts

+9-1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,15 @@ export const ChainIDToNativeSymbol: Record<number, string> = {
1818
80001: "MATIC",
1919
};
2020

21+
export const ChainIDToName: Record<number, string> = {
22+
1: "Mainnet",
23+
4: "Rinkeby",
24+
137: "Polygon",
25+
250: "Fantom",
26+
43114: "Avalanche",
27+
80001: "Mumbai",
28+
}
29+
2130
export enum ChainId {
2231
Mainnet = 1,
2332
Ropsten = 3,
@@ -52,4 +61,3 @@ export const supportedChains = defaultChains
5261
.concat(defaultL2Chains)
5362
.filter((c) => SUPPORTED_CHAIN_IDS.includes(c.id));
5463

55-
console.log("*** supportedChains", supportedChains);

Diff for: src/shared/connect-wallet-button.tsx

+3-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import {
1414
import React from "react";
1515
import { IoSwapHorizontalSharp } from "react-icons/io5";
1616
import { useConnect, useNetwork } from "wagmi";
17-
import { supportedChains } from "./commonRPCUrls";
17+
import { ChainIDToName, supportedChains } from "./commonRPCUrls";
1818

1919
interface ConnectWalletButtonProps {
2020
expectedChainId: number;
@@ -43,10 +43,11 @@ export const ConnectWalletButton: React.FC<ConnectWalletButtonProps> = ({
4343
leftIcon={<IoSwapHorizontalSharp />}
4444
onClick={() => switchNetwork(expectedChainId)}
4545
>
46-
Switch Network
46+
Switch Network To {ChainIDToName[expectedChainId]}
4747
</Button>
4848
);
4949
}
50+
5051
return (
5152
<Alert variant="left-accent" status="warning">
5253
<AlertIcon />

0 commit comments

Comments
 (0)