BackgroundReceiveChecker

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).

It reuses the exact indexer pipeline the live SDK runs (UtxoManager ← SubscriptionManager ← IndexerClient — see MidnightSdk's builder), as a bounded one-shot: start the unshielded-tx subscription for the PUBLIC address (no seed — unshielded UTXOs are owned by the address, not a private key), collect the per-transaction ReceiptEvents the subscription classifies (#284) while it catches up to tip (SyncState.Synced) or a budget elapses, then tear the pipeline down and return what it saw.

Receipts are classified by UTXO-set provenance in SubscriptionManager, so this NEVER reports a user's own change as a receipt — the same guarantee the live observer has. The shared persisted sync cursor means a receipt already accounted for by the live SDK isn't re-delivered here. Shielded receipts are out of scope (they need the seed-derived viewing key — the #280 carve-out); this covers public NIGHT only.

Lives in midnight-sdk (which owns the indexer pipeline); wallet-runtime's worker calls it. Lightweight — no DI, no live SDK instance.

Constructors

Link copied to clipboard
constructor(appContext: Context)

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
suspend fun newReceipts(network: MidnightNetwork, address: String): List<ReceiptEvent>?

Inbound NIGHT receipts seen for address on network during a bounded catch-up to tip, or null if the check couldn't run (network error). An empty list means "caught up, nothing new." The caller dedups across poll runs (a receipt already announced carries the same transaction id) before notifying.