Updated on 2026-08-14
This commit is contained in:
parent
702041224f
commit
2a2ea1667a
18 changed files with 261 additions and 138 deletions
|
|
@ -97,4 +97,6 @@ interface SwapInteractor {
|
|||
* @param token
|
||||
*/
|
||||
fun getTokenBalance(token: Currency): SwapAmount
|
||||
|
||||
fun isAvailableToSwap(networkId: String): Boolean
|
||||
}
|
||||
|
|
@ -232,6 +232,10 @@ internal class SwapInteractorImpl @Inject constructor(
|
|||
} ?: SwapAmount(BigDecimal.ZERO, getTokenDecimals(token))
|
||||
}
|
||||
|
||||
override fun isAvailableToSwap(networkId: String): Boolean {
|
||||
return ONE_INCH_SUPPORTED_NETWORKS.contains(networkId)
|
||||
}
|
||||
|
||||
fun getTokenDecimals(token: Currency): Int {
|
||||
return if (token is Currency.NonNativeToken) {
|
||||
token.decimalCount
|
||||
|
|
@ -593,5 +597,10 @@ internal class SwapInteractorImpl @Inject constructor(
|
|||
private const val USDT_SYMBOL = "USDT"
|
||||
private const val USDC_SYMBOL = "USDC"
|
||||
private const val INFINITY_SYMBOL = "∞"
|
||||
|
||||
private val ONE_INCH_SUPPORTED_NETWORKS = listOf(
|
||||
"ethereum", "binance-smart-chain", "polygon-pos",
|
||||
"optimistic-ethereum", "arbitrum-one", "xdai", "avalanche", "fantom",
|
||||
)
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue