Updated on 2026-08-14
This commit is contained in:
parent
8ef0c9f5a6
commit
6d697e05c1
15 changed files with 217 additions and 83 deletions
|
|
@ -4,6 +4,7 @@ import androidx.core.os.bundleOf
|
|||
import com.tangem.blockchain.blockchains.ethereum.EthereumWalletManager
|
||||
import com.tangem.blockchain.common.AmountType
|
||||
import com.tangem.core.analytics.Analytics
|
||||
import com.tangem.domain.common.extensions.toCoinId
|
||||
import com.tangem.domain.common.extensions.toNetworkId
|
||||
import com.tangem.feature.swap.presentation.SwapFragment
|
||||
import com.tangem.tap.common.analytics.events.AnalyticsParam
|
||||
|
|
@ -155,11 +156,11 @@ class TradeCryptoMiddleware {
|
|||
return when (this) {
|
||||
is Currency.Blockchain -> {
|
||||
SwapCurrency.NativeToken(
|
||||
id = blockchain.id,
|
||||
id = blockchain.toCoinId(),
|
||||
name = this.currencyName,
|
||||
symbol = this.currencySymbol,
|
||||
networkId = this.blockchain.toNetworkId(),
|
||||
logoUrl = getIconUrl(this.blockchain.toNetworkId()),
|
||||
logoUrl = getIconUrl(this.blockchain.toCoinId()),
|
||||
)
|
||||
}
|
||||
is Currency.Token -> SwapCurrency.NonNativeToken(
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ import com.tangem.blockchain.common.WalletManagerFactory
|
|||
import com.tangem.domain.common.CardDTO
|
||||
import com.tangem.domain.common.TapWorkarounds.derivationStyle
|
||||
import com.tangem.domain.common.extensions.fromNetworkId
|
||||
import com.tangem.domain.common.extensions.toCoinId
|
||||
import com.tangem.domain.common.extensions.toNetworkId
|
||||
import com.tangem.lib.crypto.UserWalletManager
|
||||
import com.tangem.lib.crypto.models.Currency
|
||||
|
|
@ -59,6 +60,16 @@ class UserWalletManagerImpl(
|
|||
}
|
||||
}
|
||||
|
||||
override fun getNativeTokenForNetwork(networkId: String): Currency {
|
||||
val blockchain = requireNotNull(Blockchain.fromNetworkId(networkId)) { "blockchain not found" }
|
||||
return NativeToken(
|
||||
id = blockchain.toCoinId(),
|
||||
name = blockchain.fullName,
|
||||
symbol = blockchain.currency,
|
||||
networkId = networkId,
|
||||
)
|
||||
}
|
||||
|
||||
override fun getWalletId(): String {
|
||||
return appStateHolder.getActualCard()?.let {
|
||||
UserWalletIdBuilder.card(it)
|
||||
|
|
@ -148,11 +159,6 @@ class UserWalletManagerImpl(
|
|||
)
|
||||
}
|
||||
|
||||
override fun getCurrencyByNetworkId(networkId: String): String {
|
||||
val blockchain = requireNotNull(Blockchain.fromNetworkId(networkId)) { "blockchain not found" }
|
||||
return blockchain.currency
|
||||
}
|
||||
|
||||
private fun addNativeTokenToWalletAction(token: NativeToken, card: CardDTO): Action {
|
||||
val blockchain = Blockchain.fromNetworkId(token.networkId)
|
||||
val scanResponse = appStateHolder.scanResponse
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue