Skip to content

Conversation

@bobo-k2
Copy link
Contributor

@bobo-k2 bobo-k2 commented Jul 24, 2025

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

  • contains breaking changes
  • adds new feature
  • modifies existing feature (bug fix or improvements)
  • relies on other tasks
  • documentation changes
  • tested on mobile devices

@github-actions
Copy link

github-actions bot commented Jul 24, 2025

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

@bobo-k2 bobo-k2 marked this pull request as ready for review July 24, 2025 13:57
@bobo-k2 bobo-k2 self-assigned this Jul 24, 2025
Copy link

Copilot AI left a 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

Comment on lines +38 to +45
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;
Copy link

Copilot AI Jul 24, 2025

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.

Copilot uses AI. Check for mistakes.
export function useVote(dapps: Ref<DappVote[]>, dappToMoveTokensFromAddress?: string) {
const { currentAccount } = useAccount();
const { useableBalance, lockedInDemocracy } = useBalance(currentAccount);
const { useableBalance } = useBalance(currentAccount);
Copy link

Copilot AI Jul 24, 2025

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.

Copilot uses AI. Check for mistakes.
@bobo-k2 bobo-k2 merged commit 3cf2d66 into release-hotfix Jul 28, 2025
5 of 6 checks passed
@bobo-k2 bobo-k2 deleted the fix/locked-amount branch July 28, 2025 05:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants