SpiceFlowProvider
The root provider component that wraps your application and manages wallet connections.Usage
Props
| Prop | Type | Required | Default | Description |
|---|---|---|---|---|
provider | 'privy' | 'dynamic' | Yes | - | Wallet provider to use |
children | ReactNode | Yes | - | Your application components |
privyAppId | string | If using Privy | - | Privy application ID |
dynamicEnvironmentId | string | If using Dynamic | - | Dynamic environment ID |
supportedChainIds | number[] | No | [11155111, 421614, 5115, 123420001114] | Array of supported chain IDs |
mode | '7702' | 'presign' | 'ondemand' | No | '7702' | Execution mode (see Configuration) |
nativeChainId | number | No | - | Native chain ID for non-7702 modes |
appName | string | No | 'Spicenet' | Your application name |
embeddedWalletConfig | object | No | - | Embedded wallet configuration |
Examples
SwapWidget
Pre-built UI component for cross-chain swaps with built-in asset selection, balance display, and transaction execution.Usage
Props
| Prop | Type | Required | Default | Description |
|---|---|---|---|---|
swapBatches | ChainBatch[] | Yes | - | Array of chain batches for cross-chain execution |
supportedChains | number[] | Yes | - | Array of supported chain IDs for swap |
tokenAddress | string | No | '0x0' | Token address for the swap (0x0 for native) |
theme | 'light' | 'dark' | No | 'light' | Color theme |
styles | SwapWidgetStyles | No | - | Custom styling object |
showSlippageSettings | boolean | No | true | Show/hide slippage settings |
enableFlipSwap | boolean | No | true | Enable asset flipping button |
fromInputHook | UseFromInputReturn | No | - | External hook for “from” input control |
toInputUpdateHook | UseToInputUpdateReturn | No | - | External hook for “to” input updates |
ChainBatch Type
SpiceDeposit
Modal flow for depositing assets into Spicenet. Handles chain selection, wallet connection, and deposit execution.Usage
Props
| Prop | Type | Required | Default | Description |
|---|---|---|---|---|
isOpen | boolean | Yes | - | Control modal visibility |
onClose | () => void | Yes | - | Callback when modal closes |
styles | CustomStyles | No | - | Custom styling |
className | string | No | '' | Additional CSS class |
walletConnectProjectId | string | No | - | WalletConnect project ID |
postDepositBatches | ChainBatch[] | No | - | Batches to execute after deposit |
allowedTokens | string[] | No | - | Token symbols allowed for deposit |
onDepositAmountChange | (amount: string) => void | No | - | Callback on amount change |
allowSecondAsset | boolean | No | - | Allow adding a second asset |
destinationChainId | number | No | - | Destination chain for non-7702 mode |
destinationTokenAddress | string | No | - | Destination token address |
postDepositInstruction | (bridgedAmount: string) => Promise<void> | void | No | - | Post-deposit callback (e.g., vault deposit) |
postDepositInstructionLabel | string | No | - | Label for post-deposit action |
airdrop | boolean | No | false | Show airdrop button |
sponsorGas | boolean | No | false | Backend sponsors gas on Pharos |
Example
SpiceBalance
Balance dashboard component showing user’s deposited assets with deposit/withdraw actions.Usage
Props
| Prop | Type | Required | Default | Description |
|---|---|---|---|---|
balanceData | BalanceData | Yes | - | Balance data object |
isLoading | boolean | No | false | Show loading state |
styles | any | No | - | Custom styling |
className | string | No | '' | Additional CSS class |
showHeader | boolean | No | true | Show header section |
onAccountClick | (accountId: string) => void | No | - | Account item click handler |
onDepositClick | () => void | No | - | Deposit button handler |
onWithdrawClick | () => void | No | - | Withdraw button handler |
vaultBalance | number | No | - | External vault balance |
fetchVaultBalance | () => Promise<number> | No | - | Fetch vault balance function |
postWithdrawInstruction | (amount: string) => Promise<void> | void | No | - | Post-withdraw callback |
postWithdrawInstructionLabel | string | No | - | Label for post-withdraw action |
destinationChainId | number | No | - | Destination chain for withdrawals |
destinationTokenAddress | string | No | - | Destination token address |
customSections | BalanceSectionConfig[] | No | - | Custom balance sections |
showDefaultSections | boolean | No | true | Show default sections |
BalanceData Type
SpiceWithdraw
Modal flow for withdrawing assets from Spicenet to external wallets.Usage
Props
| Prop | Type | Required | Default | Description |
|---|---|---|---|---|
isOpen | boolean | Yes | - | Control modal visibility |
onClose | () => void | Yes | - | Callback when modal closes |
styles | CustomStyles | No | - | Custom styling |
className | string | No | '' | Additional CSS class |
walletConnectProjectId | string | No | - | WalletConnect project ID |
postWithdrawBatches | ChainBatch[] | No | - | Batches to execute after withdraw |
postWithdrawInstruction | (withdrawnAmount: string) => Promise<void> | void | No | - | Post-withdraw callback |
postWithdrawInstructionLabel | string | No | - | Label for post-withdraw action |
useInternalWagmi | boolean | No | true | Use internal Wagmi provider |
vaultBalance | number | No | - | Available vault balance |
fetchVaultBalance | () => Promise<number> | No | - | Fetch vault balance function |
destinationChainId | number | No | - | Destination chain ID |
destinationTokenAddress | string | No | - | Destination token address |
LpModal
Modal for managing liquidity pool positions.Usage
Props
| Prop | Type | Required | Default | Description |
|---|---|---|---|---|
isOpen | boolean | Yes | - | Modal visibility |
onClose | () => void | Yes | - | Close handler |
pairLabel | string | Yes | - | Trading pair label (e.g., “ETH/USDC”) |
pairApr | string | Yes | - | APR display string |
pairAddressLabel | string | Yes | - | LP address label |
lpLabel | string | Yes | - | LP provider label |
onViewPool | () => void | No | - | View pool button handler |
primaryAsset | LpAssetInput | Yes | - | Primary asset input state |
secondaryAsset | LpAssetInput | No | - | Secondary asset input state |
onPrimaryAssetChange | (asset: Asset | null, amount: string) => void | Yes | - | Primary asset change handler |
onSecondaryAssetChange | (asset: Asset | null, amount: string) => void | No | - | Secondary asset change handler |
availableAssets | Asset[] | Yes | - | Available assets for selection |
showSecondaryAsset | boolean | Yes | - | Show secondary asset input |
onAddSecondaryAsset | () => void | No | - | Add secondary asset handler |
alertVariant | 'none' | 'crossNetworkAssets' | 'noCollateral' | No | 'none' | Alert type to display |
crossNetworkCopy | CrossNetworkCopy | No | - | Cross-network alert content |
onClickDepositCollateral | () => void | No | - | Deposit collateral handler |
transactionDetailsCollapsed | boolean | No | true | Transaction details collapsed |
onToggleTransactionDetails | () => void | No | - | Toggle transaction details |
transactionDetails | TransactionDetail[] | No | - | Transaction detail items |
isSubmitting | boolean | No | false | Submission in progress |
canSubmit | boolean | No | false | Enable submit button |
onSubmit | () => void | Yes | - | Submit handler |
styles | CustomStyles | No | - | Custom styling |
ProviderLogin
Wallet connection button that adapts to your selected provider.Usage
Props
| Prop | Type | Required | Description |
|---|---|---|---|
styles | LoginStyles | No | Custom styling for the login button |
onAuthSuccess | () => void | No | Callback after successful authentication |
autoTrigger | boolean | No | Automatically trigger login on mount |
