Skip to main content

API Reference

Complete API reference for the Privacy Boost React SDK.

Generated Documentation

Full API documentation can be generated using TypeDoc:
The generated docs include:
  • All hook signatures and return types
  • JSDoc comments with usage examples
  • Type definitions and interfaces

Provider

PrivacyBoostProvider

Main provider component that initializes the SDK.

Context Hooks

usePrivacyBoost()

Get direct access to the SDK instance.

usePrivacyBoostState()

Get provider initialization state.

useAuth

Authentication hook.

useVault

Vault operations hook.

useBalances

Reactive balance data hook.

useTransactions

Transaction history hook.

useChain

Get a chain-scoped client for multi-chain operations.
The returned ChainClient exposes the same vault, transactions, audit, and campaigns resources as the root SDK, scoped to the target chain. Authentication is a method rather than a resource — call chain.authenticate(walletBridge). Returns null until the provider has finished initializing. The hook memoizes by serverUrl, so changing other fields between renders is ignored — pass a stable config or a new serverUrl to switch chains.

useCampaignProgress

Read the authenticated user’s Startale mission progress.
The hook requires the full auth tier, so it stays idle until the session is authenticated and fetches once it becomes so. It reads through the provider’s active client, so after a chain switch it reports the progress of the chain currently in view. On failure it reports null with an error rather than falling back to { false, false }. The server answers 503 when a shield token price is unavailable, and rendering that as “mission incomplete” would tell a user who qualified that they did not. See the sdk.campaigns section of the TypeScript API reference for what each mission counts, why hasDepositedAtLeast10Usd is not monotonic, and what campaignTokenId changes about which deposits count.

Helper Functions

createWalletAdapter()

Create wallet adapter from window.ethereum.

Types

PrivacyBoostConfig

Transaction

TokenBalance

useBalances() returns FormattedBalance values, which extend TokenBalance with formattedShielded / formattedWallet strings already formatted with the token’s decimals.

OnProgress


Preview Features

The React SDK does not yet expose dedicated hooks for the two preview features (pending external audit). Access them through the underlying SDK via usePrivacyBoost():