-
Notifications
You must be signed in to change notification settings - Fork 436
fix: perps agent credential cleanup logic #8514
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
Conversation
- Add debug logging and error handling in perps account selection - Adjust loading timeout delay from 0ms to 300ms for better UX - Add auto-select perps account when ETH accounts are added to wallet - Hide deposit button when no perps account is selected - Replace debug button text with icon for cleaner UI - Remove unnecessary console logs in subscription service 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
- Add @toastIfError decorator to enableTrading method for better error handling - Fix atom setter type consistency in disposeExchangeClients - Refactor invalid agent error handling to use service method instead of direct atom manipulation - Remove redundant error toast in DepositWithdrawModal to avoid duplicate error messages 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
- Refactor shouldDeleteCredential method to use object parameters for better readability - Add delay and logic to prevent wallet-level deletion when account-specific deletion is requested - Fix parameter passing in cleanupOrphanedHyperLiquidAgentCredentials calls - Remove unnecessary walletId parameter when deleting specific accounts 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
WalkthroughRefactors two functions to accept parameter objects instead of multiple params. Updates internal call sites accordingly. Adds a one-second delay and walletId normalization in cleanupOrphanedHyperLiquidAgentCredentials when indexedAccountId or accountId are present. Reconstructs deletedInfo for downstream logic. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant Caller
participant ServiceAccount
participant CredentialStore as Credential Logic
Caller->>ServiceAccount: cleanupOrphanedHyperLiquidAgentCredentials({ walletId?, indexedAccountId?, accountId? })
alt indexedAccountId or accountId provided
ServiceAccount->>ServiceAccount: wait 1s
ServiceAccount->>ServiceAccount: normalize walletId
ServiceAccount->>ServiceAccount: reconstruct deletedInfo
else
ServiceAccount->>ServiceAccount: use provided walletId/deletedInfo
end
ServiceAccount->>CredentialStore: shouldDeleteCredential({ addressRecord, deletedInfo })
CredentialStore-->>ServiceAccount: decision
ServiceAccount->>CredentialStore: delete or skip
CredentialStore-->>ServiceAccount: result
ServiceAccount-->>Caller: completion
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Pre-merge checks and finishing touches❌ Failed checks (1 inconclusive)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: ASSERTIVE Plan: Pro Cache: Disabled due to data retention organization setting Knowledge base: Disabled due to data retention organization setting Disabled knowledge base sources:
📒 Files selected for processing (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
Comment |
🎉 Snyk checks have passed. No issues have been found so far.✅ security/snyk check is complete. No issues have been found. (View Details) ✅ license/snyk check is complete. No issues have been found. (View Details) |
Summary by CodeRabbit
This PR provides comprehensive improvements to the HyperLiquid perpetuals trading functionality, including account selection enhancements, error handling improvements, UI/UX refinements, and agent credential cleanup optimizations.
Changes
Account Selection & Management
Agent Credential Cleanup
shouldDeleteCredential
method with object parameters for better readabilityUI/UX Improvements
Error Handling & Code Quality
@toastIfError
decorator toenableTrading
method for consistent error handlingdisposeExchangeClients
Technical Details
Files Modified
ServiceAccount.ts
: Agent credential cleanup improvementsServiceHyperliquid.ts
: Account selection and error handling enhancementsServiceHyperliquidSubscription.ts
: Console log cleanupwithToast.ts
: Error handling refactoringPerpsGlobalEffects.tsx
: Auto-selection logic and event handlingPerpsHeaderRight.tsx
: UI improvements and conditional renderingDepositWithdrawModal.tsx
: Error handling cleanupTest Plan
🤖 Generated with Claude Code