Skip to content

Commit 4eff6e1

Browse files
committed
Add Coinbase connector example
1 parent 81022db commit 4eff6e1

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

quick-starts/react-quick-start/src/App.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import "./App.css";
22
import { useWeb3AuthConnect, useWeb3AuthDisconnect, useWeb3AuthUser } from "@web3auth/modal/react";
3+
import { WALLET_CONNECTORS } from "@web3auth/modal";
34
// IMP START - Blockchain Calls
45
import { useAccount } from "wagmi";
56
import { SendTransaction } from "./components/sendTransaction";
@@ -8,7 +9,7 @@ import { SwitchChain } from "./components/switchNetwork";
89
// IMP END - Blockchain Calls
910
function App() {
1011
// IMP START - Login
11-
const { connect, isConnected, connectorName, loading: connectLoading, error: connectError } = useWeb3AuthConnect();
12+
const { connectTo, isConnected, connectorName, loading: connectLoading, error: connectError } = useWeb3AuthConnect();
1213
// IMP END - Login
1314
// IMP START - Logout
1415
const { disconnect, loading: disconnectLoading, error: disconnectError } = useWeb3AuthDisconnect();
@@ -59,8 +60,8 @@ function App() {
5960
const unloggedInView = (
6061
// IMP START - Login
6162
<div className="grid">
62-
<button onClick={() => connect()} className="card">
63-
Login
63+
<button onClick={() => connectTo(WALLET_CONNECTORS.COINBASE)} className="card">
64+
Login via Coinbase
6465
</button>
6566
{connectLoading && <div className="loading">Connecting...</div>}
6667
{connectError && <div className="error">{connectError.message}</div>}

quick-starts/react-quick-start/src/web3authContext.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// IMP START - Quick Start
22
import { WEB3AUTH_NETWORK } from "@web3auth/modal";
3+
import { coinbaseConnector } from "@web3auth/no-modal/connectors/coinbase-connector";
34
import { type Web3AuthContextConfig } from "@web3auth/modal/react";
45
// IMP END - Quick Start
56

@@ -12,6 +13,7 @@ const web3AuthContextConfig: Web3AuthContextConfig = {
1213
web3AuthOptions: {
1314
clientId,
1415
web3AuthNetwork: WEB3AUTH_NETWORK.SAPPHIRE_DEVNET,
16+
connectors: [coinbaseConnector({})],
1517
}
1618
};
1719
// IMP END - Config

0 commit comments

Comments
 (0)