Wallet Provider
Spice Flow uses Privy for wallet connections and embedded wallets.Privy
Best for embedded wallets and social logins.PrivyProvider (which the SDK reads through Privy’s hooks), not on SpiceFlowProvider:
privyAppId and embeddedWalletConfig props on SpiceFlowProvider exist for compatibility but
have no effect in the current release.
Get Your Privy App ID:
- Sign up at privy.io
- Create a new app
- Copy your App ID from the dashboard
Execution Modes
mode="7702" selects the embedded account (default). mode="ondemand" selects the external
account; "presign" is an alias of "ondemand". These account modes do not mean that all
external-mode actions are implemented through host callbacks.
- A positive-amount external action using its matching destination token on the destination chain executes directly from that wallet, with its native gas. Fee-only and proceeds-funded actions are excluded.
- By default, other supported sources use the routed path through the embedded wallet. The host defines destination
calls and any separate beneficiary; it does not send the transaction through
onPayExecuteoronLockExecute. For the supported routed external-caller option, see Wallets and callers. - Same-wallet, same-chain embedded actions that need no routing execute without an unnecessary Spice funding leg. Relayed execution still consumes gas; the SDK quotes its fees through the shared fee hierarchy.
SpiceDeposit / SpiceWithdraw retain their own non-7702 callbacks (onDepositExecute,
onWithdrawExecute). They are account funding/withdrawal flows, not the Supply/Lock override contract.
Use useSpiceAccount() to render mode and owner. Omit a fixed provider mode when the SDK account
toggle should control it. Funding from both connected wallets is enabled by default; mode chooses the
account owner and is not a source-wallet filter. See Migration.
Fee Funding and Tolerance
The SDK selects execution fees from action input, declared proceeds, then available balances. Within each tier, direct payment comes before conversion.feeFunding can restrict that order; [] retains
the selected-source funding path. Fixed input and exact-output principal remain reserved. Only an
input-inclusive budget may shrink to cover fees.
Expose the assets involved in your action so the SDK can quote and collect execution fees without
requiring a separate manual gas purchase:
- Declare tokens consumed by your protocol calls with
actionInput, using raw token amounts. - For a supported input-inclusive trade whose output remains in the executing wallet, set
actionProceeds: "output"so the SDK can account for fees from that output. - For other protocol proceeds, pass
actionProceeds: { token, resolve }, whereresolvereturns the available raw amount. For several output tokens, use{ resolve }returning an array of{ token, amount }from the same simulation. The SDK chooses the eligible fee source. - Keep the balance tier available when users can pay from their other eligible holdings. Restrict
feeFundingonly when the product needs a narrower set of sources.
canExecute.
Local embedded-wallet actions incur execution fees even without escrow delivery. Direct external-wallet
actions require native gas in the sending wallet. See Custom UI Integration
for the action declarations and amount semantics.
Set the shared fee drift tolerance on the provider:
20000 allows fee movement of 200% relative to the reviewed fee. For example, a reviewed
fee of 100 raw units permits an estimate up to 300 units, subject to the unchanged source debit cap,
destination minimum and remaining budget. It is not a swap-slippage setting. Use a non-negative safe
integer; 0 requires the same fee amount.
Card and Exchange Deposits
Available from@spicenet-io/spiceflow-ui@4.7.11. When enabled, SpiceDeposit opens with a source
chooser in front of the existing flow: Wallet, Card, or Exchange. Card and exchange deposits
run through the Swapper Finance widget, and the SDK verifies on chain that the USDC arrived before handing
off. Users can fund with a debit card or from an exchange account instead of only from a connected wallet.
The options are off by default. Enable them on the SpiceFlowProvider that wraps your
SpiceDeposit or SpiceAccount:
enabled: true is the only required field. The integrator id defaults to Spicenet’s; pass
integratorId only if Swapper has issued you your own.
Card or exchange options are missing
Check that the surrounding provider has bothswapper={{ enabled: true }} and
network="mainnet". The default network is testnet, which skips the chooser. When SpiceDeposit
resumes an existing deposit through escrowRecovery, it intentionally skips the source chooser.
Enabling the chooser does not guarantee a particular payment method or region. The selected
provider’s live quote determines available methods, eligibility, minimums and fees.
Where the funds land
Swapper delivers USDC to the wallet the user is operating with, and the wallet mode decides what happens next.
Swapper currently delivers to Base and Arbitrum. An embedded deposit always lands on Arbitrum
because escrow abstracts the chain downstream. An external deposit lands on your app’s chain when Swapper
covers it, and on Arbitrum when it does not. The app’s chain is read from
destinationChainId on
SpiceDeposit, falling back to nativeChainId on the provider.
Since 5.0.2, a single SpiceDeposit can combine card or exchange funding, escrow deposit and delivery to
your app. Supply depositBatches through quoteSpicenetWithdrawalBatches and keep it during recovery.
See Deposit and deliver to your app for the Elysium USDC example.
A completed payment or provider callback alone is not proof that the destination payout arrived.
If your app runs on a chain Swapper does not deliver to, an external-wallet user’s card or exchange deposit
ends up on Arbitrum, in their own wallet. Consider enabling this only for embedded-wallet users on those
chains, or make sure your flow can handle funds arriving there.
Telling the two outcomes apart
onDepositSuccess on SpiceDeposit reports which path completed through detail.type:
"deposit" callback can report either an escrow deposit or funds delivered to the embedded wallet.
Read the receipt balance to confirm an escrow credit. When depositBatches includes a destination
payout, detail.txHash identifies the delivery transaction, while detail.amount remains the escrow
credit. Verify the finalized destination transfer and credit its actual amount in your host.
The source chooser only appears on network="mainnet"; testnets skip it and go straight to the wallet
flow.
Network Configuration
Set the network to control which chains are available:Default Chains by Network
Use the chain set from your installed package, so configuration follows its supported networks:Custom Chain IDs
Override the defaults withsupportedChainIds:
RPC provider and token discovery
Wallet token discovery and USD prices use the Alchemy API of the RPC endpoint in use for a chain. On an endpoint without that token API, discovery is limited to configured tokens and provider prices may be unavailable. Pass an endpoint per chain withrpcOverrides; a chain without an entry uses
the SDK’s built-in endpoint. Configured RPCs are tried first. Shared chain reads can fall back to a
different built-in endpoint for transport failures, timeouts, rate limits or unavailable resources;
valid RPC and contract failures are preserved. This fallback does not add an Alchemy token API to an
endpoint that lacks one.
Wagmi transports alone do not configure SDK reads. Rollup prices can use configured RPCs or mapped-asset
fallback pricing. Keep private provider keys on your server and expose an appropriate proxy URL to
the browser. Do not rely on a NEXT_PUBLIC_ variable to keep a key private.
Elysium mainnet
On Elysium mainnet (chain 99901), Spicenet supports escrow deposits and withdrawals for canonical USDC, native HYPE and canonical KNTQ. Use UI SDK5.0.3 with core 0.10.3 for HYPE and KNTQ.
The Elysium USDC deposit and withdrawal flow is also live in
Spice Stocks. Elysium testnet uses chain 99801 and has separate deployment settings.
Core records the Delegate at
0x8AA041d9d3dC3391c7C7BA3591E3dd6AeB0A299f; the escrow is
0x7839287eAc1Db87b53aF06Be2A704f25F2186102. These are existing deployments; publishing
the package does not deploy or upgrade contracts. Network identity is recorded in
Conduit’s Elysium chain configuration.
An escrow deposit of HYPE or KNTQ credits its matching receipt, which can be withdrawn as the same asset on
Elysium. HYPE is also the chain’s gas asset. Wrapped HYPE (0xbA876237B0F021A6c6D852d6c26E107997cC5E81)
has registry metadata and no matching escrow route in this flow. Check
active escrow mappings and the live
quote for the selected asset, fees and net amount. See
Withdraw to a deposit address for delivery and receipt checks.
The core registry’s community RPC and
explorer are metadata defaults. The RPC redirects to the
canonical public endpoint. Use the canonical URL directly if your client does not
follow redirects. A client’s rpcOverrides entry retains precedence; wagmi configuration and
supportedChainIds do not activate backend support.
If you operate your own backend or relayer, verify its escrow mapping, solver delegation and HYPE gas funding.
Each API and relayer RPC must independently qualify eth_simulateV1
authorization effects, successful and reverting calls, both validation modes,
blockOverrides.baseFeePerGas, gasUsed and maxUsedGas. An ordinary successful
eth_call or eth_estimateGas response is insufficient. Client RPC access does not establish
those service capabilities; see EIP-7702 RPC support.
Elysium mainnet contracts
These are the existing Spicenet escrow deployments on Elysium mainnet (chain 99901). The proxy holds the escrow state and funds; the implementation contains the logic it executes. Both contracts have published source verification on the Elysium explorer.
The explorer’s public source API also provides the verified Solidity files, ABI and constructor
arguments: escrow proxy source
and implementation source.
Use these JSON responses if the explorer’s contract tabs are unavailable.
The implementation above was confirmed in the proxy’s EIP-1967 implementation slot at
finalized block 8,546,696 on November 20, 2026.
Liquidity Venues
Available from@spicenet-io/spiceflow-ui@4.8.0. When a flow has to swap on the destination chain,
the SDK quotes every liquidity venue that covers that chain and takes the best fill: the most output
for an exact input, the least input for an exact output. The SDK compares on-chain quoter results
and supported venue API quotes. The solver executes the calls the winning quote produced.
Leave liquidityVenues off and you get the built-in venues:
Every built-in serves both swap directions, so a venue is never reachable for an exact-input swap
but missing for an exact-output one.
A supported chain still needs a configured venue and liquidity for the requested swap pair. The SDK
has no keyless 1inch fallback in its default venue list. For deployments outside the built-ins,
declare a venue explicitly; both exact-input and exact-output routing use the declaration.
Metric API routing
The SDK supports Metric for both exact-input and exact-output swaps.SpiceFlowProvider derives
its Metric proxy URL from the configured relayer API as /liquidity/metric. A compatible backend
keeps partner credentials on the server. To use your own compatible proxy, set only its base URL:
Adding your own venue
Declare it once on the provider and every component picks it up. This is the whole change needed to route through a deployment. This example declares the SushiSwap v3 deployment on Robinhood:Turning the built-ins off
SetincludeDefaults: false to drop every built-in venue, and route only through
what you declared:
includeDefaults off (or true) to keep the built-ins and
add yours alongside them.
Venue fields
Supply the deployment’s addresses, not a pool address. A v3-style pool calls back intomsg.sender, so swaps go through the router and quotes through the quoter; the SDK finds the pools
itself from the fee tiers (or tick spacings) and hub currencies.
Each entry names exactly one chain. Declare the same deployment twice if it runs on two chains.
nameis shown to the user asvia <name>once an exact-output swap is quoted. It defaults to the protocol.hubCurrenciesare the intermediate tokens tried for two-hop routes, usually wrapped native and the chain’s main stablecoin.feeTiers/tickSpacingsare the pool tiers to search. Include any non-standard tier your venue uses, such as PancakeSwap’s 2500.
Each quote can consult every configured venue on that chain. On-chain adapters issue quoter calls
against your RPC; Metric issues route and metadata API requests. Adding venues increases read load.
Scope
chainId tightly and keep hubCurrencies to tokens that carry liquidity.Venues from another protocol family
Many DEXs use one of the on-chain families above, so adding one is addresses only. A venue built on a different family, such as a Uniswap v2 pair, Curve or Balancer, needs an adapter inside the SDK, because the SDK owns the calldata rather than asking you to encode swaps yourself. Send us the chain, router, quoter and one funded pool and it becomes aprotocol every integration can name.
Theming
Set your app’s visual identity through thetheme prop. All SDK components inherit these values.
API URL Override
By default, the SDK connects to the Spicenet relayer. Override this if you’re proxying requests or using a custom deployment:Complete Provider Reference
Next Steps
Styling
Customize component appearance
Components
Explore available components
Examples
See complete examples
Best Practices
Security and integration patterns
