Updated on 2026-08-14
This commit is contained in:
parent
88969b1a16
commit
d121dace8f
7 changed files with 27 additions and 11 deletions
|
|
@ -1 +1 @@
|
|||
Subproject commit 098662beb5b0123b11f5ee4873d4bd667ac93c73
|
||||
Subproject commit 8285f8d2896d2994337f55a7b3a54fd5acc24304
|
||||
|
|
@ -149,7 +149,7 @@ class DefaultGaslessTransactionRepository(
|
|||
}
|
||||
|
||||
private companion object {
|
||||
val BASE_GAS_FOR_TRANSACTION: BigInteger = BigInteger("100000")
|
||||
val BASE_GAS_FOR_TRANSACTION: BigInteger = BigInteger("60000")
|
||||
val EMPTY_ADDRESSES = emptySet<String>()
|
||||
}
|
||||
}
|
||||
|
|
@ -279,6 +279,11 @@ internal class DefaultWalletManagersFacade @Inject constructor(
|
|||
),
|
||||
)
|
||||
|
||||
val gaslessFeeAddresses = try {
|
||||
gaslessTransactionRepository.getGaslessFeeAddresses()
|
||||
} catch (_: Throwable) {
|
||||
emptySet()
|
||||
}
|
||||
return when (itemsResult) {
|
||||
is Result.Success -> PaginationWrapper(
|
||||
currentPage = sdkPageConverter.convert(page),
|
||||
|
|
@ -286,7 +291,7 @@ internal class DefaultWalletManagersFacade @Inject constructor(
|
|||
items = SdkTransactionHistoryItemConverter(
|
||||
smartContractMethods = readSmartContractMethods(),
|
||||
yieldSupplyAddresses = YIELD_SUPPLY_ADDRESSES,
|
||||
gaslessFeeAddresses = gaslessTransactionRepository.getGaslessFeeAddresses(),
|
||||
gaslessFeeAddresses = gaslessFeeAddresses,
|
||||
).convertList(itemsResult.data.items),
|
||||
)
|
||||
is Result.Failure -> error(itemsResult.error.message ?: itemsResult.error.customMessage)
|
||||
|
|
|
|||
|
|
@ -133,9 +133,10 @@ internal class TokenFeeCalculator(
|
|||
is Fee.Ethereum.TokenCurrency -> raiseIllegalStateError("initialFee could only be native")
|
||||
}
|
||||
|
||||
val feeInNativeCurrency = maxTokenFeeGas
|
||||
.multiply(maxFeePerGas)
|
||||
.multiply(GAS_PRICE_MULTIPLIER.toBigInteger())
|
||||
val feeInNativeCurrency = BigDecimal(maxTokenFeeGas.multiply(maxFeePerGas))
|
||||
.multiply(BigDecimal(GAS_PRICE_MULTIPLIER))
|
||||
.setScale(0, RoundingMode.UP)
|
||||
.toBigInteger()
|
||||
|
||||
val nativeFiatRate = nativeCurrencyStatus.value.fiatRate ?: raiseIllegalStateError("fiatRate is null")
|
||||
val tokenFiatRate = tokenForPayFeeStatus.value.fiatRate ?: raiseIllegalStateError("fiatRate is null")
|
||||
|
|
@ -201,7 +202,7 @@ internal class TokenFeeCalculator(
|
|||
/** Amount in token units for fee transfer */
|
||||
const val FEE_TRANSFER_AMOUNT = 0.01 // calculate using decimals
|
||||
/** Gas price safety multiplier for fee calculation */
|
||||
const val GAS_PRICE_MULTIPLIER = 2
|
||||
const val GAS_PRICE_MULTIPLIER = 1.5
|
||||
const val PERCENT_TO_INCREASE_TOKEN_PRICE = 1
|
||||
const val PERCENT_TO_INCREASE_TRANSFER_GASLIMIT = 10
|
||||
|
||||
|
|
|
|||
|
|
@ -363,7 +363,7 @@ class TokenFeeCalculatorTest {
|
|||
// Expected
|
||||
|
||||
val expectedAmount = Amount(
|
||||
value = BigDecimal("37.400000000000000000000000000000000000"),
|
||||
value = BigDecimal("28.050000000000000000000000000000000000"),
|
||||
token = Token(
|
||||
name = "USDC",
|
||||
symbol = "USDC",
|
||||
|
|
|
|||
|
|
@ -266,10 +266,20 @@ internal class FeeSelectorLogic @AssistedInject constructor(
|
|||
private suspend fun populateExtendedFee(
|
||||
fee: TransactionFeeExtended,
|
||||
): Either<GetFeeError, LoadedFeeResult.Extended> = either {
|
||||
val selectedToken = getSelectedTokenStatus(fee.feeTokenId).bind()
|
||||
val availableTokens = getAvailableFeeTokens().fold(
|
||||
ifLeft = { error ->
|
||||
if (selectedToken.currency !is CryptoCurrency.Coin) {
|
||||
raise(error)
|
||||
}
|
||||
emptyList()
|
||||
},
|
||||
ifRight = { it },
|
||||
)
|
||||
LoadedFeeResult.Extended(
|
||||
fee = fee,
|
||||
selectedToken = getSelectedTokenStatus(fee.feeTokenId).bind(),
|
||||
availableTokens = getAvailableFeeTokens().bind(),
|
||||
selectedToken = selectedToken,
|
||||
availableTokens = availableTokens,
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
# https://github.com/tangem/tangem-sdk-android/
|
||||
# https://github.com/tangem/vico
|
||||
|
||||
tangemBlockchainSdk = "releases-5.33-1393"
|
||||
tangemBlockchainSdk = "releases-5.33-1398"
|
||||
#tangemBlockchainSdk = "0.0.1" # Keep it! - used for local builds
|
||||
tangemCardSdk = "releases-5.33-576"
|
||||
#tangemCardSdk = "0.0.1" # Keep it! - used for local builds ^
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue