export default function Walletconnect() {
const connector = useWalletConnect();
const connectWallet = React.useCallback(() => {
try{
console.log("wallet");
console.log("return",connector.connect());
return connector.connect();
}catch(err){
console.log(err)
}
}, [connector]);
const killSession = React.useCallback(() => {
return connector.killSession();
}, [connector]);
return (
<>
{!connector.connected ? (
<Button onPress={connectWallet} label="Connect a wallet" />
) : (
<>
<Text>{shortenAddress(connector.accounts[0])}</Text>
<Button onPress={killSession} label="Log out" />
</>
)}
</>
);
}
When clicking a button(connect a wallet) then not open metamask wallet. connector.connect() not response any.