Updated on 2026-08-14

This commit is contained in:
Tangem 2023-01-13 17:01:04 +03:00
parent cf4dc83d0d
commit 83571f3bd5
19 changed files with 360 additions and 57 deletions

View file

@ -66,6 +66,12 @@ class TransactionManagerImpl(
return Blockchain.fromNetworkId(networkId)?.decimals() ?: error("blockchain not found")
}
override fun calculateFee(networkId: String, gasPrice: String, estimatedGas: Int): BigDecimal {
val blockchain = requireNotNull(Blockchain.fromNetworkId(networkId)) { "blockchain not found" }
val gasPriceValue = requireNotNull(gasPrice.toLongOrNull()) { "gasprice should be Long" }
return (gasPriceValue * estimatedGas).toBigDecimal().movePointLeft(blockchain.decimals())
}
@Throws(IllegalStateException::class)
override suspend fun getFee(
networkId: String,

View file

@ -131,6 +131,11 @@ 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