Updated on 2026-08-14

This commit is contained in:
Tangem 2024-11-26 14:54:02 +03:00
parent 40e083ffad
commit b0694b6798
12 changed files with 66 additions and 22 deletions

View file

@ -37,4 +37,10 @@ data class ExpressErrorValue(
@Json(name = "expressFromDecimals")
val expressFromDecimals: Int?,
@Json(name = "fromAmount")
val fromAmount: String?,
@Json(name = "fromAmountProvider")
val fromAmountProvider: String?,
)

View file

@ -6,8 +6,6 @@
<string name="action_buttons_swap_empty_search_message">Token nicht in Deinem Portfolio gefunden? Überprüfe die Märkte, um es für Swaps zu finden und hinzuzufügen</string>
<string name="action_buttons_swap_no_available_pair_notification_message">Es gibt keine verfügbaren Token, die mit dem ausgewählten Token getauscht werden können. Bitte wähle einen anderen.</string>
<string name="action_buttons_swap_no_available_pair_notification_title">Kein verfügbares Paar</string>
<string name="action_buttons_you_want_to_receive">Du möchtest erhalten</string>
<string name="action_buttons_you_want_to_swap">Du möchtest tauschen</string>
<string name="add_custom_token_choose_network">Netzwerk wählen</string>
<string name="add_custom_token_title">Token anlegen</string>
<string name="add_tokens_title">Token verwalten</string>
@ -590,8 +588,11 @@
<string name="qr_scanner_camera_denied_settings_button">Einstellungen</string>
<string name="qr_scanner_camera_denied_text">Du hast keinen Zugriff auf deine Kamera gewährt</string>
<string name="qr_scanner_camera_denied_title">Kamerazugriff verweigert</string>
<string name="receive_bottom_sheet_no_memo_required_message">Kein Memo erforderlich</string>
<string name="receive_bottom_sheet_warning_message">%1$s ( %2$s ) im %3$s Netzwerk</string>
<string name="receive_bottom_sheet_warning_message_description">Das Senden einer anderen Währung führt zu deren irreversiblem Verlust.</string>
<string name="receive_bottom_sheet_warning_message_full">Sende nur %s an diese Adresse. Der Versand einer anderen Währung führt zu ihrem unwiderruflichen Verlust.</string>
<string name="receive_bottom_sheet_warning_message_title">Sende nur %s an diese Adresse.</string>
<string name="receive_token_description">Überweise Geld von einem anderen Wallet oder einer anderen Börse</string>
<string name="referral_button_participate">Teilnehmen</string>
<string name="referral_error_failed_to_load_info">Die Informationen zum Empfehlungsprogramm konnten nicht geladen werden. Bitte versuche es später noch einmal.</string>

View file

@ -6,8 +6,6 @@
<string name="action_buttons_swap_empty_search_message">¿No encuentras el token en tu billetera? Consulte los mercados para encontrarlo y agregarlo al intercambio</string>
<string name="action_buttons_swap_no_available_pair_notification_message">No hay tokens disponibles para intercambiar con el token seleccionado. Por favor elige otro.</string>
<string name="action_buttons_swap_no_available_pair_notification_title">No hay par disponible</string>
<string name="action_buttons_you_want_to_receive">Desea recibir</string>
<string name="action_buttons_you_want_to_swap">Quiere intercambiar</string>
<string name="add_custom_token_choose_network">Elige red</string>
<string name="add_custom_token_title">Agregue un token personalizado</string>
<string name="add_tokens_title">Gestionar tokens</string>

View file

