Overview
ThedetectWallets() utility function detects which Solana wallets are installed in the user’s browser.
Import
Usage
Return Value
Returns an array of wallet names that are detected:"phantom"- Phantom wallet"solflare"- Solflare wallet"backpack"- Backpack wallet
Example
Implementation Details
The function checks for wallet objects in thewindow object:
window.phantom?.solana- Phantom walletwindow.solflare- Solflare walletwindow.backpack- Backpack wallet
This function only works in browser environments. It will return an empty
array in server-side contexts.