Skip to main content
SDK 4.19.0 exposes useSpiceConditionalIntents and useSpiceLimitOrders. They are separate APIs with separate lifecycle objects. Both require a ready embedded wallet in 7702 mode and a configured backend that supports the requested service. Registration is not transaction completion.

Conditional Intents

useSpiceConditionalIntents() prepares a fixed action for a configured trigger service and evaluator. The host defines the trigger specification and protocol calls; the SDK binds the reviewed calls and trigger bytes to the signatures and registration request.

Draft Fields

prepare(draft) does not turn arbitrary protocol calls into a funded or fee-quoted action. Supply complete executable batches, including required funding and fee calls, and review their validity at execution time. For the supported swap path use prepareSwap, which owns its swap/funding/fee plan. prepareSwap(draft) replaces chainBatches with chainId, tokenIn, tokenOut, amountIn, minimumOutput, and an AerodromeVenueConfig in venue. Amounts are raw token-unit bigints. amountMode is "fixed-input" or "input-inclusive". Review the returned swapAmountIn, fees, feeFundingSource and feeSourceAmount; do not infer the executable swap input from the gross budget. A zero minimum output does not protect the fill price. Show any actionSummary disclosure.

Review, Sign and Register

Keep the hook mounted throughout preparation, review, signing and registration. Use the exact object returned by that hook; a serialized, cloned or independently reconstructed object cannot replace it. A wallet/provider/API change requires a new preparation.
Render actionSummary (chain, target, value, selector and available swap bounds), the trigger and expiry, and the returned fee data before calling confirm. The prepared object reports additionalSignatureCount: 2 plus delegationAuthorizationCount. These are signature requirements, not a promise of a particular number of wallet popups. The trigger is enforced by the conditional-intent service; it is not an on-chain condition added to every protocol call. Registration does not guarantee a later fill: balances, liquidity, allowances, contract state and the authorization’s validity must still permit execution.

Read and Cancel

Status reads can prompt for a read signature. Keep polling and cancellation tied to the current wallet and service. Cancellation cannot undo a transaction already executed; reconcile returned status and receipts before presenting funds as available or creating a replacement.

Limit Orders

useSpiceLimitOrders({ combineSourceBalances?: boolean }) handles supported limit swaps funded from account Cash. Combined funding is off by default; opting in lets the SDK fund a shortfall from an eligible account-wallet balance. It may submit a real deposit during placement before registering the order, so placement is not a read-only call. Use the methods in this order, with the same mounted hook:
  1. Wait for canPrepare, then call prepareOrder(input).
  2. Render the returned amountIn, minimumOutput, feeAmount, grossAmount and any funding or fundingWarning. The funding fields use the original source asset’s units; grossAmount is the escrow budget after any funding fee.
  3. After user confirmation call signOrder(prepared) and retain its exact returned request.
  4. Check canPlace(request) and call placeOrder(request).
  5. Read getOrder(id) or listOrders(after?); cancel with cancelOrder(id).
Render status.step, status.message, status.isExecuting, status.pending and status.error. Call refreshStatus() after an uncertain funding or registration outcome; do not start a fresh funding sequence to work around a pending original order. Retain the original signed request while the hook remains mounted so the SDK can reconcile placement rather than deposit twice. listOrders returns { orders, nextCursor }. Order statuses are open, executing, filled, cancelled, expired, failed and needs_attention. Inspect actionId, transactionHash, lastError and any balance warning. An open order is not a fill, and a reserved amount is not proof that all execution-time funding is available.