Guard an ICRC-2 allowance edit against concurrent spending
An approval screen can become stale between reading an allowance and submitting its replacement. ICRC-2 provides an expected_allowance field for this race.
Preserve the user's observed value
Read icrc2_allowance for the exact owner and spender accounts. When the user edits the limit from 80 to 100, supply 80 as the expected value. If the spender consumes 30 first, the old value no longer matches. Display the new allowance and request a new decision about the intended total.
read allowance = 80
spender consumes 30 → current allowance = 50
approve(amount = 100, expected_allowance = 80) → AllowanceChanged
Use an absolute replacement
The approve amount specifies the resulting allowance. Automatically retrying with 50 as the new expectation would grant a different decision from the one reviewed. Also inspect expires_at and the owner's actual balance when diagnosing a later transfer_from failure.