Skip to content

Conversation

@SeniorZhai
Copy link
Member

No description provided.

Copy link
Contributor

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 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_QUERY companion object constant from Web3WalletDao and inlined its SQL in all queries that used it
  • Split getWalletByAddress into getSafeWalletByAddress to be more explicit about querying only safe wallets
  • Added @SuppressWarnings(RoomWarnings.QUERY_MISMATCH) annotations to Web3TokenDao methods 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.

Comment on lines +55 to +66
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
Copy link

Copilot AI Dec 25, 2025

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.

Copilot uses AI. Check for mistakes.
# Conflicts:
#	app/src/sharedTest/java/one.mixin.android.mock/AccountMock.kt
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.

2 participants