Updated on 2026-08-14
This commit is contained in:
parent
8f78031374
commit
2756dc5687
24 changed files with 843 additions and 314 deletions
|
|
@ -1,5 +1,6 @@
|
|||
package com.tangem.tap.proxy
|
||||
|
||||
import com.tangem.blockchain.common.AmountType
|
||||
import com.tangem.blockchain.common.Blockchain
|
||||
import com.tangem.blockchain.common.DerivationParams
|
||||
import com.tangem.blockchain.common.DerivationStyle
|
||||
|
|
@ -119,6 +120,25 @@ class UserWalletManagerImpl(
|
|||
}.toMap()
|
||||
}
|
||||
|
||||
override fun getNativeTokenBalance(networkId: String): ProxyAmount? {
|
||||
val blockchain = requireNotNull(Blockchain.fromNetworkId(networkId)) { "blockchain not found" }
|
||||
val walletManager = getActualWalletManager(blockchain)
|
||||
return walletManager.wallet.amounts.firstNotNullOfOrNull {
|
||||
it.takeIf { it.key is AmountType.Coin }
|
||||
}?.value?.let {
|
||||
ProxyAmount(
|
||||
it.currencySymbol,
|
||||
it.value ?: BigDecimal.ZERO,
|
||||
it.decimals,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
override fun getNetworkCurrency(networkId: String): String {
|
||||
val blockchain = requireNotNull(Blockchain.fromNetworkId(networkId)) { "blockchain not found" }
|
||||
return blockchain.currency
|
||||
}
|
||||
|
||||
override fun getUserAppCurrency(): ProxyFiatCurrency {
|
||||
val appCurrency = appStateHolder.appFiatCurrency
|
||||
return ProxyFiatCurrency(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue