Updated on 2026-08-14
This commit is contained in:
parent
6b95243f9a
commit
9bb0c2ec48
3 changed files with 24 additions and 1 deletions
|
|
@ -148,6 +148,7 @@ class TransactionManagerImpl(
|
|||
amountToSend: BigDecimal,
|
||||
currencyToSend: Currency,
|
||||
destinationAddress: String,
|
||||
increaseBy: Int?,
|
||||
data: String?,
|
||||
derivationPath: String?,
|
||||
): ProxyFee {
|
||||
|
|
@ -161,7 +162,13 @@ class TransactionManagerImpl(
|
|||
currency = currencyToSend,
|
||||
destinationAddress = destinationAddress,
|
||||
data = data,
|
||||
)
|
||||
).let {
|
||||
if (increaseBy != null && increaseBy != 0) {
|
||||
it.multiply(increaseBy.toBigInteger()).divide(BigInteger("100"))
|
||||
} else {
|
||||
it
|
||||
}
|
||||
}
|
||||
return when (val gasPrice = walletManager.getGasPrice()) {
|
||||
is Result.Success -> {
|
||||
val fee = gasLimit.multiply(gasPrice.data).toBigDecimal(
|
||||
|
|
|
|||
|
|
@ -411,6 +411,7 @@ internal class SwapInteractorImpl @Inject constructor(
|
|||
amountToSend = amount.value,
|
||||
currencyToSend = cryptoCurrencyConverter.convert(fromToken),
|
||||
destinationAddress = swapData.transaction.toWalletAddress,
|
||||
increaseBy = INCREASE_GAS_LIMIT_BY,
|
||||
data = swapData.transaction.data,
|
||||
derivationPath = derivationPath,
|
||||
)
|
||||
|
|
@ -529,6 +530,7 @@ internal class SwapInteractorImpl @Inject constructor(
|
|||
amountToSend = BigDecimal.ZERO,
|
||||
currencyToSend = userWalletManager.getNativeTokenForNetwork(networkId),
|
||||
destinationAddress = transactionData.toAddress,
|
||||
increaseBy = INCREASE_GAS_LIMIT_BY,
|
||||
data = transactionData.data,
|
||||
derivationPath = derivationPath,
|
||||
)
|
||||
|
|
@ -645,6 +647,7 @@ internal class SwapInteractorImpl @Inject constructor(
|
|||
private const val ZERO_BALANCE = "0"
|
||||
private const val DEFAULT_BLOCKCHAIN_INCH_ADDRESS = "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE"
|
||||
private const val INCREASE_FEE_TO_CHECK_ENOUGH_PERCENT = 1.4
|
||||
private const val INCREASE_GAS_LIMIT_BY = 125
|
||||
private const val USDT_SYMBOL = "USDT"
|
||||
private const val USDC_SYMBOL = "USDC"
|
||||
private const val INFINITY_SYMBOL = "∞"
|
||||
|
|
|
|||
|
|
@ -33,6 +33,18 @@ interface TransactionManager {
|
|||
derivationPath: String?,
|
||||
): SendTxResult
|
||||
|
||||
/**
|
||||
* Get fee
|
||||
*
|
||||
* @param networkId network id of blockchain
|
||||
* @param amountToSend amount
|
||||
* @param currencyToSend currency to send in tx
|
||||
* @param destinationAddress address to send tx
|
||||
* @param increaseBy percents in format 125 = 25%
|
||||
* @param data data for tx
|
||||
* @param derivationPath derivation path
|
||||
* @return
|
||||
*/
|
||||
@Suppress("LongParameterList")
|
||||
@Throws(IllegalStateException::class)
|
||||
suspend fun getFee(
|
||||
|
|
@ -40,6 +52,7 @@ interface TransactionManager {
|
|||
amountToSend: BigDecimal,
|
||||
currencyToSend: Currency,
|
||||
destinationAddress: String,
|
||||
increaseBy: Int?,
|
||||
data: String?,
|
||||
derivationPath: String?,
|
||||
): ProxyFee
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue