observeLedger
Observe this contract's ledger state as it changes on-chain (#255).
Emits the CURRENT MidnightLedger immediately, then a fresh one each time the contract's on-chain state actually changes — driven by the chain's block stream (the SDK wires MidnightConfig.Builder.blockSignals; a raw config falls back to a poll). The raw state hex is de-duplicated BEFORE the (QuickJs) decode, so an unchanged block costs only a state fetch, not a decode. Lets a dApp REACT to state instead of polling ledger in a loop.
Resilient: a transient state-fetch failure (indexer hiccup) skips that tick rather than terminating the flow, and if the block stream itself errors the SDK config degrades to polling — so the flow keeps running until the collector cancels. Fetch+decode run on Dispatchers.IO.
Throws
if this contract was built without an address.