-
Notifications
You must be signed in to change notification settings - Fork 95
Fix for remaining locked balance #1491
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
|
Visit the preview URL for this PR (updated for commit e7e7bc3): https://astar-apps--pr1491-fix-locked-amount-z3wehm6n.web.app (expires Thu, 31 Jul 2025 13:08:32 GMT) 🔥 via Firebase Hosting GitHub Action 🌎 Sign: dd76fe72958fe2910fef9d53f0b4539b82b849db |
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 PR fixes a bug where democracy-locked tokens were incorrectly treated as dApp staking locked tokens, and also resolves identity information loading issues on Shibuya.
- Fixed locked balance calculation by removing democracy balance from dApp staking locked amount calculation
- Updated identity repository to properly handle API response structure and add null safety checks
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/v2/repositories/implementations/IdentityRepository.ts | Updated API query type definition and added null safety checks for identity data |
| src/staking-v3/hooks/useVote.ts | Removed democracy locked balance from dApp staking locked calculation |
| const result = await api.query.identity.identityOf<Option<PalletIdentityRegistration>>(address); | ||
|
|
||
| if (result.isNone) { | ||
| return undefined; | ||
| } | ||
|
|
||
| const unwrappedResult = result.unwrapOrDefault(); | ||
| const identity = <PalletIdentityRegistration>unwrappedResult[0]; | ||
| const identity = <PalletIdentityRegistration>unwrappedResult; |
Copilot
AI
Jul 24, 2025
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.
The type change from Option to Option should be verified against the actual API response structure to ensure compatibility across different runtime versions.
| export function useVote(dapps: Ref<DappVote[]>, dappToMoveTokensFromAddress?: string) { | ||
| const { currentAccount } = useAccount(); | ||
| const { useableBalance, lockedInDemocracy } = useBalance(currentAccount); | ||
| const { useableBalance } = useBalance(currentAccount); |
Copilot
AI
Jul 24, 2025
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.
[nitpick] Consider adding a comment explaining why lockedInDemocracy was removed to prevent future confusion about the reasoning behind this change.
Pull Request Summary
By mistake amount locked in democracy was treated as locked in dApp staking 👎
Also fixed identity info loading (used only on Shibuya)
Check list