-
Notifications
You must be signed in to change notification settings - Fork 5
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
fix: undefined asset id in send page #1704
Conversation
WalkthroughThis change updates the logic within the Changes
Possibly related PRs
Suggested reviewers
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
⏰ Context from checks skipped due to timeout of 90000ms (1)
🔇 Additional comments (1)
✨ Finishing Touches
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
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.
Actionable comments posted: 1
🧹 Nitpick comments (1)
packages/extension-polkagate/src/hooks/useBalances.ts (1)
17-17
: Consider improving type safety.The repeated use of String() conversion suggests underlying type inconsistencies between assetId and the native token constants.
Consider:
- Defining consistent types for asset IDs
- Using type guards instead of string conversion
type AssetId = string | number; const isNativeTokenId = (id: AssetId): boolean => id === NATIVE_TOKEN_ASSET_ID || id === NATIVE_TOKEN_ASSET_ID_ON_ASSETHUB; const isNativeAssetId = assetId === undefined || (assetId !== null && isNativeTokenId(assetId));
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
packages/extension-polkagate/src/hooks/useBalances.ts
(2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (2)
- GitHub Check: build
- GitHub Check: Analyze (javascript)
🔇 Additional comments (1)
packages/extension-polkagate/src/hooks/useBalances.ts (1)
14-14
:✅ Verification successful
Verify the fix in the send page context.
Let's verify how this hook is used in the send page to ensure the fix addresses the root cause.
🏁 Script executed:
#!/bin/bash # Search for usages of useBalances in send page components rg -l "useBalances.*send" --type tsLength of output: 37
I'll run a broader search for usages of
useBalances
across the repository to identify if it is referenced in the send page context or elsewhere. This will help us confirm whether the intended usage in the send page is indeed invoking this hook (and specifically if theassetId
parameter is being correctly passed).
🏁 Script executed:
#!/bin/bash # Search for all usages of useBalances hook in the repository rg -l "useBalances(" --type tsLength of output: 107
🏁 Script executed:
#!/bin/bash # Search for all usages of useBalances hook in the repository with proper regex escaping rg -l 'useBalances\(' --type tsLength of output: 1599
🏁 Script executed:
#!/bin/bash # Extract context around the useBalances invocation in the sendFund file to inspect the assetId parameter usage rg "useBalances" packages/extension-polkagate/src/fullscreen/sendFund/index.tsx -nC 3Length of output: 798
Fix Verified: Asset ID Parameter Flow is Correct
The usage of the
useBalances
hook inpackages/extension-polkagate/src/fullscreen/sendFund/index.tsx
shows the asset ID being passed as the fifth parameter:const balances = useBalances(address, refresh, setRefresh, undefined, assetId);This confirms that the fix correctly propagates the
assetId
through the hook, and no further changes are required.
closes #1703
Summary by CodeRabbit
Bug Fixes
New Features