Skip to main content
This reference targets stable @spicenet-io/spiceflow-ui@5.0.3. See the migration guide when upgrading an existing integration.

Installation

Install the stable version described by this reference:
UI 5.0.3 pins core 0.10.3. If your application imports core directly, declare that exact version to keep helpers and types aligned; the examples follow the UI dependency rather than core’s separate latest tag.
Stable UI 5.0.3 and core 0.10.3 include Elysium mainnet. See Elysium mainnet for supported assets and RPC requirements. Apps that pin the SDK must update their dependencies, rebuild, and deploy to adopt a new release.

Peer Dependencies

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

Required Dependencies

These are always required:
Keep the app on React 18 and resolve peers within the declared ranges. Do not bypass peer conflicts as a default setup step. Reuse an existing compatible wallet/provider stack.

Wagmi and Viem compatibility

The examples pin wagmi@2.19.5 with viem@2.38.0, matching SDK 5.0.3’s published development dependencies. These are example pins, separate from the SDK’s minimum peer versions above. Choose Wagmi and Viem versions as a pair. A new Wagmi release can use APIs missing from an older Viem minor even when both satisfy broad peer ranges. The examples use Wagmi 2; an unversioned install can select a different major. See Wagmi’s version migration guide before changing majors. Inspect the resolved tree when you see missing exports, incompatible client types, or peer errors:
Keep the matching versions in your lockfile, then run your app’s typecheck and production build.

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. The SDK injects its stylesheet automatically in the browser; an existing explicit styles.css import remains supported:
The example enables card and exchange deposits with swapper={{ enabled: true }} on the SpiceFlowProvider wrapping SpiceDeposit or SpiceAccount. The flag is required and these options only appear on network="mainnet"; omitting it leaves them off. See Card and Exchange Deposits for the full setup.
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 an Action and Account Menu

Use SpiceSupply for protocol calls, or useSpiceSupply for your own UI. See the complete Quick Start example. For account funding and Spice-balance withdrawals, the combined component needs no modal wiring:
The SDK supplies default fee/funding batches, token metadata, venues and styles. Protocol addresses, ABIs, recipient policy and any required application updates remain yours to define.

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

Set your public Privy App ID in .env.local. For Next.js:
Then use them in your code:
The app ID belongs on your own PrivyProvider. SpiceFlowProvider has a privyAppId prop, but it has no effect. For Vite, use its public environment-variable prefix:
The App ID is public. Privy app secrets and private RPC credentials stay on your server.

Local development and approved origins

  1. Use a development Privy app or app client. An app client can have its own origin settings while sharing the app’s users. Pass its clientId to PrivyProvider if you use one.
  2. For app defaults, open Configuration > App settings > Domains > Allowed Origins in the Privy dashboard. For an app client, open Configuration > App settings > Clients, select the client, and edit its Allowed Origins. Add the exact local origin, for example http://localhost:5173 for Vite or http://localhost:3000 for Next.js. Privy supports HTTP on localhost, with an explicit port.
  3. Keep the dev server on that port. For Vite, set server.port: 5173 and server.strictPort: true in your existing config so an occupied port fails instead of silently changing the origin.
  4. For a preview, tunnel, phone, or custom hostname, use HTTPS and add that exact origin, without a path, to the same app or client’s allowlist. Check OAuth redirect settings separately when using an OAuth login method.
See Privy’s allowed-domain rules and Vite’s port settings. The web origin does not select the blockchain network: card and exchange options still require network="mainnet", including when the app runs locally.

Vite and optional Solana dependencies

Vite can resolve Privy’s optional Solana imports during a build even when your Spice Flow integration uses EVM chains. Errors such as a missing getTransferSolInstruction export or @solana/kit’s ./program-client-core specifier can indicate missing or mismatched optional peers.
Pin the conflicting package to a release that matches your installed Kit major and your Privy version’s peers. For example, @solana-program/system@0.10.0 requires Kit ^5.0, while 0.8.0 requires Kit ^3.0. Installing the newest program package alone can introduce a different Kit major. Keep the compatible set pinned in your lockfile and rerun the production build. Privy’s Vite troubleshooting guide also provides a temporary shim for apps that do not use Solana wallets. Apps using Solana wallets need the real compatible packages; the shim is not a replacement for their functionality.

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