Skip to main content

useWallet()

Primary hook for accessing wallet state and methods. Supports both legacy web3.js and modern @solana/kit architectures.

Wallet State Properties

Wallet | null
Currently selected wallet adapter
PublicKey | null
Public key of connected wallet (web3.js format)
boolean
Whether wallet is connected
boolean
Connection in progress
boolean
Disconnection in progress
Wallet[]
Array of all available wallet adapters (both installed and detected)
boolean
Whether auto-connect is enabled

Kit Architecture Properties

These properties enable seamless integration with @solana/kit’s modern architecture.
Address<string> | null
Kit Address type - Use this with @solana/kit instead of publicKey. Null if wallet not connected.
string | null
Plain address string - Base58-encoded address. Null if wallet not connected.
`solana:${string}` | null
Current Solana chain identifier following Wallet Standard format (CAIP-2). Null if not configured.Examples:
  • Mainnet: 'solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp'
  • Devnet: 'solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1'
  • Testnet: 'solana:4uhcVJyU9pJkvQyS88uRDiswHXSCkY3z'
MessageModifyingSigner<string> | null
Kit message signer - Use for signing messages with @solana/kit architecture. Null if wallet doesn’t support message signing or not connected.
TransactionSendingSigner<string> | null
Kit transaction signer - Use for signing and sending transactions with @solana/kit. Null if wallet doesn’t support transactions or not connected.

Wallet Methods

(walletName: string | null) => Promise<void>
Select a wallet by name. Pass null to deselect.
() => Promise<WalletAdapter>
Connect to selected wallet
() => Promise<void>
Disconnect from wallet

Transaction Methods

All transaction methods support both web3.js and @solana/kit architectures through DualConnection and DualTransaction types.
<T extends DualTransaction>(transaction: T, options?: DualArchitectureOptions) => Promise<T>
Sign a transaction without sending it. Supports both web3.js Transaction/VersionedTransaction and Kit TransactionMessage.
<T extends DualTransaction>(transaction: T, connection: DualConnection, options?: DualArchitectureOptions) => Promise<string>
Sign and send a transaction. Accepts both legacy Connection and Kit Rpc.
<T extends DualTransaction>(transactions: T[], options?: DualArchitectureOptions) => Promise<T[]>
Sign multiple transactions. All transactions must use the same architecture (all web3.js OR all Kit).
<T extends DualTransaction>(transaction: T, connection: DualConnection, options?: DualArchitectureOptions) => Promise<string>
Sign and send a transaction in one call. More efficient than separate sign + send.
(message: Uint8Array) => Promise<Uint8Array>
Sign a message for authentication. Returns the signature bytes.
() => Promise<SolanaSignInOutput>
Sign in with Solana (SIWS) - standardized authentication method.

Utility Methods

(network: 'mainnet' | 'devnet' | 'testnet') => `solana:${string}`
Get the Wallet Standard chain identifier for a given network.
(feature: 'signMessage' | 'signTransaction' | 'signAllTransactions' | 'signIn') => boolean
Check if the connected wallet supports a specific feature.

Complete Example with Kit

Migration from v1

If you’re upgrading from v1, here are the key changes: New Kit Properties:
Enhanced Transaction Methods:
All legacy APIs remain fully supported - v2 is backward compatible!