|
1 | 1 | 'use client' |
2 | 2 |
|
3 | | -import { useAccount } from 'wagmi' |
4 | | -import { useConnect } from 'wagmi' |
5 | | -import { useDisconnect } from 'wagmi' |
6 | | -import { config } from './Providers' |
7 | | - |
| 3 | +import { |
| 4 | + Address, |
| 5 | + Avatar, |
| 6 | + Identity, |
| 7 | + Name, |
| 8 | +} from '@coinbase/onchainkit/identity' |
| 9 | +import { |
| 10 | + ConnectWallet, |
| 11 | + Wallet, |
| 12 | + WalletDropdown, |
| 13 | + WalletDropdownBasename, |
| 14 | + WalletDropdownDisconnect, |
| 15 | +} from '@coinbase/onchainkit/wallet' |
8 | 16 |
|
9 | 17 | export function WalletComponent() { |
10 | | - const { isConnected, address } = useAccount() |
11 | | - const { connect, connectors } = useConnect({ config }) |
12 | | - const { disconnect } = useDisconnect() |
| 18 | + return ( |
| 19 | + <div style={{ display: 'flex', justifyContent: 'flex-end'}}> |
| 20 | + <Wallet> |
| 21 | + <ConnectWallet> |
| 22 | + <Name /> |
| 23 | + </ConnectWallet> |
| 24 | + <WalletDropdown> |
| 25 | + <Identity> |
| 26 | + <Avatar /> |
| 27 | + <Name /> |
| 28 | + <Address /> |
| 29 | + </Identity> |
| 30 | + <WalletDropdownBasename /> |
| 31 | + <WalletDropdownDisconnect /> |
| 32 | + </WalletDropdown> |
| 33 | + </Wallet> |
| 34 | + </div> |
| 35 | + ) |
| 36 | +} |
| 37 | + |
| 38 | +// 'use client' |
| 39 | + |
| 40 | +// import { useAccount } from 'wagmi' |
| 41 | +// import { useConnect } from 'wagmi' |
| 42 | +// import { useDisconnect } from 'wagmi' |
| 43 | +// import { config } from './Providers' |
13 | 44 |
|
14 | | - console.log('connectors:', connectors) |
| 45 | + |
| 46 | +// export function WalletComponent() { |
| 47 | +// const { isConnected, address } = useAccount() |
| 48 | +// const { connect, connectors } = useConnect({ config }) |
| 49 | +// const { disconnect } = useDisconnect() |
| 50 | + |
| 51 | +// console.log('connectors:', connectors) |
15 | 52 |
|
16 | | - if (isConnected && address) { |
17 | | - return ( |
18 | | - <div> |
19 | | - <div |
20 | | - onClick={() => disconnect()} |
21 | | - style={{ |
22 | | - padding: '0.5rem 1rem', |
23 | | - border: '1px solid #d1d5db', |
24 | | - borderRadius: '8px', |
25 | | - background: 'white', |
26 | | - color: '#374151', |
27 | | - fontSize: '0.875rem', |
28 | | - fontWeight: '500', |
29 | | - fontFamily: 'monospace', |
30 | | - cursor: 'pointer' |
31 | | - }} |
32 | | - > |
33 | | - {address.slice(0, 6)}...{address.slice(-4)} |
34 | | - </div> |
35 | | - </div> |
36 | | - ) |
37 | | - } |
| 53 | +// if (isConnected && address) { |
| 54 | +// return ( |
| 55 | +// <div> |
| 56 | +// <div |
| 57 | +// onClick={() => disconnect()} |
| 58 | +// style={{ |
| 59 | +// padding: '0.5rem 1rem', |
| 60 | +// border: '1px solid #d1d5db', |
| 61 | +// borderRadius: '8px', |
| 62 | +// background: 'white', |
| 63 | +// color: '#374151', |
| 64 | +// fontSize: '0.875rem', |
| 65 | +// fontWeight: '500', |
| 66 | +// fontFamily: 'monospace', |
| 67 | +// cursor: 'pointer' |
| 68 | +// }} |
| 69 | +// > |
| 70 | +// {address.slice(0, 6)}...{address.slice(-4)} |
| 71 | +// </div> |
| 72 | +// </div> |
| 73 | +// ) |
| 74 | +// } |
38 | 75 |
|
39 | 76 |
|
40 | 77 |
|
41 | | - return ( |
42 | | - <button |
43 | | - type="button" |
44 | | - onClick={() => { |
45 | | - const preferredConnector = connectors.find(c => |
46 | | - c.name.toLowerCase().includes('base') || |
47 | | - c.name.toLowerCase().includes('farcaster') |
48 | | - ) || connectors[0] |
| 78 | +// return ( |
| 79 | +// <button |
| 80 | +// type="button" |
| 81 | +// onClick={() => { |
| 82 | +// const preferredConnector = connectors.find(c => |
| 83 | +// c.name.toLowerCase().includes('base') || |
| 84 | +// c.name.toLowerCase().includes('farcaster') |
| 85 | +// ) || connectors[0] |
49 | 86 |
|
50 | | - connect({ connector: preferredConnector }) |
51 | | - }} |
52 | | - style={{ |
53 | | - padding: '0.5rem 1rem', |
54 | | - border: '1px solid #d1d5db', |
55 | | - borderRadius: '8px', |
56 | | - background: 'white', |
57 | | - color: '#374151', |
58 | | - fontSize: '0.875rem', |
59 | | - fontWeight: '500', |
60 | | - cursor: 'pointer' |
61 | | - }} |
62 | | - > |
63 | | - Connect |
64 | | - </button> |
65 | | - ) |
66 | | -} |
| 87 | +// connect({ connector: preferredConnector }) |
| 88 | +// }} |
| 89 | +// style={{ |
| 90 | +// padding: '0.5rem 1rem', |
| 91 | +// border: '1px solid #d1d5db', |
| 92 | +// borderRadius: '8px', |
| 93 | +// background: 'white', |
| 94 | +// color: '#374151', |
| 95 | +// fontSize: '0.875rem', |
| 96 | +// fontWeight: '500', |
| 97 | +// cursor: 'pointer' |
| 98 | +// }} |
| 99 | +// > |
| 100 | +// Connect |
| 101 | +// </button> |
| 102 | +// ) |
| 103 | +// } |
0 commit comments