React Integration
@signum-tech/sdk-react is a companion package that wraps the Clossir SDK with
TanStack Query hooks and a wallet management hook for
React applications.
Installation
Peer dependencies: React 18+, @tanstack/react-query 5+, @signum-tech/sdk 0.3.1+.
SignumProvider
Wrap your app with SignumProvider to make the SDK client available to all hooks:
SignumProvider creates a client instance (memoized on options) and wraps your
app in a TanStack QueryClientProvider. If you already have a QueryClient, pass it via
the queryClient prop to share it.
The default QueryClient is configured with staleTime: 30s and retry: 1.
useSignumQuery
Type-safe queries with the SDK client auto-injected from context:
The queryFn receives the SDK client as its first argument — no need to import or
instantiate the client yourself.
The error type defaults to SignumProblemDetailsError, so error.title, error.status,
and other RFC 9457 fields are available without type casting.
useSignumMutation
Type-safe mutations for write operations:
The mutationFn receives (client, variables) — the SDK client from context and the
variables you pass to mutate().
Polling after a command
Combine useSignumMutation with useSignumQuery and refetchInterval to poll for
command completion:
useSignumWallet
The useSignumWallet hook manages wallet state across two modes:
- Managed — Privy-provisioned wallets with Biconomy gasless UX (no user key management)
- External — Bring-your-own wallet via EIP-712 signature binding (e.g., MetaMask, WalletConnect)
External wallet linking flow
When using the external wallet mode, linkExternalWallet performs a nonce-sign-link flow:
- Requests a nonce from the Clossir API
- Calls your
signFnwith the nonce message - Submits the signature to bind the wallet to the user’s account
The signFn is injected by you — use whatever wallet library your app already has
(wagmi useSignMessage, ethers.js Signer.signMessage, etc.).
Re-exports
@signum-tech/sdk-react re-exports commonly used types from @signum-tech/sdk so you
don’t need to import from both packages:
Available re-exports:
SDKOptions— client configuration typeSignumProblemDetailsError— the typed error classoperations— all request/response types per endpointcomponents— shared schema types
Next steps
- Error Handling — handle API errors in your components
- Async Operations — understand the 202 command lifecycle
- Authentication — set up API keys and token exchange