Solana Wallet Integration
This guide explains how to properly integrate Solana wallet authentication with POW Cards.
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
autoConnect
in the WalletProvider for better UX. -
Multiple Wallets: Support multiple wallet providers to give users choice.
For more details on the available endpoints and responses, see the API Reference.
Wallet Type Detection
The wallet type is automatically detected using the Solana wallet adapter:
The 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)Phantom
Solflare
Coinbase Wallet
MathWallet
SafePal
Clover
Coin98
HyperPay
Krystal
ONTO
TokenPocket
Trust
This allows for a more seamless user experience as users can quickly access their preferred wallet application directly from the pass.