Updated on 2026-08-14

This commit is contained in:
Tangem 2023-05-29 20:27:46 +03:00
parent 5cc1aa7ce8
commit c9917f1c05
8 changed files with 128 additions and 81 deletions

View file

@ -72,7 +72,7 @@ class CurrencyExchangeManager(
return when (action) {
Action.Buy -> buyService
Action.Sell -> sellService
} as ExchangeUrlBuilder
}
}
enum class Action { Buy, Sell }
@ -96,12 +96,11 @@ suspend fun CurrencyExchangeManager.buyErc20TestnetTokens(
val amountToSend = Amount(walletManager.wallet.blockchain)
val destinationAddress = token.contractAddress
val feeResult =
walletManager.getFee(
val feeResult = walletManager.getFee(
amountToSend,
destinationAddress,
) as? Result.Success ?: return
val fee = feeResult.data[0]
val fee = feeResult.data.minimum
val coinValue = walletManager.wallet.amounts[AmountType.Coin]?.value ?: BigDecimal.ZERO
if (coinValue < fee.value) return