@ -6,8 +6,6 @@
<string name="action_buttons_swap_empty_search_message">Jeton non trouvé dans votre portefeuille ? Consultez les marchés pour le trouver et l\'ajouter à l\'échange</string>
<string name="action_buttons_swap_no_available_pair_notification_message">Il n\'y a pas de token disponible pour échanger avec le token sélectionné. Veuillez en choisir un autre.</string>
<string name="action_buttons_swap_no_available_pair_notification_title">Aucune paire disponible</string>
<string name="action_buttons_you_want_to_receive">Vous souhaitez recevoir</string>
<string name="action_buttons_you_want_to_swap">Vous souhaitez échanger</string>
<string name="add_custom_token_choose_network">Choisissez le réseau</string>
<string name="add_custom_token_title">Ajouter un jeton personnalisé</string>
<string name="add_tokens_title">Gérer les jetons</string>
@ -370,7 +368,7 @@
<string name="manage_tokens_wallet_selector_title">Choisissez un portefeuille</string>
<string name="manage_tokens_wallet_support_only_one_network_title">Le portefeuille ne prend pas en charge plus d\'un réseau</string>
<string name="markets_add_to_my_portfolio_description">Pour acheter, échanger ou recevoir cet actif, ajoutez-le à votre portefeuille</string>
<string name="markets_add_to_my_portfolio_unavailable_description">Cet actif n\'est plus pris en charge dans le portefeuille</string>
<string name="markets_add_to_my_portfolio_unavailable_description">Cet actif n\'est pas pris en charge dans le portefeuille</string>
<string name="markets_add_to_my_portfolio_unavailable_for_wallet_description">Cet actif n\'est pas disponible pour ce portefeuille</string>
<string name="markets_add_to_portfolio_button">Ajouter au portfolio</string>
<string name="markets_add_token">Ajoutez un jeton</string>

View file

@ -6,8 +6,6 @@
<string name="action_buttons_swap_empty_search_message">ポートフォリオにトークンが見つかりませんか?マーケットから見つけ、スワップのために追加してください</string>
<string name="action_buttons_swap_no_available_pair_notification_message">選択したトークンと交換できるトークンがありません。別のトークンを選択してください。</string>
<string name="action_buttons_swap_no_available_pair_notification_title">利用可能なペアがありません</string>
<string name="action_buttons_you_want_to_receive">受け取りたい</string>
<string name="action_buttons_you_want_to_swap">交換したい</string>
<string name="add_custom_token_choose_network">ネットワークを選択</string>
<string name="add_custom_token_title">カスタムトークンの追加</string>
<string name="add_tokens_title">トークンの管理</string>
@ -123,7 +121,7 @@
<string name="common_fee_selector_option_market">マーケット</string>
<string name="common_fee_selector_option_slow">遅い</string>
<string name="common_fee_selector_title">速度と料金</string>
<string name="common_generate_addresses">アドレスを取得する</string>
<string name="common_generate_addresses">アドレスを同期する</string>
<string name="common_go_to_provider">プロバイダーへ移動</string>
<string name="common_go_to_token">トークンへ移動</string>
<string name="common_hour">時間</string>
@ -557,6 +555,7 @@
<string name="onboarding_wallet_info_title_fourth">アクセスコードの復元</string>
<string name="onboarding_wallet_info_title_second">同一のカード</string>
<string name="onboarding_wallet_info_title_third">アクセスコード</string>
<string name="onramp_choose_provider_title_hint">プロバイダーは取引を促進し、スムーズで効率的なトークン交換を保証します</string>
<string name="onramp_country_search">国で検索</string>
<string name="onramp_country_unavailable">利用不可</string>
<string name="onramp_currency_search">通貨で検索</string>
@ -582,8 +581,11 @@
<string name="qr_scanner_camera_denied_settings_button">設定</string>
<string name="qr_scanner_camera_denied_text">カメラへのアクセスを許可していません。</string>
<string name="qr_scanner_camera_denied_title">カメラへのアクセスが拒否されました</string>
<string name="receive_bottom_sheet_no_memo_required_message">メモ不要</string>
<string name="receive_bottom_sheet_warning_message">%3$sネットワーク上の%1$s ( %2$s )</string>
<string name="receive_bottom_sheet_warning_message_description">他の暗号資産を送信すると、取り返しのつかない損失が発生します。</string>
<string name="receive_bottom_sheet_warning_message_full">このアドレスには%sのみを送金してください。他のトークンを送信すると、取り返しのつかない損失が発生します。</string>
<string name="receive_bottom_sheet_warning_message_title">このアドレスには%sのみを送信してください。</string>
<string name="receive_token_description">ウォレットや取引所から資金を送金する</string>
<string name="referral_button_participate">参加する</string>
<string name="referral_error_failed_to_load_info">紹介プログラムに関する情報を読み込めませんでした。しばらくしてからもう一度お試しください。</string>

View file

