Updated on 2026-08-14

This commit is contained in:
Tangem 2023-11-30 18:11:28 +03:00
parent b904eecf7a
commit 59dff6b9bd
5 changed files with 21 additions and 3 deletions

View file

@ -32,6 +32,7 @@ interface TangemExpressApi {
@Query("toNetwork") toNetwork: String,
@Query("fromAmount") fromAmount: String,
@Query("fromDecimals") fromDecimals: Int,
@Query("toDecimals") toDecimals: Int,
@Query("providerId") providerId: String,
@Query("rateType") rateType: String,
): ApiResponse<ExchangeQuoteResponse>
@ -44,6 +45,7 @@ interface TangemExpressApi {
@Query("toNetwork") toNetwork: String,
@Query("fromAmount") fromAmount: String,
@Query("fromDecimals") fromDecimals: Int,
@Query("toDecimals") toDecimals: Int,
@Query("providerId") providerId: String,
@Query("rateType") rateType: String,
@Query("toAddress") toAddress: String,

View file

@ -168,6 +168,7 @@ internal class SwapRepositoryImpl @Inject constructor(
toNetwork: String,
fromAmount: String,
fromDecimals: Int,
toDecimals: Int,
providerId: String,
rateType: RateType,
): AggregatedSwapDataModel<QuoteModel> {
@ -180,6 +181,7 @@ internal class SwapRepositoryImpl @Inject constructor(
toNetwork = toNetwork,
fromAmount = fromAmount,
fromDecimals = fromDecimals,
toDecimals = toDecimals,
providerId = providerId,
rateType = rateType.name.lowercase(),
).getOrThrow()
@ -208,6 +210,7 @@ internal class SwapRepositoryImpl @Inject constructor(
toNetwork: String,
fromAmount: String,
fromDecimals: Int,
toDecimals: Int,
providerId: String,
rateType: RateType,
toAddress: String,
@ -221,6 +224,7 @@ internal class SwapRepositoryImpl @Inject constructor(
toNetwork = toNetwork,
fromAmount = fromAmount,
fromDecimals = fromDecimals,
toDecimals = toDecimals,
providerId = providerId,
rateType = rateType.name.lowercase(),
toAddress = toAddress,

View file

@ -270,6 +270,7 @@ internal class SwapInteractorImpl @Inject constructor(
toNetwork = toToken.currency.network.backendId,
fromAmount = amount.toStringWithRightOffset(),
fromDecimals = amount.decimals,
toDecimals = toToken.currency.decimals,
providerId = provider.providerId,
rateType = RateType.FLOAT,
)
@ -462,6 +463,7 @@ internal class SwapInteractorImpl @Inject constructor(
toNetwork = currencyToGet.currency.network.backendId,
fromAmount = amount.toStringWithRightOffset(),
fromDecimals = amount.decimals,
toDecimals = currencyToGet.currency.decimals,
providerId = swapProvider.providerId,
rateType = RateType.FLOAT,
toAddress = currencyToGet.value.networkAddress?.defaultAddress ?: "",
@ -652,6 +654,7 @@ internal class SwapInteractorImpl @Inject constructor(
fromAmount = amount.toStringWithRightOffset(),
fromDecimals = amount.decimals,
providerId = provider.providerId,
toDecimals = toToken.decimals,
rateType = RateType.FLOAT,
)
@ -707,7 +710,7 @@ internal class SwapInteractorImpl @Inject constructor(
swapAmount = amount,
quotesLoadedState = swapState,
isAllowedToSpend = isAllowedToSpend,
spenderAddress = requireNotNull(quoteModel.allowanceContract) { "Allowance contract is null" },
spenderAddress = quoteModel.allowanceContract,
)
state.copy(
preparedSwapConfigState = state.preparedSwapConfigState.copy(
@ -776,6 +779,7 @@ internal class SwapInteractorImpl @Inject constructor(
toNetwork = toToken.currency.network.backendId,
fromAmount = amount.toStringWithRightOffset(),
fromDecimals = amount.decimals,
toDecimals = toToken.currency.decimals,
providerId = provider.providerId,
rateType = RateType.FLOAT,
toAddress = toToken.value.networkAddress?.defaultAddress ?: "",
@ -907,7 +911,7 @@ internal class SwapInteractorImpl @Inject constructor(
fromTokenStatus: CryptoCurrencyStatus,
swapAmount: SwapAmount,
quotesLoadedState: SwapState.QuotesLoadedState,
spenderAddress: String,
spenderAddress: String?,
isAllowedToSpend: Boolean,
): SwapState.QuotesLoadedState {
val fromToken = fromTokenStatus.currency
@ -934,7 +938,7 @@ internal class SwapInteractorImpl @Inject constructor(
derivationPath = derivationPath,
fromToken = fromToken,
swapAmount = swapAmount,
spenderAddress = spenderAddress,
spenderAddress = requireNotNull(spenderAddress) { "Spender address is null" },
)
val feeData = try {
transactionManager.getFee(

View file

@ -25,6 +25,7 @@ interface SwapRepository {
toNetwork: String,
fromAmount: String,
fromDecimals: Int,
toDecimals: Int,
providerId: String,
rateType: RateType,
): AggregatedSwapDataModel<QuoteModel>
@ -72,6 +73,7 @@ interface SwapRepository {
toNetwork: String,
fromAmount: String,
fromDecimals: Int,
toDecimals: Int,
providerId: String,
rateType: RateType,
toAddress: String,

View file

@ -294,6 +294,12 @@ private fun SwapWarnings(warnings: List<SwapWarning>) {
config = warning.notificationConfig,
)
}
is SwapWarning.GeneralWarning -> {
Notification(
config = warning.notificationConfig,
iconTint = TangemTheme.colors.icon.warning,
)
}
else -> {}
}
SpacerH8()