-
Notifications
You must be signed in to change notification settings - Fork 111
Fix Room SQL parser errors in Web3WalletDao/Web3AddressDao #6049
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
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 Room SQL parser errors in Web3WalletDao and Web3AddressDao by refactoring how UNION queries are constructed. The changes eliminate the use of a companion object constant (WALLET_ITEM_QUERY) that was causing Room's SQL parser to fail, and instead inline the full SQL queries directly in each @Query annotation.
Key Changes
- Removed the
WALLET_ITEM_QUERYcompanion object constant fromWeb3WalletDaoand inlined its SQL in all queries that used it - Split
getWalletByAddressintogetSafeWalletByAddressto be more explicit about querying only safe wallets - Added
@SuppressWarnings(RoomWarnings.QUERY_MISMATCH)annotations toWeb3TokenDaomethods to suppress expected warnings from LEFT JOIN queries
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| Web3WalletDao.kt | Removed companion object and inlined UNION queries for wallet retrieval across wallets and safe_wallets tables |
| Web3AddressDao.kt | Refactored queries to avoid companion object reference; split getWalletByAddress into more explicit getSafeWalletByAddress method |
| Web3Repository.kt | Renamed getWalletByAddress to getSafeWalletByAddress to match DAO layer changes |
| SessionRequestViewModel.kt | Updated method call to use renamed getSafeWalletByAddress |
| Web3ViewModel.kt | Updated method call to use renamed getSafeWalletByAddress |
| Web3TokenDao.kt | Added query mismatch suppressions for LEFT JOIN queries that intentionally return extra columns |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| suspend fun getWalletByDestination(destination: String): WalletItem? // Only find with wallets | ||
|
|
||
| @Query( | ||
| """ | ||
| SELECT wallet_id AS id, 'mixin_safe' AS category, name, created_at AS createdAt, updated_at AS updatedAt, | ||
| role AS safeRole, chain_id AS safeChainId, address AS safeAddress, url AS safeUrl | ||
| FROM safe_wallets | ||
| WHERE address = :destination AND chain_id = :chainId | ||
| LIMIT 1 | ||
| """, | ||
| ) | ||
| suspend fun getSafeWalletByAddress(destination: String, chainId: String): WalletItem? // Only find with safe_wallets |
Copilot
AI
Dec 25, 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 inline comments "Only find with wallets" and "Only find with safe_wallets" describe implementation details rather than the purpose or usage of these methods. Consider updating these comments to describe when each method should be used or what scenarios they handle, which would be more helpful for API consumers.
# Conflicts: # app/src/sharedTest/java/one.mixin.android.mock/AccountMock.kt
No description provided.