Skip to content

Update isSingleChainSwap to return true for EVM-based swap providers#9193

Merged
omurovch merged 1 commit into
version/0.49from
swap-status-fix
May 12, 2026
Merged

Update isSingleChainSwap to return true for EVM-based swap providers#9193
omurovch merged 1 commit into
version/0.49from
swap-status-fix

Conversation

@omurovch
Copy link
Copy Markdown
Contributor

@omurovch omurovch commented May 12, 2026

#9055

Summary by CodeRabbit

  • Bug Fixes
    • Fixed single-chain swap detection to properly support EVM-compatible chains, enabling previously unavailable swap functionality on eligible networks.

Review Change Stack

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 12, 2026

📝 Walkthrough

Walkthrough

This PR modifies USwapProvider.isSingleChainSwap() to return the EVM status of the underlying provider instead of always returning false, making single-chain swap support conditional on EVM compatibility.

Changes

Single-Chain Swap EVM Conditioning

Layer / File(s) Summary
Single-chain swap support conditional on EVM provider
app/src/main/java/io/horizontalsystems/bankwallet/modules/multiswap/providers/USwapProvider.kt
isSingleChainSwap() now returns isEvm instead of always returning false, making single-chain swap availability conditional on EVM provider detection.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~5 minutes

Suggested reviewers

  • rafaelekol
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: updating isSingleChainSwap to return true for EVM-based swap providers, which directly matches the changeset modification.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch swap-status-fix

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@app/src/main/java/io/horizontalsystems/bankwallet/modules/multiswap/providers/USwapProvider.kt`:
- Line 45: USwapProvider.isSingleChainSwap currently ignores
tokenInBlockchainTypeUid and tokenOutBlockchainTypeUid and just returns isEvm;
either confirm that behavior is intentional or update the method to also check
that both tokens are on the same blockchain like AllBridgeProvider does (i.e.,
return isEvm && tokenInBlockchainTypeUid == tokenOutBlockchainTypeUid) so it
only treats swaps as single-chain when both tokens share the same blockchain UID
and the provider is EVM-based; modify the USwapProvider.isSingleChainSwap
implementation accordingly and run tests.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 2ae85627-c81d-4eb3-9b7f-48a303b5cf5f

📥 Commits

Reviewing files that changed from the base of the PR and between 422dba2 and b058ee6.

📒 Files selected for processing (1)
  • app/src/main/java/io/horizontalsystems/bankwallet/modules/multiswap/providers/USwapProvider.kt

override val riskLevel = provider.riskLevel

override fun isSingleChainSwap(tokenInBlockchainTypeUid: String, tokenOutBlockchainTypeUid: String) = false
override fun isSingleChainSwap(tokenInBlockchainTypeUid: String, tokenOutBlockchainTypeUid: String) = isEvm
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Search for the interface definition and usage of isSingleChainSwap

# Find the interface definition
echo "=== Interface definition ==="
ast-grep --pattern $'interface $_ {
  $$$
  fun isSingleChainSwap($$$)
  $$$
}'

# Find all implementations
echo -e "\n=== All implementations ==="
rg -n "fun isSingleChainSwap|override fun isSingleChainSwap" -A 2

# Find all call sites
echo -e "\n=== Call sites ==="
rg -n "\.isSingleChainSwap\(" -B 2 -A 2

Repository: horizontalsystems/unstoppable-wallet-android

Length of output: 5786


Clarify whether USwapProvider should compare blockchain type UIDs.

The function ignores tokenInBlockchainTypeUid and tokenOutBlockchainTypeUid parameters, returning only isEvm. However, AllBridgeProvider implements the same interface method differently at line 154:

tokenInBlockchainTypeUid == tokenOutBlockchainTypeUid

This shows that some providers do evaluate both parameters to determine if a swap is single-chain. If USwapProvider should also validate that tokens are on the same blockchain (not just EVM), it should compare the parameters like AllBridgeProvider does. Verify this is intentional or update to match the pattern used by similar bridge/provider implementations.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@app/src/main/java/io/horizontalsystems/bankwallet/modules/multiswap/providers/USwapProvider.kt`
at line 45, USwapProvider.isSingleChainSwap currently ignores
tokenInBlockchainTypeUid and tokenOutBlockchainTypeUid and just returns isEvm;
either confirm that behavior is intentional or update the method to also check
that both tokens are on the same blockchain like AllBridgeProvider does (i.e.,
return isEvm && tokenInBlockchainTypeUid == tokenOutBlockchainTypeUid) so it
only treats swaps as single-chain when both tokens share the same blockchain UID
and the provider is EVM-based; modify the USwapProvider.isSingleChainSwap
implementation accordingly and run tests.

@omurovch omurovch merged commit 10a374c into version/0.49 May 12, 2026
2 checks passed
@omurovch omurovch deleted the swap-status-fix branch May 12, 2026 11:21
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