4.3 KiB
Element X ADA Polish Tasks - Completed
Date: 2026-03-29
Task 1: isDM Detection — Fixed
Problem: The wallet button was using overly broad logic:
isDmRoom = roomInfo.isDm || roomInfo.activeMembersCount == 2L
This would show the wallet button in ANY 2-person room, including private rooms that aren't DMs.
Solution: Simplified to use only the proper isDm property:
isDmRoom = roomInfo.isDm
The RoomInfo.isDm extension property already implements the correct logic:
val RoomInfo.isDm get() = isDm(isDirect, activeMembersCount.toInt())
fun isDm(isDirect: Boolean, activeMembersCount: Int): Boolean {
return isDirect && activeMembersCount <= 2
}
This ensures the wallet button only appears in genuine 1:1 DM rooms where:
isDirectis true (Matrix spec DM flag)- At most 2 active members
Commit: faa6f768f6 - fix(wallet): use proper isDm check for wallet button visibility
Task 2: Payment Card UI — Polished
Added: Truncated recipient/sender address display
The payment card now shows:
- Header: Cardano icon + "Sent" or "Received" label + testnet badge
- Amount: Large bold text (e.g., "10 ADA")
- Address: "To: addr_tes...ytjqp" for sent / "From: addr_tes...pd0hq" for received
- Status: Chip with spinner (pending), checkmark (confirmed), or X (failed)
- Tx hash: Truncated (first 8...last 8), tappable to open CardanoScan
- Explorer link: "View on CardanoScan →" for confirmed transactions
Changes:
-
TimelineItemPaymentContent.kt:- Added
truncatedToAddressandtruncatedFromAddresscomputed properties - Added
truncateAddress()helper (first 8 + last 6 chars)
- Added
-
TimelineItemPaymentView.kt:- Added address row showing "To:" or "From:" with truncated address
-
TimelineItemPaymentContentWrapper.kt:- Exposed new truncated address properties
Commit: 699807e1bd - feat(wallet): add recipient address to payment card UI
APK Available
Fresh arm64 build served at:
http://192.168.0.5:8888/app-fdroid-arm64-v8a-debug.apk
Size: ~210 MB
Code Quality Notes
- Used existing
RoomInfo.isDmextension rather than reinventing logic - Address truncation follows same pattern as tx hash (first N...last M)
- Payment card remains clean and intentional — not a debug dump
- All changes respect 160 char ktlint limit
- No new dependencies added
Task 3: Cardano Address in Matrix Account Data — Implemented
Publishing (Write Side)
After wallet creation, import, or SSSS restore, the user's Cardano address is automatically published to Matrix account data:
- Key:
com.sulkta.cardano.address - Content:
{ "address": "addr1..." } - Public/unencrypted — this is a discovery mechanism, not a secret
Where it's called:
WalletSetupPresenter→ after all wallet setup completion paths- Fire-and-forget — wallet setup doesn't fail if publish fails
Lookup (Read Side)
When entering a Matrix user ID in the /pay payment form:
- System looks up their
com.sulkta.cardano.addressaccount data - If found → auto-fills recipient, shows "Address loaded from @user's profile ✓"
- If not found → shows "@user hasn't linked a wallet", allows manual entry
New UI States:
RecipientResolutionState.Resolving— spinner while looking upRecipientResolutionState.Found— green card with checkmark and truncated addressRecipientResolutionState.NeedsManualEntry— red card prompting manual entry
New Files
CardanoAddressService.kt(wallet:api) — interfaceDefaultCardanoAddressService.kt(wallet:impl) — implementation using OkHttp + SessionStore
Modified Files
WalletSetupPresenter.kt— callspublishAddressToMatrix()after wallet setupPaymentEntryPresenter.kt— looks up recipient address on Matrix user inputPaymentEntryState.kt— addedResolvingandFoundstatesPaymentEntryView.kt— added lookup progress and result cards
Commit: c35289a3bd
Final APK
Fresh arm64 build with all three tasks:
http://192.168.0.5:8888/app-fdroid-arm64-v8a-debug.apk
All Commits
faa6f768f6— fix(wallet): use proper isDm check for wallet button visibility699807e1bd— feat(wallet): add recipient address to payment card UIc35289a3bd— feat(wallet): store Cardano address in Matrix account data for discovery