This tutorial walks through a minimal Stellar preset integration using an in-memory state adapter — no Redux, no React provider. It is a learning exercise, not a production app layout. For full React wiring, see Setup.

What you will build

A short script that:
  1. Creates a Stellar privacy client with in-memory state.
  2. Seeds the minimum fixture data prepare expects.
  3. Calls deposit, checks the prepare result, and runs execute with progress logging.

Prerequisites

  • Node.js 20.10 or later
  • Packages: @arcanetech/privacy-sdk-stellar, @arcanetech/privacy-sdk-state-memory
Need Redux and React too? See Install.

Step 1 — In-memory state adapter

The SDK keeps domain data — private records, pool snapshot, registry cache, wallet keys — that prepare reads to decide whether an operation is valid. If notes, pool root, or wallet secrets are missing or stale, prepare returns rejected with insufficient_state instead of opening the wallet. An in-memory adapter stores this data in process memory. It is ideal for tutorials and unit tests; it does not survive reloads.
You pass the adapter to createStellarPrivacyClient as state. The SDK reads and updates domain data through the adapter library — you do not implement low-level storage APIs yourself.

Step 2 — Wallet stub

The Stellar preset signs through a wallet adapter. Replace this stub with your wallet SDK in production.
getAddress identifies the connected account. authorizeMessage proves control of a private payment address. signTransactionPayload signs the Soroban transaction XDR before submission.

Step 3 — Create the client

Load bundled runtime assets, configure Soroban network contracts, and create the client once.
loadDefaultStellarBrowserAssets() returns bundled runtime assets required by the Stellar preset. transactEnvironment ties together network contracts, optional KYT, and your app’s transaction signing hook.

Step 4 — Seed minimal fixture state

The block below is tutorial fixture data — in production, assets and wallet secrets come from your backend and wallet flows. See Data sources.
Prepare checks this cache before asking the wallet to sign. Missing asset catalog rows or wallet scalars are common reasons for early rejected results.

Step 5 — Prepare and execute

Always branch on operation.status before calling execute(). Use onEvent to drive progress UI — stages are listed in Operation lifecycle.

Next steps

State integration

Move from in-memory to Redux for production React.

Data sources

Replace fixtures with live backend and chain sync.

Setup

Full Stellar application shell with persistence.

Deposit how-to

Complete deposit reference with disclosure tiles.