Connecting to the wallet

When making a connection request to your user’s wallet, you can use the Wallet.request method to let them select their preferred wallet first:

import Wallet from "sats-connect"

export const App = () => {

	const handleConnect = async () => {
		const provider = await Wallet.request('getAccounts', null);
  return (
		<button onClick={handleConnect}>Connect</button>

If a wallet is connected already, the method resolves to the connected account's addresses.

If the user has not connected a wallet yet, the method will prompt them to select from their preferred wallet from a list of Sats Connect-compatible wallets.

Once they select a wallet, they will be presented with a connection request in their selected wallet, according to the parameters passed to the getAccounts method.