Comprehensive collection of Solana wallet adapters for TypeScript applications with tree-shaking support
—
Hardware wallet adapters for secure, air-gapped transaction signing with custom derivation path support.
Hardware wallet integration using WebHID transport with custom derivation path support.
/**
* Ledger hardware wallet adapter with WebHID transport
*/
class LedgerWalletAdapter extends BaseSignerWalletAdapter {
name: WalletName<'Ledger'>;
url: string;
icon: string;
supportedTransactionVersions: ReadonlySet<TransactionVersion>;
constructor(config?: LedgerWalletAdapterConfig);
/** Connect to Ledger device via WebHID */
connect(): Promise<void>;
/** Disconnect from Ledger device */
disconnect(): Promise<void>;
/** Sign transaction on hardware device */
signTransaction<T extends Transaction | VersionedTransaction>(transaction: T): Promise<T>;
/** Sign multiple transactions on hardware device */
signAllTransactions<T extends Transaction | VersionedTransaction>(transactions: T[]): Promise<T[]>;
}
const LedgerWalletName: WalletName<'Ledger'>;
interface LedgerWalletAdapterConfig {
/** Custom BIP44 derivation path as Buffer */
derivationPath?: Buffer;
}
/**
* Generate BIP44 derivation path for Ledger wallet
* @param account - Account index (default: 0)
* @param change - Change index (default: 0)
* @returns Buffer containing the derivation path
*/
function getDerivationPath(account?: number, change?: number): Buffer;Usage Example:
import {
LedgerWalletAdapter,
LedgerWalletName,
getDerivationPath
} from "@solana/wallet-adapter-wallets";
// Use default derivation path
const defaultAdapter = new LedgerWalletAdapter();
// Use custom derivation path
const customAdapter = new LedgerWalletAdapter({
derivationPath: getDerivationPath(1, 0) // Account 1, Change 0
});
await customAdapter.connect();
// Sign transaction (requires user confirmation on device)
const signedTx = await customAdapter.signTransaction(transaction);Hardware wallet integration using Trezor Connect with extensive configuration options.
/**
* Trezor hardware wallet adapter with Trezor Connect integration
*/
class TrezorWalletAdapter extends BaseSignerWalletAdapter {
name: WalletName<'Trezor'>;
url: string;
icon: string;
supportedTransactionVersions: ReadonlySet<TransactionVersion>;
constructor(config?: TrezorWalletAdapterConfig);
/** Connect to Trezor device via Trezor Connect */
connect(): Promise<void>;
/** Disconnect from Trezor device */
disconnect(): Promise<void>;
/** Sign transaction on Trezor device */
signTransaction<T extends Transaction | VersionedTransaction>(transaction: T): Promise<T>;
/** Sign multiple transactions on Trezor device */
signAllTransactions<T extends Transaction | VersionedTransaction>(transactions: T[]): Promise<T[]>;
}
const TrezorWalletName: WalletName<'Trezor'>;
interface TrezorWalletAdapterConfig {
/** Custom derivation path as string (e.g., "m/44'/501'/0'/0'") */
derivationPath?: string;
/** Custom Trezor Connect URL (for self-hosted instances) */
connectUrl?: string;
/** Application name shown on Trezor device */
appName?: string;
/** Developer email for Trezor Connect registration */
email?: string;
}Usage Example:
import { TrezorWalletAdapter, TrezorWalletName } from "@solana/wallet-adapter-wallets";
const adapter = new TrezorWalletAdapter({
derivationPath: "m/44'/501'/1'/0'", // Account 1
appName: "My Solana App",
email: "developer@example.com"
});
await adapter.connect();
// Sign transaction (requires user confirmation on device)
const signedTx = await adapter.signTransaction(transaction);import { getDerivationPath, LedgerWalletAdapter } from "@solana/wallet-adapter-wallets";
// Generate paths for multiple accounts
const accounts = [0, 1, 2].map(account => ({
account,
derivationPath: getDerivationPath(account, 0),
adapter: new LedgerWalletAdapter({
derivationPath: getDerivationPath(account, 0)
})
}));
// Connect to specific account
const selectedAccount = accounts[1];
await selectedAccount.adapter.connect();import {
LedgerWalletAdapter,
WalletNotReadyError,
WalletConnectionError
} from "@solana/wallet-adapter-wallets";
const adapter = new LedgerWalletAdapter();
try {
await adapter.connect();
} catch (error) {
if (error instanceof WalletNotReadyError) {
console.log("WebHID not supported or device not available");
} else if (error instanceof WalletConnectionError) {
console.log("Failed to connect to Ledger device");
}
}// Support both hardware wallets
const hardwareWallets = [
new LedgerWalletAdapter(),
new TrezorWalletAdapter({
appName: "My App",
email: "dev@example.com"
})
];
// Check which devices are available
const availableWallets = hardwareWallets.filter(
wallet => wallet.readyState === WalletReadyState.Loadable
);Hardware wallets require user confirmation for every transaction:
// User must physically confirm on device
const signedTransaction = await hardwareAdapter.signTransaction(transaction);
// For multiple transactions, each requires confirmation
const signedTransactions = await hardwareAdapter.signAllTransactions([tx1, tx2, tx3]);import { getDerivationPath } from "@solana/wallet-adapter-wallets";
// Validate account bounds (typically 0-2147483647)
function createLedgerAdapter(accountIndex: number) {
if (accountIndex < 0 || accountIndex > 2147483647) {
throw new Error("Invalid account index");
}
return new LedgerWalletAdapter({
derivationPath: getDerivationPath(accountIndex, 0)
});
}These wallets also extend BaseSignerWalletAdapter (transaction signing only, no message signing):
// Bitpie Wallet
class BitpieWalletAdapter extends BaseSignerWalletAdapter {
name: WalletName<'Bitpie'>;
}
const BitpieWalletName: WalletName<'Bitpie'>;
interface BitpieWalletAdapterConfig {}
// Coinhub Wallet
class CoinhubWalletAdapter extends BaseSignerWalletAdapter {
name: WalletName<'Coinhub'>;
}
const CoinhubWalletName: WalletName<'Coinhub'>;
interface CoinhubWalletAdapterConfig {}
// MathWallet
class MathWalletAdapter extends BaseSignerWalletAdapter {
name: WalletName<'MathWallet'>;
}
const MathWalletName: WalletName<'MathWallet'>;
interface MathWalletAdapterConfig {}
// SafePal Wallet
class SafePalWalletAdapter extends BaseSignerWalletAdapter {
name: WalletName<'SafePal'>;
}
const SafePalWalletName: WalletName<'SafePal'>;
interface SafePalWalletAdapterConfig {}
// Solong Wallet
class SolongWalletAdapter extends BaseSignerWalletAdapter {
name: WalletName<'Solong'>;
}
const SolongWalletName: WalletName<'Solong'>;
interface SolongWalletAdapterConfig {}Ledger wallet requires WebHID support:
// Check WebHID availability
if (!navigator.hid) {
console.log("WebHID not supported - Ledger wallet unavailable");
}
// Check wallet ready state
if (ledgerAdapter.readyState === WalletReadyState.Unsupported) {
console.log("Hardware wallet not supported in this environment");
}Install with Tessl CLI
npx tessl i tessl/npm-solana--wallet-adapter-wallets