Skip to Content
useConnection

useConnection

The useConnection hook provides access to the current Solana network connection. This allows you to interact with the blockchain, such as querying account data or sending transactions.

These hooks are typically used inside your React components to build custom wallet interactions or to access the connection object for blockchain operations.

NameTypeDefault
getBlockHeight
async (commitmentOrConfig?) => number
Fetches the current block height from the Solana network.
_commitment
"processed" | "confirmed" | "finalized"
The default commitment level used for requests (e.g., 'confirmed').
"confirmed"
_rpcEndpoint
string
The HTTP endpoint URL for the Solana RPC node.
"https://api.mainnet-beta.solana.com/"
_rpcWebSocket
RpcWebSocketClient
WebSocket client instance for subscriptions and real-time updates.
_rpcRequest
(method: string, args: any[]) => Promise<any>
Performs a raw RPC request to the Solana node.
_rpcClient
ClientBrowser
Underlying RPC client used for HTTP requests.
Last updated on