Updated on 2026-08-14

This commit is contained in:
Tangem 2025-09-07 12:44:07 +04:00
parent e599995315
commit f39054b5a9
7 changed files with 788 additions and 19 deletions

View file

@ -21,12 +21,7 @@ inline fun <T> catchApiResponseError(onError: (ApiResponseError) -> Unit, block:
}
}
/**
* Checks if the [ApiResponseError] is a network-related error.
* You can provide a custom predicate [codePredicate] to check for specific HTTP status codes.
*/
inline fun ApiResponseError.isNetworkError(
codePredicate: (ApiResponseError.HttpException.Code) -> Boolean = { true },
): Boolean {
return this is ApiResponseError.HttpException && codePredicate(this.code)
/** Checks if the ApiResponseError is a network error with the specified HTTP status [code] */
fun ApiResponseError.isNetworkError(code: ApiResponseError.HttpException.Code): Boolean {
return this is ApiResponseError.HttpException && this.code == code
}

View file

@ -15,7 +15,7 @@ data class GetWalletAccountsResponse(
@JsonClass(generateAdapter = true)
data class Wallet(
@Json(name = "version") val version: Int,
@Json(name = "version") val version: Int = 0,
@Json(name = "group") val group: GroupType,
@Json(name = "sort") val sort: SortType,
@Json(name = "totalAccounts") val totalAccounts: Int,