The process of connecting to a wallet gives the web app information about the wallet account, which enables interactions with the Stacks blockchain, like calling smart contracts.
Using the showConnect function, you can prompt the user to select a wallet to connect to your app.
connect.ts
import{ showConnect }from'@stacks/connect';
import{ userSession }from'./session';
constappDetails={
name:"My app",
icon:"logo.png",
}
showConnect({
appDetails,
userSession,
onFinish:()=>{
window.location.reload();
},
onCancel:()=>{
console.log('oops');
},
});
This will configure the showConnect function to display a wallet connection pop-up with your app's name and icon, and handle user confirmation or cancellation actions in the onFinish and onCancel callbacks.