Skip to main content
Use SDK 5.0.2 to combine funding, an escrow deposit and delivery to your app in one SpiceDeposit. This example delivers USDC to a Cloak receiving address on Elysium. Your app creates that address and verifies the final transfer before crediting its private balance.

Set up the providers and wallet

Pin @spicenet-io/spiceflow-ui@5.0.2. If you import core directly, pin @spicenet-io/spiceflow-core@0.10.3 too. Mount your existing Privy, wagmi and Query providers as shown in Quick Start, then configure Spice Flow:
swapper.enabled makes Card and Exchange available alongside Wallet. Payment methods, eligibility, minimums and funding-route fees still depend on the provider’s live quote. Set RPC overrides for any other chains your app exercises as needed. Establish a recoverable login before accepting funds. A guest must link its login while the original account is accessible. Keep the same embedded wallet and the same issued receiving address until that deposit and its delivery are resolved.

Build the delivery inside the deposit

The SDK supplies context.destinationAmount in destination-token smallest units. It is the deposit’s net escrow amount, used here as the total payout budget. quoteSpicenetWithdrawalBatches quotes payout fees within that budget and builds both the Spicenet withdrawal and destination transfers. Pass the amount unchanged; do not subtract payout fees yourself or replace it with an earlier card or exchange quote.
Render the component only after your host has the authenticated embedded wallet and the receiving address for this deposit. onDeliveryTransaction is a host callback that starts receipt verification; it is not supplied by the SDK. onDepositSuccess is a notification and does not await your application’s verification or crediting work. Remove the separate SpiceWithdraw step from this combined deposit flow. For a separate withdrawal from an existing Spicenet balance, SpiceWithdraw still supports recipient={receiveAddress}.

Verify delivery before crediting

For this combined flow, use detail.txHash to find the final Elysium receipt. detail.amount is the escrow credit, not the net USDC delivered to Cloak. The modal can show the actual delivered amount when it reads the receipt; the callback amount retains its escrow-credit meaning. Your host verifier must wait for Elysium finality and match the canonical USDC contract, the issued receiving address and the transfer from the configured Elysium escrow. Credit the amount from that receipt once, using the transaction hash and log index to identify the transfer. See Elysium mainnet for the token and escrow. Keep the application status pending until verification and private-balance credit succeed. Before launch, test that the final transfer credits the expected private balance in your actual integration. SDK completion alone does not establish that application credit.

Recover interrupted funding

Reopen the same SpiceDeposit with skipRecovery={false}, the same guest or linked account, the same receiving address and the same depositBatches callback. Keep those values with the host’s original deposit record, including after a browser reload. Confirm the existing funded balance to continue without paying again. If an action was already submitted, inspect its existing status before retrying. Preserve its identity and original transfers; an uncertain payment or submission is not permission to send it again. A recovery attempt must not allocate a new receiving address or create a replacement guest account.