Skip to main content

Installation

Install the Spice Flow SDK using npm, yarn, or pnpm:

Peer Dependencies

The SDK requires the following peer dependencies. Install based on your wallet provider:

Required Dependencies

These are always required:
A peer-dependency conflict on a fresh install is expected (the SDK declares React 18 while some peers accept 18 or 19). Use --legacy-peer-deps and keep the app on React 18.

Wallet Provider

The SDK uses Privy for wallet connections:

Complete Installation


Basic Setup

1. Mount the Provider Stack

SpiceFlowProvider reads wallet state from Privy, wagmi, and react-query — it does not mount them. Your app provides all four, in this order, and imports the SDK stylesheet once at app entry:
See Quick Start Step 2 for the full wagmi and Privy configs. Already running Privy? Reuse your existing PrivyProvider — add the chains you enable to its supportedChains and your wagmi config.

2. Add Wallet Connection

Use the ProviderLogin component to let users connect their wallet:

3. Add a Deposit Flow

Add SpiceDeposit to let users deposit from any chain:

Complete Example

Here’s a complete Next.js example with deposit and withdraw:

Next.js Considerations

If you’re using Next.js with Server-Side Rendering (SSR), wrap components that use Spice Flow in a client component:
Or check for the window object:

Environment Variables

Store your provider credentials in environment variables:
Then use them in your code:

Next Steps

Components

Learn about all available components and their props

Hooks

Use React hooks to build custom UIs

Configuration

Configure wallet providers, chains, and more

Quick Start Guide

Build your first Spice Flow app step-by-step