Overview
The@hermis/solana-headless-adapter-base package provides a framework-agnostic wallet adapter implementation. It’s perfect for vanilla JavaScript applications or when you need direct control over wallet adapter management.
Installation
Step 1: Initialize Wallet Adapters
Set up wallet adapters for your application:The
getStandardWalletAdapters function automatically detects Wallet Standard compatible wallets in addition to the adapters you provide.Step 2: Create Wallet Manager
Initialize theWalletAdapterManager to manage wallet connections:
Step 3: Connect to a Wallet
Select and connect to a wallet:Step 4: Build a Wallet Selector UI
Create a UI for users to select from available wallets:Step 5: Filter Wallets by Ready State
Filter adapters based on their installation status:Complete Example
Here’s a complete vanilla JavaScript example:index.html
app.js
API Reference
WalletAdapterManager
function
Creates a new wallet adapter manager
function
Selects a wallet adapter by name
function
Connects to the selected wallet
function
Disconnects from the current wallet
function
Subscribe to wallet events
Utility Functions
function
Gets all standard wallet adapters including custom ones. Network is required
— substring-based inference from the RPC URL was removed for security.
function
Sorts adapters by priority (mobile wallets, then installed wallets first)
function
Filters adapters by ready state
Best Practices
Event-Driven Updates
Event-Driven Updates
Use events to update your UI reactively:
Error Handling
Error Handling
Always handle connection errors gracefully:
Wallet Detection
Wallet Detection
Prioritize installed wallets in your UI:
Cleanup
Cleanup
Clean up event listeners when done:
What’s Next?
API Reference
Explore the adapter API
Cookbook
See practical wallet patterns
Examples
View complete examples
