Updated on 2026-08-14
This commit is contained in:
parent
40e083ffad
commit
b0694b6798
12 changed files with 66 additions and 22 deletions
|
|
@ -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,
|
||||
)
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue