File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 33import { useAccount } from 'wagmi'
44import { useConnect } from 'wagmi'
55import { useDisconnect } from 'wagmi'
6+ import { config } from './Providers'
67
78
89export function WalletComponent ( ) {
910 const { isConnected, address } = useAccount ( )
10- const { connect, connectors } = useConnect ( )
11+ const { connect, connectors } = useConnect ( { config } )
1112 const { disconnect } = useDisconnect ( )
1213
1314 console . log ( 'connectors:' , connectors )
@@ -34,11 +35,20 @@ export function WalletComponent() {
3435 </ div >
3536 )
3637 }
38+
39+
3740
3841 return (
3942 < button
4043 type = "button"
41- onClick = { ( ) => connect ( { connector : connectors [ 0 ] } ) }
44+ onClick = { ( ) => {
45+ const preferredConnector = connectors . find ( c =>
46+ c . name . toLowerCase ( ) . includes ( 'base' ) ||
47+ c . name . toLowerCase ( ) . includes ( 'farcaster' )
48+ ) || connectors [ 0 ]
49+
50+ connect ( { connector : preferredConnector } )
51+ } }
4252 style = { {
4353 padding : '0.5rem 1rem' ,
4454 border : '1px solid #d1d5db' ,
You can’t perform that action at this time.
0 commit comments