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.
| Name | Type | Default |
|---|---|---|
getBlockHeight | async (commitmentOrConfig?) => numberFetches the current block height from the Solana network. | |
_commitment | "processed" | "confirmed" | "finalized"The default commitment level used for requests (e.g., 'confirmed'). | |
_rpcEndpoint | stringThe HTTP endpoint URL for the Solana RPC node. | |
_rpcWebSocket | RpcWebSocketClientWebSocket 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 | ClientBrowserUnderlying RPC client used for HTTP requests. | |
Last updated on