Updated on 2026-08-14

This commit is contained in:
Tangem 2025-12-04 11:26:04 +04:00
parent a7dc87ec2b
commit 050f370a9b
4 changed files with 23 additions and 14 deletions

View file

@ -1020,7 +1020,10 @@ internal class SwapInteractorImpl @AssistedInject constructor(
cryptoAmount = amount.value,
cryptoCurrencyId = requireNotNull(currencyToSend.currency.id.rawCurrencyId),
cexAddress = exchangeDataCex.txTo,
fromAmount = amount.toStringWithRightOffset(),
fromAmount = amountFormatter.formatSwapAmountToUI(
amount,
currencyToSend.currency.symbol,
),
fromAmountValue = amount.value,
toAmount = amountFormatter.formatSwapAmountToUI(
exchangeData.toTokenAmount,
@ -1035,7 +1038,7 @@ internal class SwapInteractorImpl @AssistedInject constructor(
amount = amount,
swapProvider = swapProvider,
swapDataModel = exchangeData,
txExternalUrl = "",
txExternalUrl = exchangeDataCex.externalTxUrl,
txExternalId = exchangeDataCex.externalTxId,
averageDuration = null,
),

View file

@ -809,6 +809,7 @@ internal class SwapModel @Inject constructor(
makeDefaultAlert()
}
.onRight {
val txUrl = swapTransactionState.storeData.txExternalUrl
swapInteractor.storeSwapTransaction(
currencyToSend = swapTransactionState.storeData.currencyToSend,
currencyToGet = swapTransactionState.storeData.currencyToGet,
@ -817,7 +818,7 @@ internal class SwapModel @Inject constructor(
amount = swapTransactionState.storeData.amount,
swapProvider = swapTransactionState.storeData.swapProvider,
swapDataModel = swapTransactionState.storeData.swapDataModel,
txExternalUrl = "",
txExternalUrl = txUrl,
timestamp = System.currentTimeMillis(),
txExternalId = swapTransactionState.storeData.txExternalId,
averageDuration = null,
@ -826,6 +827,8 @@ internal class SwapModel @Inject constructor(
uiState = uiState,
swapTransactionState = swapTransactionState,
dataState = dataState,
txUrl = txUrl.orEmpty(),
onExploreClick = { if (txUrl != null) urlOpener.openUrl(txUrl) },
)
swapRouter.openScreen(SwapNavScreen.Success)
}

View file

@ -859,6 +859,8 @@ internal class StateBuilder(
uiState: SwapStateHolder,
swapTransactionState: SwapTransactionState.TangemPayWithdrawalData,
dataState: SwapProcessDataState,
txUrl: String,
onExploreClick: () -> Unit,
): SwapStateHolder {
val fromCryptoCurrency = requireNotNull(dataState.fromCryptoCurrency)
val toCryptoCurrency = requireNotNull(dataState.toCryptoCurrency)
@ -869,14 +871,13 @@ internal class StateBuilder(
val fromFiatAmount = getFormattedFiatAmount(fromCryptoCurrency.value.fiatRate?.multiply(fromAmount))
val toFiatAmount = getFormattedFiatAmount(toCryptoCurrency.value.fiatRate?.multiply(toAmount))
val shouldShowStatus = providerState.type == ExchangeProviderType.CEX.providerName
return uiState.copy(
successState = SwapSuccessStateHolder(
timestamp = System.currentTimeMillis(),
txUrl = "",
txUrl = txUrl,
providerName = stringReference(providerState.name),
providerType = stringReference(providerState.type),
showStatusButton = shouldShowStatus,
showStatusButton = false,
providerIcon = providerState.iconUrl,
rate = providerState.subtitle,
fee = TextReference.EMPTY,
@ -888,7 +889,7 @@ internal class StateBuilder(
toTokenFiatAmount = stringReference(toFiatAmount),
fromTokenIconState = iconStateConverter.convert(fromCryptoCurrency),
toTokenIconState = iconStateConverter.convert(toCryptoCurrency),
onExploreButtonClick = {},
onExploreButtonClick = onExploreClick,
onStatusButtonClick = {},
),
)

View file

@ -101,13 +101,15 @@ private fun SwapSuccessScreenContent(state: SwapSuccessStateHolder, padding: Pad
.background(TangemTheme.colors.background.action),
)
SpacerH16()
InputRowDefault(
title = TextReference.Res(R.string.common_network_fee_title),
text = state.fee,
modifier = Modifier
.clip(TangemTheme.shapes.roundedCornersXMedium)
.background(TangemTheme.colors.background.action),
)
if (state.fee != TextReference.EMPTY) {
InputRowDefault(
title = TextReference.Res(R.string.common_network_fee_title),
text = state.fee,
modifier = Modifier
.clip(TangemTheme.shapes.roundedCornersXMedium)
.background(TangemTheme.colors.background.action),
)
}
}
}