Skip to content

Organize feature/swap into coordinators#269

Open
DRadmir wants to merge 4 commits intomainfrom
199-organize-featureswap
Open

Organize feature/swap into coordinators#269
DRadmir wants to merge 4 commits intomainfrom
199-organize-featureswap

Conversation

@DRadmir
Copy link
Copy Markdown
Contributor

@DRadmir DRadmir commented May 6, 2026

Move swap from cases + repository to the application/swap/coordinators pattern used by the rest of the codebase. Extracts six coordinators covering quote requests, quote-data retrieval, supported chains, ConfirmParams construction, swap-asset search, and swap quote refresh orchestration.

Side fixes:

  • Permit2 expiration now reads from Rust core's SwapConfig (permit2_expiration / permit2_sig_deadline) instead of hardcoded values; previous Android value was 30 hours instead of 30 days.
  • Restore SyncAssetInfoImplTest compile by using coVerify for the suspend addAssetIds call.

Closes: #199

Move swap from cases + repository to the application/swap/coordinators
pattern used by the rest of the codebase. Extracts six coordinators
covering quote requests, quote-data retrieval, supported chains,
ConfirmParams construction, swap-asset search, and swap quote refresh
orchestration.

Side fixes:
- Permit2 expiration now reads from Rust core's SwapConfig
  (permit2_expiration / permit2_sig_deadline) instead of hardcoded
  values; previous Android value was 30 hours instead of 30 days.
- Restore SyncAssetInfoImplTest compile by using coVerify for the
  suspend addAssetIds call.

Closes #199
@DRadmir DRadmir self-assigned this May 6, 2026
@DRadmir DRadmir added the Android label May 6, 2026

private fun permit2Single(token: String, spender: String, value: String, nonce: ULong): PermitSingle {
val config = Config().getSwapConfig()
val now = (System.currentTimeMillis() / 1000).toULong()
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add now to extension

value = permit.value,
nonce = permit.permit2Nonce,
)
val chain = quote.request.fromAsset.id.toAssetId()?.chain ?: throw Exception()
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SwapperQuoteAsset.id make it AssetId

DRadmir added 2 commits May 8, 2026 14:41
…ze-featureswap

# Conflicts:
#	android/data/coordinators/src/main/kotlin/com/gemwallet/android/data/coordinators/swap/RequestSwapQuotesImpl.kt
#	android/features/swap/viewmodels/src/main/kotlin/com/gemwallet/android/features/swap/viewmodels/SwapViewModel.kt
Add a small Time utility (nowSeconds) and use it in permit creation; validate asset chain with a clear error message. Introduce QUOTE_DEBOUNCE_MS constant and use it for quote request debounce instead of a hardcoded 500ms. Simplify asset ID collection by using flatMap and avoid intermediate folding. Consolidate transfer error handling in SwapViewModel via a setTransferError helper to remove duplicated code. Also add a small cache placeholder file.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Organize feature/swap

2 participants