@ -3,8 +3,6 @@
<string name="action_buttons_swap_choose_token">Выберите токен</string>
<string name="action_buttons_swap_no_available_pair_notification_message">Нет доступных токенов для обмена с выбранным токеном, пожалуйста, выберите другой.</string>
<string name="action_buttons_swap_no_available_pair_notification_title">Нет доступных пар</string>
<string name="action_buttons_you_want_to_receive">Вы хотите получить</string>
<string name="action_buttons_you_want_to_swap">Вы хотите обменять</string>
<string name="add_custom_token_choose_network">Выберите сеть</string>
<string name="add_custom_token_title">Добавить токен</string>
<string name="add_tokens_title">Валюты</string>
@ -129,7 +127,7 @@
<string name="common_fee_selector_option_market">По рынку</string>
<string name="common_fee_selector_option_slow">Медленно</string>
<string name="common_fee_selector_title">Скорость и комиссия</string>
<string name="common_generate_addresses">Получить ваши адреса</string>
<string name="common_generate_addresses">Синхронизировать адреса</string>
<string name="common_go_to_provider">К провайдеру</string>
<string name="common_go_to_token">Перейти в токен</string>
<string name="common_hour">час</string>

View file

@ -6,8 +6,6 @@
<string name="action_buttons_swap_empty_search_message">Токен не знайдено у вашому портфелі? Перевірте ринки, щоб знайти та додати його для обміну</string>
<string name="action_buttons_swap_no_available_pair_notification_message">Немає доступних токенів для обміну з обраним токеном. Будь ласка, оберіть інший.</string>
<string name="action_buttons_swap_no_available_pair_notification_title">Немає вільної пари</string>
<string name="action_buttons_you_want_to_receive">Ви хочете отримати</string>
<string name="action_buttons_you_want_to_swap">Ви хочете обміняти</string>
<string name="add_custom_token_choose_network">Оберіть мережу</string>
<string name="add_custom_token_title">Додати токен</string>
<string name="add_tokens_title">Токени</string>

View file

@ -6,8 +6,8 @@
<string name="action_buttons_swap_empty_search_message">Token not found in your portfolio? Check the Markets to find and add it for swap</string>
<string name="action_buttons_swap_no_available_pair_notification_message">There are no available tokens to swap with the selected token. Please choose another one.</string>
<string name="action_buttons_swap_no_available_pair_notification_title">No available pair</string>
<string name="action_buttons_you_want_to_receive">You want to Receive</string>
<string name="action_buttons_you_want_to_swap">You want to Swap</string>
<string name="action_buttons_you_want_to_receive">Choose the Token you want to Receive</string>
<string name="action_buttons_you_want_to_swap">Choose the Token you want to Swap</string>
<string name="add_custom_token_choose_network">Choose network</string>
<string name="add_custom_token_title">Add custom token</string>
<string name="add_tokens_title">Manage tokens</string>
@ -126,7 +126,7 @@
<string name="common_fee_selector_option_market">Market</string>
<string name="common_fee_selector_option_slow">Slow</string>
<string name="common_fee_selector_title">Speed and fee</string>
<string name="common_generate_addresses">Get your addresses</string>
<string name="common_generate_addresses">Synchronize addresses</string>
<string name="common_go_to_provider">Go to provider</string>
<string name="common_go_to_token">Go to token</string>
<string name="common_hour">hour</string>
@ -251,6 +251,7 @@
<string name="express_choose_providers_subtitle">Tangem offers token swaps via 3rd-party providers according to each provider\'s terms</string>
<string name="express_choose_providers_title">Choose provider</string>
<string name="express_error_code">An error occurred. Code: %s</string>
<string name="express_error_provider_amount_roundup">Error %1$s. The selected provider cannot process the specified transaction. Please round the value up to %2$s or change it</string>
<string name="express_error_swap_pair_unavailable">Selected provider is unavailable at the moment. Please try again later. (Code: %s)</string>
<string name="express_error_swap_unavailable">Swaps are unavailable at the moment. Please try again later. (Code: %s)</string>
<string name="express_estimated_amount">Estimated amount</string>
@ -565,6 +566,7 @@
<string name="onboarding_wallet_info_title_fourth">Access code restore</string>
<string name="onboarding_wallet_info_title_second">Identical cards</string>
<string name="onboarding_wallet_info_title_third">Access code</string>
<string name="onramp_choose_provider_title_hint">Providers facilitate transactions, ensuring smooth and efficient token exchanges</string>
<string name="onramp_country_search">Search by country</string>
<string name="onramp_country_unavailable">Unavailable</string>
<string name="onramp_currency_search">Search by currency</string>

