Client-side operations
This section covers the client-side operations for Sign In with Algorand (SIWA), including wallet initialization, connection, message signing, and disconnection for multiple wallet providers.
Initializing Wallet Connections
import { useWalletConnection, WalletProvider } from "@/hooks/useWalletConnection";
// In your component
const {
address,
provider,
isLoading,
connectWallet,
disconnectWallet,
signMessage,
} = useWalletConnection();Connecting a Wallet
const handleConnect = async (selectedProvider: WalletProvider) => {
try {
await connectWallet(selectedProvider);
console.log(`Connected to ${selectedProvider} wallet`);
} catch (error) {
console.error(`Error connecting to ${selectedProvider}:`, error);
}
};Signing a Message
Disconnecting a Wallet
Wallet-Specific Considerations
Pera Wallet
Defly Wallet
Kibisis Wallet
Lute Wallet
Full Example: Client-Side Workflow
Last updated