Skip to main content

Installation

Package Installation

Install both the React SDK and the underlying TypeScript SDK:
# npm
npm install @testinprod-io/privacy-boost @testinprod-io/privacy-boost-react

# yarn
yarn add @testinprod-io/privacy-boost @testinprod-io/privacy-boost-react

# pnpm
pnpm add @testinprod-io/privacy-boost @testinprod-io/privacy-boost-react

Bundler Configuration

The SDK includes WebAssembly modules. See the TypeScript SDK installation guide for bundler-specific configuration.

Next.js

// next.config.js
/** @type {import('next').NextConfig} */
const nextConfig = {
  webpack: (config) => {
    config.experiments = {
      ...config.experiments,
      asyncWebAssembly: true,
    };
    return config;
  },
};

module.exports = nextConfig;

Vite

Works out of the box. No configuration needed.

Create React App

Requires react-app-rewired. See TypeScript installation.

TypeScript Configuration

Recommended tsconfig.json:
{
  "compilerOptions": {
    "target": "ES2020",
    "lib": ["ES2020", "DOM", "DOM.Iterable"],
    "module": "ESNext",
    "moduleResolution": "bundler",
    "jsx": "react-jsx",
    "strict": true,
    "esModuleInterop": true,
    "skipLibCheck": true
  }
}

Peer Dependencies

The React SDK requires:
  • react >= 18.0.0
  • @testinprod-io/privacy-boost (latest)

Verifying Installation

import { PrivacyBoostProvider } from '@testinprod-io/privacy-boost-react';

function App() {
  return (
    <PrivacyBoostProvider
      config={{
        indexerUrl: 'https://test-api.privacy-boost.sunnyside.io/indexer',
        proverUrl: 'https://test-api.privacy-boost.sunnyside.io/prover',
        chainId: 11155420,
        shieldContract: "0xB22fD661b322F10d4B7cd0cFcb9578C485423119",
        wethContract: "0x4200000000000000000000000000000000000006"
      }}
      loadingComponent={<div>Loading...</div>}
    >
      <div>SDK loaded successfully!</div>
    </PrivacyBoostProvider>
  );
}

Next Steps