Installation
First, install the required Solana wallet adapter packages:Wallet Provider Setup
Wrap your application with the necessary Solana wallet providers:Creating a Sign-In Hook
Create a custom hook to handle the wallet sign-in flow:Using the Sign-In Hook
Implement the wallet connection and sign-in flow in your component:Error Handling
The integration includes built-in error handling for common scenarios:- Wallet not connected
- User rejected signature request
- Network errors
- Invalid responses from the server
Best Practices
- Connection State: Always check if the wallet is connected before attempting to sign messages.
- Loading States: Show appropriate loading indicators during async operations.
- Error Handling: Display user-friendly error messages and provide clear next steps.
-
Auto Connect: Consider enabling
autoConnectin the WalletProvider for better UX. - Multiple Wallets: Support multiple wallet providers to give users choice.
Wallet Type Detection
The wallet type is automatically detected using the Solana wallet adapter:wallet.adapter.name property automatically provides the correct wallet type. While the wallet type doesn’t affect the pass functionality itself, it determines which wallet app will be opened when users tap on the pass in their digital wallet. Supported wallet types include:
Generic(default)PhantomSolflareCoinbase WalletMathWalletSafePalCloverCoin98HyperPayKrystalONTOTokenPocketTrust