Updated on 2026-08-14

This commit is contained in:
Tangem 2023-04-21 13:55:21 +03:00
parent 6f379ec96f
commit 8b68e88ab4

View file

@ -176,18 +176,29 @@ private fun sendTransaction(
scope.launch {
val updateWalletResult = walletManager.safeUpdate()
if (updateWalletResult is Result.Failure) {
when (val error = updateWalletResult.error) {
is TapError -> store.dispatchErrorNotification(error)
else -> {
val tapError = if (error.message == null) {
TapError.UnknownError
} else {
TapError.CustomError(error.message!!)
withMainContext {
when (val error = updateWalletResult.error) {
is TapError -> store.dispatchErrorNotification(error)
is BlockchainSdkError -> {
updateFeedbackManagerInfo(
walletManager = walletManager,
amountToSend = amountToSend,
feeAmount = feeAmount,
destinationAddress = destinationAddress,
)
dispatch(SendAction.Dialog.SendTransactionFails.BlockchainSdkError(error = error))
}
else -> {
val tapError = if (error.message == null) {
TapError.UnknownError
} else {
TapError.CustomError(error.message!!)
}
store.dispatchErrorNotification(tapError)
}
store.dispatchErrorNotification(tapError)
}
dispatch(SendAction.ChangeSendButtonState(ButtonState.ENABLED))
}
withMainContext { dispatch(SendAction.ChangeSendButtonState(ButtonState.ENABLED)) }
return@launch
}
@ -250,7 +261,7 @@ private fun sendTransaction(
}
}
is SimpleResult.Failure -> {
store.state.globalState.feedbackManager?.infoHolder?.updateOnSendError(
updateFeedbackManagerInfo(
walletManager = walletManager,
amountToSend = amountToSend,
feeAmount = feeAmount,
@ -306,6 +317,20 @@ private fun sendTransaction(
}
}
private fun updateFeedbackManagerInfo(
walletManager: WalletManager,
amountToSend: Amount,
feeAmount: Amount,
destinationAddress: String,
) {
store.state.globalState.feedbackManager?.infoHolder?.updateOnSendError(
walletManager = walletManager,
amountToSend = amountToSend,
feeAmount = feeAmount,
destinationAddress = destinationAddress,
)
}
fun createValidateTransactionError(
errorList: EnumSet<TransactionError>,
walletManager: WalletManager,