element-x-ada/PHASE1-STATUS.md
Kayos bd883e9c3a Fix ~60 compile errors - build now succeeds
- Fixed DI imports: javax.inject -> dev.zacsweers.metro
- Fixed cardano-client-lib API: KoiosBackendService constructor, Amount.quantity type
- Added kotlin-parcelize plugin
- Workaround for Timeline.sendRaw(): use message prefix approach
- Fixed MnemonicCode wordlist access
- Fixed Compose lifecycle/context handling
- Updated test fakes

BUILD SUCCESSFUL - unit tests still need updating for new APIs
2026-03-27 13:30:14 -07:00

106 lines
4.3 KiB
Markdown

# Element X ADA Wallet - Phase 1 Status
## Current Build Status: ✅ COMPILES (with warnings)
**Last build:** 2026-03-27
**Build command:** `./gradlew :features:wallet:impl:compileDebugKotlin`
**Result:** BUILD SUCCESSFUL in 7m 28s
## Issues Fixed
### 1. ✅ DI Import Errors (17 files)
- Changed from `javax.inject.Inject``dev.zacsweers.metro.Inject`
- Changed from `io.element.android.libraries.di.AppScope``dev.zacsweers.metro.AppScope`
- Fixed `@ContributesBinding`, `@SingleIn`, `@AssistedInject`, `@Assisted` imports
### 2. ✅ Parcelize Plugin
- Added `id("kotlin-parcelize")` to wallet impl build.gradle.kts
### 3. ✅ cardano-client-lib API Fixes
- Fixed `KoiosBackendService` constructor (use `new KoiosBackendService(baseUrl)` not `BackendFactory.getKoiosBackendService()`)
- Fixed `Amount.quantity` type - it's a `BigInteger`, not a `String`, so use `.toLong()` not `.toLongOrNull()`
- Fixed `Transaction.serializeToHex()` and `TransactionUtil.getTxHash()` usage
- Fixed `signedTx.body.fee.toLong()` usage
### 4. ✅ Timeline.sendRaw() Issue
- **Solution:** The Matrix SDK doesn't expose raw event sending in the current version
- **Workaround:** Changed to send payment data as a structured message with `$CARDANO_PAY$` prefix
- The timeline UI will recognize this prefix and render a payment card
- This is a pragmatic Phase 1 solution; raw events can be added when SDK support arrives
### 5. ✅ MnemonicCode API
- Fixed `Words.ENGLISH.words` → use `MnemonicCode().wordList` directly
### 6. ✅ PaymentConfirmationNode Lifecycle
- Changed `lifecycleScope.launch``rememberCoroutineScope().launch` (Compose-friendly)
- Changed `requireActivity()``LocalContext.current as? FragmentActivity`
### 7. ✅ Button Icon API
- Changed `leadingIcon = { Icon(...) }``leadingIcon = IconSource.Vector(icon)`
## Remaining Warnings (non-blocking)
- Deprecated `Account(Network, String, Int)` constructor - cardano-client-lib deprecation
- Deprecated `Icons.Filled.Send` - use `Icons.AutoMirrored.Filled.Send` instead
- Single @Inject constructor suggestions
- Deprecated `setUserAuthenticationValidityDurationSeconds` - Android API deprecation
## Test Status: ⚠️ Tests need updating
The unit tests need to be updated for the API changes:
- Test files reference old method signatures
- FakeCardanoKeyStorage and FakeWalletEntryPoint updated
- ~37 test errors to fix (API signature mismatches)
## Files Changed
```
features/wallet/impl/build.gradle.kts
features/wallet/impl/src/main/kotlin/io/element/android/features/wallet/impl/
├── DefaultWalletEntryPoint.kt
├── biometric/BiometricAuthenticator.kt
├── cardano/CardanoWalletManager.kt
├── cardano/DefaultTransactionBuilder.kt
├── cardano/KoiosCardanoClient.kt
├── cardano/PaymentStatusPoller.kt
├── di/WalletModule.kt
├── payment/DefaultPaymentEventSender.kt
├── payment/PaymentConfirmationNode.kt
├── payment/PaymentConfirmationView.kt
├── seedphrase/SeedPhraseManager.kt
├── slash/SlashCommandParser.kt
├── storage/CardanoKeyStorageImpl.kt
└── timeline/TimelineItemContentPaymentFactory.kt
features/wallet/test/build.gradle.kts
features/wallet/test/src/main/kotlin/io/element/android/features/wallet/test/
├── FakeWalletEntryPoint.kt
└── storage/FakeCardanoKeyStorage.kt
```
## Next Steps
1. **Fix unit tests** - Update test files to match new API signatures
2. **Integration testing** - Test actual Cardano transactions on Preview network
3. **Timeline rendering** - Implement payment card rendering in messages feature
4. **UI polish** - Add AutoMirrored icons, clean up deprecation warnings
## Technical Notes
### Payment Event Sending Strategy
Since the Matrix Rust SDK doesn't expose `sendRaw()` for custom events, we use a message-based approach:
```kotlin
// Payment messages have format:
"$CARDANO_PAY$" + json(PaymentEventData)
// Status updates have format:
"$CARDANO_STATUS$" + json(PaymentStatusUpdateData)
```
The timeline UI should check for these prefixes and render payment cards accordingly.
### cardano-client-lib Version
Using version 0.7.1 with Koios backend. Key classes:
- `KoiosBackendService(baseUrl)` - main backend
- `QuickTxBuilder(backendService)` - transaction building
- `Account(network, mnemonic)` - key derivation (deprecated but functional)
- `TransactionUtil.getTxHash(tx)` - hash calculation