Skip to main content

React SDK

The @yativo/crypto-sdk-react package wraps the TypeScript SDK with React hooks and pre-built components, giving you managed authentication state, data-fetching hooks, and drop-in UI widgets. npm version npm weekly downloads

Installation

Package: @yativo/crypto-sdk-react · Latest: 1.0.2 · Requirements: React 17 or higher. The TypeScript SDK (@yativo/crypto-sdk) is installed automatically as a peer dependency.

Provider Setup

Wrap your application (or the relevant subtree) with YativoProvider. This creates the SDK instance and makes it available to all hooks and components below.
Never expose apiSecret in client-side code. Do not use NEXT_PUBLIC_YATIVO_API_SECRET or any environment variable that gets bundled into the browser. For React apps, use passwordless login (sdk.auth.login + sdk.auth.verifyOTP) for client-side auth — or have your backend exchange API key credentials and return a short-lived access token to the frontend.

useYativo() — Authentication & SDK Access

Login is passwordless and happens in two steps: send an OTP with login(email), then verify it with verifyOTP(otp, email).

Hook Return Values


useWallets() — Create and List Wallets


useTransactions() — Send and List Transactions


useBalance() — Auto-Refreshing Balance Display


useCards() — Card Management


useSwap() — Swap Functionality


useStandaloneIban() — IBAN Management


useGasStations() — Gas Station Management


useAutoForwarding() — Auto-Forwarding Rules


DepositWidget — Embedded Deposit UI

The DepositWidget renders a complete deposit flow: it displays a QR code, network selector, and deposit address — with real-time confirmation updates.

YativoCardWidget — Embedded Card Display

The card widget renders sensitive card details (PAN, CVV, expiry) inside a secure sandboxed iframe. Card data never touches your JavaScript. Your backend requests a secure_view_url and passes it to the client — never pass API credentials to client-side components.

Pre-Built UI Components

The React SDK ships utility components styled to match the Yativo design system:

Theme Customization

Pass a theme object to YativoProvider to apply a global theme to all SDK components and widgets:
Individual components and widgets accept their own theme prop which merges with (and overrides) the global theme.

Complete Example — Next.js Dashboard Page