Updated on 2026-08-14

This commit is contained in:
Tangem 2022-02-01 18:26:33 +03:00
parent b881339f57
commit 79a7e7263d
4 changed files with 8 additions and 16 deletions

View file

@ -77,9 +77,9 @@ dependencies {
implementation 'com.google.android.play:core-ktx:1.8.1'
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.5'
implementation 'com.tangem:blockchain:develop-55'
implementation 'com.tangem.tangem-sdk-kotlin:core:develop-125'
implementation 'com.tangem.tangem-sdk-kotlin:android:develop-125'
implementation 'com.tangem:blockchain:develop-57'
implementation 'com.tangem.tangem-sdk-kotlin:core:develop-127'
implementation 'com.tangem.tangem-sdk-kotlin:android:develop-127'
// WebView
implementation "androidx.browser:browser:1.3.0"

View file

@ -1,11 +1,11 @@
package com.tangem.tap.common.extensions
import com.tangem.blockchain.common.BlockchainSdkError
import com.tangem.blockchain.common.Wallet
import com.tangem.blockchain.common.WalletManager
import com.tangem.common.services.Result
import com.tangem.tap.domain.TapError
import com.tangem.tap.domain.extensions.amountToCreateAccount
import com.tangem.tap.domain.extensions.isNoAccountError
import com.tangem.tap.domain.getFirstToken
import com.tangem.tap.domain.topup.TradeCryptoHelper
import com.tangem.tap.features.wallet.redux.AddressData
@ -26,7 +26,7 @@ suspend fun WalletManager.safeUpdate(): Result<Wallet> = try {
val blockchain = wallet.blockchain
val amountToCreateAccount = blockchain.amountToCreateAccount(wallet.getFirstToken())
if (blockchain.isNoAccountError(exception) && amountToCreateAccount != null) {
if (exception is BlockchainSdkError.AccountNotFound && amountToCreateAccount != null) {
Result.Failure(TapError.WalletManagerUpdate.NoAccountError(amountToCreateAccount.toString()))
} else {
val message = exception.localizedMessage ?: "An error has occurred. Try later"

View file

@ -6,14 +6,6 @@ import com.tangem.common.card.EllipticCurve
import java.math.BigDecimal
fun Blockchain.isNoAccountError(exception: Throwable): Boolean {
return when (this) {
Blockchain.Stellar, Blockchain.XRP ->
exception.message?.contains("Account not found") == true
else -> false
}
}
fun Blockchain.amountToCreateAccount(token: Token? = null): BigDecimal? {
return when (this) {
Blockchain.Stellar -> if (token?.symbol == NODL) BigDecimal(1.5) else BigDecimal.ONE

View file

@ -205,13 +205,13 @@ private fun sendTransaction(
}
is SimpleResult.Failure -> {
when (sendResult.error) {
is CreateAccountUnderfunded -> {
val error = sendResult.error as CreateAccountUnderfunded
is BlockchainSdkError.CreateAccountUnderfunded -> {
val error = sendResult.error as BlockchainSdkError.CreateAccountUnderfunded
val reserve = error.minReserve.value?.stripZeroPlainString() ?: "0"
val symbol = error.minReserve.currencySymbol
dispatch(SendAction.SendError(TapError.CreateAccountUnderfunded(listOf(reserve, symbol))))
}
is SendException -> {
is BlockchainSdkError.SendException -> {
sendResult.error?.let { FirebaseCrashlytics.getInstance().recordException(it) }
}
is Throwable -> {