Updated on 2026-08-14
This commit is contained in:
parent
2f29f6d8d7
commit
0f44f21d6f
5 changed files with 51 additions and 14 deletions
|
|
@ -101,18 +101,27 @@ class TransactionManagerImpl(
|
|||
// for not EVM blockchains set gasLimit ZERO for now
|
||||
when (fee.data) {
|
||||
is TransactionFee.Single -> {
|
||||
val normalFee = (fee.data as TransactionFee.Single).normal
|
||||
val singleFee = if (normalFee as? Fee.CardanoToken != null) {
|
||||
ProxyFee.CardanoToken(
|
||||
gasLimit = BigInteger.ZERO,
|
||||
fee = convertToProxyAmount(amount = normalFee.amount),
|
||||
minAdaValue = normalFee.minAdaValue,
|
||||
)
|
||||
} else {
|
||||
ProxyFee.Common(
|
||||
gasLimit = BigInteger.ZERO,
|
||||
fee = convertToProxyAmount(amount = normalFee.amount),
|
||||
)
|
||||
val singleFee = when (val normalFee = (fee.data as TransactionFee.Single).normal) {
|
||||
is Fee.CardanoToken -> {
|
||||
ProxyFee.CardanoToken(
|
||||
gasLimit = BigInteger.ZERO,
|
||||
fee = convertToProxyAmount(amount = normalFee.amount),
|
||||
minAdaValue = normalFee.minAdaValue,
|
||||
)
|
||||
}
|
||||
is Fee.Filecoin -> {
|
||||
ProxyFee.Filecoin(
|
||||
gasLimit = BigInteger.ZERO,
|
||||
fee = convertToProxyAmount(amount = normalFee.amount),
|
||||
gasPremium = normalFee.gasPremium,
|
||||
)
|
||||
}
|
||||
else -> {
|
||||
ProxyFee.Common(
|
||||
gasLimit = BigInteger.ZERO,
|
||||
fee = convertToProxyAmount(amount = normalFee.amount),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
ProxyFees.SingleFee(singleFee = singleFee)
|
||||
|
|
|
|||
|
|
@ -105,6 +105,7 @@ data class TxFee(
|
|||
val decimals: Int,
|
||||
val cryptoSymbol: String,
|
||||
val feeType: FeeType,
|
||||
val gasPremium: Long?,
|
||||
)
|
||||
|
||||
enum class FeeType {
|
||||
|
|
|
|||
|
|
@ -889,6 +889,21 @@ internal class SwapInteractorImpl @Inject constructor(
|
|||
gasLimit = fee.gasLimit.toLong(),
|
||||
)
|
||||
}
|
||||
blockchain == Blockchain.Filecoin -> {
|
||||
val gasUnitPrice = fee.feeValue.divide(
|
||||
BigDecimal(fee.gasLimit),
|
||||
Blockchain.Filecoin.decimals(),
|
||||
RoundingMode.HALF_UP,
|
||||
)
|
||||
Fee.Filecoin(
|
||||
amount = feeAmount,
|
||||
gasUnitPrice = gasUnitPrice
|
||||
.movePointRight(Blockchain.Filecoin.decimals())
|
||||
.toLong(),
|
||||
gasLimit = fee.gasLimit.toLong(),
|
||||
gasPremium = requireNotNull(fee.gasPremium),
|
||||
)
|
||||
}
|
||||
else -> Fee.Common(feeAmount)
|
||||
}
|
||||
}
|
||||
|
|
@ -1513,6 +1528,7 @@ internal class SwapInteractorImpl @Inject constructor(
|
|||
decimals = minFee.fee.decimals,
|
||||
cryptoSymbol = minFee.fee.currencySymbol,
|
||||
feeType = FeeType.NORMAL,
|
||||
gasPremium = (minFee as? ProxyFee.Filecoin)?.gasPremium,
|
||||
),
|
||||
priorityFee = TxFee(
|
||||
feeValue = priorityFeeValue,
|
||||
|
|
@ -1522,6 +1538,7 @@ internal class SwapInteractorImpl @Inject constructor(
|
|||
decimals = normalFee.fee.decimals,
|
||||
cryptoSymbol = normalFee.fee.currencySymbol,
|
||||
feeType = FeeType.PRIORITY,
|
||||
gasPremium = (normalFee as? ProxyFee.Filecoin)?.gasPremium,
|
||||
),
|
||||
)
|
||||
}
|
||||
|
|
@ -1544,6 +1561,7 @@ internal class SwapInteractorImpl @Inject constructor(
|
|||
decimals = singleFee.fee.decimals,
|
||||
cryptoSymbol = singleFee.fee.currencySymbol,
|
||||
feeType = FeeType.NORMAL,
|
||||
gasPremium = (singleFee as? ProxyFee.Filecoin)?.gasPremium,
|
||||
),
|
||||
)
|
||||
}
|
||||
|
|
@ -1575,6 +1593,7 @@ internal class SwapInteractorImpl @Inject constructor(
|
|||
decimals = normalFee.amount.decimals,
|
||||
cryptoSymbol = normalFee.amount.currencySymbol,
|
||||
feeType = FeeType.NORMAL,
|
||||
gasPremium = (normalFee as? Fee.Filecoin)?.gasPremium,
|
||||
),
|
||||
priorityFee = TxFee(
|
||||
feeValue = feePriority,
|
||||
|
|
@ -1584,6 +1603,7 @@ internal class SwapInteractorImpl @Inject constructor(
|
|||
decimals = priorityFee.amount.decimals,
|
||||
cryptoSymbol = priorityFee.amount.currencySymbol,
|
||||
feeType = FeeType.PRIORITY,
|
||||
gasPremium = (priorityFee as? Fee.Filecoin)?.gasPremium,
|
||||
),
|
||||
)
|
||||
}
|
||||
|
|
@ -1603,6 +1623,7 @@ internal class SwapInteractorImpl @Inject constructor(
|
|||
decimals = normal.amount.decimals,
|
||||
cryptoSymbol = normal.amount.currencySymbol,
|
||||
feeType = FeeType.NORMAL,
|
||||
gasPremium = (normal as? Fee.Filecoin)?.gasPremium,
|
||||
),
|
||||
)
|
||||
}
|
||||
|
|
@ -1638,6 +1659,7 @@ internal class SwapInteractorImpl @Inject constructor(
|
|||
is Fee.Ethereum -> gasLimit.toInt()
|
||||
is Fee.VeChain -> gasLimit.toInt()
|
||||
is Fee.Aptos -> gasLimit.toInt()
|
||||
is Fee.Filecoin -> gasLimit.toInt()
|
||||
else -> 0
|
||||
}
|
||||
}
|
||||
|
|
@ -1856,7 +1878,6 @@ internal class SwapInteractorImpl @Inject constructor(
|
|||
normalFee = ProxyFee.Common(
|
||||
gasLimit = 1.toBigInteger(),
|
||||
fee = demoFee.copy(value = normalDemoFee),
|
||||
|
||||
),
|
||||
priorityFee = ProxyFee.Common(
|
||||
gasLimit = 1.toBigInteger(),
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@ markdown = "0.7.2"
|
|||
# endregion Other libraries
|
||||
|
||||
# region Tangem
|
||||
tangemBlockchainSdk = "develop-723"
|
||||
tangemBlockchainSdk = "develop-724"
|
||||
#tangemBlockchainSdk = "0.0.1" # Keep it! - used for local builds
|
||||
tangemCardSdk = "develop-375"
|
||||
#tangemCardSdk = "0.0.1" # Keep it! - used for local builds ^
|
||||
|
|
|
|||
|
|
@ -18,4 +18,10 @@ sealed interface ProxyFee {
|
|||
override val fee: ProxyAmount,
|
||||
val minAdaValue: BigDecimal,
|
||||
) : ProxyFee
|
||||
|
||||
data class Filecoin(
|
||||
override val gasLimit: BigInteger,
|
||||
override val fee: ProxyAmount,
|
||||
val gasPremium: Long,
|
||||
) : ProxyFee
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue