Skip to main content

Overview

The detectWallets() 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 the window object:
  • window.phantom?.solana - Phantom wallet
  • window.solflare - Solflare wallet
  • window.backpack - Backpack wallet
This function only works in browser environments. It will return an empty array in server-side contexts.