Skip to main content
For stable SDK 4.10.0, use the shared controllers below for custom UIs. Stock components consume these same controllers. The lower-level hooks remain available for existing integrations.

useSpiceSupply

Owns the Supply/Pay action from inventory and quote through fees, Max, funding and completion. See the complete typed example. Other optional fields are declared in UseSpiceSupplyParams, including source-wallet inclusion, additional tokens and custom swap resolvers. Do not add these just to reproduce the defaults. Keep enabled true while quotes and fees load; use canExecute for submit-button readiness. Setting enabled to true does not submit a transaction. Explicit false disables this controller’s preparation and submission, which is useful when a hidden form remains mounted.
SDK PR #159 makes useSpiceSupply.enabled optional, defaulting to true. It is not in published 4.10.0; keep the explicit value on that version. Once released, an always-active form can omit it and use three basic inputs: destinationToken, selectedAsset, and buildActionCalls.
Do not independently estimate fees or rebuild batches around this controller. Preserve token units, source identity and beneficiary in your builder; show the SDK’s readiness instead of deriving your own.

useSpiceLock

An input-inclusive adapter over useSpiceSupply. Provide enabled, selectedAsset, lockChainId, lockTokenSymbol and lockBatches; name an unconfigured lock token with destinationTokenAddress. Decimals and logo are optional. beneficiary, onSubmit, onLockSuccess and onLockError support product-specific ownership and application updates. The lockBatches callback receives amountWei in destination lock-token units, along with beneficiary and executorAddress. Return destination-chain protocol calls. The SDK owns conversion and delivery. Do not execute transactions in onLockExecute; that override blocks execution. The hook returns the Supply controller plus destination and metadataError. Duration and protocol lock parameters remain host-owned. max() and the shared status/fee fields are available to custom UIs.

useSpiceAccount

Returns mode (embedded or external), setMode, ownerAddress, embeddedAddress, externalAddress and whitelist state/actions. A provider with a fixed mode prop ignores mode changes. Account ownership does not restrict the controller’s funding sources to that wallet.

useSpiceInventory

Returns positions (assets plus eligibility/reasons), eligible assets, walletAssets, rollupAssets, loading, refreshing, error and refresh. Optional owner, chain, token and role filters select the view; roles are holding, deposit-source, spend-source, and withdraw-destination. Supply/Lock already read inventory, so do not add a second inventory pipeline around them.

Compatibility Hooks

useSpiceAction remains a compatibility adapter over Supply. Existing useSupplyAssets, useSupplyQuote and execution helpers remain exported; new custom actions should start with useSpiceSupply. The SDK has no persistent pending-action journal. See Migration to 4.10.0 before carrying older recovery or execution overrides forward.

useSpiceExecution

The core execution hook. Handles EIP 7702 delegation signing, intent submission, and solver execution polling. It is a lower-level primitive; use useSpiceSupply for a protocol action rather than composing a new pipeline.

Usage

Return Value

The hook returns execute (not executeGasless), plus fee estimation, status, and a status reset:
The SDK holds its own concurrency lock and throws on an overlapping execute call, so you do not need a module-level mutex. For multi-step flows, call clearStatus() between executions.

Progress Steps

The onProgress callback receives updates as execution proceeds:

useSpiceAssets

Fetch the user’s Spice balance from the relayer API. This returns the off chain balance (what the user has deposited via escrow), not on chain wallet balances.

Usage

Config

Return Value


useSupplyAssets

Lists every asset the user can fund a given destination token with — wallet balances and Spice balances, across all supported chains. This is the source-selection half of a custom supply UI (see the Custom UI Integration guide for the full flow).

Usage

Return Value


useSupplyQuote

Resolves routing for a selected source asset: whether it funds the destination token directly or needs a swap, and the quote for it. It remains available for lower-level integrations. New custom UIs should use useSpiceSupply to keep quote, fee and execution state together.

Usage

Return Value


useWallet

Access wallet connection state and signing actions for the configured provider (Privy).

Usage

Return Value


Getting the embedded wallet address

There is no standalone useEmbeddedWalletAddress hook. In 7702 mode the embedded wallet is the on-chain identity; read its address from useWallet() or from the provider context:

useAssetInput

Manage asset selection and amount input state. Used to control the asset selector in deposit and lock flows from your own UI.

Usage

Return Value


useLockDuration

Manage lock duration selection state for SpiceLock.

Usage


useSpicePendingDeposits

Detect funds stranded in the user’s embedded wallet (deposits that were sent but not yet credited to Spice balance). Used by SpiceDeposit internally for recovery flows.

Usage


useSpiceBrand

Resolve the current theme from the provider’s theme prop and any component-level styles/dark overrides. Only used when building custom components that need to match the SDK’s look.

Usage

Return Value


Next Steps

Components

Use prebuilt components for common flows

Styling

Customize appearance with the brand system

API Reference

Explore the REST API for advanced use cases

Configuration

Configure chains and providers