SpiceFlowProvider
The root provider that wraps your application. Manages wallet connections, chain configuration, theming, and execution mode.Usage
Props
| Prop | Type | Required | Default | Description |
|---|---|---|---|---|
provider | "privy" | "dynamic" | Yes | Wallet provider to use | |
children | ReactNode | Yes | Your application components | |
network | "mainnet" | "testnet" | No | "testnet" | Network environment |
nativeChainId | number | No | Default chain for the user | |
brand | SpiceBrand | No | Branding and theme config (see Styling) | |
privyAppId | string | If Privy | Privy application ID | |
dynamicEnvironmentId | string | If Dynamic | Dynamic environment ID | |
supportedChainIds | number[] | No | Per network | Override supported chain IDs |
mode | "7702" | "presign" | "ondemand" | No | "7702" | Execution mode |
appName | string | No | "Spicenet" | Your application name |
apiUrl | string | No | Override relayer API URL | |
embeddedWalletConfig | object | No | Embedded wallet configuration |
Examples
SpiceDeposit
The main deposit flow. Handles everything: Privy login, external wallet connection, token selection, escrow deposit, 7702 signing, and solver execution. This is the primary component most apps will use.Usage
Props
| Prop | Type | Required | Default | Description |
|---|---|---|---|---|
isOpen | boolean | Yes | Control modal visibility | |
onClose | () => void | Yes | Close handler | |
styles | CustomStyles | No | Custom styling | |
depositBatches | ChainBatch[] | ((amount, token) => Promise<ChainBatch[]>) | No | Destination chain calls to execute after deposit | |
allowedTokens | string[] | No | Filter token list by symbol (lowercase), e.g. ["usdc", "eth"] | |
onDepositAmountChange | (amount: string) => void | No | Fires when user changes the deposit amount | |
destinationChainId | number | No | Target chain for execution | |
destinationTokenAddress | string | No | Target token on destination chain | |
onDepositExecute | (amount: string) => Promise<void> | No | Callback for non 7702 mode (app handles execution) | |
depositActionLabel | string | No | Custom label for the action button | |
airdrop | boolean | No | false | Show testnet airdrop button |
sponsorGas | boolean | No | false | Backend sponsors gas |
skipTokenSelection | boolean | No | false | Skip the token selection step |
skipRecovery | boolean | No | false | Skip the stranded funds recovery prompt |
escrowRecovery | EscrowRecovery | No | Recover funds stuck in escrow | |
onDepositSuccess | (detail) => void | No | Success callback with tx details |
depositBatches
ThedepositBatches prop defines what happens on the destination chain after the deposit. It can be a static array or an async function that returns batches based on the deposit amount:
SpiceWithdraw
Withdraw assets from the user’s Spice balance back to their wallet. Users select from their deposited tokens and receive the same token on the same chain.Usage
Props
| Prop | Type | Required | Default | Description |
|---|---|---|---|---|
isOpen | boolean | Yes | Control modal visibility | |
onClose | () => void | Yes | Close handler | |
styles | CustomStyles | No | Custom styling | |
onWithdrawExecute | (amount: string) => Promise<void> | No | Callback for non 7702 mode | |
withdrawActionLabel | string | No | Custom button label | |
onWithdrawSuccess | (data) => void | No | Success callback | |
onWithdrawError | (error: string) => void | No | Error callback | |
supportedChains | number[] | No | Filter to specific chains |
SpiceLockModal
Lock tokens for a duration (veToken style). Supports cross chain deposits into the lock. The app provides duration options and the lock batches.Usage
Props
| Prop | Type | Required | Default | Description |
|---|---|---|---|---|
isOpen | boolean | Yes | Modal visibility | |
onClose | () => void | Yes | Close handler | |
lockBatches | ChainBatch[] | Yes | On chain lock calls | |
lockTokenSymbol | string | Yes | Display symbol for the lock token | |
lockChainId | number | Yes | Chain where the lock contract lives | |
sourceChains | number[] | Yes | Chains users can deposit from | |
durationOptions | LockDurationOption[] | Yes | Available lock durations | |
styles | CustomStyles | No | Custom styling | |
dark | boolean | No | Dark mode override | |
lockTokenLogoURI | string | No | Logo URL for the lock token | |
votingPowerEstimate | (amount, months) => number | No | Estimate voting power from amount and duration | |
sourceToDestinationConversionRate | number | No | Conversion rate display | |
onLockSuccess | (txHash?: string) => void | No | Success callback | |
onAddFunds | () => void | No | Handler for “add funds” action | |
destinationTokenAddress | Address | No | Target token on lock chain |
AccountDisplay
A popover that shows the user’s Spice balance breakdown, pending deposits, and quick actions for deposit/withdraw. Great for header navigation.Usage
Props
| Prop | Type | Required | Default | Description |
|---|---|---|---|---|
styles | CustomStyles | No | Custom styling | |
dark | boolean | No | Dark mode override | |
appName | string | No | "Spice" | Display name |
status | "active" | "inactive" | No | "active" | Account status indicator |
statusLabel | string | No | Custom status text | |
onDepositClick | () => void | No | Deposit button handler | |
onWithdrawClick | () => void | No | Withdraw button handler | |
onDepositSuccess | () => void | No | Called after successful deposit | |
customSections | CustomSection[] | No | Add custom sections to the popover | |
extraAssets | SpiceAsset[] | No | Additional assets to display | |
tokenPrices | Record<string, number> | No | Token price overrides | |
supportedChains | number[] | No | Filter chains shown |
SpiceBalance
A balance dashboard card that shows the user’s deposited assets. Usually used within a larger page layout rather than as a standalone modal.Usage
Props
| Prop | Type | Required | Default | Description |
|---|---|---|---|---|
balanceData | BalanceData | Yes | Balance data object | |
isLoading | boolean | No | false | Loading state |
onDepositClick | () => void | No | Deposit button handler | |
onWithdrawClick | () => void | No | Withdraw button handler | |
styles | CustomStyles | No | Custom styling | |
showHeader | boolean | No | true | Show the header |
customSections | BalanceSectionConfig[] | No | Custom balance sections |
AirdropModal
Request testnet tokens for development and testing.Usage
ProviderLogin
Wallet connection button that adapts to your selected provider (Privy or Dynamic).Usage
Props
| Prop | Type | Required | Description |
|---|---|---|---|
onAuthSuccess | () => void | No | Callback after successful authentication |
autoTrigger | boolean | No | Automatically trigger login on mount |
ExportWalletButton
Lets users export their Privy embedded wallet private key.Next Steps
Hooks
Build custom UIs with React hooks
Styling
Customize component appearance
Configuration
Configure chains and providers
Examples
See complete examples
