Skip to content

Commit

Permalink
Merge pull request #522 from us3r-network/B-allowanceMaxCheck-ttang
Browse files Browse the repository at this point in the history
fix: allowance max check
  • Loading branch information
Tonyce authored Feb 4, 2024
2 parents 8014f8b + 5ea63ad commit 40f2e31
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion apps/u3/src/components/social/farcaster/FCastTips.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,14 @@ function TipTransaction({
}, [address, tipAmount, result, cast]);

const allowanceAction = useCallback(async () => {
if (
Number.isNaN(Number(allowanceValue)) ||
Number.isNaN(Number(allowance)) ||
Number(allowanceValue) > Number(allowance)
) {
toast.error('not enough allowance');
return;
}
try {
const castToReply = (
await makeCastAdd(
Expand Down Expand Up @@ -355,7 +363,7 @@ function TipTransaction({
console.error(error);
toast.success('allowance tip failed');
}
}, [allowanceValue, currFid, encryptedSigner]);
}, [allowanceValue, currFid, encryptedSigner, allowance]);

useEffect(() => {
if (Number(allowance) > 0) {
Expand Down

0 comments on commit 40f2e31

Please sign in to comment.