-
Notifications
You must be signed in to change notification settings - Fork 41
fix: sign-transactions balances call should fail silently #2564
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
… view. Tweaks logic for insufficient balance warning to degrade silently in case of balance failures. Adds test cases for balance failures in the sign transaction flow
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This pull request addresses issue #2437 by making the account balance fetch in the sign transaction flow fail silently. Previously, if the balance API call failed (e.g., due to network connectivity issues), users were blocked from signing transactions with an error. Now, the balance fetch failure is handled gracefully, allowing users to proceed with signing transactions even when balances cannot be loaded.
Changes:
- Modified balance fetching in
useGetSignTxDatato handle failures silently by catching errors and setting balances toundefined - Updated the
ResolvedDatainterface to make thebalancesfield optional - Changed the insufficient balance check in
SignTransactionto skip the warning when balances are unavailable - Added comprehensive test coverage for the new behavior
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| extension/src/popup/views/SignTransaction/hooks/useGetSignTxData.tsx | Added try-catch block around balance fetching to handle failures silently, removed error-throwing logic, and made balances field optional in ResolvedData interface |
| extension/src/popup/views/SignTransaction/index.tsx | Updated balance check logic to handle undefined balances by defaulting to allowing the user to proceed |
| extension/src/popup/views/tests/SignTransaction.test.tsx | Added test case for rendering sign transaction view when balances are unavailable, with minor inconsistency in using hardcoded network passphrase |
| extension/src/popup/views/SignTransaction/hooks/tests/useGetSignTxData.test.tsx | Added test case to verify graceful handling of balance fetch failures |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Closes #2437
Why
If a user is in the sign-transaction flow and the call to fetch their balances fails, we fail harshly and block them from completing the transaction.
What
This handles the failure silently and allows the user to continue in their flow, the only side effect is that we cannot warn them about a potential insufficient balance.