Skip to content

Commit bbd92cd

Browse files
committed
chore: add logs
1 parent 1cd7421 commit bbd92cd

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

app/src/main/java/to/bitkit/utils/AddressChecker.kt

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ package to.bitkit.utils
33
import io.ktor.client.HttpClient
44
import io.ktor.client.call.body
55
import io.ktor.client.request.get
6+
import io.ktor.http.contentType
67
import kotlinx.serialization.Serializable
8+
import kotlinx.serialization.json.Json
79
import to.bitkit.env.Env
810
import javax.inject.Inject
911
import javax.inject.Singleton
@@ -32,8 +34,17 @@ class AddressChecker @Inject constructor(
3234
try {
3335
val response = client.get("${Env.esploraServerUrl}/tx/$txid")
3436

35-
return response.body<TxDetails>()
37+
// Debug: Check content type and body
38+
Logger.debug("Response status: ${response.status}")
39+
Logger.debug("Response content type: ${response.contentType()}")
40+
41+
val bodyAsString = response.body<String>()
42+
Logger.debug("Response body: $bodyAsString")
43+
44+
// Parse manually to see if the JSON structure is correct
45+
return Json.decodeFromString<TxDetails>(bodyAsString)
3646
} catch (e: Exception) {
47+
Logger.error("getTransaction error", e)
3748
throw AddressCheckerError.NetworkError(e)
3849
}
3950
}

0 commit comments

Comments
 (0)