View file

@ -30,6 +30,7 @@ internal class ErrorsDataConverter(
2270 -> ExpressDataError.ExchangeNotEnoughBalanceError(code = error.code)
2280 -> ExpressDataError.ExchangeInvalidAddressError(code = error.code)
2290 -> tryParseExchangeInvalidFromDecimalsError(error = error)
2320 -> tryParseProviderDifferentAmountError(error = error)
else -> ExpressDataError.UnknownErrorWithCode(error.code)
}
} catch (e: Exception) {
@ -79,4 +80,20 @@ internal class ErrorsDataConverter(
expressFromDecimals = expressFromDecimals,
)
}
private fun tryParseProviderDifferentAmountError(error: ExpressError): ExpressDataError {
val decimals = error.value?.decimals ?: return ExpressDataError.UnknownErrorWithCode(error.code)
val fromAmount = error.value?.fromAmount?.toBigDecimalOrNull()
?: return ExpressDataError.UnknownErrorWithCode(error.code)
val fromAmountProvider = error.value?.fromAmountProvider?.toBigDecimalOrNull()
?: return ExpressDataError.UnknownErrorWithCode(error.code)
return ExpressDataError.ProviderDifferentAmountError(
code = error.code,
decimals = decimals,
fromAmount = fromAmount,
fromProviderAmount = fromAmountProvider,
)
}
}

View file

@ -39,6 +39,13 @@ sealed class ExpressDataError {
val expressFromDecimals: Int,
) : ExpressDataError()
data class ProviderDifferentAmountError(
override val code: Int,
val fromAmount: BigDecimal,
val fromProviderAmount: BigDecimal,
val decimals: Int,
) : ExpressDataError()
data class UnknownErrorWithCode(override val code: Int) : ExpressDataError()
data class InvalidSignatureError(override val code: Int = 990) : ExpressDataError()

View file

@ -10,10 +10,7 @@ import com.tangem.core.ui.components.notifications.NotificationConfig
import com.tangem.core.ui.event.consumedEvent
import com.tangem.core.ui.event.triggeredEvent
import com.tangem.core.ui.extensions.*
import com.tangem.core.ui.format.bigdecimal.anyDecimals
import com.tangem.core.ui.format.bigdecimal.crypto
import com.tangem.core.ui.format.bigdecimal.format
import com.tangem.core.ui.format.bigdecimal.uncapped
import com.tangem.core.ui.format.bigdecimal.*
import com.tangem.core.ui.utils.BigDecimalFormatter
import com.tangem.core.ui.utils.parseBigDecimal
import com.tangem.domain.appcurrency.model.AppCurrency
@ -777,6 +774,19 @@ internal class StateBuilder(
iconResId = R.drawable.ic_alert_circle_24,
),
)
is ExpressDataError.ProviderDifferentAmountError -> SwapWarning.GeneralError(
notificationConfig = NotificationConfig(
title = resourceReference(id = R.string.common_error),
subtitle = resourceReference(
R.string.express_error_provider_amount_roundup,
formatArgs = wrappedList(
expressDataError.code,
expressDataError.fromProviderAmount.format { simple(decimals = expressDataError.decimals) },
),
),
iconResId = R.drawable.ic_alert_circle_24,
),
)
else -> SwapWarning.GeneralWarning(
notificationConfig = NotificationConfig(
title = providerErrorTitle,

View file

@ -28,6 +28,13 @@ internal fun getExpressErrorMessage(expressDataError: ExpressDataError): TextRef
id = R.string.express_error_swap_pair_unavailable,
formatArgs = wrappedList(expressDataError.code),
)
is ExpressDataError.ProviderDifferentAmountError -> resourceReference(
R.string.express_error_provider_amount_roundup,
formatArgs = wrappedList(
expressDataError.code,
expressDataError.fromProviderAmount.format { simple(decimals = expressDataError.decimals) },
),
)
else -> resourceReference(R.string.express_error_code, wrappedList(expressDataError.code.toString()))
}
}