Skip to main content
For stable SDK 5.0.3, 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. An always-active form needs three basic inputs: destinationToken, selectedAsset, and buildActionCalls. Unlike Supply, useSpiceLock still requires an explicit enabled value. 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.

Action admission and funding

Use submit(), submitSupply() or submitPay() for the configured action. The removed fundEmbeddedSource() helper must not be called separately. For API-dependent wallet funding, the controller admits the signed action before requesting the funding transfer; your API must advertise admissionBeforeFunding: true and automatic continuation in its capabilities response. See Migration to 5.0.0 before upgrading existing callers.

Read-only previews and interrupted external actions

Set quoteOnlyAccount to the account address for an unsigned preview before login. A preview cannot fund or submit an action. After authentication, remove this option and obtain an executable review for the connected account. For routed external-caller actions, keep the same actionExecution.recoveryKey for the same product action. Use canExecute and the normal submit(), submitSupply() or submitPay() after interruption. When status.canRetry is true, these methods reconcile the original action and submit only its remaining supported calls. Confirmed funding or protocol calls are not repeated. Pending or unknown transactions remain blocked until their outcome is established. refreshStatus() and retrySupply() are read-only. resumeExternalAction() remains a compatibility alias for the explicit retry operation. The host still owns protocol availability, caller/beneficiary rules and awaited application updates. Use retryFinalization() when only those updates failed after a confirmed destination transaction.

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. 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.

useSpiceConditionalIntents

Prepares fixed conditional actions or supported swaps, signs the reviewed plan, and registers it with a configured service. Returns prepare, prepareSwap, sign, register, authorizeRead, get, list and cancel. Use the exact prepared/signed object from the same mounted hook. See Conditional intents for draft fields, signature requirements, service trust and a typed review example. To amend an existing unclaimed conditional intent, prepare a new draft with replacesIntentId, review it, then sign and register the replacement. Use the exported CONDITIONAL_INTENT_UNTIL_CANCELLED constant for an until-cancelled expiry when the configured service supports it. Other expiries remain limited to 30 days. Keep all bigint times in seconds.

useSpiceLimitOrders

Prepares and manages account-funded limit swaps. Accepts optional { combineSourceBalances: true } to fund an eligible account Cash shortfall from wallet balance. Returns canPrepare, canPlace, prepareOrder, prepareAmendment, signOrder, placeOrder, getOrder, listOrders, cancelOrder, status and refreshStatus. prepareAmendment(id, minimumOutput, venue?) preserves the open order’s reserved principal and expiry, then requires a new review and signature. orderId identifies the order across revisions; id remains the signed revision identity for exact retries. Its conditional controller connects limit-order preparation to a configured conditional service:
Choose "cash-first" to fund an eligible account Cash shortfall, or "execution-balances" to prepare against balances on the execution chain. The order and condition expiry must match. prepared.fees.amount already includes fundingFeeAmount; do not add it again. Registration may submit the accepted funding before registering the condition. Preserve the signed object and use refreshStatus() for an uncertain outcome instead of preparing another order. See Limit orders for amounts, service configuration and pending-operation handling.

useSpiceActionActivity

Observes backend actions for a wallet. Accepts (wallet?, enabled?, { pendingOnly? }?) and returns actions, loading, error, updatedAt, revision and refresh. Supply already exposes its observer as status.activity; use this hook for a separate activity view, not a second execution or recovery loop. Availability depends on the configured backend.

Compatibility Hooks

useSpiceAction remains a compatibility adapter over Supply. Existing useSupplyAssets, useSupplyQuote and execution helpers remain exported; new custom actions should start with useSpiceSupply. Accepted-action recovery uses backend status, not a browser action journal. See Migration to 5.0.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:
SDK 5.0.3 has no SDK-wide execution lock. High-level controllers retain their own submission state; the API decides which actions may overlap. clearStatus() resets presentation, not an accepted backend action. Use the original action’s recovery state before starting another submission.

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

Read recoverable deposits associated with the embedded account. SpiceDeposit owns its account-deposit recovery presentation. AccountDisplay no longer renders pending-deposit rows. A wallet balance alone does not establish a failed transaction; use the SDK’s verified result instead of starting a new deposit.

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