Skip to content
This repository was archived by the owner on Apr 26, 2024. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,11 @@ const magicLinkConnector = new MagicConnector({
},
});

// Array of wallet connectors you want to use for your dApp.
const connectors = [magicLinkConnector];

function MyApp({ Component, pageProps }: AppProps) {
return (
<ThirdwebProvider
desiredChainId={activeChainId}
walletConnectors={connectors}
walletConnectors={[magicLinkConnector, "metamask", "walletConnect"]}
chainRpc={{
[ChainId.Mumbai]: "https://rpc-mumbai.maticvigil.com",
}}
Expand Down
14 changes: 13 additions & 1 deletion pages/index.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
import styles from "./styles/Home.module.css";
import { useAddress, useDisconnect } from "@thirdweb-dev/react";
import {
useAddress,
useDisconnect,
useMetamask,
useWalletConnect,
} from "@thirdweb-dev/react";
import type { NextPage } from "next";
import { useState } from "react";
import { useMagic } from "@thirdweb-dev/react/evm/connectors/magic";

const Home: NextPage = () => {
const address = useAddress(); // Hook to grab the currently connected user's address.
const connectWithMagic = useMagic(); // Hook to connect with Magic Link.
const connectMetamask = useMetamask();
const connectWalletConnect = useWalletConnect();
const disconnectWallet = useDisconnect(); // Hook to disconnect from the connected wallet.

const [email, setEmail] = useState<string>(""); // State to hold the email address the user entered.
Expand Down Expand Up @@ -83,6 +90,11 @@ const Home: NextPage = () => {
>
Login
</a>

<button onClick={() => connectMetamask()}>Metamask</button>
<button onClick={() => connectWalletConnect()}>
WalletConnect
</button>
</div>
</>
)}
Expand Down