Reference for integration path proven by current @nullark/sdk source and package-pinned starter. Start with complete SDK integration when you want runnable order.

Nullark

Create one client with one runtime and one matching set of adapters.
Client exposes runtime as nullark.runtime and five public operations:

Constructor options

Missing operation-specific adapter rejects that operation before transaction preparation finishes.

recovery.createKey

No input. Returns new Uint8Array containing exactly 32 bytes. When randomBytes is set, callback must return requested byte count. Keep returned bytes with recovery envelope created by deposits.prepare.

deposits.prepare

Input

Method creates private bundle, encrypts recovery envelope, builds proof binding, calls localDepositProver, validates returned proof data, then builds unsigned transaction.

Result

Keep binding, recovery.bundle, key, and witness data inside trusted client. Wallet receives transaction after recovery backup passes restore roundtrip. Preparation rejects missing prover, unknown template, invalid recovery key, malformed prover result, or proof data that fails binding checks.

recovery.restore

Input

Method checks envelope against active runtime, opens it with recovery key, verifies recovered bundle commitment, then returns bundle accepted by withdrawals.prepare. Wrong key, changed envelope, or runtime mismatch rejects restore.

balances.get

Input

Method calls readDeposits, tries matching encrypted events locally, calls isNullifierSpent for each recovered note, and sums notes still available.

Result

Spent notes stay in notes with status "spent"; available balance excludes their amounts. Unrelated encrypted events stay out of deposits. Call requires both readDeposits and isNullifierSpent. Malformed events, duplicate commitments, malformed status, or reader-source mismatch reject whole read.

withdrawals.prepare

Input

When fee bounds are omitted, method uses fee and net amount read during preparation as exact bounds. Preparation checks bundle/runtime match, resolves membership, checks selected note, reads fee, checks user bounds, calls local prover, validates proof intent, reads fee again, checks selected note again, then builds unsigned transaction.

Result

Preparation rejects spent note, missing adapter, invalid destination, invalid decimal bound, fee above ceiling, net amount below floor, fee change during proving, or prover result that fails proof checks.

Adapter contracts

All chain readers stay tied to nullark.runtime.

Reader source

readDeposits and isNullifierSpent return same source fields with their data:
SDK checks every field against active runtime.

Adapter shapes

Starter setup helpers

These exports wire proving path used by starter: @nullark/sdk/node reads local files with Node APIs. Keep that entry in Node code. Main @nullark/sdk entry carries client, methods, types, proof helpers, and runtime helpers.

Common stops

Submission status stays app-owned. Use starter-backed errors and status flow before any retry.