deliveryStatesFor function

Future<Map<String, DeliveryState?>> deliveryStatesFor(
  1. WalletSession session,
  2. List<TxSubmitResult> results
)

The core's delivery reading for every transaction in results that did NOT come back accepted, keyed by txid — the summarizeSendOutcome input that makes "saved for retry" a reported fact (stage S8 obligation, row 10) rather than a fallback. A read that fails typed is recorded as null: the reducer then lands on SendKept (saved, no promise) — under-promising is the honest direction when the wallet's answer could not be taken.

Implementation

Future<Map<String, DeliveryState?>> deliveryStatesFor(
  WalletSession session,
  List<TxSubmitResult> results,
) async {
  final out = <String, DeliveryState?>{};
  for (final result in results) {
    if (result is TxSubmitResult_Success) continue;
    final txid = _txidOf(result);
    if (txid == null) continue;
    try {
      out[txid] = await session.deliveryState(txid);
    } on WalletApiError {
      out[txid] = null;
    }
  }
  return out;
}