fix: enforce unwrap daily limit#138
Conversation
|
If you're new to commit signing, there are different ways to set it up: Sign commits with
|
There was a problem hiding this comment.
Code Review
This pull request refactors the daily limit fetching and validation logic. In app/page.tsx, the daily limit is now fetched immediately on mount and updated periodically. In hooks/use-bridge-to-tari.ts, the limit check was simplified to return a boolean instead of instantiating an unused error. Feedback points out that removing the limitXtm check could allow transactions to bypass the limit if the value is undefined or NaN, and recommends adding an active flag to the asynchronous useEffect hook to prevent state updates on unmounted components.
c1255b3 to
e998a06
Compare
a44d5ca to
e998a06
Compare
Fixes #137
Summary
Context
This restores the protection originally added in #96. During the later store cleanup, the polling hook's returned value stopped being written to
remainingDailyLimit, and the final preflight guard was reduced to an inertnew Error(...)expression with no control-flow exit.Verification
git diff --check origin/development...HEADsetRemainingDailyLimit(await fetchDailyLimit())immediately and on the interval; the final guard returns beforeparseEther, typed-data signing, andwriteContractLocal validation constraint
npm ci --ignore-scripts --no-audit --no-fundcould not complete in this environment because@tari-project/wxtm-bridge-contracts@0.1.12is served from GitHub Packages and the available token does not have the required package-read scope. Please run the normal build in the maintainer environment with package access.