waitForFunding

suspend fun waitForFunding(minNight: BigInteger, pollIntervalMs: Long, timeoutMs: Long = DEFAULT_FUNDING_TIMEOUT_MS): WalletBalance

Suspend until the wallet's NIGHT balance reaches minNight or timeoutMs elapses.

Used by onboarding flows after the user is told "fund this address" — the UI can call this and show a spinner until funding lands, then proceed to MidnightSdk.registerForDustGeneration. Throws kotlinx.coroutines.TimeoutCancellationException on timeout; callers can catch and re-prompt the user.

On the funded edge, forces a fresh dust resync so the next operation doesn't read stale UTXO state. (The unshielded subscription drives NIGHT automatically — dust is on a separate sync path.)

Parameters

minNight

Minimum NIGHT amount that counts as "funded" (in u128 base units).

pollIntervalMs

Reserved — currently driven by the underlying Flow's emissions, not a poll.

timeoutMs

Wall-clock cap on how long to wait.