diff --git a/common/ui/src/main/java/com/tangem/common/ui/notifications/NotificationUM.kt b/common/ui/src/main/java/com/tangem/common/ui/notifications/NotificationUM.kt
index 7425a7aa0f..fe9115cfec 100644
--- a/common/ui/src/main/java/com/tangem/common/ui/notifications/NotificationUM.kt
+++ b/common/ui/src/main/java/com/tangem/common/ui/notifications/NotificationUM.kt
@@ -301,6 +301,12 @@ sealed class NotificationUM(val config: NotificationConfig) {
),
subtitle = TextReference.EMPTY,
)
+
+ data object YieldSupplyHighNetworkFee : Info(
+ title = resourceReference(id = R.string.yield_module_high_network_fees_notification_title),
+ subtitle = resourceReference(id = R.string.yield_module_high_network_fees_notification_description),
+ iconTint = NotificationConfig.IconTint.Accent,
+ )
}
sealed interface Cardano {
diff --git a/core/config-toggles/src/main/assets/configs/feature_toggles_config.json b/core/config-toggles/src/main/assets/configs/feature_toggles_config.json
index cd6aa8ac62..dce534df8d 100644
--- a/core/config-toggles/src/main/assets/configs/feature_toggles_config.json
+++ b/core/config-toggles/src/main/assets/configs/feature_toggles_config.json
@@ -17,7 +17,7 @@
},
{
"name": "STAKING_CARDANO_ENABLED",
- "version": "undefined"
+ "version": "5.31.1"
},
{
"name": "STAKING_ETH_ENABLED",
diff --git a/core/res/src/main/res/values-de/strings.xml b/core/res/src/main/res/values-de/strings.xml
index 0dc6af1380..af3e4fd8d7 100644
--- a/core/res/src/main/res/values-de/strings.xml
+++ b/core/res/src/main/res/values-de/strings.xml
@@ -392,6 +392,7 @@
Woche
mit
Ja
+ Ertragsmodus
Vertragsadresse kopiert!
Verfügbare Netzwerke
Die Ableitung Deines Tokens entspricht der Ableitung von %1$s. Dein Token wird diesem Konto gutgeschrieben.
@@ -1483,11 +1484,11 @@
Ein separates Zahlungskonto wird erstellt, ohne Ihre Adressen und Vermögenswerte offenzulegen
Unerreichte Privatsphäre
Erhalten Sie Ihre kostenlose Tangem Pay Card in wenigen Minuten
- Payment account
+ Zahlungskonto
Synchronisierung des Zahlungskontos erforderlich
Wir beheben ein technisches Problem. Bitte versuchen Sie es später erneut.
Service vorübergehend nicht verfügbar
- Der Dienst ist derzeit nicht erreichbar. Bitte versuchen Sie es später erneut.
+ Daten können derzeit nicht angezeigt werden, Kartenzahlungen funktionieren jedoch weiterhin.
Synchronisation erforderlich
Tangem Visa Card
Tangem Pay ist vorübergehend nicht verfügbar
diff --git a/core/res/src/main/res/values-es/strings.xml b/core/res/src/main/res/values-es/strings.xml
index b0aabad52d..e99920eeb5 100644
--- a/core/res/src/main/res/values-es/strings.xml
+++ b/core/res/src/main/res/values-es/strings.xml
@@ -345,6 +345,7 @@
semana
con
Sí
+ Modo de rendimiento
Dirección de contrato copiada
Redes disponibles
Dirección de contrato
@@ -1319,11 +1320,11 @@
Se creará una cuenta de pago separada sin divulgar tus direcciones y activos
Privacidad inigualable
Obtén tu tarjeta Tangem Pay gratuita en minutos
- Payment account
+ Cuenta de pago
Sincronización de cuenta de pago necesaria
Estamos solucionando un problema técnico. Por favor, inténtelo de nuevo más tarde.
Servicio temporalmente no disponible
- El servicio no está disponible actualmente. Inténtalo de nuevo más tarde.
+ No es posible mostrar los datos en este momento, pero los pagos con tarjeta siguen funcionando.
Sincronización necesaria
Tangem Visa Card
Tangem Pay temporalmente no disponible
@@ -1417,6 +1418,10 @@
Renombrar la billetera
Desbloquear todo
Desbloquear todo con %s
+ Configure un código de 4 dígitos.\nSe utilizará para los pagos.
+ Crear código PIN
+ No se aceptó el PIN. Inténtalo de nuevo o usa un código diferente.
+ PIN no válido: evitar secuencias o repeticiones
Elija cómo agregar su billetera
La blockchain está Inaccesible. Inténtelo más tarde
Escanee la tarjeta o el anillo
diff --git a/core/res/src/main/res/values-fr/strings.xml b/core/res/src/main/res/values-fr/strings.xml
index ca122acb3d..faddf299c6 100644
--- a/core/res/src/main/res/values-fr/strings.xml
+++ b/core/res/src/main/res/values-fr/strings.xml
@@ -328,6 +328,7 @@
semaine
avec
Oui
+ Mode Rendement
Adresse du contrat copiée !
Réseaux disponibles
Adresse du contrat
@@ -1300,11 +1301,11 @@
Un compte de paiement séparé sera créé sans divulguer vos adresses et actifs
Confidentialité inégalée
Obtenez votre carte Tangem Pay gratuite en quelques minutes
- Payment account
+ Compte de paiement
Synchronisation du compte de paiement nécessaire
Nous réparons un problème technique. Veuillez réessayer plus tard.
Service temporairement indisponible
- Le service est actuellement indisponible. Veuillez réessayer plus tard.
+ Les données ne peuvent pas être affichées pour le moment, mais les paiements par carte fonctionnent toujours.
Synchronisation requise
Tangem Visa Card
Tangem Pay est temporairement indisponible
@@ -1408,6 +1409,9 @@
Cela ne prendra pas longtemps. Nous configurons votre compte.
Cela ne prendra pas longtemps. Nous terminons l\'activation.
Tout est en cours de préparation !
+ Créez un code à 4 chiffres. Il servira pour les paiements.
+ Créer un code PIN
+ Le code PIN n\'a pas été accepté. Veuillez réessayer ou utiliser un autre code.
Code PIN invalide : évitez les séquences ou les répétitions
Accéder le site Web
Continuons la configuration de votre compte.
diff --git a/core/res/src/main/res/values-it/strings.xml b/core/res/src/main/res/values-it/strings.xml
index 179f7018a0..b7536b13ca 100644
--- a/core/res/src/main/res/values-it/strings.xml
+++ b/core/res/src/main/res/values-it/strings.xml
@@ -162,11 +162,11 @@
Verrà creato un conto di pagamento separato senza divulgare i tuoi indirizzi e asset
Privacy senza rivali
Ottieni la tua carta Tangem Pay gratuita in pochi minuti
- Payment account
+ Conto di pagamento
Sincronizzazione del conto di pagamento necessaria
Stiamo risolvendo un problema tecnico. Riprova più tardi.
Servizio temporaneamente non disponibile
- Il servizio è attualmente non raggiungibile. Riprova più tardi.
+ Al momento non è possibile visualizzare i dati, ma i pagamenti con carta continuano a funzionare.
Sincronizzazione necessaria
Tangem Visa Card
Tangem Pay è temporaneamente non disponibile
@@ -174,6 +174,10 @@
Usa la tua carta o il tuo anello per ripristinare l\'accesso al tuo conto di pagamento
Il tuo codice PIN
Tangem Twin
+ Imposta un codice di 4 cifre.\nVerrà utilizzato per i pagamenti.
+ Crea codice PIN
+ Il PIN non è stato accettato. Riprova o utilizza un codice diverso.
+ PIN non valido: evitare sequenze o ripetizioni
WalletConnect
L\'indirizzo è stato copiato con successo
Nessuna connessione a Internet
diff --git a/core/res/src/main/res/values-ja/strings.xml b/core/res/src/main/res/values-ja/strings.xml
index 82aca73289..bce005b585 100644
--- a/core/res/src/main/res/values-ja/strings.xml
+++ b/core/res/src/main/res/values-ja/strings.xml
@@ -4,7 +4,7 @@
とにかくスキップ
アクセスコードが設定されていません
コードを変更
- アクセスコードは、ウォレットのロック解除・資産へのアクセス保護に使用されます
+ アクセスコードは、ウォレットのロック解除およびウォレットへのアクセス保護に使用されます
このまま使う
このアクセスコードは簡単に推測される可能性があります
アクセスコードを入力
@@ -96,7 +96,7 @@
%1$s ネットワークのトークンは、ファームウェアの制限により、このカードまたはリングではサポートされていません。
カードまたはリングのスキャンに問題がありますか?
このカードはこのアプリでは使用できません。
- まずアクセスコードを設定してから、生体認証を有効にしてください
+ 生体認証を有効にするには、アクセスコードを設定してください
%1$sを使用してウォレットのロックを解除し、取引の署名などの機密性の高い操作を承認してください。ハードウェアウォレットの場合は、署名にカードまたはリングが必要です。
デフォルト手数料
デフォルト手数料を有効にすると、取引手数料が自動的に設定され、送金時に手数料ページを表示する必要がなくなります。必要に応じて、いつでもこのページに戻ることができます。
@@ -136,7 +136,7 @@
リカバリーフレーズ
これらの単語は誰にも教えないでください。Tangemがこれらの単語を尋ねることは、絶対にありません。以下の%s個の単語はウォレットのリカバリーフレーズです。デバイスを紛失した場合、これらの単語を使用してウォレットを復元できます。
これらの%s個の単語を番号順に書き留め、安全かつ他人の目に触れない場所に保管してください
- ウォレットおよびリカバリーフレーズの保護とバックアップは、すべてあなた自身の責任となります。
+ ウォレットの安全確保およびリカバリーフレーズの安全なバックアップは、すべてご自身の責任となります。
リカバリーフレーズ
残高を表示または非表示にするには、デバイスの画面を下向きにするか、設定でオフにしてください。
今後表示しない
@@ -386,6 +386,7 @@
週
で
はい
+ 利息モード
コントラクトアドレスをコピーしました!
利用可能なネットワーク
このトークンの導出パスが%1$sの導出パスと一致しています。トークンはこのアカウントに追加されます。
@@ -575,8 +576,8 @@
今すぐ確定
ウォレットの設定を完了する
アクセスコードでアプリを保護して、設定を完了してください。
- そうした場合は、最初からやり直す必要があります。
- 本当にアクティベーション処理を終了してもよろしいですか?
+ 終了すると、最初からやり直す必要があります。
+ セットアップを中止してもよろしいですか?
暗号資産をオフラインで厳重保管。カードサイズで、金庫以上の安心を。
実行すると、最初からやり直す必要があります。
Googleドライブのバックアップから既存のウォレットを復元する
@@ -585,18 +586,19 @@
新しいウォレットを作成
Tangemの高性能ハードウェアウォレットで、セキュリティをさらに強化しましょう。
ハードウェアウォレット
- 現在のウォレットをTangemウォレットに移します。
+ 現在のウォレットをTangemに移します。
現在のウォレットをアップグレードする
バックアップへ移動
アクセスコードを作成する前にウォレットをバックアップしてください。
- まずバックアップを完了する
+ 先にバックアップを完了してください
まずバックアップを完了する
その他の方法
- リカバリーフレーズは、ご自身で安全な場所に保管し、資金を守るために他人には絶対に共有しないでください。
+ 資金を保護するため、リカバリーフレーズは安全な場所に保管し、他人に知られないようにしてください。
リカバリーフレーズ
- アクセスコードを使用してウォレットを保護するには、まずバックアップを完了してください。
- ウォレットをハードウェアにアップグレードするには、まずバックアップしてください。
- 鍵はアプリに保存されます
+ アクセスコードでウォレットを保護するには、バックアップの手続きを完了してください。
+ ハードウェアウォレットにアップグレードするには、バックアップの手続きを完了してください。
+ 秘密鍵はデバイス上に保持されます
+ リカバリーフレーズを使ってウォレットを作成または復元してください。
シードフレーズのバックアップ
モバイルウォレットを作成する
既存のウォレットをインポートする
@@ -610,25 +612,25 @@
バックアップを表示
ウォレット削除
とにかく削除する
- このウォレットにはバックアップが存在します。後で復元できるように、削除する前に内容を確認してください。
- バックアップなしでこのウォレットを削除すると、資金へのアクセスを永久に失います。
- このウォレットを削除しますか?
- ウォレットの削除前にバックアップをしていなければ、アクセスを失う可能性があることを理解しています。
- ウォレットを削除しても中身自体が消えるわけではなく、単にこのデバイスから表示が消えるだけであることを理解しています。
- もはや、シードフレーズは不要。Tangemカードやリングが、そのまま安全なバックアップになります。
+ このウォレットにはバックアップがあります。ウォレットを削除する前に、復元できることを確認してください。
+ バックアップを行わずにこのウォレットを削除すると、資金へのアクセスを永久に失います。
+ このウォレットを削除してもよろしいですか?
+ ウォレットを削除する前にバックアップを行っていない場合、ウォレットへのアクセスを失うことを理解しています。
+ ウォレットを削除しても中身自体が消えるわけではなく、このデバイスから表示が消えるだけであることを理解しています。
+ シードフレーズは不要です。Tangemカードまたはリングが安全なバックアップとなります。
Tangemでバックアップ
アップグレードできません。このデバイスにはすでにウォレットが存在します。
別のデバイスを選択してください。このデバイスはアップグレードに使用できません。
操作中にエラーが発生しました。
処理中も、資金は安全に保たれ、常にアクセス可能です。
資金へのアクセス
- ウォレットのデータはアプリから削除され、Tangemデバイスに保存されます。
+ ウォレットのデータはアプリから削除され、ハードウェアウォレットに保存されます
セキュリティ全般
- 秘密鍵はアプリからTangemデバイスに移動されます。
- 鍵の移行
+ 秘密鍵はアプリからTangemハードウェアウォレットへ移行されます
+ キーの移行
デバイスをスキャン
アップグレードを開始
- ハードウェアウォレットにアップグレードすると、資産がコールドストレージで安全に保管されます。
+ ハードウェアウォレットへのアップグレードを行います。資産はコールドストレージで安全に保管されます。
Tangemウォレット
ハードウェアウォレットにアップグレード
Tangemの業界最高クラスのハードウェアウォレットで、暗号資産を安全に保管しましょう。
@@ -714,6 +716,7 @@
上昇率上位
下落率上位
トレンド
+ 利息モード
ステーキングは暗号資産で報酬を受け取る最も簡単な方法です。 %s
最大%s APYを獲得
トークンを追加しました
@@ -963,6 +966,7 @@
その他の通貨
人気の法定通貨
通貨で検索
+ この取引はすでに処理されています。これ以上の対応は必要ありません。
最良のレートを取得しています...
即時
オンランプ機能を使用することにより、プロバイダの%1$sおよび%2$sに同意するものとします
@@ -1481,7 +1485,7 @@
支払いアカウントの同期が必要です
技術的な問題を修正しています。後でもう一度お試しください。
サービスは一時的に利用できません
- 現在サービスに接続できません。後ほどもう一度お試しください。
+ 現在、データを表示できませんが、カードでのお支払いは引き続きご利用いただけます。
同期が必要です
Tangem Visaカード
Tangem Payは一時的に利用できません
@@ -1589,6 +1593,7 @@
長くはかかりません。アクティベーションを完了しています。
準備完了です!
4桁のコードを設定します。 \nお支払いの際に使用されます。
+ PINコードを作成する
PINの認証に失敗しました。もう一度お試しいただくか、別のコードを使用してください。
無効な暗証番号:連続や繰り返しを避けてください
ウェブサイトに移動
diff --git a/core/res/src/main/res/values-ru/strings.xml b/core/res/src/main/res/values-ru/strings.xml
index 0ad7e694bf..0d5eaa197f 100644
--- a/core/res/src/main/res/values-ru/strings.xml
+++ b/core/res/src/main/res/values-ru/strings.xml
@@ -402,6 +402,7 @@
неделю
с
Да
+ Режим доходности
Адрес контракта скопирован!
Доступные сети
Деривация вашего токена совпадает с деривацией %1$s. Токен будет добавлен к этой учётной записи.
@@ -1518,16 +1519,16 @@
Мы создадим отдельный платежный счет без раскрытия ваших активов \nи их адресов
Абсолютная приватность
Откройте виртуальную \nTangem Pay Card
- Payment account
- Требуется синхронизация платежного счета
+ Платежный аккаунт
+ Требуется синхронизация платежного аккаунта
Мы устраняем техническую проблему. Пожалуйста, попробуйте позже.
Сервис временно недоступен
- Сервис временно недоступен. Пожалуйста, попробуйте позже.
+ Не можем показать данные карты, но оплаты продолжают работать.
Требуется синхронизация
Tangem Visa Card
Tangem Pay временно недоступен
Tangem Pay
- Используйте вашу карту или кольцо для восстановления доступа к платежному счету
+ Используйте вашу карту или кольцо для восстановления доступа к платежному аккаунту
Ваш PIN-код
Это мой кошелек
Балансы скрыты
@@ -1621,7 +1622,11 @@
Разблокировать все с %s
Код доступа
Активация аккаунта
+ Установите 4-значный код.\nОн будет использоваться для платежей.
+ ПИН-код
+ Установить ПИН-код
ПИН не принят. Попробуйте ещё раз или введите другой код.
+ Слабый ПИН: не используйте повторы или последовательности.
Разблокировать
Выберите способ добавления кошелька
Отсканируйте вашу карту или кольцо Tangem, чтобы восстановить её или импортировать из другого кошелька.
diff --git a/core/res/src/main/res/values-uk-rUA/strings.xml b/core/res/src/main/res/values-uk-rUA/strings.xml
index 98ddcc642a..92eff0a832 100644
--- a/core/res/src/main/res/values-uk-rUA/strings.xml
+++ b/core/res/src/main/res/values-uk-rUA/strings.xml
@@ -257,6 +257,7 @@
тиждень
з
Так
+ Режим дохідності
Адреса контракту скопійована!
Доступні мережі
Адреса контракту
diff --git a/core/res/src/main/res/values-zh-rTW/strings.xml b/core/res/src/main/res/values-zh-rTW/strings.xml
index b2f04957dd..6fa2c8b69c 100644
--- a/core/res/src/main/res/values-zh-rTW/strings.xml
+++ b/core/res/src/main/res/values-zh-rTW/strings.xml
@@ -405,11 +405,11 @@
將創建單獨的支付帳戶,且不會透露您的地址和資產
無與倫比的隱私
在幾分鐘內獲得免費的 Tangem Pay 卡
- Payment account
+ 付款帳戶
需要同步支付账户
我们正在修复技术问题。请稍后再试。
服務暫時無法使用
- 服务当前不可用,请稍后再试
+ 目前無法顯示資料,但卡片支付仍可正常使用。
需要同步
Tangem Visa Card
Tangem Pay暂时不可用
diff --git a/core/res/src/main/res/values/strings.xml b/core/res/src/main/res/values/strings.xml
index a82169d021..d365c6e247 100644
--- a/core/res/src/main/res/values/strings.xml
+++ b/core/res/src/main/res/values/strings.xml
@@ -4,7 +4,7 @@
Skip anyway
Access code not set
Change code
- Your access code will be used to unlock your wallet and to protect access to the assets
+ Your access code unlocks and protects access to your wallet
Use anyway
This access code can be easily guessed
Enter access code
@@ -96,7 +96,7 @@
Tokens in %1$s network are not supported by this card or ring due to firmware limitation.
Are you having difficulty scanning your card or ring?
This card is not designed to work with this app
- Set an access code first to enable biometrics
+ Set an access code to enable biometrics
Use %1$s to unlock your wallet and approve sensitive actions, like signing transactions. For hardware wallets, a card or ring is still required to sign.
Default Fee
Enable Default Fee to set transaction fees automatically and skip the Fee page when sending funds. You can always go back to this page if necessary.
@@ -137,7 +137,7 @@
Recovery phrase
Never share these words with anyone. Tangem will never ask you for them. The %s words below are your wallet\'s recovery phrase. Use them to restore your wallet if you lose your device.
Write down these %s words in numerical order and keep them safe and private
- You are fully responsible for securing and backing up your wallet and recovery phrase.
+ You are fully responsible for securing your wallet and safely backing up your recovery phrase.
Recovery phrase
To hide or show your balances, simply flip your device screen down, or switch it off in Settings
Don\'t show again
@@ -394,6 +394,7 @@
week
with
Yes
+ Yield Mode
Contract address copied!
Available networks
Derivation of your token matches the derivation of %1$s. Your token will be added to this account.
@@ -583,7 +584,7 @@
Finalize now
Finalize wallet setup
Complete setup by securing the app with an access code.
- If you do, you\'ll need to start over.
+ If you exit, you\'ll need to start over.
Are you sure you want to quit the setup process?
Keeps your crypto safe and offline. Slim as a credit card, safer than a bank vault.
If you do, you\'ll need to start over.
@@ -592,7 +593,7 @@
Create a secure wallet and transfer your funds for extra protection.
Create new wallet
Level up your security with the superior Tangem hardware wallet.
- Hardware Wallet
+ Hardware wallet
Move your current wallet into Tangem.
Upgrade current wallet
Go to backup
@@ -603,7 +604,7 @@
Other methods
Save your recovery phrase in a secure place and keep it private to protect your funds.
Recovery phrase
- To secure your wallet with an Access Code, complete the backup first.
+ To secure your wallet with an access code, complete the backup process.
To upgrade to a hardware wallet, complete the backup process.
Your private keys are securely encrypted and stored on your phone
Private keys stay on your device
@@ -624,24 +625,24 @@
This wallet has a backup. Ensure you can recover it before forgetting the wallet.
If you forget this wallet without a backup, you\'ll permanently lose access to your funds.
Are you sure you want to forget this wallet?
- I understand that if I haven\'t backed up my wallet before removing it, I may lose access to it.
+ I understand that if I haven\'t backed up my wallet before removing it, I will lose access to it.
I understand that removing my wallet does not delete it, only removes it from my device.
Seed phrase not required. Your Tangem card or ring becomes your secure backup.
Backup with Tangem
- Can’t upgrade. A wallet already exists on this device.
+ Can\'t upgrade. A wallet already exists on this device.
Pick another device. This one can’t be used for the upgrade.
An error occurred during the operation.
Your funds remain safe and fully accessible during the process
Access to funds
- Your wallet data will be erased from the app and stored on your Tangem device
+ Your wallet data will be erased from the app and stored on your hardware wallet
General security
- Private keys will be moved from the app to your Tangem device
- Key Migration
+ Private keys will be moved from the app to your Tangem hardware wallet
+ Key migration
Scan device
Start upgrade
You\'re about to upgrade to our hardware wallet. It will keep your assets safe in cold storage.
Tangem Wallet
- Upgrade to Hardware Wallet
+ Upgrade to our Hardware Wallet
Keep your crypto safe with Tangem\'s top-tier hardware wallet.
Upgrade your wallet to hardware security
This information was generated with AI.\nTap here, if you find any errors.
@@ -1437,6 +1438,7 @@
Failed to unfreeze the card. Try again later.
Your card is unfrozen.
Withdrawal
+ Unable to use on rooted device
Add funds
Top-up options
Card Number
@@ -1478,6 +1480,7 @@
Withdrawal in progress
Change PIN-code
Come back to the app if you forget it.
+ I understand that I will completely lose access to my Tangem Pay Card and all funds on it without the possibility of recovery
Failed to issue card
A technical error has occurred, please try again by clicking the button below.
A technical error has occurred, please contact support.
@@ -1508,10 +1511,10 @@
Payment account sync needed
We’re fixing a technical issue. Please try again later.
Service temporarily unavailable
- The service is currently unreachable. Please try again later.
+ Unable to display details. However, card payments are still working.
Sync needed
Tangem Visa Card
- Tangem Pay is temporarily unavailable
+ Tangem Pay is temporarily unreachable
Tangem Pay
Use your card or ring to restore access to your payment account
Your PIN code
@@ -1729,7 +1732,7 @@
Using a Tangem Wallet already?
Scan now
Pick a wallet setup method
- Want to purchase Tangem Wallet?
+ Want to buy a Tangem Wallet?
Buy now
Recover existing wallet via Google Drive backup
Import from Google Drive
@@ -1959,7 +1962,7 @@
Create or import a software wallet on your phone.
Start with Mobile Wallet
Other method
- Use Tangem Hardware Wallet
+ Use a Tangem hardware wallet
Learn more & buy
Discard
You have an interrupted backup. Do you want to resume?
diff --git a/data/swap/src/main/java/com/tangem/data/swap/DefaultSwapRepositoryV2.kt b/data/swap/src/main/java/com/tangem/data/swap/DefaultSwapRepositoryV2.kt
index 94583d0bee..b15bc7b0bf 100644
--- a/data/swap/src/main/java/com/tangem/data/swap/DefaultSwapRepositoryV2.kt
+++ b/data/swap/src/main/java/com/tangem/data/swap/DefaultSwapRepositoryV2.kt
@@ -272,7 +272,7 @@ internal class DefaultSwapRepositoryV2 @Inject constructor(
override suspend fun swapTransactionSent(
userWallet: UserWallet,
fromCryptoCurrencyStatus: CryptoCurrencyStatus,
- toAddress: String,
+ payInAddress: String,
txId: String,
txHash: String,
txExtraId: String?,
@@ -289,7 +289,7 @@ internal class DefaultSwapRepositoryV2 @Inject constructor(
txId = txId,
fromNetwork = currency.network.backendId,
fromAddress = status.networkAddress?.defaultAddress?.value.orEmpty(),
- payinAddress = toAddress,
+ payinAddress = payInAddress,
payinExtraId = txExtraId,
txHash = txHash,
),
diff --git a/domain/app-theme/models/src/main/kotlin/com/tangem/domain/apptheme/model/AppThemeMode.kt b/domain/app-theme/models/src/main/kotlin/com/tangem/domain/apptheme/model/AppThemeMode.kt
index dd24287e13..85da14ca89 100644
--- a/domain/app-theme/models/src/main/kotlin/com/tangem/domain/apptheme/model/AppThemeMode.kt
+++ b/domain/app-theme/models/src/main/kotlin/com/tangem/domain/apptheme/model/AppThemeMode.kt
@@ -3,21 +3,21 @@ package com.tangem.domain.apptheme.model
/**
* Enumerates the possible modes for the application's theme.
*/
-enum class AppThemeMode {
+enum class AppThemeMode(val value: String) {
/**
* Forces the dark theme mode regardless of system settings.
*/
- FORCE_DARK,
+ FORCE_DARK("Dark"),
/**
* Forces the light theme mode regardless of system settings.
*/
- FORCE_LIGHT,
+ FORCE_LIGHT("Light"),
/**
* Follows the system-wide theme mode.
*/
- FOLLOW_SYSTEM,
+ FOLLOW_SYSTEM("System"),
;
@@ -30,6 +30,6 @@ enum class AppThemeMode {
/**
* List of available [AppThemeMode]s.
* */
- val available: List = values().toList()
+ val available: List = entries
}
}
\ No newline at end of file
diff --git a/domain/models/src/main/kotlin/com/tangem/domain/models/wallet/UserWallet.kt b/domain/models/src/main/kotlin/com/tangem/domain/models/wallet/UserWallet.kt
index 30b9500769..8f2b0572ff 100644
--- a/domain/models/src/main/kotlin/com/tangem/domain/models/wallet/UserWallet.kt
+++ b/domain/models/src/main/kotlin/com/tangem/domain/models/wallet/UserWallet.kt
@@ -86,6 +86,13 @@ fun UserWallet.requireHotWallet(): UserWallet.Hot {
?: error("This user wallet is not a hot wallet")
}
+fun UserWallet.isImported(): Boolean {
+ return when (this) {
+ is UserWallet.Cold -> isImported
+ is UserWallet.Hot -> true
+ }
+}
+
fun UserWallet.copy(name: String = this.name, walletId: UserWalletId = this.walletId): UserWallet = when (this) {
is UserWallet.Cold -> this.copy(name = name, walletId = walletId)
is UserWallet.Hot -> this.copy(name = name, walletId = walletId)
diff --git a/domain/swap/src/main/java/com/tangem/domain/swap/SwapRepositoryV2.kt b/domain/swap/src/main/java/com/tangem/domain/swap/SwapRepositoryV2.kt
index d25708c229..8f26ccadb6 100644
--- a/domain/swap/src/main/java/com/tangem/domain/swap/SwapRepositoryV2.kt
+++ b/domain/swap/src/main/java/com/tangem/domain/swap/SwapRepositoryV2.kt
@@ -93,7 +93,7 @@ interface SwapRepositoryV2 {
*
* @param userWallet selected user wallet
* @param fromCryptoCurrencyStatus currency status being swapped from
- * @param toAddress swap destination address
+ * @param payInAddress swap destination address
* @param txId transaction id in ExpressApi
* @param txHash transaction hash in blockchain
* @param txExtraId extra transaction id in ExpressApi
@@ -101,7 +101,7 @@ interface SwapRepositoryV2 {
suspend fun swapTransactionSent(
userWallet: UserWallet,
fromCryptoCurrencyStatus: CryptoCurrencyStatus,
- toAddress: String,
+ payInAddress: String,
txId: String,
txHash: String,
txExtraId: String?,
diff --git a/domain/swap/src/main/java/com/tangem/domain/swap/usecase/GetSwapSupportedPairsUseCase.kt b/domain/swap/src/main/java/com/tangem/domain/swap/usecase/GetSwapSupportedPairsUseCase.kt
index 7cd009b31b..af3d4fe6aa 100644
--- a/domain/swap/src/main/java/com/tangem/domain/swap/usecase/GetSwapSupportedPairsUseCase.kt
+++ b/domain/swap/src/main/java/com/tangem/domain/swap/usecase/GetSwapSupportedPairsUseCase.kt
@@ -32,7 +32,10 @@ class GetSwapSupportedPairsUseCase(
swapTxType = swapTxType,
)
- val filteredOutInitial = cryptoCurrencyList.filterNot { it.id.rawNetworkId == initialCurrency.id.rawNetworkId }
+ val filteredOutInitial = cryptoCurrencyList.filterNot { currency ->
+ currency.id.rawNetworkId == initialCurrency.id.rawNetworkId &&
+ currency.id.rawCurrencyId == initialCurrency.id.rawCurrencyId
+ }
val fromGroup = pairs.groupPairs(
initialCurrency = initialCurrency,
diff --git a/domain/swap/src/main/java/com/tangem/domain/swap/usecase/SwapTransactionSentUseCase.kt b/domain/swap/src/main/java/com/tangem/domain/swap/usecase/SwapTransactionSentUseCase.kt
index be872f8701..92fcc325e3 100644
--- a/domain/swap/src/main/java/com/tangem/domain/swap/usecase/SwapTransactionSentUseCase.kt
+++ b/domain/swap/src/main/java/com/tangem/domain/swap/usecase/SwapTransactionSentUseCase.kt
@@ -27,6 +27,7 @@ class SwapTransactionSentUseCase(
swapDataTransactionModel: SwapDataTransactionModel,
provider: ExpressProvider,
txHash: String,
+ payInAddress: String,
timestamp: Long,
swapTxType: SwapTxType,
) = Either.catch {
@@ -63,7 +64,7 @@ class SwapTransactionSentUseCase(
swapRepositoryV2.swapTransactionSent(
userWallet = userWallet,
fromCryptoCurrencyStatus = fromCryptoCurrencyStatus,
- toAddress = swapDataTransactionModel.txTo,
+ payInAddress = payInAddress,
txId = swapDataTransactionModel.txId,
txHash = txHash,
txExtraId = swapDataTransactionModel.txExtraId,
diff --git a/domain/yield-supply/models/src/main/java/com/tangem/domain/yield/supply/models/YieldSupplyFee.kt b/domain/yield-supply/models/src/main/java/com/tangem/domain/yield/supply/models/YieldSupplyFee.kt
new file mode 100644
index 0000000000..6763e16cf5
--- /dev/null
+++ b/domain/yield-supply/models/src/main/java/com/tangem/domain/yield/supply/models/YieldSupplyFee.kt
@@ -0,0 +1,8 @@
+package com.tangem.domain.yield.supply.models
+
+import java.math.BigDecimal
+
+data class YieldSupplyFee(
+ val value: BigDecimal,
+ val isHighFee: Boolean = false,
+)
\ No newline at end of file
diff --git a/domain/yield-supply/src/main/java/com/tangem/domain/yield/supply/usecase/YieldSupplyGetCurrentFeeUseCase.kt b/domain/yield-supply/src/main/java/com/tangem/domain/yield/supply/usecase/YieldSupplyGetCurrentFeeUseCase.kt
index 460440f4b4..30daafec70 100644
--- a/domain/yield-supply/src/main/java/com/tangem/domain/yield/supply/usecase/YieldSupplyGetCurrentFeeUseCase.kt
+++ b/domain/yield-supply/src/main/java/com/tangem/domain/yield/supply/usecase/YieldSupplyGetCurrentFeeUseCase.kt
@@ -2,6 +2,8 @@ package com.tangem.domain.yield.supply.usecase
import arrow.core.Either
import arrow.core.Either.Companion.catch
+import com.tangem.blockchain.common.Blockchain
+import com.tangem.blockchain.common.transaction.Fee
import com.tangem.domain.models.currency.CryptoCurrencyStatus
import com.tangem.domain.models.quote.QuoteStatus
import com.tangem.domain.models.wallet.UserWalletId
@@ -10,6 +12,7 @@ import com.tangem.domain.tokens.repository.CurrenciesRepository
import com.tangem.domain.transaction.FeeRepository
import com.tangem.domain.yield.supply.YieldSupplyConst.YIELD_SUPPLY_EVM_CONSTANT_GAS_LIMIT
import com.tangem.domain.yield.supply.fixFee
+import com.tangem.domain.yield.supply.models.YieldSupplyFee
import java.math.BigDecimal
import java.math.RoundingMode
@@ -25,7 +28,7 @@ class YieldSupplyGetCurrentFeeUseCase(
suspend operator fun invoke(
userWalletId: UserWalletId,
cryptoCurrencyStatus: CryptoCurrencyStatus,
- ): Either = catch {
+ ): Either = catch {
val feeWithoutGas = feeRepository.getEthereumFeeWithoutGas(userWalletId, cryptoCurrencyStatus.currency)
val fiatRate = cryptoCurrencyStatus.value.fiatRate ?: error("Fiat rate is missing")
@@ -60,6 +63,23 @@ class YieldSupplyGetCurrentFeeUseCase(
val tokenValue = rateRatio.multiply(nativeGas.amount.value)
- tokenValue.stripTrailingZeros()
+ val isEthereum = cryptoCurrencyStatus.currency
+ .network.id.rawId.value == Blockchain.Ethereum.id
+
+ val isHighFee = if (isEthereum) {
+ val maxFeePerGas = (feeWithoutGas as? Fee.Ethereum.EIP1559)?.maxFeePerGas ?: 0.toBigInteger()
+ maxFeePerGas >= HIGH_ETHEREUM_FEE
+ } else {
+ false
+ }
+
+ YieldSupplyFee(
+ value = tokenValue.stripTrailingZeros(),
+ isHighFee = isHighFee,
+ )
+ }
+
+ companion object {
+ private val HIGH_ETHEREUM_FEE = 400_000_000.toBigInteger()
}
}
\ No newline at end of file
diff --git a/domain/yield-supply/src/main/java/com/tangem/domain/yield/supply/usecase/YieldSupplyGetRewardsBalanceUseCase.kt b/domain/yield-supply/src/main/java/com/tangem/domain/yield/supply/usecase/YieldSupplyGetRewardsBalanceUseCase.kt
index 93e18928bf..f0b5c39b43 100644
--- a/domain/yield-supply/src/main/java/com/tangem/domain/yield/supply/usecase/YieldSupplyGetRewardsBalanceUseCase.kt
+++ b/domain/yield-supply/src/main/java/com/tangem/domain/yield/supply/usecase/YieldSupplyGetRewardsBalanceUseCase.kt
@@ -29,6 +29,9 @@ class YieldSupplyGetRewardsBalanceUseCase(
val fiatRate = status.value.fiatRate
if (cryptoAmount?.compareTo(BigDecimal.ZERO) == 0) {
+ emit(
+ YieldSupplyRewardBalance(fiatBalance = null, cryptoBalance = null),
+ )
return@flow
}
diff --git a/domain/yield-supply/src/test/java/com/tangem/domain/yield/supply/usecase/YieldSupplyGetCurrentFeeUseCaseTest.kt b/domain/yield-supply/src/test/java/com/tangem/domain/yield/supply/usecase/YieldSupplyGetCurrentFeeUseCaseTest.kt
new file mode 100644
index 0000000000..54977eb022
--- /dev/null
+++ b/domain/yield-supply/src/test/java/com/tangem/domain/yield/supply/usecase/YieldSupplyGetCurrentFeeUseCaseTest.kt
@@ -0,0 +1,384 @@
+package com.tangem.domain.yield.supply.usecase
+
+import arrow.core.Either
+import com.google.common.truth.Truth.assertThat
+import com.tangem.blockchain.common.Blockchain
+import com.tangem.blockchain.common.transaction.Fee
+import com.tangem.domain.models.StatusSource
+import com.tangem.domain.models.currency.CryptoCurrency
+import com.tangem.domain.models.currency.CryptoCurrencyStatus
+import com.tangem.domain.models.network.Network
+import com.tangem.domain.models.network.NetworkAddress
+import com.tangem.domain.models.quote.QuoteStatus
+import com.tangem.domain.models.wallet.UserWalletId
+import com.tangem.domain.quotes.QuotesRepository
+import com.tangem.domain.tokens.repository.CurrenciesRepository
+import com.tangem.domain.transaction.FeeRepository
+import com.tangem.domain.utils.convertToSdkAmount
+import io.mockk.coEvery
+import io.mockk.mockk
+import kotlinx.coroutines.ExperimentalCoroutinesApi
+import kotlinx.coroutines.test.runTest
+import org.junit.jupiter.api.BeforeEach
+import org.junit.jupiter.api.Test
+import java.math.BigDecimal
+import java.math.BigInteger
+import java.math.RoundingMode
+
+@OptIn(ExperimentalCoroutinesApi::class)
+class YieldSupplyGetCurrentFeeUseCaseTest {
+
+ private val feeRepository: FeeRepository = mockk()
+ private val quotesRepository: QuotesRepository = mockk()
+ private val currenciesRepository: CurrenciesRepository = mockk()
+
+ private lateinit var useCase: YieldSupplyGetCurrentFeeUseCase
+
+ private val userWalletId = UserWalletId("abcdef012345")
+
+ @BeforeEach
+ fun setUp() {
+ useCase = YieldSupplyGetCurrentFeeUseCase(
+ feeRepository = feeRepository,
+ quotesRepository = quotesRepository,
+ currenciesRepository = currenciesRepository,
+ )
+ }
+
+ @Test
+ fun `GIVEN valid inputs on non-ethereum WHEN invoke THEN returns fee value and not high`() = runTest {
+ val rawNetworkId = Blockchain.BSC.id
+ val tokenDecimals = 8
+ val nativeDecimals = 18
+ val token = createToken(rawNetworkId = rawNetworkId, decimals = tokenDecimals)
+ val cryptoStatus = createStatus(token = token, fiatRate = BigDecimal("2.00"))
+ val nativeCoin = createCoin(rawNetworkId = rawNetworkId, decimals = nativeDecimals)
+ val nativeFiatRate = BigDecimal("4.00")
+
+ val maxFeePerGas = BigInteger.valueOf(1_000_000_000L)
+ val feeWithoutGas = Fee.Ethereum.EIP1559(
+ maxFeePerGas = maxFeePerGas,
+ priorityFee = BigInteger.ONE,
+ gasLimit = BigInteger.ZERO,
+ amount = BigDecimal.ZERO.convertToSdkAmount(cryptoStatus),
+ )
+
+ coEvery { feeRepository.getEthereumFeeWithoutGas(userWalletId, token) } returns feeWithoutGas
+ coEvery {
+ currenciesRepository.getNetworkCoin(
+ userWalletId = userWalletId,
+ networkId = token.network.id,
+ derivationPath = token.network.derivationPath,
+ )
+ } returns nativeCoin
+ coEvery {
+ quotesRepository.getMultiQuoteSyncOrNull(setOf(nativeCoin.id.rawCurrencyId!!))
+ } returns setOf(
+ QuoteStatus(
+ rawCurrencyId = nativeCoin.id.rawCurrencyId!!,
+ value = QuoteStatus.Data(
+ source = StatusSource.ACTUAL,
+ fiatRate = nativeFiatRate,
+ priceChange = BigDecimal.ZERO,
+ ),
+ ),
+ )
+
+ val gasLimit = BigInteger.valueOf(350_000)
+ val nativeGasValue = maxFeePerGas.multiply(gasLimit).toBigDecimal().movePointLeft(nativeDecimals)
+ val rateRatio = nativeFiatRate.divide(cryptoStatus.value.fiatRate!!, tokenDecimals, RoundingMode.HALF_UP)
+ val expectedTokenValue = rateRatio.multiply(nativeGasValue).stripTrailingZeros()
+
+ val result = useCase(userWalletId, cryptoStatus)
+
+ assertThat(result.isRight()).isTrue()
+ val fee = (result as Either.Right).value
+ assertThat(fee.value).isEqualTo(expectedTokenValue)
+ assertThat(fee.isHighFee).isFalse()
+ }
+
+ @Test
+ fun `GIVEN ethereum with high gas WHEN invoke THEN returns high fee flag`() = runTest {
+ val rawNetworkId = Blockchain.Ethereum.id
+ val tokenDecimals = 8
+ val nativeDecimals = 18
+ val token = createToken(rawNetworkId = rawNetworkId, decimals = tokenDecimals)
+ val cryptoStatus = createStatus(token = token, fiatRate = BigDecimal("2.00"))
+ val nativeCoin = createCoin(rawNetworkId = rawNetworkId, decimals = nativeDecimals)
+ val nativeFiatRate = BigDecimal("4.00")
+
+ val maxFeePerGas = BigInteger.valueOf(400_000_000L) // threshold
+ val feeWithoutGas = Fee.Ethereum.EIP1559(
+ maxFeePerGas = maxFeePerGas,
+ priorityFee = BigInteger.ONE,
+ gasLimit = BigInteger.ZERO,
+ amount = BigDecimal.ZERO.convertToSdkAmount(cryptoStatus),
+ )
+
+ coEvery { feeRepository.getEthereumFeeWithoutGas(userWalletId, token) } returns feeWithoutGas
+ coEvery {
+ currenciesRepository.getNetworkCoin(
+ userWalletId = userWalletId,
+ networkId = token.network.id,
+ derivationPath = token.network.derivationPath,
+ )
+ } returns nativeCoin
+ coEvery {
+ quotesRepository.getMultiQuoteSyncOrNull(setOf(nativeCoin.id.rawCurrencyId!!))
+ } returns setOf(
+ QuoteStatus(
+ rawCurrencyId = nativeCoin.id.rawCurrencyId!!,
+ value = QuoteStatus.Data(
+ source = StatusSource.ACTUAL,
+ fiatRate = nativeFiatRate,
+ priceChange = BigDecimal.ZERO,
+ ),
+ ),
+ )
+
+ val gasLimit = BigInteger.valueOf(350_000)
+ val nativeGasValue = maxFeePerGas.multiply(gasLimit).toBigDecimal().movePointLeft(nativeDecimals)
+ val rateRatio = nativeFiatRate.divide(cryptoStatus.value.fiatRate!!, tokenDecimals, RoundingMode.HALF_UP)
+ val expectedTokenValue = rateRatio.multiply(nativeGasValue).stripTrailingZeros()
+
+ val result = useCase(userWalletId, cryptoStatus)
+
+ assertThat(result.isRight()).isTrue()
+ val fee = (result as Either.Right).value
+ assertThat(fee.value).isEqualTo(expectedTokenValue)
+ assertThat(fee.isHighFee).isTrue()
+ }
+
+ @Test
+ fun `GIVEN token fiat rate missing WHEN invoke THEN returns error`() = runTest {
+ val rawNetworkId = Blockchain.BSC.id
+ val token = createToken(rawNetworkId = rawNetworkId, decimals = 8)
+ val cryptoStatus = createStatus(token = token, fiatRate = null)
+
+ coEvery { feeRepository.getEthereumFeeWithoutGas(userWalletId, token) } returns Fee.Ethereum.EIP1559(
+ maxFeePerGas = BigInteger.ONE,
+ priorityFee = BigInteger.ONE,
+ gasLimit = BigInteger.ZERO,
+ amount = BigDecimal.ZERO.convertToSdkAmount(
+ createStatus(token = token, fiatRate = BigDecimal.ONE),
+ ),
+ )
+
+ val result = useCase(userWalletId, cryptoStatus)
+
+ assertThat(result.isLeft()).isTrue()
+ val error = (result as Either.Left).value
+ assertThat(error).isInstanceOf(IllegalStateException::class.java)
+ assertThat(error.message).isEqualTo("Fiat rate is missing")
+ }
+
+ @Test
+ fun `GIVEN native quotes unavailable WHEN invoke THEN returns error`() = runTest {
+ val rawNetworkId = Blockchain.BSC.id
+ val token = createToken(rawNetworkId = rawNetworkId, decimals = 8)
+ val cryptoStatus = createStatus(token = token, fiatRate = BigDecimal("2.00"))
+ val nativeCoin = createCoin(rawNetworkId = rawNetworkId, decimals = 18)
+
+ coEvery { feeRepository.getEthereumFeeWithoutGas(userWalletId, token) } returns Fee.Ethereum.EIP1559(
+ maxFeePerGas = BigInteger.valueOf(1_000_000_000L),
+ priorityFee = BigInteger.ONE,
+ gasLimit = BigInteger.ZERO,
+ amount = BigDecimal.ZERO.convertToSdkAmount(cryptoStatus),
+ )
+ coEvery {
+ currenciesRepository.getNetworkCoin(
+ userWalletId = userWalletId,
+ networkId = token.network.id,
+ derivationPath = token.network.derivationPath,
+ )
+ } returns nativeCoin
+ coEvery { quotesRepository.getMultiQuoteSyncOrNull(setOf(nativeCoin.id.rawCurrencyId!!)) } returns null
+
+ val result = useCase(userWalletId, cryptoStatus)
+
+ assertThat(result.isLeft()).isTrue()
+ val error = (result as Either.Left).value
+ assertThat(error).isInstanceOf(IllegalStateException::class.java)
+ assertThat(error.message).isEqualTo("Quotes for native coin are unavailable")
+ }
+
+ @Test
+ fun `GIVEN empty quotes list WHEN invoke THEN returns error`() = runTest {
+ val rawNetworkId = Blockchain.BSC.id
+ val token = createToken(rawNetworkId = rawNetworkId, decimals = 8)
+ val cryptoStatus = createStatus(token = token, fiatRate = BigDecimal("2.00"))
+ val nativeCoin = createCoin(rawNetworkId = rawNetworkId, decimals = 18)
+
+ coEvery { feeRepository.getEthereumFeeWithoutGas(userWalletId, token) } returns Fee.Ethereum.EIP1559(
+ maxFeePerGas = BigInteger.valueOf(1_000_000_000L),
+ priorityFee = BigInteger.ONE,
+ gasLimit = BigInteger.ZERO,
+ amount = BigDecimal.ZERO.convertToSdkAmount(cryptoStatus),
+ )
+ coEvery {
+ currenciesRepository.getNetworkCoin(
+ userWalletId = userWalletId,
+ networkId = token.network.id,
+ derivationPath = token.network.derivationPath,
+ )
+ } returns nativeCoin
+ coEvery { quotesRepository.getMultiQuoteSyncOrNull(setOf(nativeCoin.id.rawCurrencyId!!)) } returns emptySet()
+
+ val result = useCase(userWalletId, cryptoStatus)
+
+ assertThat(result.isLeft()).isTrue()
+ val error = (result as Either.Left).value
+ assertThat(error).isInstanceOf(IllegalStateException::class.java)
+ assertThat(error.message).isEqualTo("Empty quotes list for native coin")
+ }
+
+ @Test
+ fun `GIVEN native fiat rate non-positive WHEN invoke THEN returns error`() = runTest {
+ val rawNetworkId = Blockchain.BSC.id
+ val token = createToken(rawNetworkId = rawNetworkId, decimals = 8)
+ val cryptoStatus = createStatus(token = token, fiatRate = BigDecimal("2.00"))
+ val nativeCoin = createCoin(rawNetworkId = rawNetworkId, decimals = 18)
+
+ coEvery { feeRepository.getEthereumFeeWithoutGas(userWalletId, token) } returns Fee.Ethereum.EIP1559(
+ maxFeePerGas = BigInteger.valueOf(1_000_000_000L),
+ priorityFee = BigInteger.ONE,
+ gasLimit = BigInteger.ZERO,
+ amount = BigDecimal.ZERO.convertToSdkAmount(cryptoStatus),
+ )
+ coEvery {
+ currenciesRepository.getNetworkCoin(
+ userWalletId = userWalletId,
+ networkId = token.network.id,
+ derivationPath = token.network.derivationPath,
+ )
+ } returns nativeCoin
+ coEvery {
+ quotesRepository.getMultiQuoteSyncOrNull(setOf(nativeCoin.id.rawCurrencyId!!))
+ } returns setOf(
+ QuoteStatus(
+ rawCurrencyId = nativeCoin.id.rawCurrencyId!!,
+ value = QuoteStatus.Data(
+ source = StatusSource.ACTUAL,
+ fiatRate = BigDecimal.ZERO, // non-positive
+ priceChange = BigDecimal.ZERO,
+ ),
+ ),
+ )
+
+ val result = useCase(userWalletId, cryptoStatus)
+
+ assertThat(result.isLeft()).isTrue()
+ val error = (result as Either.Left).value
+ assertThat(error).isInstanceOf(IllegalArgumentException::class.java)
+ assertThat(error.message).isEqualTo("Native fiat rate must be > 0")
+ }
+
+ @Test
+ fun `GIVEN token fiat rate non-positive WHEN invoke THEN returns error`() = runTest {
+ val rawNetworkId = Blockchain.BSC.id
+ val token = createToken(rawNetworkId = rawNetworkId, decimals = 8)
+ val cryptoStatus = createStatus(token = token, fiatRate = BigDecimal.ZERO) // non-positive
+
+ coEvery { feeRepository.getEthereumFeeWithoutGas(userWalletId, token) } returns Fee.Ethereum.EIP1559(
+ maxFeePerGas = BigInteger.ONE,
+ priorityFee = BigInteger.ONE,
+ gasLimit = BigInteger.ZERO,
+ amount = BigDecimal.ZERO.convertToSdkAmount(
+ createStatus(token = token, fiatRate = BigDecimal.ONE),
+ ),
+ )
+
+ val result = useCase(userWalletId, cryptoStatus)
+
+ assertThat(result.isLeft()).isTrue()
+ val error = (result as Either.Left).value
+ assertThat(error).isInstanceOf(IllegalArgumentException::class.java)
+ assertThat(error.message).isEqualTo("Fiat rate for token must be > 0")
+ }
+
+ private fun createToken(rawNetworkId: String, decimals: Int): CryptoCurrency.Token {
+ val derivationPath = Network.DerivationPath.None
+ val network = Network(
+ id = Network.ID(value = rawNetworkId, derivationPath = derivationPath),
+ backendId = rawNetworkId,
+ name = rawNetworkId,
+ currencySymbol = rawNetworkId.take(3).uppercase(),
+ derivationPath = derivationPath,
+ isTestnet = false,
+ standardType = Network.StandardType.Unspecified("UNSPECIFIED"),
+ hasFiatFeeRate = true,
+ canHandleTokens = true,
+ transactionExtrasType = Network.TransactionExtrasType.NONE,
+ nameResolvingType = Network.NameResolvingType.NONE,
+ )
+
+ return CryptoCurrency.Token(
+ id = CryptoCurrency.ID(
+ prefix = CryptoCurrency.ID.Prefix.TOKEN_PREFIX,
+ body = CryptoCurrency.ID.Body.NetworkId(rawNetworkId),
+ suffix = CryptoCurrency.ID.Suffix.RawID(rawNetworkId),
+ ),
+ network = network,
+ name = "TEST_TOKEN",
+ symbol = "TTK",
+ decimals = decimals,
+ iconUrl = null,
+ isCustom = false,
+ contractAddress = "0xToken",
+ )
+ }
+
+ private fun createCoin(rawNetworkId: String, decimals: Int): CryptoCurrency.Coin {
+ val derivationPath = Network.DerivationPath.None
+ val network = Network(
+ id = Network.ID(value = rawNetworkId, derivationPath = derivationPath),
+ backendId = rawNetworkId,
+ name = rawNetworkId,
+ currencySymbol = rawNetworkId.take(3).uppercase(),
+ derivationPath = derivationPath,
+ isTestnet = false,
+ standardType = Network.StandardType.Unspecified("UNSPECIFIED"),
+ hasFiatFeeRate = true,
+ canHandleTokens = true,
+ transactionExtrasType = Network.TransactionExtrasType.NONE,
+ nameResolvingType = Network.NameResolvingType.NONE,
+ )
+
+ return CryptoCurrency.Coin(
+ id = CryptoCurrency.ID(
+ prefix = CryptoCurrency.ID.Prefix.COIN_PREFIX,
+ body = CryptoCurrency.ID.Body.NetworkId(rawNetworkId),
+ suffix = CryptoCurrency.ID.Suffix.RawID(rawNetworkId),
+ ),
+ network = network,
+ name = "TEST_COIN",
+ symbol = "TCN",
+ decimals = decimals,
+ iconUrl = null,
+ isCustom = false,
+ )
+ }
+
+ private fun createStatus(token: CryptoCurrency.Token, fiatRate: BigDecimal?): CryptoCurrencyStatus {
+ return CryptoCurrencyStatus(
+ currency = token,
+ value = CryptoCurrencyStatus.Custom(
+ amount = BigDecimal.ZERO,
+ fiatAmount = BigDecimal.ZERO,
+ fiatRate = fiatRate,
+ priceChange = BigDecimal.ZERO,
+ stakingBalance = null,
+ yieldSupplyStatus = null,
+ hasCurrentNetworkTransactions = false,
+ pendingTransactions = emptySet(),
+ networkAddress = NetworkAddress.Single(
+ defaultAddress = NetworkAddress.Address(
+ value = "0x0000000000000000000000000000000000000000",
+ type = NetworkAddress.Address.Type.Primary,
+ ),
+ ),
+ sources = CryptoCurrencyStatus.Sources(),
+ ),
+ )
+ }
+}
\ No newline at end of file
diff --git a/domain/yield-supply/src/test/java/com/tangem/domain/yield/supply/usecase/YieldSupplyGetRewardsBalanceUseCaseTest.kt b/domain/yield-supply/src/test/java/com/tangem/domain/yield/supply/usecase/YieldSupplyGetRewardsBalanceUseCaseTest.kt
index 5521464a9c..878b0ca49e 100644
--- a/domain/yield-supply/src/test/java/com/tangem/domain/yield/supply/usecase/YieldSupplyGetRewardsBalanceUseCaseTest.kt
+++ b/domain/yield-supply/src/test/java/com/tangem/domain/yield/supply/usecase/YieldSupplyGetRewardsBalanceUseCaseTest.kt
@@ -1,10 +1,10 @@
package com.tangem.domain.yield.supply.usecase
import com.google.common.truth.Truth.assertThat
-import com.tangem.core.ui.format.bigdecimal.format
-import com.tangem.core.ui.format.bigdecimal.fiat
import com.tangem.core.ui.format.bigdecimal.anyDecimals
import com.tangem.core.ui.format.bigdecimal.crypto
+import com.tangem.core.ui.format.bigdecimal.fiat
+import com.tangem.core.ui.format.bigdecimal.format
import com.tangem.domain.appcurrency.model.AppCurrency
import com.tangem.domain.models.currency.CryptoCurrency
import com.tangem.domain.models.currency.CryptoCurrencyStatus
@@ -18,8 +18,8 @@ import io.mockk.coEvery
import io.mockk.mockk
import kotlinx.coroutines.CoroutineDispatcher
import kotlinx.coroutines.async
-import kotlinx.coroutines.flow.toList
import kotlinx.coroutines.flow.take
+import kotlinx.coroutines.flow.toList
import kotlinx.coroutines.test.StandardTestDispatcher
import kotlinx.coroutines.test.TestScope
import kotlinx.coroutines.test.advanceTimeBy
@@ -49,6 +49,38 @@ class YieldSupplyGetRewardsBalanceUseCaseTest {
assertThat(emissions).isEmpty()
}
+ @Test
+ fun `GIVEN zero amount WHEN invoke THEN emit null balances`() = runTest {
+ val network = createNetwork()
+ val token = createToken(network)
+ val status = CryptoCurrencyStatus(
+ currency = token,
+ value = CryptoCurrencyStatus.Custom(
+ amount = BigDecimal.ZERO,
+ fiatAmount = null,
+ fiatRate = BigDecimal.ONE,
+ priceChange = null,
+ stakingBalance = null,
+ yieldSupplyStatus = null,
+ hasCurrentNetworkTransactions = false,
+ pendingTransactions = emptySet(),
+ networkAddress = NetworkAddress.Single(
+ NetworkAddress.Address(value = "0xabc", type = NetworkAddress.Address.Type.Primary),
+ ),
+ sources = CryptoCurrencyStatus.Sources(),
+ ),
+ )
+
+ val dispatcherProvider = testDispatcherProvider(this)
+ val useCase = YieldSupplyGetRewardsBalanceUseCase(repository, dispatcherProvider)
+ val appCurrency = AppCurrency.Default
+
+ val emissions = useCase(status, appCurrency).toList()
+ assertThat(emissions).hasSize(1)
+ assertThat(emissions[0].fiatBalance).isNull()
+ assertThat(emissions[0].cryptoBalance).isNull()
+ }
+
@Test
fun `GIVEN coin currency WHEN invoke THEN emit nothing`() = runTest {
val network = createNetwork()
diff --git a/features/staking/impl/src/main/java/com/tangem/features/staking/impl/presentation/state/transformers/notifications/AddStakingNotificationsTransformer.kt b/features/staking/impl/src/main/java/com/tangem/features/staking/impl/presentation/state/transformers/notifications/AddStakingNotificationsTransformer.kt
index 3194f4e9ae..45351b95ed 100644
--- a/features/staking/impl/src/main/java/com/tangem/features/staking/impl/presentation/state/transformers/notifications/AddStakingNotificationsTransformer.kt
+++ b/features/staking/impl/src/main/java/com/tangem/features/staking/impl/presentation/state/transformers/notifications/AddStakingNotificationsTransformer.kt
@@ -291,6 +291,8 @@ internal class AddStakingNotificationsTransformer(
}
private fun MutableList.addTonInitializeAccountNotification(prevState: StakingUiState) {
+ if (prevState.actionType !is StakingActionCommonType.Enter) return
+
val isAccountInitialized = isAccountInitializedProvider.invoke()
val cryptoCurrencyNetworkIdValue = cryptoCurrencyStatusProvider().currency.network.rawId
diff --git a/features/swap-v2/impl/src/main/java/com/tangem/features/swap/v2/impl/sendviaswap/confirm/model/SwapTransactionSender.kt b/features/swap-v2/impl/src/main/java/com/tangem/features/swap/v2/impl/sendviaswap/confirm/model/SwapTransactionSender.kt
index 1c6a439eeb..15b59a6ef4 100644
--- a/features/swap-v2/impl/src/main/java/com/tangem/features/swap/v2/impl/sendviaswap/confirm/model/SwapTransactionSender.kt
+++ b/features/swap-v2/impl/src/main/java/com/tangem/features/swap/v2/impl/sendviaswap/confirm/model/SwapTransactionSender.kt
@@ -1,7 +1,9 @@
package com.tangem.features.swap.v2.impl.sendviaswap.confirm.model
import arrow.core.getOrElse
+import com.tangem.blockchain.blockchains.ethereum.EthereumTransactionExtras
import com.tangem.blockchain.common.transaction.Fee
+import com.tangem.blockchain.yieldsupply.providers.ethereum.yield.EthereumYieldSupplySendCallData
import com.tangem.domain.express.models.ExpressError
import com.tangem.domain.express.models.ExpressOperationType
import com.tangem.domain.express.models.ExpressProvider
@@ -152,6 +154,13 @@ internal class SwapTransactionSender @AssistedInject constructor(
return
}
+ val ethereumCallData = (txData.extras as? EthereumTransactionExtras)?.callData
+ val payInAddress = if (ethereumCallData is EthereumYieldSupplySendCallData) {
+ ethereumCallData.destinationAddress
+ } else {
+ txData.destinationAddress
+ }
+
sendTransactionUseCase(
txData = txData,
userWallet = userWallet,
@@ -169,6 +178,7 @@ internal class SwapTransactionSender @AssistedInject constructor(
swapDataTransactionModel = swapTransaction,
provider = provider,
txHash = txHash,
+ payInAddress = payInAddress,
timestamp = timestamp,
swapTxType = SwapTxType.SendWithSwap,
)
diff --git a/features/swap/domain/src/main/java/com/tangem/feature/swap/domain/SwapInteractorImpl.kt b/features/swap/domain/src/main/java/com/tangem/feature/swap/domain/SwapInteractorImpl.kt
index fc9b3e26de..9121e9d618 100644
--- a/features/swap/domain/src/main/java/com/tangem/feature/swap/domain/SwapInteractorImpl.kt
+++ b/features/swap/domain/src/main/java/com/tangem/feature/swap/domain/SwapInteractorImpl.kt
@@ -3,6 +3,7 @@ package com.tangem.feature.swap.domain
import android.util.Base64
import arrow.core.Either
import arrow.core.getOrElse
+import com.tangem.blockchain.blockchains.ethereum.EthereumTransactionExtras
import com.tangem.blockchain.blockchains.solana.SolanaTransactionHelper
import com.tangem.blockchain.common.Amount
import com.tangem.blockchain.common.Blockchain
@@ -11,6 +12,7 @@ import com.tangem.blockchain.common.TransactionExtras
import com.tangem.blockchain.common.smartcontract.SmartContractCallDataProviderFactory
import com.tangem.blockchain.common.transaction.Fee
import com.tangem.blockchain.common.transaction.TransactionFee
+import com.tangem.blockchain.yieldsupply.providers.ethereum.yield.EthereumYieldSupplySendCallData
import com.tangem.blockchainsdk.utils.fromNetworkId
import com.tangem.blockchainsdk.utils.toBlockchain
import com.tangem.blockchainsdk.utils.toNetworkId
@@ -883,6 +885,7 @@ internal class SwapInteractorImpl @AssistedInject constructor(
Timber.e(error, "Failed to create swap dex tx data")
return SwapTransactionState.Error.UnknownError
}
+
return handleSwapResult(
provider = provider,
networkId = networkId,
@@ -894,7 +897,7 @@ internal class SwapInteractorImpl @AssistedInject constructor(
amount = amount,
derivationPath = derivationPath,
txData = txData,
- payInAddress = txData.destinationAddress,
+ payInAddress = getPayoutAddress(txData),
)
}
@@ -1108,7 +1111,7 @@ internal class SwapInteractorImpl @AssistedInject constructor(
txId = exchangeDataCex.txId,
fromNetwork = currencyToSend.currency.network.backendId,
fromAddress = cexFromAddress,
- payInAddress = txData.destinationAddress,
+ payInAddress = getPayoutAddress(txData),
txHash = txHash,
payInExtraId = exchangeDataCex.txExtraId,
)
@@ -2349,6 +2352,15 @@ internal class SwapInteractorImpl @AssistedInject constructor(
}
}
+ private fun getPayoutAddress(txData: TransactionData.Uncompiled): String {
+ val ethereumCallData = (txData.extras as? EthereumTransactionExtras)?.callData
+ return if (ethereumCallData is EthereumYieldSupplySendCallData) {
+ ethereumCallData.destinationAddress
+ } else {
+ txData.destinationAddress
+ }
+ }
+
companion object {
private const val INCREASE_GAS_LIMIT_FOR_DEX = 112 // 12%
private const val INCREASE_GAS_LIMIT_FOR_SEND = 105 // 5%
diff --git a/features/swap/impl/src/main/java/com/tangem/feature/swap/analytics/SwapEvents.kt b/features/swap/impl/src/main/java/com/tangem/feature/swap/analytics/SwapEvents.kt
index e1c2640942..92e8672bb2 100644
--- a/features/swap/impl/src/main/java/com/tangem/feature/swap/analytics/SwapEvents.kt
+++ b/features/swap/impl/src/main/java/com/tangem/feature/swap/analytics/SwapEvents.kt
@@ -43,18 +43,31 @@ sealed class SwapEvents(
params = mapOf("Send Token" to sendToken, "Receive Token" to receiveToken),
)
- class ButtonGivePermissionClicked : SwapEvents(event = "Button - Give permission")
+ data class ButtonGivePermissionClicked(
+ val sendToken: String,
+ val receiveToken: String,
+ val provider: SwapProvider,
+ ) : SwapEvents(
+ event = "Button - Give permission",
+ params = mapOf(
+ "Send Token" to sendToken,
+ "Receive Token" to receiveToken,
+ "Provider" to provider.name,
+ ),
+ )
data class ButtonPermissionApproveClicked(
val sendToken: String,
val receiveToken: String,
val approveType: ApproveType,
+ val provider: SwapProvider,
) : SwapEvents(
event = "Button - Permission Approve",
params = mapOf(
"Send Token" to sendToken,
"Receive Token" to receiveToken,
"Type" to if (approveType == ApproveType.LIMITED) "Current Transaction" else "Unlimited",
+ "Provider" to provider.name,
),
)
@@ -145,4 +158,17 @@ sealed class SwapEvents(
data object Recommended : PromoState("Recommended")
}
}
+
+ data class NoticePermissionNeeded(
+ val sendToken: String,
+ val receiveToken: String,
+ val provider: SwapProvider,
+ ) : SwapEvents(
+ event = "Notice - Permission Needed",
+ params = mapOf(
+ "Send Token" to sendToken,
+ "Receive Token" to receiveToken,
+ "Provider" to provider.name,
+ ),
+ )
}
\ No newline at end of file
diff --git a/features/swap/impl/src/main/java/com/tangem/feature/swap/model/SwapModel.kt b/features/swap/impl/src/main/java/com/tangem/feature/swap/model/SwapModel.kt
index 3c9ba8dff3..f4b0a59776 100644
--- a/features/swap/impl/src/main/java/com/tangem/feature/swap/model/SwapModel.kt
+++ b/features/swap/impl/src/main/java/com/tangem/feature/swap/model/SwapModel.kt
@@ -192,6 +192,7 @@ internal class SwapModel @Inject constructor(
private val toTokenBalanceJobHolder = JobHolder()
private var isAmountChangedByUser: Boolean = false
+ private var lastPermissionNotificationTokens: Pair? = null
val currentScreen: SwapNavScreen
get() = swapRouter.currentScreen
@@ -547,60 +548,101 @@ internal class SwapModel @Inject constructor(
private fun setupLoadedState(provider: SwapProvider, state: SwapState, fromToken: CryptoCurrencyStatus) {
when (state) {
is SwapState.QuotesLoadedState -> {
- fillLoadedDataState(state, state.permissionState, state.swapDataModel)
- val loadedStates = dataState.lastLoadedSwapStates.getLastLoadedSuccessStates()
- val bestRatedProviderId = findBestQuoteProvider(loadedStates)?.providerId ?: provider.providerId
- uiState = stateBuilder.createQuotesLoadedState(
- uiStateHolder = uiState,
- quoteModel = state,
- fromToken = fromToken.currency,
- feeCryptoCurrencyStatus = dataState.feePaidCryptoCurrency,
- swapProvider = provider,
- bestRatedProviderId = bestRatedProviderId,
- isNeedBestRateBadge = dataState.lastLoadedSwapStates.consideredProvidersStates().size > 1,
- selectedFeeType = dataState.selectedFee?.feeType ?: FeeType.NORMAL,
- isReverseSwapPossible = isReverseSwapPossible(),
- needApplyFCARestrictions = userCountry.needApplyFCARestrictions(),
- hideFee = tangemPayInput?.isWithdrawal == true,
- )
- if (uiState.notifications.any { it is SwapNotificationUM.Error.UnableToCoverFeeWarning }) {
- analyticsEventHandler.send(
- SwapEvents.NoticeNotEnoughFee(
- token = initialCurrencyFrom.symbol,
- blockchain = fromToken.currency.network.name,
- ),
- )
- }
+ setupQuotesLoadedUiState(provider, state, fromToken)
+ sendAnalyticsForNotifications(fromToken)
+ updatePermissionNotificationState(state)
}
is SwapState.EmptyAmountState -> {
- val toTokenStatus = dataState.toCryptoCurrency
- uiState = stateBuilder.createQuotesEmptyAmountState(
- uiStateHolder = uiState,
- emptyAmountState = state,
- fromTokenStatus = fromToken,
- toTokenStatus = toTokenStatus,
- isReverseSwapPossible = isReverseSwapPossible(),
- toAccount = dataState.toAccount,
- )
+ setupEmptyAmountUiState(state, fromToken)
+ lastPermissionNotificationTokens = null
}
is SwapState.SwapError -> {
- singleTaskScheduler.cancelTask()
- uiState = stateBuilder.createQuotesErrorState(
- uiStateHolder = uiState,
- swapProvider = provider,
- fromToken = state.fromTokenInfo,
- toToken = dataState.toCryptoCurrency,
- expressDataError = state.error,
- includeFeeInAmount = state.includeFeeInAmount,
- isReverseSwapPossible = isReverseSwapPossible(),
- needApplyFCARestrictions = userCountry.needApplyFCARestrictions(),
- toAccount = dataState.toAccount,
- )
- sendErrorAnalyticsEvent(state.error, provider)
+ setupErrorUiState(provider, state)
+ lastPermissionNotificationTokens = null
}
}
}
+ private fun setupQuotesLoadedUiState(
+ provider: SwapProvider,
+ state: SwapState.QuotesLoadedState,
+ fromToken: CryptoCurrencyStatus,
+ ) {
+ fillLoadedDataState(state, state.permissionState, state.swapDataModel)
+ val loadedStates = dataState.lastLoadedSwapStates.getLastLoadedSuccessStates()
+ val bestRatedProviderId = findBestQuoteProvider(loadedStates)?.providerId ?: provider.providerId
+ uiState = stateBuilder.createQuotesLoadedState(
+ uiStateHolder = uiState,
+ quoteModel = state,
+ fromToken = fromToken.currency,
+ feeCryptoCurrencyStatus = dataState.feePaidCryptoCurrency,
+ swapProvider = provider,
+ bestRatedProviderId = bestRatedProviderId,
+ isNeedBestRateBadge = dataState.lastLoadedSwapStates.consideredProvidersStates().size > 1,
+ selectedFeeType = dataState.selectedFee?.feeType ?: FeeType.NORMAL,
+ isReverseSwapPossible = isReverseSwapPossible(),
+ needApplyFCARestrictions = userCountry.needApplyFCARestrictions(),
+ hideFee = tangemPayInput?.isWithdrawal == true,
+ )
+ }
+
+ private fun sendAnalyticsForNotifications(fromToken: CryptoCurrencyStatus) {
+ if (uiState.notifications.any { it is SwapNotificationUM.Error.UnableToCoverFeeWarning }) {
+ analyticsEventHandler.send(
+ SwapEvents.NoticeNotEnoughFee(
+ token = initialCurrencyFrom.symbol,
+ blockchain = fromToken.currency.network.name,
+ ),
+ )
+ }
+ }
+
+ private fun updatePermissionNotificationState(state: SwapState.QuotesLoadedState) {
+ val fromTokenId = state.fromTokenInfo.cryptoCurrencyStatus
+ .currency.id.value
+ val toTokenId = state.toTokenInfo.cryptoCurrencyStatus
+ .currency.id.value
+ val currentTokenPair = Pair(fromTokenId, toTokenId)
+
+ when {
+ uiState.notifications.none { it is SwapNotificationUM.Info.PermissionNeeded } -> {
+ lastPermissionNotificationTokens = null
+ }
+ lastPermissionNotificationTokens != currentTokenPair -> {
+ sendNoticePermissionNeededEvent()
+ lastPermissionNotificationTokens = currentTokenPair
+ }
+ }
+ }
+
+ private fun setupEmptyAmountUiState(state: SwapState.EmptyAmountState, fromToken: CryptoCurrencyStatus) {
+ val toTokenStatus = dataState.toCryptoCurrency
+ uiState = stateBuilder.createQuotesEmptyAmountState(
+ uiStateHolder = uiState,
+ emptyAmountState = state,
+ fromTokenStatus = fromToken,
+ toTokenStatus = toTokenStatus,
+ isReverseSwapPossible = isReverseSwapPossible(),
+ toAccount = dataState.toAccount,
+ )
+ }
+
+ private fun setupErrorUiState(provider: SwapProvider, state: SwapState.SwapError) {
+ singleTaskScheduler.cancelTask()
+ uiState = stateBuilder.createQuotesErrorState(
+ uiStateHolder = uiState,
+ swapProvider = provider,
+ fromToken = state.fromTokenInfo,
+ toToken = dataState.toCryptoCurrency,
+ expressDataError = state.error,
+ includeFeeInAmount = state.includeFeeInAmount,
+ isReverseSwapPossible = isReverseSwapPossible(),
+ needApplyFCARestrictions = userCountry.needApplyFCARestrictions(),
+ toAccount = dataState.toAccount,
+ )
+ sendErrorAnalyticsEvent(state.error, provider)
+ }
+
private fun sendErrorAnalyticsEvent(error: ExpressDataError, provider: SwapProvider) {
val receiveToken = dataState.toCryptoCurrency?.currency?.let { currency ->
"${currency.network.backendId}:${currency.symbol}"
@@ -1342,7 +1384,7 @@ internal class SwapModel @Inject constructor(
onReduceByAmount = ::onReduceAmountClicked,
openPermissionBottomSheet = {
singleTaskScheduler.cancelTask()
- analyticsEventHandler.send(SwapEvents.ButtonGivePermissionClicked())
+ sendGivePermissionClickedEvent()
uiState = stateBuilder.showPermissionBottomSheet(uiState) {
startLoadingQuotesFromLastState(isSilent = true)
analyticsEventHandler.send(SwapEvents.ButtonPermissionCancelClicked())
@@ -1603,19 +1645,46 @@ internal class SwapModel @Inject constructor(
}.map { currencyStatus -> currencyStatus.currency }.contains(chosen.currency)
}
+ private fun sendNoticePermissionNeededEvent() {
+ val sendTokenSymbol = dataState.fromCryptoCurrency?.currency?.symbol ?: return
+ val receiveTokenSymbol = dataState.toCryptoCurrency?.currency?.symbol ?: return
+ val provider = dataState.selectedProvider ?: return
+ analyticsEventHandler.send(
+ SwapEvents.NoticePermissionNeeded(
+ sendToken = sendTokenSymbol,
+ receiveToken = receiveTokenSymbol,
+ provider = provider,
+ ),
+ )
+ }
+
+ private fun sendGivePermissionClickedEvent() {
+ val sendTokenSymbol = dataState.fromCryptoCurrency?.currency?.symbol ?: return
+ val receiveTokenSymbol = dataState.toCryptoCurrency?.currency?.symbol ?: return
+ val provider = dataState.selectedProvider ?: return
+ analyticsEventHandler.send(
+ SwapEvents.ButtonGivePermissionClicked(
+ sendToken = sendTokenSymbol,
+ receiveToken = receiveTokenSymbol,
+ provider = provider,
+ ),
+ )
+ }
+
private fun sendPermissionApproveClickedEvent() {
- val sendTokenSymbol = dataState.fromCryptoCurrency?.currency?.symbol
- val receiveTokenSymbol = dataState.toCryptoCurrency?.currency?.symbol
- val approveType = uiState.permissionState.getApproveTypeOrNull()
- if (sendTokenSymbol != null && receiveTokenSymbol != null && approveType != null) {
- analyticsEventHandler.send(
- SwapEvents.ButtonPermissionApproveClicked(
- sendToken = sendTokenSymbol,
- receiveToken = receiveTokenSymbol,
- approveType = approveType,
- ),
- )
- }
+ val sendTokenSymbol = dataState.fromCryptoCurrency?.currency?.symbol ?: return
+ val receiveTokenSymbol = dataState.toCryptoCurrency?.currency?.symbol ?: return
+ val approveType = uiState.permissionState.getApproveTypeOrNull() ?: return
+ val provider = dataState.selectedProvider ?: return
+
+ analyticsEventHandler.send(
+ SwapEvents.ButtonPermissionApproveClicked(
+ sendToken = sendTokenSymbol,
+ receiveToken = receiveTokenSymbol,
+ approveType = approveType,
+ provider = provider,
+ ),
+ )
}
private fun updateWalletBalance() {
diff --git a/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/state/factory/TokenDetailsLoadedBalanceConverter.kt b/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/state/factory/TokenDetailsLoadedBalanceConverter.kt
index ee290cda1f..44384391ba 100644
--- a/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/state/factory/TokenDetailsLoadedBalanceConverter.kt
+++ b/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/state/factory/TokenDetailsLoadedBalanceConverter.kt
@@ -98,8 +98,16 @@ internal class TokenDetailsLoadedBalanceConverter(
stakingCryptoAmount,
currentState.selectedBalanceType,
),
- displayYieldSupplyFiatBalance = (currentState as? TokenDetailsBalanceBlockState.Content)
- ?.displayYieldSupplyFiatBalance,
+ displayYieldSupplyFiatBalance = if (status.value.yieldSupplyStatus?.isActive == true) {
+ (currentState as? TokenDetailsBalanceBlockState.Content)?.displayYieldSupplyFiatBalance
+ } else {
+ null
+ },
+ displayYieldSupplyCryptoBalance = if (status.value.yieldSupplyStatus?.isActive == true) {
+ (currentState as? TokenDetailsBalanceBlockState.Content)?.displayYieldSupplyCryptoBalance
+ } else {
+ null
+ },
balanceSegmentedButtonConfig = currentState.balanceSegmentedButtonConfig,
onBalanceSelect = clickIntents::onBalanceSelect,
selectedBalanceType = currentState.selectedBalanceType,
diff --git a/features/wallet/impl/build.gradle.kts b/features/wallet/impl/build.gradle.kts
index 81e2a852c5..5d647616a7 100644
--- a/features/wallet/impl/build.gradle.kts
+++ b/features/wallet/impl/build.gradle.kts
@@ -103,6 +103,8 @@ dependencies {
implementation(projects.domain.transaction)
implementation(projects.domain.yieldSupply)
implementation(projects.domain.yieldSupply.models)
+ implementation(projects.domain.appTheme)
+ implementation(projects.domain.appTheme.models)
/** Feature Apis */
implementation(projects.features.details.api)
diff --git a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/child/wallet/model/WalletModel.kt b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/child/wallet/model/WalletModel.kt
index 291743c337..4b707d963b 100644
--- a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/child/wallet/model/WalletModel.kt
+++ b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/child/wallet/model/WalletModel.kt
@@ -13,12 +13,11 @@ import com.tangem.core.decompose.model.Model
import com.tangem.domain.account.featuretoggle.AccountsFeatureToggles
import com.tangem.domain.account.supplier.SingleAccountListSupplier
import com.tangem.domain.account.usecase.IsAccountsModeEnabledUseCase
+import com.tangem.domain.apptheme.GetAppThemeModeUseCase
+import com.tangem.domain.apptheme.model.AppThemeMode
import com.tangem.domain.balancehiding.GetBalanceHidingSettingsUseCase
import com.tangem.domain.common.wallets.UserWalletsListRepository
-import com.tangem.domain.models.wallet.UserWallet
-import com.tangem.domain.models.wallet.UserWalletId
-import com.tangem.domain.models.wallet.isLocked
-import com.tangem.domain.models.wallet.isMultiCurrency
+import com.tangem.domain.models.wallet.*
import com.tangem.domain.nft.ObserveAndClearNFTCacheIfNeedUseCase
import com.tangem.domain.notifications.GetIsHuaweiDeviceWithoutGoogleServicesUseCase
import com.tangem.domain.notifications.repository.NotificationsRepository
@@ -100,6 +99,7 @@ internal class WalletModel @Inject constructor(
private val yieldSupplyFeatureToggles: YieldSupplyFeatureToggles,
private val accountsFeatureToggles: AccountsFeatureToggles,
private val tangemPayMainScreenCustomerInfoUseCase: TangemPayMainScreenCustomerInfoUseCase,
+ private val getAppThemeModeUseCase: GetAppThemeModeUseCase,
private val trackingContextProxy: TrackingContextProxy,
private val singleAccountListSupplier: SingleAccountListSupplier,
private val isAccountsModeEnabledUseCase: IsAccountsModeEnabledUseCase,
@@ -114,17 +114,13 @@ internal class WalletModel @Inject constructor(
private val walletsUpdateJobHolder = JobHolder()
private val refreshWalletJobHolder = JobHolder()
- private var needToRefreshWallet = false
private val clearNFTCacheJobHolder = JobHolder()
private val updateTangemPayJobHolder = JobHolder()
+ private var needToRefreshWallet = false
private var expressTxStatusTaskScheduler = SingleTaskScheduler()
init {
- if (!hotWalletFeatureToggles.isHotWalletEnabled) {
- analyticsEventsHandler.send(WalletScreenAnalyticsEvent.MainScreen.ScreenOpenedLegacy())
- }
-
updateMarketToggle()
suggestToOpenMarkets()
@@ -305,10 +301,14 @@ internal class WalletModel @Inject constructor(
} else {
null
}
+ val result = getAppThemeModeUseCase().firstOrNull()
+ val theme = result?.getOrElse { AppThemeMode.FOLLOW_SYSTEM } ?: AppThemeMode.FOLLOW_SYSTEM
analyticsEventsHandler.send(
WalletScreenAnalyticsEvent.MainScreen.ScreenOpened(
hasMobileWallet = hasMobileWallet,
accountsCount = accountsCount,
+ theme = theme.value,
+ isImported = selectedWallet.isImported(),
),
)
}
diff --git a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/analytics/WalletScreenAnalyticsEvent.kt b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/analytics/WalletScreenAnalyticsEvent.kt
index 317c4582c9..dec57f0b23 100644
--- a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/analytics/WalletScreenAnalyticsEvent.kt
+++ b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/analytics/WalletScreenAnalyticsEvent.kt
@@ -51,18 +51,23 @@ sealed class WalletScreenAnalyticsEvent {
params: Map = mapOf(),
) : AnalyticsEvent(category = "Main Screen", event = event, params = params) {
- class ScreenOpenedLegacy : MainScreen(
- event = "Screen opened",
- )
-
data class ScreenOpened(
private val hasMobileWallet: Boolean,
private val accountsCount: Int?,
+ val theme: String,
+ val isImported: Boolean,
) : MainScreen(
event = "Screen opened",
params = buildMap {
put("Mobile Wallet", if (hasMobileWallet) "Yes" else "No")
if (accountsCount != null) put("Accounts Count", accountsCount.toString())
+ put("App Theme", theme)
+ val seedPhrase = if (isImported) {
+ "Seed Phrase"
+ } else {
+ "Seedless"
+ }
+ put("Wallet Type", seedPhrase)
},
)
diff --git a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/analytics/utils/SelectedWalletAnalyticsSender.kt b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/analytics/utils/SelectedWalletAnalyticsSender.kt
index ad5cc6aa22..f637e0bfc4 100644
--- a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/analytics/utils/SelectedWalletAnalyticsSender.kt
+++ b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/analytics/utils/SelectedWalletAnalyticsSender.kt
@@ -3,6 +3,7 @@ package com.tangem.feature.wallet.presentation.wallet.analytics.utils
import com.tangem.core.analytics.api.AnalyticsEventHandler
import com.tangem.core.analytics.models.AnalyticsEvent
import com.tangem.domain.models.wallet.UserWallet
+import com.tangem.domain.models.wallet.isImported
import com.tangem.domain.models.wallet.isLocked
import com.tangem.feature.wallet.presentation.wallet.analytics.WalletScreenAnalyticsEvent
import com.tangem.feature.wallet.presentation.wallet.utils.ScreenLifecycleProvider
@@ -32,11 +33,4 @@ internal class SelectedWalletAnalyticsSender @Inject constructor(
else -> WalletScreenAnalyticsEvent.MainScreen.WalletSelected(userWallet.isImported())
}
-
- private fun UserWallet.isImported(): Boolean {
- return when (this) {
- is UserWallet.Cold -> isImported
- is UserWallet.Hot -> true
- }
- }
}
\ No newline at end of file
diff --git a/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/active/model/YieldSupplyActiveModel.kt b/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/active/model/YieldSupplyActiveModel.kt
index d468e6d60d..e18a49c84a 100644
--- a/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/active/model/YieldSupplyActiveModel.kt
+++ b/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/active/model/YieldSupplyActiveModel.kt
@@ -283,7 +283,7 @@ internal class YieldSupplyActiveModel @Inject constructor(
YieldSupplyActiveFeeContentTransformer(
cryptoCurrencyStatus = cryptoStatus,
appCurrency = appCurrency,
- feeValue = currentFee,
+ feeValue = currentFee.value,
maxNetworkFee = maxFee,
analyticsHandler = analyticsHandler,
),
diff --git a/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/subcomponents/notifications/YieldSupplyNotificationsComponent.kt b/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/subcomponents/notifications/YieldSupplyNotificationsComponent.kt
index 366490ead7..0e5ade929b 100644
--- a/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/subcomponents/notifications/YieldSupplyNotificationsComponent.kt
+++ b/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/subcomponents/notifications/YieldSupplyNotificationsComponent.kt
@@ -43,7 +43,6 @@ internal class YieldSupplyNotificationsComponent(
Modifier.padding(top = 16.dp)
},
containerColor = TangemTheme.colors.background.action,
- iconTint = null,
)
}
}
diff --git a/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/subcomponents/notifications/entity/YieldSupplyNotificationData.kt b/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/subcomponents/notifications/entity/YieldSupplyNotificationData.kt
index 7b9a1e53ef..446047a107 100644
--- a/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/subcomponents/notifications/entity/YieldSupplyNotificationData.kt
+++ b/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/subcomponents/notifications/entity/YieldSupplyNotificationData.kt
@@ -6,4 +6,5 @@ import java.math.BigDecimal
data class YieldSupplyNotificationData(
val feeValue: BigDecimal?,
val feeError: GetFeeError?,
+ val shouldShowHighFeeNotification: Boolean = false,
)
\ No newline at end of file
diff --git a/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/subcomponents/notifications/model/YieldSupplyNotificationsModel.kt b/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/subcomponents/notifications/model/YieldSupplyNotificationsModel.kt
index 77907f4839..2e81b51d3f 100644
--- a/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/subcomponents/notifications/model/YieldSupplyNotificationsModel.kt
+++ b/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/subcomponents/notifications/model/YieldSupplyNotificationsModel.kt
@@ -74,6 +74,10 @@ internal class YieldSupplyNotificationsModel @Inject constructor(
dustValue = null,
onReload = params.callback::onFeeReload,
)
+
+ if (data.shouldShowHighFeeNotification) {
+ add(NotificationUM.Info.YieldSupplyHighNetworkFee)
+ }
}
if (notifications.any { it is NotificationUM.Error.TokenExceedsBalance }) {
diff --git a/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/subcomponents/startearning/model/YieldSupplyStartEarningModel.kt b/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/subcomponents/startearning/model/YieldSupplyStartEarningModel.kt
index a41f836310..6a2d3d2597 100644
--- a/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/subcomponents/startearning/model/YieldSupplyStartEarningModel.kt
+++ b/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/subcomponents/startearning/model/YieldSupplyStartEarningModel.kt
@@ -190,7 +190,7 @@ internal class YieldSupplyStartEarningModel @Inject constructor(
updatedTransactionList = updatedTransactionList,
feeValue = feeSum,
maxNetworkFee = maxFee,
- estimatedFeeValueInTokenCurrency = estimatedFee,
+ estimatedFeeValueInTokenCurrency = estimatedFee.value,
minAmount = minAmount,
),
)
@@ -198,6 +198,7 @@ internal class YieldSupplyStartEarningModel @Inject constructor(
data = YieldSupplyNotificationData(
feeValue = feeSum,
feeError = null,
+ shouldShowHighFeeNotification = estimatedFee.isHighFee,
),
)
},