Package-level declarations

Types

Link copied to clipboard

An operation currently in flight — the unit observed by the foreground service.

Link copied to clipboard

Optional cross-device backup of host app state (e.g. Kicks match witnesses, draft data) — distinct from the wallet seed/identity (carried by the passkey, reconstructed locally) and from the dust checkpoint (DustCloudBackup).

Link copied to clipboard

One-shot, SEED-FREE detection of inbound NIGHT receipts for an address on a network — what the background receive poll does while the full MidnightSdk may be dropped (session locked / process backgrounded).

Link copied to clipboard
data class BackupStatusSnapshot(val dust: CloudBackupStatus = CloudBackupStatus.Idle, val appData: CloudBackupStatus = CloudBackupStatus.Idle)

Snapshot of every cloud-backup lane the wallet drives. Emitted by MidnightWallet.backupStatus on each backup attempt.

Link copied to clipboard
sealed interface CloudBackupStatus

Cloud-backup status for one lane (dust checkpoint or app state), surfaced by MidnightWallet.backupStatus so the UI can show what's happening instead of a silent log. The SDK stays best-effort/non-crashing — this is observation only.

Link copied to clipboard

Full cross-device dust backup — adds the upload side to DustCloudBackupSource. One implementation serves both views: DustSyncManager consumes only fetch, MidnightWallet also drives upload.

Link copied to clipboard
fun interface DustCloudBackupSource

Optional cross-device source of a dust checkpoint (e.g. Google Drive). The concrete implementation lives in sdk:wallet-runtime (it needs Drive + the backup crypto); core:indexer and this module stay transport-agnostic.

Link copied to clipboard
class DustSyncManager(dustRepository: DustRepository, nodeRpcClient: NodeRpcClient, walletAddress: String, dustSeed: ByteArray, cloudBackupSource: DustCloudBackupSource? = null, chainResetGuard: ChainResetGuard? = null, restoreGate: suspend () -> Unit? = null)

Dust state manager — keeps a single in-memory DustLocalState for the session.

Link copied to clipboard
@RequiresOptIn(level = RequiresOptIn.Level.WARNING, message = "This API is experimental and may change in future releases. Opt in with @OptIn(ExperimentalKuiraApi::class) to acknowledge.")
annotation class ExperimentalKuiraApi

Marks an API as experimental — subject to breaking changes between releases without going through the standard deprecation cycle declared in STABILITY.md.

Link copied to clipboard

Thrown when a balance can't proceed because the wallet has no spendable dust — specifically, every dust UTXO in the synced state is one the wallet already spent but whose spend the indexer's event stream hasn't reflected yet (so it's correctly excluded to avoid node error 115).

Link copied to clipboard

Thrown when the wallet's unshielded NIGHT can't cover a requested amount — e.g. funding the value a contract receives via receiveUnshielded in MidnightSdk.buildUnshieldedFundingJson.

Link copied to clipboard

Top-level entry point for the Midnight Android SDK.

Link copied to clipboard

Embedded wallet that handles transaction balancing and submission on-device.

Link copied to clipboard

A one-shot ATTENTION request (#264 inbound) — fired MID-flight to pull the user BACK to a tracked operation that needs them (a protocol step waiting on their input, a counterparty's move). Distinct from OperationOutcome, which fires when the op FINISHES. The presentation edge turns it into a heads-up notification and decides whether to suppress it (e.g. when the app is already foreground — no point summoning someone who's looking). title/body are caller-provided; contentIntent taps back to the op's screen.

Link copied to clipboard
class OperationDescriptor(val kind: OperationKind, val label: String? = null, val completionLabel: String? = null, val contentIntent: PendingIntent? = null)

Describes a foreground operation to track. label is CALLER-PROVIDED (the dApp/host owns its own strings) so the SDK emits no English of its own; when null, the presentation edge resolves a default label from kind. A Custom operation MUST provide a label. completionLabel optionally overrides the finalization-notification title (else the ongoing label is reused).

Link copied to clipboard

The kind of value-bearing wallet operation tracked by OperationRegistry and surfaced by the background foreground service (#261-264).

Link copied to clipboard

A one-shot terminal event — the unit the finalization notification rides.

Link copied to clipboard

Process-singleton registry of in-flight value-bearing wallet operations (#261-264). Mirrors MidnightWallet.syncStatus's observable-state model:

Link copied to clipboard
class OperationResult(val status: OperationTerminalStatus, val txHash: String? = null)

How a finished operation's normal return maps to a terminal outcome.

Link copied to clipboard

Terminal status of a tracked operation.

Link copied to clipboard
sealed class ProtocolResult

Outcome of a MidnightSdk.runProtocol segment.

Link copied to clipboard
interface ProtocolScope

The builder scope of a MidnightSdk.runProtocol saga — an ordered list of idempotent, ledger-anchored steps (#253 + #254).

Link copied to clipboard
data class RestoredAppState(val prefs: WalletBackupPrefs?, val hostPayload: ByteArray)

The decoded app-state blob: SDK-level prefs (null when the blob predates the envelope — a legacy raw host payload — or was uploaded with no prefs set) + the host's own payload.

Link copied to clipboard
data class RestoredDustCheckpoint(val stateBytes: ByteArray, val lastEventId: Long)

A restored dust checkpoint: enough to seed DustSyncManager so the next sync is a fast delta instead of a genesis replay.

Link copied to clipboard

The single source of truth for which kind of wallet sync is running.

Link copied to clipboard
sealed interface SyncStatus

Observable state of wallet syncing, exposed by MidnightWallet.syncStatus.

Link copied to clipboard

Pre-flight check that the client's bundled ledger version is coherent with the node it's talking to.

Link copied to clipboard

Thrown when a submit is aborted because the node's ledger version is incompatible with the client's bundled version AND the policy is set to hard-fail (VersionCoherence.HARD_FAIL_ON_SKEW). Under the default warn policy this is never thrown.

Link copied to clipboard
data class WalletBackupPrefs(val dustBackupEnabled: Boolean, val dustBackupOptedOut: Boolean)

Wallet-level backup preferences that travel WITH the wallet (inside the seed-keyed app-state blob) instead of dying with the install (package-local prefs).

Link copied to clipboard
data class WalletBalance(val unshieldedNight: BigInteger, val shieldedNight: BigInteger, val dust: BigInteger, val dustRegistered: Boolean)

Snapshot of a wallet's full balance state across both pools.

Properties

Link copied to clipboard
const val NIGHT_DECIMALS: Int = 6

Decimal places NIGHT is denominated in: a raw WalletBalance amount is in 10^-NIGHT_DECIMALS NIGHT units (the smallest unit). The one source of this scale — presentation layers (dapp-ui, wallet-runtime notifications) reference this rather than re-hardcoding 6.

Functions

Link copied to clipboard

Format a raw NIGHT balance (smallest units) as a human display string, trimming trailing zeros: 5_000_000"5", 1_500_000"1.5", 0"0".