Skip to main content

createWalletConnectionManager()

Factory function that creates a wallet connection manager for vanilla TypeScript applications.

Parameters

Adapter[]
required
Array of wallet adapters to manage
WalletAdapterNetwork
required
Active Solana network. Required so wallet adapters can set their chain hint explicitly — previous versions inferred this from the RPC URL which was unsafe (untrusted URLs containing “mainnet” would be misclassified).
string
default:"walletName"
Key to store the selected wallet name in localStorage
string
Optional RPC endpoint for automatic wallet detection

WalletConnectionManager Interface

The returned manager object provides the following methods:

getAdapter()

Get the currently selected wallet adapter.
Adapter | null
The currently selected adapter, or null if none selected

selectWallet()

Select a wallet by name.
WalletName | null
required
Name of the wallet to select, or null to deselect
Adapter | null
The selected adapter, or null

connect()

Connect to the selected wallet.
Promise<Adapter | null>
Promise resolving to the connected adapter

disconnect()

Disconnect from the current wallet.
Promise<void>
Promise that resolves when disconnected

autoConnect()

Automatically reconnect to the previously selected wallet on page load.
Promise<Adapter | null>
Promise resolving to the reconnected adapter, or null

Transaction Methods

The manager supports dual architecture (web3.js and Kit) for all transaction operations:

signTransaction()

Sign a single transaction.
DualTransaction
required
Transaction to sign (Transaction, VersionedTransaction, or TransactionMessage)
DualArchitectureOptions
Optional architecture-specific options

signAllTransactions()

Sign multiple transactions.

sendTransaction()

Send a transaction to the network.
DualConnection
required
Solana connection (web3.js Connection or Kit Rpc)
DualTransaction
required
Transaction to send

signAndSendTransaction()

Sign and send a transaction in one operation.

Adapter Management

getAdapters()

Get all available wallet adapters (including dynamically detected ones).
Adapter[]
Array of all detected wallet adapters

onAdaptersChange()

Subscribe to adapter list changes (e.g., when new wallets are dynamically registered).
(adapters: Adapter[]) => void
required
Function called when adapter list changes
() => void
Unsubscribe function to stop listening for changes

Complete Example