Documentation Index
Fetch the complete documentation index at: https://docs.getpara.com/llms.txt
Use this file to discover all available pages before exploring further.
The useClient hook provides direct access to the Para client instance, allowing you to call any method available on the Para SDK.
Import
import { useClient } from "@getpara/react-sdk";
Usage
function ClientExample() {
const para = useClient();
const { data: wallet } = useWallet();
const getFormattedAddress = () => {
if (!para || !wallet) return "No wallet";
return para.getDisplayAddress(wallet.id, {
truncate: true,
addressType: wallet.type
});
};
const checkSessionStatus = async () => {
if (!para) return;
const isActive = await para.isSessionActive();
console.log("Session active:", isActive);
};
return (
<div>
<p>Address: {getFormattedAddress()}</p>
<button onClick={checkSessionStatus}>
Check Session
</button>
</div>
);
}
Parameters
This hook does not accept any parameters.
Return Type
Available Methods
When you have the Para client instance, you can access all SDK methods including:
getDisplayAddress() - Format wallet addresses
isSessionActive() - Check session status
exportSession() - Export session for server-side use
findWallet() - Find a specific wallet
getUserId() - Get the current user ID
- And many more…
Example: Advanced Usage
function AdvancedClientUsage() {
const para = useClient();
const [sessionInfo, setSessionInfo] = useState<string>("");
const exportCurrentSession = () => {
if (!para) return;
// Export session without signers for security
const session = para.exportSession({ excludeSigners: true });
setSessionInfo(session);
};
const checkUserDetails = async () => {
if (!para) return;
const userId = para.getUserId();
const authInfo = para.authInfo;
console.log("User ID:", userId);
console.log("Auth Info:", authInfo);
};
return (
<div>
<button onClick={exportCurrentSession}>Export Session</button>
<button onClick={checkUserDetails}>Check User Details</button>
{sessionInfo && <p>Session: {sessionInfo.substring(0, 50)}...</p>}
</div>
);
}
Notes
- The client is undefined until the
ParaProvider is fully initialized
- Always check if the client exists before using it
- The client instance is the same one passed to the
ParaProvider