mirror of
https://github.com/minibits-cash/minibits_wallet.git
synced 2026-10-05 19:28:26 +00:00
Reported from device: with an 11k sat amount on a mint that advertises onchain
and NUT-20, the "Bitcoin address" button never appeared.
Two causes, both mine.
1. A missing `time` was being read as FRESH. The stamp only started being
written when the capability model landed (d008d45), so every mint info
cached before that has `time: undefined`. `now - undefined` is NaN, and
every comparison against NaN is false — so `now - time > TTL` reported
those records as fresh and never refetched them. A mint that had since
gained onchain support kept looking like one that never had it, forever.
isMintInfoStale() now treats a missing or non-finite timestamp as stale, and
lives in its own module (no stores, no services) so the NaN behaviour is
pinned by tests rather than rediscovered on a device.
2. Nothing on TopupScreen ever refreshed capabilities. The screen gates on the
mint's cached NUT-06 info but otherwise never talks to the mint, so even
with (1) fixed there was no trigger. Selecting a mint now kicks getMint(),
which only hits the network when the info is genuinely stale; the screen is
an observer, so the option appears by itself once fresher capabilities land.
Also logs the gate inputs (supportsOnchain / nut20 / mintMin / floor / amount),
since "the button is missing" is otherwise indistinguishable from a dozen
different causes.
260/260 tests pass; typecheck introduces no new errors.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>